/* ── Stundenabgleich ─────────────────────────────────────────────────────────── */

/* Innerer Wrapper — nicht der View selbst (der wird vom POLARIS-View-System gesteuert) */
.sa-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0;
}

/* ── Top-Bar mit Mandant-Pills ────────────────────────────────────────────── */
.sa-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 10px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.sa-mandant-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.sa-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color, #e2e8f0);
    background: transparent;
    color: var(--text-muted, #64748b);
    transition: all .15s;
}
.sa-pill:hover { background: var(--hover-bg, #f1f5f9); }
.sa-pill.active { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); }
.sa-pill-alle.active { background: #7c3aed; border-color: #7c3aed; }
.sa-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .7rem;
    font-weight: 700;
    background: rgba(255,255,255,.25);
}
.sa-mandant-10 { background: #1d4ed8; }
.sa-mandant-30 { background: #b45309; }
.sa-mandant-60 { background: #15803d; }

.sa-spacer { flex: 1; }
.sa-status-row {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: .75rem;
    color: var(--text-muted, #64748b);
}
.sa-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #cbd5e1;
    display: inline-block;
}
.sa-status-dot.ok    { background: #16a34a; }
.sa-status-dot.error { background: #dc2626; }

/* ── Tab-Navigation ───────────────────────────────────────────────────────── */
.sa-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    flex-shrink: 0;
}
.sa-tab {
    padding: 10px 18px;
    font-size: .83rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    border-bottom: 2px solid transparent;
    transition: all .15s;
    margin-bottom: -1px;
}
.sa-tab:hover { color: var(--text-main, #1e293b); }
.sa-tab.active { color: var(--primary, #2563eb); border-bottom-color: var(--primary, #2563eb); font-weight: 600; }

/* ── Content-Panels ───────────────────────────────────────────────────────── */
.sa-panel { display: none; flex: 1; overflow: hidden; flex-direction: column; padding: 16px 20px; }
.sa-panel.active { display: flex; }

/* ── Stundenauswertung ────────────────────────────────────────────────────── */
.sa-filter-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.sa-filter-row label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    display: block;
    margin-bottom: 3px;
}
.sa-autocomplete-wrap { position: relative; flex: 1; min-width: 200px; }
.sa-autocomplete-wrap input { width: 100%; box-sizing: border-box; }
.sa-autocomplete-dd {
    position: fixed;
    z-index: 500;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    max-height: 280px;
    overflow-y: auto;
    min-width: 260px;
}
.sa-autocomplete-dd.hidden { display: none; }
.sa-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: .82rem;
    cursor: pointer;
}
.sa-dd-item:hover { background: var(--hover-bg, #f1f5f9); }
.sa-emp-nr { font-size: .75rem; color: var(--text-muted, #64748b); margin-left: auto; font-family: monospace; }

.sa-time-results { flex: 1; overflow: auto; }
.sa-time-results.hidden { display: none; }
.sa-result-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; gap: 12px; flex-wrap: wrap;
}
.sa-result-title { font-size: .95rem; font-weight: 700; }
.sa-result-count { font-size: .78rem; color: var(--text-muted, #64748b); }

/* ── PDF-Abgleich ─────────────────────────────────────────────────────────── */
.sa-compare-layout {
    display: flex;
    gap: 12px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.sa-left-panel {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sa-right-panel { flex: 1; overflow: auto; min-width: 0; }

/* Dropzone */
.sa-dropzone {
    border: 2px dashed var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    color: var(--text-muted, #64748b);
    font-size: .82rem;
}
.sa-dropzone:hover, .sa-dropzone.dragover {
    border-color: var(--primary, #2563eb);
    background: rgba(37,99,235,.04);
    color: var(--primary, #2563eb);
}
.sa-dropzone-icon { font-size: 1.6rem; margin-bottom: 6px; }

/* PDF-Liste */
.sa-pdf-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.sa-pdf-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    font-size: .8rem;
}
.sa-pdf-item:hover   { background: var(--hover-bg, #f1f5f9); }
.sa-pdf-item.selected { background: rgba(37,99,235,.08); border-color: var(--primary, #2563eb); }
.sa-pdf-item-name    { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sa-pdf-item-sub     { font-size: .72rem; color: var(--text-muted, #64748b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Status-Chips */
.sa-chip {
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}
.sa-chip-pending  { background: #f1f5f9; color: #64748b; }
.sa-chip-loading  { background: #dbeafe; color: #1e40af; }
.sa-chip-ok       { background: #dcfce7; color: #15803d; }
.sa-chip-warn     { background: #fef9c3; color: #854d0e; }
.sa-chip-error    { background: #fee2e2; color: #991b1b; }

/* Progress */
.sa-progress {
    height: 6px;
    background: var(--border-color, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}
.sa-progress.hidden { display: none; }
.sa-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #2563eb), #38bdf8);
    border-radius: 3px;
    transition: width .3s;
    width: 0%;
}
.sa-progress-label { font-size: .75rem; color: var(--text-muted, #64748b); text-align: center; margin-top: 3px; }

/* Summary-Bar */
.sa-summary-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: var(--hover-bg, #f8fafc);
    border-radius: 8px;
    font-size: .78rem;
    flex-wrap: wrap;
}
.sa-summary-bar.hidden { display: none; }
.sa-sum-item { display: flex; align-items: center; gap: 4px; }
.sa-sum-num { font-weight: 700; }

/* Detail-Panel */
.sa-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #64748b);
    gap: 8px;
    font-size: .85rem;
}
.sa-empty-state.hidden { display: none; }
.sa-empty-icon { font-size: 2.5rem; }

.sa-detail-content.hidden { display: none; }
.sa-detail-header { margin-bottom: 12px; }
.sa-detail-title  { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.sa-detail-meta   { display: flex; gap: 10px; flex-wrap: wrap; font-size: .78rem; color: var(--text-muted, #64748b); align-items: center; }

/* Download-Banner */
.sa-dl-banner {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; margin: 8px 0;
    background: #f0fdf4; border-radius: 6px;
    border: 1px solid #bbf7d0; font-size: .8rem;
}
.sa-dl-banner-name { flex: 1; color: #15803d; font-weight: 600; }

/* Tabellen */
.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
.sa-table thead th {
    padding: 7px 10px;
    text-align: left;
    font-weight: 600;
    font-size: .75rem;
    color: var(--text-muted, #64748b);
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    white-space: nowrap;
    position: sticky; top: 0;
    background: var(--bg-card, #fff);
    z-index: 1;
}
.sa-table tbody td { padding: 5px 10px; border-bottom: 1px solid var(--border-color, #e2e8f0); vertical-align: middle; }
.sa-table tbody tr:last-child td { border-bottom: none; }
.sa-table tbody tr.sa-row-ok      { background: transparent; }
.sa-table tbody tr.sa-row-warn    { background: #fffbeb; }
.sa-table tbody tr.sa-row-weekend { background: var(--hover-bg, #f8fafc); color: var(--text-muted, #64748b); }
.sa-table tbody tr:hover { background: rgba(37,99,235,.04); }

.sa-row-day-header td { background: var(--hover-bg, #f8fafc); font-weight: 600; padding: 5px 10px; }

/* Code-Chips */
.sa-code { display: inline-block; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: .75rem; font-family: monospace; }
.sa-code-A   { background: #dcfce7; color: #15803d; }
.sa-code-K   { background: #fee2e2; color: #991b1b; }
.sa-code-TU  { background: #dbeafe; color: #1d4ed8; }
.sa-code-F, .sa-code-Z   { background: #f0fdf4; color: #15803d; }
.sa-code-KUG { background: #fef9c3; color: #854d0e; }
.sa-code-dash, .sa-code-  { color: #cbd5e1; }

/* Modal */
.sa-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
}
.sa-modal-overlay.hidden { display: none; }
.sa-modal {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px; width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.sa-modal-title { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.sa-modal-desc  { font-size: .82rem; color: var(--text-muted, #64748b); margin-bottom: 14px; line-height: 1.5; }
.sa-modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Buttons */
.sa-btn {
    padding: 6px 14px; border-radius: 6px; font-size: .82rem; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border-color, #e2e8f0); background: var(--bg-card, #fff);
    color: var(--text-main, #1e293b); transition: all .15s;
}
.sa-btn:hover { background: var(--hover-bg, #f1f5f9); }
.sa-btn.primary { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); }
.sa-btn.primary:hover { background: #1d4ed8; }
.sa-btn.sm { padding: 4px 10px; font-size: .75rem; }
.sa-btn:disabled { opacity: .5; cursor: not-allowed; }
