/* OS-2045 Buchhaltungs-Hub
   Aggregated layout: 180px sidebar + main pane with KPI cards, charts,
   quick actions, recent activity, and global search. Dark-mode native.
*/

.buchhaltung-hub {
    display: flex;
    width: 100%;
    height: 100%;
    background: #0d1117;
    color: #e6edf3;
    font-family: 'Inter', system-ui, sans-serif;
}

/* ---------- Sidebar ---------- */
.buch-sidebar {
    flex: 0 0 180px;
    background: #161b22;
    border-right: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
}
.buch-sidebar-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7d8590;
    padding: 6px 8px 14px 8px;
}
.buch-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.buch-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #c9d1d9;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: background 120ms ease, color 120ms ease;
}
.buch-nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: #fff;
}
.buch-nav-item.active {
    background: rgba(99,179,237,0.12);
    color: #63b3ed;
    border-color: rgba(99,179,237,0.25);
}
.buch-nav-icon {
    font-size: 16px;
    width: 18px;
    text-align: center;
}
.buch-nav-label {
    flex: 1;
}

/* ---------- Main pane ---------- */
.buch-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.buch-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
}
.buch-search-wrap {
    position: relative;
    flex: 1;
    max-width: 520px;
}
#buchhaltungSearch {
    width: 100%;
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #e6edf3;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
}
#buchhaltungSearch:focus {
    border-color: #63b3ed;
    box-shadow: 0 0 0 2px rgba(99,179,237,0.15);
}
.buch-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    background: #161b22;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 50;
    padding: 8px;
}
.buch-search-section {
    margin-bottom: 10px;
}
.buch-search-section:last-child { margin-bottom: 0; }
.buch-search-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7d8590;
    padding: 0 6px 4px 6px;
}
.buch-search-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.buch-search-section li {
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #c9d1d9;
    cursor: pointer;
}
.buch-search-section li:hover,
.buch-search-section li:focus {
    background: rgba(99,179,237,0.10);
    color: #fff;
    outline: none;
}
.buch-search-section li:focus-visible {
    box-shadow: 0 0 0 2px rgba(99,179,237,0.45);
}
.buch-search-empty {
    padding: 10px;
    color: #7d8590;
    font-size: 13px;
    text-align: center;
}

.buch-pane {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}
/* Sub-Module bringen ihren eigenen Header/Tab-Layout mit (Rechnungen, EÜR,
   Stammdaten). Padding aus dem Hub-Pane würde sie eindrücken — wenn ein
   Modul gemountet ist, soll der Container voll angezeigt werden. */
.buch-pane[data-buch-module]:not([data-buch-module="uebersicht"]) {
    padding: 0;
}
/* Mounted sub-modules sollen die volle Höhe ausfüllen */
.buch-pane > .rechnungen-container,
.buch-pane > .euer-container,
.buch-pane > .stammdaten-container {
    height: 100%;
}

/* ---------- KPI Row ---------- */
.buch-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.buch-kpi {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #161b22;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 14px;
    border-left: 3px solid #63b3ed;
}
.buch-kpi-red    { border-left-color: #e94560; }
.buch-kpi-amber  { border-left-color: #f6ad55; }
.buch-kpi-green  { border-left-color: #34d399; }
.buch-kpi-cyan   { border-left-color: #63b3ed; }
.buch-kpi-icon {
    font-size: 26px;
    flex-shrink: 0;
}
.buch-kpi-body { min-width: 0; }
.buch-kpi-label {
    font-size: 12px;
    color: #7d8590;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.buch-kpi-value {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    margin-top: 2px;
}
.buch-kpi-sub {
    font-size: 12px;
    color: #8b949e;
    margin-top: 2px;
}

/* ---------- Cards / Charts ---------- */
.buch-card {
    background: #161b22;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.buch-card-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7d8590;
    margin-bottom: 10px;
}
.buch-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    margin-bottom: 0;
}
.buch-charts-row .buch-card { margin-bottom: 16px; }
.buch-chart-card canvas {
    width: 100%;
    height: 160px;
    display: block;
}
.buch-trend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #6e7681;
    margin-top: 4px;
    padding: 0 8px;
}
.buch-trend-labels .dim { opacity: 0.5; }
.buch-customers-card .buch-donut-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.buch-customers-card canvas {
    flex-shrink: 0;
}
.buch-customers-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    font-size: 12px;
}
.buch-customers-list li {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: #c9d1d9;
}
.buch-cust-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.buch-cust-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.buch-cust-total { color: #fff; font-weight: 500; }
.buch-cust-empty { color: #7d8590; padding: 4px 0; }

/* ---------- Quick Actions ---------- */
.buch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.buch-btn {
    background: #21262d;
    border: 1px solid rgba(255,255,255,0.12);
    color: #e6edf3;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 120ms ease, border-color 120ms ease;
}
.buch-btn:hover {
    background: #30363d;
    border-color: rgba(99,179,237,0.5);
}
.buch-btn.primary {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
}
.buch-btn.primary:hover {
    background: #2a7df1;
}

/* ---------- Activity ---------- */
.buch-activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
}
.buch-activity-item {
    display: grid;
    grid-template-columns: 110px 180px 1fr 120px;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    align-items: baseline;
}
.buch-activity-item:last-child { border-bottom: none; }
.buch-act-time { color: #6e7681; font-size: 11px; }
.buch-act-action { color: #63b3ed; font-weight: 500; }
.buch-act-target {
    color: #c9d1d9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.buch-act-user { color: #7d8590; font-size: 11px; text-align: right; }
.buch-activity-empty {
    padding: 10px 0;
    color: #7d8590;
    text-align: center;
}

/* ---------- Error state ---------- */
.buch-error {
    padding: 40px;
    text-align: center;
    color: #e94560;
}
.buch-error h3 { margin: 0 0 6px 0; }
.buch-error p {
    margin: 0 0 16px 0;
    color: #8b949e;
}

/* ---------- Responsive collapse ---------- */
@media (max-width: 820px) {
    .buch-sidebar { flex-basis: 56px; }
    .buch-nav-label { display: none; }
    .buch-sidebar-title { display: none; }
    .buch-charts-row { grid-template-columns: 1fr; }
    .buch-activity-item {
        grid-template-columns: 90px 1fr;
        grid-row-gap: 2px;
    }
    .buch-act-action,
    .buch-act-user { grid-column: 2; }
}

/* Extended a11y / WCAG 2.4.7 — generic fallback for all interactive
 * targets inside the Buchhaltung tool (in addition to .buch-search-section). */
.buch-tool button:focus-visible,
.buch-tool [tabindex]:focus-visible,
.buch-tool input:focus-visible,
.buch-tool select:focus-visible,
.buch-tool textarea:focus-visible {
    outline: 2px solid var(--theme-accent, #5fd1ff);
    outline-offset: 2px;
}
