:root {
    --rh-bg: #f4f6fb;
    --rh-surface: #ffffff;
    --rh-border: #e6e9f2;
    --rh-text: #1a2233;
    --rh-muted: #6b7587;
    --rh-primary: #2f54eb;
    --rh-primary-dark: #1d3fc4;
    --rh-sidebar: #0f172a;
    --rh-sidebar-text: #aab4c8;
    --rh-sidebar-active: #1e293b;
    --rh-success: #16a34a;
    --rh-danger: #dc2626;
    --rh-radius: 14px;
    --rh-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--rh-bg);
    color: var(--rh-text);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Topnav-Layout (horizontale Navigation im Kopf) ---------- */
.rh-topbar {
    background: var(--rh-sidebar); color: var(--rh-sidebar-text);
    position: sticky; top: 0; z-index: 30;
}
.rh-topbar-row {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 24px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.rh-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.12rem; white-space: nowrap; }
.rh-logo { font-size: 1.35rem; color: var(--rh-primary); }
.rh-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.rh-sync-info { font-size: .82rem; color: var(--rh-sidebar-text); }

.rh-nav-toggle {
    margin-left: auto; display: none; align-items: center; justify-content: center;
    width: 40px; height: 38px; border: 1px solid rgba(255,255,255,.15); border-radius: 9px;
    background: transparent; color: #fff; cursor: pointer;
}

/* Navigationszeile */
.rh-topnav {
    display: flex; align-items: stretch; gap: 4px;
    padding: 4px 18px 6px; overflow-x: auto; scrollbar-width: thin;
}
.rh-topnav::-webkit-scrollbar { height: 5px; }
.rh-topnav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.rh-nav-item {
    display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 9px;
    color: var(--rh-sidebar-text); text-decoration: none; font-size: .9rem; font-weight: 500;
    white-space: nowrap; transition: background .15s, color .15s;
}
.rh-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.rh-nav-item:hover { background: var(--rh-sidebar-active); color: #fff; }
.rh-nav-item.active { background: var(--rh-primary); color: #fff; }

.rh-content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* Desktop/Hochformat: Navigation immer sichtbar (überschreibt Bootstrap .collapse) */
@media (min-width: 992px) {
    .rh-topnav.collapse:not(.show) { display: flex; }
}
/* Schmale Ansichten: Hamburger zeigen, Navigation einklappen */
@media (max-width: 991.98px) {
    .rh-nav-toggle { display: inline-flex; }
    .rh-topnav { flex-direction: column; gap: 2px; padding: 8px 16px 12px; overflow: visible; }
    .rh-nav-item { padding: 11px 14px; }
}

/* ---------- Filterbar ---------- */
.rh-filterbar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--rh-surface);
    border: 1px solid var(--rh-border); border-radius: var(--rh-radius); padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--rh-shadow);
}
.rh-filter { display: flex; flex-direction: column; gap: 4px; }
.rh-filter label { font-size: .74rem; font-weight: 600; color: var(--rh-muted); text-transform: uppercase; letter-spacing: .03em; }
.rh-filter .form-select, .rh-filter .form-control { min-width: 150px; }
.rh-filter-apply { margin-left: auto; }

.rh-period-note { color: var(--rh-muted); font-size: .85rem; margin: -6px 2px 16px; }

/* ---------- KPI ---------- */
.rh-kpi-grid { margin-bottom: 4px; }
.rh-kpi {
    background: var(--rh-surface); border: 1px solid var(--rh-border); border-radius: var(--rh-radius);
    padding: 16px 18px; height: 100%; box-shadow: var(--rh-shadow);
}
.rh-kpi-title { font-size: .8rem; color: var(--rh-muted); font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.rh-kpi-hint { cursor: help; opacity: .6; font-size: .75rem; }
.rh-kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.rh-kpi-foot { margin-top: 8px; font-size: .82rem; }
.kpi-trend { font-weight: 600; }

/* ---------- Panels ---------- */
.rh-panel {
    background: var(--rh-surface); border: 1px solid var(--rh-border); border-radius: var(--rh-radius);
    padding: 18px 20px; box-shadow: var(--rh-shadow);
}
.rh-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rh-panel-head h2 { font-size: 1.02rem; font-weight: 600; margin: 0; }
.rh-chart-wrap { position: relative; height: 320px; }
.rh-chart-wrap.rh-chart-sm { height: 200px; }
.rh-compare-table td { padding: .35rem .4rem; border-color: var(--rh-border); }

/* Firmen-Blöcke */
.rh-company-block { margin-bottom: 14px; }
.rh-company-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 6px 4px; border-bottom: 2px solid var(--rh-border); margin-bottom: 4px; }
.rh-company-name { font-weight: 600; font-size: .92rem; }
.rh-company-cur { font-size: .7rem; color: #fff; background: var(--rh-primary); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.rh-company-total { font-weight: 700; font-size: .92rem; white-space: nowrap; }
.rh-company-note { font-size: .74rem; color: var(--rh-muted); margin: 6px 4px 0; }

/* ---------- Forecast ---------- */
.rh-forecast-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rh-forecast-card { background: var(--rh-bg); border: 1px solid var(--rh-border); border-radius: 12px; padding: 12px 14px; }
.rh-forecast-label { font-size: .76rem; color: var(--rh-muted); font-weight: 600; }
.rh-forecast-value { font-size: 1.2rem; font-weight: 700; margin-top: 4px; }
.rh-forecast-disclaimer { font-size: .78rem; color: var(--rh-muted); margin-top: 14px; border-top: 1px dashed var(--rh-border); padding-top: 10px; }
.rh-series-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.rh-series-toggles .rh-series-btn {
    font-size: .76rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rh-border);
    background: var(--rh-surface); cursor: pointer; color: var(--rh-muted);
}
.rh-series-toggles .rh-series-btn.active { color: #fff; border-color: transparent; }

/* ---------- Tables ---------- */
.rh-data-table { font-size: .88rem; }
.rh-data-table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--rh-muted); border-bottom: 2px solid var(--rh-border); white-space: nowrap; }
.rh-ref { font-size: .76rem; color: var(--rh-muted); }
.rh-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.rh-page-info { font-size: .85rem; color: var(--rh-muted); }
.rh-status-filter .btn { font-size: .8rem; }

/* ---------- Login ---------- */
.rh-login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a, #1e293b); padding: 20px; }
.rh-login-card { background: #fff; border-radius: 18px; padding: 36px 34px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.rh-login-brand { text-align: center; margin-bottom: 24px; }
.rh-login-brand .rh-logo { font-size: 2.4rem; }
.rh-login-brand h1 { font-size: 1.5rem; font-weight: 700; margin: 8px 0 2px; }
.rh-login-brand p { color: var(--rh-muted); font-size: .86rem; margin: 0; }
.rh-login-note { text-align: center; font-size: .76rem; color: var(--rh-muted); margin: 18px 0 0; }

/* ---------- Buttons ---------- */
.btn-primary { background: var(--rh-primary); border-color: var(--rh-primary); }
.btn-primary:hover { background: var(--rh-primary-dark); border-color: var(--rh-primary-dark); }

/* ---------- Settings ---------- */
.rh-settings-h { font-size: .95rem; font-weight: 600; color: var(--rh-text); border-bottom: 1px solid var(--rh-border); padding-bottom: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .rh-content { padding: 16px 14px 50px; }
    .rh-topbar-row { padding: 10px 14px; }
    .rh-filter-apply { margin-left: 0; }
    .rh-filter .form-select, .rh-filter .form-control { min-width: 130px; }

    /* Tabellen als Karten */
    .rh-data-table thead { display: none; }
    .rh-data-table, .rh-data-table tbody, .rh-data-table tr, .rh-data-table td { display: block; width: 100%; }
    .rh-data-table tr { border: 1px solid var(--rh-border); border-radius: 12px; margin-bottom: 10px; padding: 6px 12px; background: var(--rh-surface); }
    .rh-data-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: none; padding: 7px 0; text-align: right !important; }
    .rh-data-table td::before { content: attr(data-label); font-size: .74rem; font-weight: 600; color: var(--rh-muted); text-transform: uppercase; letter-spacing: .02em; text-align: left; }
    .rh-data-table td:empty { display: none; }
}

@media (max-width: 575.98px) {
    .rh-kpi-value { font-size: 1.25rem; }
    .rh-sync-label { display: none; }
}
