/* Rolling Forecast v2 - Styles */

/* ============ Reset & Base ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.5;
    min-height: 100vh;
    margin: 0;
    color-scheme: light;
}

select, input, textarea {
    color-scheme: light;
}

/* ============ App Layout ============ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============ Sidebar ============ */
.sidebar {
    width: var(--sidebar-width, 200px);
    min-width: var(--sidebar-width, 200px);
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform 0.25s ease, width 0.25s ease, min-width 0.25s ease;
}

.sidebar-brand {
    padding: 14px 16px 12px;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}

.sidebar-brand a {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo {
    height: 24px;
    width: auto;
    flex-shrink: 0;
}

/* Tenant branding: logo + "Orbital" / "for OrgName" */
.sidebar-brand-tenant {
    gap: 10px !important;
    line-height: 1.2;
}

.sidebar-logo-large {
    height: 36px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-brand-top {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-brand-for {
    font-weight: 400;
    font-size: 12px;
    opacity: 0.5;
}

.sidebar-brand-org {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0;
}

.login-logo {
    height: 56px;
    width: auto;
    margin-bottom: 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 6px;
    gap: 1px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Allow flex child to shrink for scroll */
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-link:hover {
    background: #1e293b;
    color: #e2e8f0;
}

.sidebar-link.active {
    background: #1e3a5f;
    color: #fff;
    border-left: 3px solid #3b82f6;
    padding-left: 7px;
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: 0.7;
    width: 18px;
    height: 18px;
}

.sidebar-link.active svg {
    opacity: 1;
}

/* ============ Sidebar Group (Accordion) ============ */

.sidebar-group {
    margin-bottom: 1px;
}

.sidebar-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    width: 100%;
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    text-align: left;
    font-family: inherit;
}

.sidebar-group-header:hover {
    background: #1e293b;
    color: #e2e8f0;
}

.sidebar-group-header.active {
    color: #e2e8f0;
    background: #162032;
}

.sidebar-group-header svg {
    flex-shrink: 0;
    opacity: 0.7;
    width: 18px;
    height: 18px;
}

.sidebar-group-header.active svg {
    opacity: 1;
}

.sidebar-group-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.sidebar-group.expanded .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    /* No transition by default — prevents flicker on page load.
       The .animated class is added by JS after first paint. */
}

.sidebar-group-items.animated {
    transition: max-height 0.25s ease;
}

.sidebar-group.expanded .sidebar-group-items {
    max-height: 300px;
}

/* Nesting indicator: vertical line on the left inside the expanded group */
.sidebar-group-items-inner {
    margin-left: 16px;
    padding-left: 10px;
    border-left: 2px solid #1e293b;
    padding-top: 2px;
    padding-bottom: 2px;
}

.sidebar-section-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    padding: 6px 0 2px;
    font-weight: 700;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    transition: all 0.15s;
    margin: 1px 0;
}

.sidebar-sublink:hover {
    background: #1e293b;
    color: #f1f5f9;
}

.sidebar-sublink.active {
    background: #1e3a5f;
    color: #fff;
    border-left: 3px solid #3b82f6;
    padding-left: 5px;
    font-weight: 500;
}

.sidebar-sublink svg {
    flex-shrink: 0;
    opacity: 0.5;
    width: 14px;
    height: 14px;
}

.sidebar-sublink.active svg {
    opacity: 0.9;
}

.sidebar-sublink-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
}

.sidebar-sublink-desc {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.sidebar-sublink.active .sidebar-sublink-desc {
    color: #bfdbfe;
}

/* ============ Sidebar Resize Handle ============ */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 201;
    background: transparent;
    transition: background 0.15s;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: #3b82f6;
}

.sidebar.resizing,
.sidebar.resizing ~ .main-content {
    transition: none;
}

body.sidebar-resizing {
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
}

body.sidebar-resizing * {
    cursor: col-resize !important;
}

.sidebar-footer {
    padding: 8px 16px;
    border-top: 1px solid #1e293b;
    font-size: 10px;
    color: #475569;
    flex-shrink: 0;
}

/* ============ Sidebar Mobile Toggle ============ */
.sidebar-mobile-toggle {
    display: none; /* Hidden on desktop */
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 250;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #1e293b;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sidebar-mobile-toggle svg {
    width: 20px;
    height: 20px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}

/* ============ Sidebar Compact: hide descriptions at short viewport ============ */
@media (max-height: 700px) {
    .sidebar-sublink-desc {
        display: none;
    }
    .sidebar-section-label {
        padding: 4px 0 1px;
    }
    .sidebar-brand {
        padding: 10px 14px 8px;
    }
    .sidebar-link, .sidebar-group-header {
        padding: 6px 10px;
    }
    .sidebar-sublink {
        padding: 4px 8px;
    }
    .sidebar-user {
        padding: 4px 10px;
    }
    .sidebar-footer {
        padding: 4px 16px;
    }
}

/* ============ Sidebar Responsive: mobile collapse ============ */
@media (max-width: 768px) {
    .sidebar-mobile-toggle {
        display: flex;
    }
    .sidebar {
        transform: translateX(-100%);
        width: 240px;
        min-width: 240px;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .sidebar-overlay.visible {
        display: block;
    }
    .main-content {
        margin-left: 0 !important;
    }
    /* Wider top padding to make room for hamburger */
    .main-content .container {
        padding-top: 56px;
    }
    .sidebar-resize-handle {
        display: none;
    }
    .breadcrumb-bar {
        display: none;
    }
}

/* ============ Main Content ============ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width, 200px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

/* ============ Breadcrumb Bar (Sessie 101) ============ */
.breadcrumb-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 24px;
}
.breadcrumb-bar nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1;
}
.breadcrumb-bar .bc-sep {
    margin: 0 8px;
    color: #cbd5e1;
    font-size: 11px;
    user-select: none;
}
.breadcrumb-bar a {
    color: #64748b;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
}
.breadcrumb-bar a:hover {
    color: #3b82f6;
}
.breadcrumb-bar .bc-current {
    color: #1e293b;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

/* ============ Container ============ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
    width: 100%;
}

/* ============ Page Header ============ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.back-link {
    display: inline-block;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 8px;
}

.back-link:hover {
    color: #2563eb;
}

.subtitle {
    color: #64748b;
    font-size: 14px;
    margin-top: 4px;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: #64748b;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #ef4444;
}

.link-btn {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
}

.link-btn:hover {
    color: #1d4ed8;
}

/* ============ Cards ============ */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============ Summary Cards ============ */
.summary-card {
    text-align: center;
    padding: 24px;
}

.summary-card.positive {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #86efac;
}

.summary-card.warning {
    background: linear-gradient(135deg, #fefce8, #fef08a);
    border: 1px solid #fde047;
}

.summary-card.negative {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border: 1px solid #fca5a5;
}

.summary-card.neutral {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid #cbd5e1;
}

.summary-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 32px;
    font-weight: 700;
}

.summary-detail {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ============ Grid System ============ */
.grid {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}

.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1024px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ============ Tables ============ */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #f1f5f9;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 11px;
    text-transform: uppercase;
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
}

th.right, td.right {
    text-align: right;
}

tr:hover td {
    background: #f8fafc;
}

/* Row links — enables right-click "Open in new tab" on table rows */
tr[data-href] { position: relative; cursor: pointer; }
tr[data-href]:hover { z-index: 2; } /* Hovered row on top (for tooltips) */
a.row-link { color: inherit; text-decoration: none; }
a.row-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
}
/* Interactive elements above the row-link overlay */
tr[data-href] td .module-cell,
tr[data-href] td .v2-badge,
tr[data-href] td button,
tr[data-href] td input[type="checkbox"],
tr[data-href] td a:not(.row-link),
tr[data-href] td .fact-ratio,
tr[data-href] td.v2-expand-toggle { position: relative; z-index: 1; }
/* Expand toggle needs pointer-events to beat the ::after overlay */
tr[data-href] td.v2-expand-toggle { cursor: pointer; z-index: 2; }
/* Also support div rows (e.g. card layouts) */
div[data-href] { position: relative; cursor: pointer; }
div[data-href] a.row-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
}
/* Interactive elements above the row-link overlay in card layouts */
div[data-href] button,
div[data-href] input,
div[data-href] select,
div[data-href] .v2-badge,
div[data-href] a:not(.row-link) { position: relative; z-index: 1; }

tr.total td {
    background: #f1f5f9;
    font-weight: 700;
}

tr.negative td {
    background: #fef2f2;
}

.font-bold {
    font-weight: 700;
}

/* ============ Text Colors ============ */
.text-green { color: #16a34a; }
.text-red { color: #dc2626; }
.text-yellow { color: #ca8a04; }

/* ============ Source pills (cashflow tabel: Actuals/Lopend/Prognose) ============ */
.src-pill {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 9px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.4;
    vertical-align: middle;
    cursor: help;
    user-select: none;
}
.src-pill-actuals  { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.src-pill-current  { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.src-pill-forecast { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
/* Reconciliation pills — cashflow-sluitend fase 1 */
.src-pill-recon-ok   { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.src-pill-recon-warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; cursor: pointer; text-transform: none; }
.src-pill-recon-err  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; cursor: pointer; text-transform: none; }
.src-pill-recon-unk  { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
/* Bank sync badge — cashflow-sluitend fase 2 */
.bank-sync-badge {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.bank-sync-badge .icon { font-size: 14px; }
.bank-sync-aligned { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.bank-sync-drift   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.bank-sync-stale   { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.bank-sync-unknown { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.bank-sync-badge.clickable { cursor: pointer; transition: filter 0.15s, transform 0.15s; }
.bank-sync-badge.clickable:hover { filter: brightness(0.96); transform: translateY(-1px); }
.bank-sync-badge .drill-hint { font-size: 11px; opacity: 0.7; padding-left: 12px; white-space: nowrap; }

/* Cashflow-status header (v3.348.0) — vervangt losse bank-drift banner.
   Drie zones (Nu / Tot dusver / Eind-maand) als compact dashboard. */
/* v3.353.1: subtieler + consistent — uniform witte cards, lichte grijze borders,
   kleur alleen op de waarden, geen accent-backgrounds per type. */
.cashflow-status { padding: 16px 18px; }
.cs-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.cs-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cs-sync { font-size: 11px; color: #64748b; }
.cs-sync .cs-sync-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.cs-sync-dot.fresh { background: #16a34a; }
.cs-sync-dot.recent { background: #d97706; }
.cs-sync-dot.stale { background: #dc2626; }

.cs-cols {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 10px;
    align-items: stretch;
}
@media (max-width: 980px) {
    .cs-cols { grid-template-columns: 1fr; }
}
/* Uniforme stijl voor alle 'kaart'-blokjes (cs-col en cs-wf-step delen deze stijl) */
.cs-col,
.cs-wf-step {
    padding: 10px 12px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    text-align: left;
}
.cs-col.clickable { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.cs-col.clickable:hover { border-color: #cbd5e1; box-shadow: 0 1px 3px rgba(15,23,42,0.06); }
/* Consistente label-stijl, gedeeld door cs-col-label en cs-wf-label */
.cs-col-label,
.cs-wf-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}
.cs-col-icon { font-size: 12px; opacity: 0.75; }
/* Consistente waarde-stijl (cs-col-value en cs-wf-val delen) */
.cs-col-value,
.cs-wf-val {
    font-size: 19px;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.cs-col-value.cs-pos,
.cs-wf-val.cs-pos { color: #15803d; }
.cs-col-value.cs-neg,
.cs-wf-val.cs-neg { color: #b91c1c; }
.cs-col-value.cs-warn { color: #b45309; }
.cs-col-detail { font-size: 11px; color: #64748b; line-height: 1.45; }
.cs-col-detail strong { color: #334155; font-weight: 600; }
.cs-col-link {
    font-size: 11px;
    color: #2563eb;
    margin-top: auto;
    padding-top: 4px;
    font-weight: 500;
}

.cs-drift-toggle {
    display: inline-flex;
    gap: 0;
    margin-left: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    background: #f8fafc;
}
.cs-drift-toggle button {
    border: none;
    background: transparent;
    font-size: 10px;
    padding: 2px 7px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1.4;
}
.cs-drift-toggle button.active { background: #334155; color: #fff; }

.cs-explainer {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fafafa;
    border-left: 2px solid #ca8a04;
    border-radius: 4px;
    font-size: 11px;
    color: #525252;
    line-height: 1.5;
}
.cs-explainer.ok {
    border-left-color: #16a34a;
}

/* Mini-waterfall — uniforme stijl met cs-col, alleen subtiele kleur op de waarde. */
.cs-waterfall {
    margin-top: 12px;
    padding: 0;
    background: transparent;
    border: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    gap: 6px;
    align-items: stretch;
}
@media (max-width: 700px) {
    .cs-waterfall { grid-template-columns: 1fr 1fr; }
}
.cs-wf-step { gap: 3px; }
.cs-wf-plus .cs-wf-val { color: #15803d; }
.cs-wf-minus .cs-wf-val { color: #b91c1c; }
.cs-wf-end { border-color: #cbd5e1; }
.cs-wf-end .cs-wf-val { color: #0f172a; }
.cs-wf-end.cs-wf-neg .cs-wf-val { color: #b91c1c; }
.cs-wf-arrow {
    align-self: center;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 400;
    padding: 0 2px;
}
@media (max-width: 700px) {
    .cs-wf-arrow { display: none; }
}
.cs-wf-step.clickable {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cs-wf-step.clickable:hover {
    border-color: #94a3b8;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

/* v3.353.2: detail-modal — opbouw bedragen per cards. */
.cs-detail-modal {
    max-width: 580px;
}
.cs-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}
.cs-detail-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.cs-detail-table td.right { text-align: right; font-variant-numeric: tabular-nums; }
.cs-detail-table tr.clickable-row { cursor: pointer; transition: background 0.15s; }
.cs-detail-table tr.clickable-row:hover { background: #f8fafc; }
.cs-detail-table tr.clickable-row td { color: #2563eb; }
.cs-detail-table tfoot tr.cs-detail-total td {
    padding-top: 10px;
    border-top: 2px solid #cbd5e1;
    border-bottom: 0;
    font-size: 14px;
}
.cs-detail-total.cs-pos td:last-child strong { color: #15803d; }
.cs-detail-total.cs-neg td:last-child strong { color: #b91c1c; }

.cs-detail-section { margin-bottom: 14px; }
.cs-detail-kpi {
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.cs-detail-kpi-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 4px;
}
.cs-detail-kpi-value {
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.cs-detail-kpi-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.45;
}
.cs-detail-kpi-sub strong { color: #334155; font-weight: 600; }
.cs-detail-explain {
    font-size: 12px;
    color: #475569;
    line-height: 1.55;
    background: #fafafa;
    padding: 10px 12px;
    border-radius: 4px;
    border-left: 2px solid #cbd5e1;
}
.cs-detail-explain strong { color: #0f172a; }

/* Variance / forecast accuracy strip — Laag A best-practice variance tracking.
   Compact horizontaal: drift KPI + per-categorie MAPE tiles. */
.variance-strip {
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.variance-strip-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.variance-strip-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
}
.variance-strip-sub { font-size: 11px; color: #94a3b8; font-style: italic; }
.variance-tiles {
    display: grid;
    grid-template-columns: 1.4fr repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}
.variance-tile {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: filter 0.12s, transform 0.12s;
    min-width: 0;
}
.variance-tile.clickable { cursor: pointer; }
.variance-tile.clickable:hover { filter: brightness(0.98); transform: translateY(-1px); }
.variance-tile-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.variance-tile-value {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.variance-tile-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 2px;
}
.variance-tile-spark {
    flex-shrink: 0;
    opacity: 0.85;
}
.variance-tile-sub { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.variance-tile-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}
.variance-tile-status.ok    { background: #16a34a; }
.variance-tile-status.warn  { background: #f59e0b; }
.variance-tile-status.bad   { background: #dc2626; }
.variance-tile-status.unknown { background: #cbd5e1; }
.variance-tile.drift.ok    { border-color: #86efac; background: #f0fdf4; }
.variance-tile.drift.warn  { border-color: #fcd34d; background: #fffbeb; }
.variance-tile.drift.bad   { border-color: #fca5a5; background: #fef2f2; }
.variance-tile-bias {
    font-size: 10px;
    color: #64748b;
    margin-left: 4px;
}

/* R-4 Financing strip — directly visible financing summary on /forecast */
.financing-strip {
    margin-top: 12px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
    border: 1px solid #ddd6fe;
    border-radius: 8px;
}
.financing-strip-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.financing-strip-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5b21b6;
}
.financing-strip-sub { font-size: 11px; color: #8b5cf6; font-style: italic; }
.financing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.financing-card {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 6px;
    transition: filter 0.12s, transform 0.12s;
    min-width: 0;
}
.financing-card.clickable { cursor: pointer; }
.financing-card.clickable:hover { filter: brightness(0.98); transform: translateY(-1px); }
.financing-card-label {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
    font-weight: 600;
}
.financing-card-label.fixed       { color: #7c3aed; }
.financing-card-label.revolving   { color: #0e7490; }
.financing-card-label.subordinated{ color: #64748b; }
.financing-card-label.agio        { color: #15803d; }
.financing-card-value {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}
.financing-card-detail {
    font-size: 11px;
    color: #64748b;
    line-height: 1.4;
}
.financing-card-detail .num { font-weight: 600; color: #0f172a; }
.financing-card.empty .financing-card-value { color: #cbd5e1; }
.variance-tile-bias.under  { color: #b45309; }  /* onderschat */
.variance-tile-bias.over   { color: #1d4ed8; }  /* overschat */
.variance-tile-bias.on_target { color: #166534; }

/* Segmented switch in bank-drift badge — toggle Geboekt vs Incl. verwacht.
   Stop propagation in onclick zodat klik op switch de modal niet opent. */
.bank-drift-segment {
    display: inline-flex;
    gap: 1px;
    margin-left: 12px;
    background: rgba(255,255,255,0.55);
    border-radius: 4px;
    padding: 2px;
    flex-shrink: 0;
}
.bank-drift-segment button {
    background: transparent;
    border: 0;
    padding: 3px 8px;
    font-size: 11px;
    color: inherit;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.12s;
    font-weight: 500;
    white-space: nowrap;
}
.bank-drift-segment button:hover { background: rgba(255,255,255,0.75); }
.bank-drift-segment button.active {
    background: rgba(0,0,0,0.06);
    font-weight: 700;
}
.bank-sync-drift .bank-drift-segment button.active { background: #fecaca; }
.bank-sync-aligned .bank-drift-segment button.active { background: #bbf7d0; }

/* Drift-modal redesign — sticky summary header + side-by-side IN/UIT tables. */
.bank-drift-modal .modal-body { padding: 0 !important; }
.bank-drift-sticky-top {
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px;
    z-index: 5;
}
.bank-drift-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 10px;
}
.bank-drift-stat {
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
}
.bank-drift-stat .lbl { font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: 0.4px; }
.bank-drift-stat .val { font-size: 16px; font-weight: 700; color: #0f172a; margin-top: 2px; }
.bank-drift-stat .sub { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.bank-drift-stat.drift.drift { background: #fef2f2; border-color: #fca5a5; }
.bank-drift-stat.drift.drift .val { color: #991b1b; }
.bank-drift-stat.drift.aligned { background: #f0fdf4; border-color: #86efac; }
.bank-drift-stat.drift.aligned .val { color: #166534; }
.bank-drift-stat.overlap-warn { background: #fffbeb; border-color: #fcd34d; }
.bank-drift-stat.overlap-warn .val { color: #b45309; }
.bank-drift-stat.overlap-warn .lbl { color: #b45309; }

/* GL-overlap chips op categorie-rijen — variance-foundation v3.229.0 */
.gl-overlap-chip {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    font-size: 10px;
    border-radius: 3px;
    font-weight: 600;
    cursor: help;
    white-space: nowrap;
}
.gl-overlap-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 8px;
}

.bank-drift-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.bank-drift-controls .bank-drift-segment {
    margin-left: 0;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}
.bank-drift-controls .bank-drift-segment button { font-size: 12px; padding: 4px 10px; color: #475569; }
.bank-drift-controls .bank-drift-segment button.active { background: #3b82f6; color: #fff; }
.bank-drift-help { font-size: 11px; color: #64748b; font-style: italic; flex: 1; min-width: 200px; }
.bank-drift-empty-toggle {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
}
.bank-drift-empty-toggle:hover { background: #f1f5f9; }

.bank-drift-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px 20px;
}
.bank-drift-col { display: flex; flex-direction: column; }
.bank-drift-col-header {
    font-size: 13px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 4px 4px 0 0;
}
.bank-drift-col-header.in  { background: #dcfce7; color: #166534; }
.bank-drift-col-header.out { background: #fee2e2; color: #991b1b; }
.bank-drift-subtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.bank-drift-subtable th,
.bank-drift-subtable td {
    padding: 5px 8px;
    border-bottom: 1px solid #f1f5f9;
}
.bank-drift-subtable th { font-size: 10px; color: #64748b; text-transform: uppercase; font-weight: 600; background: #fafafa; }
.bank-drift-subtable td.right,
.bank-drift-subtable th.right { text-align: right; font-variant-numeric: tabular-nums; }
.bank-drift-subtable tfoot tr.bank-drift-subtotal td {
    border-top: 2px solid #cbd5e1;
    border-bottom: 0;
    background: #f8fafc;
    padding-top: 7px;
}

.bank-drift-info {
    margin: 4px 20px 20px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid;
}
.bank-drift-info.aligned { background: #f0fdf4; border-color: #86efac; color: #166534; }
.bank-drift-info.drift   { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
details.bank-drift-info summary { cursor: pointer; outline: none; }
details.bank-drift-info ul { margin: 8px 0 0 18px; padding: 0; }
details.bank-drift-info li { margin: 3px 0; }

@media (max-width: 900px) {
    .bank-drift-summary { grid-template-columns: repeat(2, 1fr); }
    .bank-drift-tables { grid-template-columns: 1fr; }
}

/* ============ Info Boxes ============ */
.info-box {
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
}

.info-box.blue { background: #eff6ff; border-left: 4px solid #3b82f6; }
.info-box.yellow { background: #fffbeb; border-left: 4px solid #f59e0b; }
.info-box.green { background: #f0fdf4; border-left: 4px solid #22c55e; }
.info-box.red { background: #fef2f2; border-left: 4px solid #ef4444; }

.info-box strong {
    color: #0f172a;
}

.big-number {
    font-size: 24px;
    font-weight: 700;
    display: block;
    margin-top: 8px;
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ============ Controls ============ */
.controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .controls { grid-template-columns: repeat(2, 1fr); }
}

.control-group {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
}

.control-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 6px;
}

.control-group input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

.control-group input[type="range"] {
    width: 100%;
    margin-top: 4px;
}

.control-value {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-top: 4px;
}

.control-group.highlight {
    background: #ecfdf5;
    border: 2px solid #86efac;
}

.control-group.highlight label {
    color: #166534;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f0f9ff;
    border-radius: 8px;
}

.controls-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* ============ Charts ============ */
.chart-container {
    height: 300px;
    position: relative;
}
/* v3.351.1: ruimere saldoprojectie zodat bank-stand marker + breakdown
   goed leesbaar zijn naast de 4 lijnen (Werkelijk/Best/Conservatief/Zonder). */
.chart-container.chart-container-tall {
    height: 380px;
}

.chart-subtitle {
    font-size: 11px;
    color: #64748b;
    margin: -4px 0 10px;
    line-height: 1.4;
}
.chart-subtitle strong[title] {
    cursor: help;
    border-bottom: 1px dotted #94a3b8;
}

.chart-toggles-card {
    padding: 0;
    margin-bottom: 12px;
    overflow: hidden;
}

.chart-toggles {
    display: flex;
    flex-direction: column;
}

.chart-toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-left: 4px solid transparent;
}

.chart-toggle-row.in {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.07), transparent 60%);
    border-left-color: #10b981;
}

.chart-toggle-row.out {
    background: linear-gradient(to right, rgba(220, 38, 38, 0.06), transparent 60%);
    border-left-color: #dc2626;
    border-top: 1px solid #f1f5f9;
}

.chart-toggle-heading {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    min-width: 96px;
    padding-top: 5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-toggle-row.in .chart-toggle-heading { color: #047857; }
.chart-toggle-row.out .chart-toggle-heading { color: #b91c1c; }

.chart-toggle-icon {
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
}

.chart-toggle-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.chart-toggle-actions {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.section-hint {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 8px;
}

/* ============ Breakdown drill-down side-panel ============ */
.breakdown-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
}

.breakdown-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    cursor: pointer;
}

.breakdown-panel-body {
    position: relative;
    width: min(480px, 92vw);
    background: white;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    animation: slidein 0.2s ease;
}

@keyframes slidein {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.breakdown-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.breakdown-panel-close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.breakdown-panel-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.breakdown-panel-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.breakdown-toggle-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #475569;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.breakdown-toggle-btn:hover { background: #f1f5f9; }
.breakdown-toggle-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.breakdown-section { margin-bottom: 16px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.breakdown-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; background: #f8fafc; cursor: pointer;
    border-bottom: 1px solid transparent;
}
.breakdown-section-header:hover { background: #f1f5f9; }
.breakdown-section.open .breakdown-section-header { border-bottom-color: #e2e8f0; }
.breakdown-section.in-source .breakdown-section-header { border-left: 3px solid #16a34a; }
.breakdown-section.out-source .breakdown-section-header { border-left: 3px solid #dc2626; }
.breakdown-section-title {
    font-weight: 600; font-size: 13px; color: #1e293b;
    display: flex; align-items: center; gap: 8px;
}
.breakdown-section-amount { font-weight: 700; font-size: 13px; }
.breakdown-section.in-source .breakdown-section-amount { color: #16a34a; }
.breakdown-section.out-source .breakdown-section-amount { color: #dc2626; }
.breakdown-section-caret { color: #94a3b8; font-size: 11px; transition: transform 0.2s; }
.breakdown-section.open .breakdown-section-caret { transform: rotate(90deg); }
.breakdown-section-body { display: none; padding: 8px 12px; }
.breakdown-section.open .breakdown-section-body { display: block; }
.breakdown-section-empty { padding: 8px 12px; color: #94a3b8; font-size: 12px; }

.breakdown-panel-total-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.breakdown-panel-total-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.breakdown-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.breakdown-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}

.breakdown-item:hover {
    background: #f8fafc;
}

.breakdown-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.breakdown-item-label {
    font-size: 13px;
    color: #0f172a;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.breakdown-item-amount {
    font-size: 13px;
    color: #0f172a;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.breakdown-item-bar {
    position: relative;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}

.breakdown-item-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.breakdown-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #94a3b8;
}

.breakdown-panel-message {
    padding: 20px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

/* ============ Chart toggle info button ============ */
.chart-toggle-info {
    margin-right: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    color: #475569;
    background: transparent;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chart-toggle-info:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

.chart-toggle-info .info-icon {
    font-size: 13px;
    color: #3b82f6;
    font-weight: 600;
}

/* ============ Sources info modal ============ */
.sources-info-modal {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.sources-info-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
}

.sources-info-modal-body {
    position: relative;
    width: min(900px, 100%);
    max-height: 90vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sources-info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.sources-info-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.sources-info-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.sources-info-modal-content {
    overflow-y: auto;
    padding: 16px 20px;
    flex: 1;
}

.chart-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}

.chart-toggle:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.chart-toggle.off {
    opacity: 0.4;
    background: #f1f5f9;
    text-decoration: line-through;
}

.chart-toggle.off .dot {
    background: #cbd5e1 !important;
}

.chart-toggle.empty {
    opacity: 0.55;
    background: #f8fafc;
    border-style: dashed;
    border-color: #cbd5e1;
}

.chart-toggle.empty:hover {
    background: #f1f5f9;
}

.chart-toggle.empty .lbl {
    color: #64748b;
}

.chart-toggle.empty .dot {
    opacity: 0.45;
}

.chart-toggle .empty-mark {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 2px;
    font-weight: 600;
}

.chart-toggle .dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

.chart-toggle-reset {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    color: #64748b;
    background: transparent;
    border: 1px solid #e2e8f0;
    cursor: pointer;
}

.chart-toggle-reset:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ============ Modals ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 560px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.modal-wide {
    max-width: 800px;
}

.modal-xl {
    max-width: 960px;
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
}

.modal-close:hover {
    color: #0f172a;
}

.modal-body {
    font-size: 14px;
    line-height: 1.7;
}

/* ============ Status Badges (unified, pill-shape) ============ */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Migratie-herkomst badge — orthogonaal aan status, voor data uit Excel/oud systeem */
.migrated-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    margin-left: 4px;
    white-space: nowrap;
}

/* Run statuses */
.status-badge.complete {
    background: #dcfce7;
    color: #166534;
}

/* Invoice statuses (herontwerp) */
.status-badge.draft { background: #fef3c7; color: #92400e; }       /* Concept — amber */
.status-badge.approved { background: #dbeafe; color: #1d4ed8; }    /* Goedgekeurd — blauw */
.status-badge.sent_to_exact { background: #e0e7ff; color: #3730a3; } /* Verstuurd — indigo */
.status-badge.invoiced { background: #f3e8ff; color: #7c3aed; }    /* Uitstaand — paars */
.status-badge.paid { background: #dcfce7; color: #166534; }        /* Betaald — donkergroen */
.status-badge.credited { background: #f1f5f9; color: #64748b; }    /* Gecrediteerd — grijs */
/* Billing statuses */
.status-badge.planned { background: #fef3c7; color: #92400e; }     /* Klaarstaan — amber */
.status-badge.in_concept { background: #dbeafe; color: #1d4ed8; }  /* In concept — blauw */
.status-badge.closed { background: #f1f5f9; color: #64748b; text-decoration: line-through; } /* Gesloten bij contract-deactivatie — grijs doorgestreept */

/* Contract statuses */
.status-badge.active { background: #dcfce7; color: #16a34a; }
.status-badge.expired { background: #fef3c7; color: #d97706; }
.status-badge.cancelled { background: #fee2e2; color: #dc2626; }
.status-badge.archived { background: #f1f5f9; color: #64748b; }

/* PO statuses — same as contract (active, expired, cancelled) */

/* Budget version statuses (uppercase) */
.status-badge.DRAFT { background: #fef3c7; color: #92400e; }
.status-badge.APPROVED { background: #dbeafe; color: #1d4ed8; }
.status-badge.LOCKED { background: #fce7f3; color: #be185d; }
.status-badge.ARCHIVED { background: #e5e7eb; color: #6b7280; }

/* Contract special statuses */
.status-badge.paused { background: #e0e7ff; color: #3730a3; }
.status-badge.completed { background: #d1fae5; color: #059669; }

/* Credit note specific (Sessie 91) */
.cd-status-btn.credited { background: #fae8ff; color: #9333ea; border-color: #d8b4fe; }
.cd-status-btn.credited:hover { background: #f5d0fe; }

.credit-info-banner {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; background: #fdf4ff;
    border: 1px solid #e9d5ff; border-radius: 8px;
    margin-bottom: 12px; font-size: 13px; color: #7c3aed;
}
.credit-info-banner a { color: #7c3aed; font-weight: 600; text-decoration: underline; }
.credit-info-banner a:hover { color: #6d28d9; }

/* Invoice list: credit note rows */
.inv-table tbody tr.row-credit { background: #fdf4ff; }
.inv-table tbody tr.row-credit:hover { background: #fae8ff; }
.inv-table tbody tr.row-credited { opacity: 0.65; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.empty-state h3 {
    color: #64748b;
    font-weight: 500;
    margin-bottom: 8px;
}

.empty-state p {
    color: #94a3b8;
    font-size: 14px;
}

/* ============ Upload Page ============ */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .upload-grid { grid-template-columns: 1fr; }
}

.upload-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 16px;
}

.upload-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.upload-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.upload-icon {
    width: 40px;
    height: 40px;
    background: #eff6ff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
}

.upload-icon.optional {
    background: #f1f5f9;
    color: #64748b;
}

.upload-info {
    flex: 1;
}

.upload-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.upload-info p {
    font-size: 12px;
    color: #64748b;
}

.upload-status {
    padding: 0 8px;
}

.status-indicator {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    position: relative;
}

.status-indicator.pending {
    background: #e2e8f0;
}

.status-indicator.valid {
    background: #22c55e;
}

.status-indicator.valid::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

.status-indicator.invalid {
    background: #ef4444;
}

.status-indicator.invalid::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

.status-indicator.uploading {
    background: #3b82f6;
    animation: pulse 1s infinite;
}

.status-indicator.optional {
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.upload-dropzone {
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.upload-result {
    margin-top: 12px;
}

.file-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
}

.file-result.valid {
    background: #f0fdf4;
}

.file-result.invalid {
    background: #fef2f2;
    flex-direction: column;
    align-items: flex-start;
}

.file-name {
    flex: 1;
    font-weight: 500;
}

.row-count {
    color: #16a34a;
    font-size: 12px;
}

.error-list {
    list-style: disc;
    margin: 8px 0 8px 20px;
    color: #dc2626;
    font-size: 12px;
}

.error-text {
    color: #dc2626;
    font-size: 13px;
}

.uploading-text {
    color: #2563eb;
    font-size: 13px;
}

.upload-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px 24px;
    margin: 24px -24px -24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-summary {
    font-size: 14px;
    color: #64748b;
}

/* ============ Dashboard ============ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 20px;
}

.header-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
}


.dashboard-loading {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dashboard-content {
    display: block;
    width: 100%;
}

#dashboard-content:not(.dashboard-loading) {
    display: block;
}

/* Dashboard sections should stack vertically */
#dashboard-content > .grid,
#dashboard-content > .card {
    margin-bottom: 24px;
}

#dashboard-content > .card.section {
    margin-bottom: 24px;
}

/* Ensure nested grids inside cards don't have extra bottom margin */
.card .grid {
    margin-bottom: 0;
}

/* Fix table overflow */
.table-wrapper {
    overflow-x: auto;
}

.card table {
    min-width: 100%;
}

/* Better spacing for info boxes in grid */
.grid .info-box {
    height: 100%;
}

/* ============ Loading & Error States ============ */
.loading {
    text-align: center;
    color: #64748b;
    padding: 40px;
}

.error {
    text-align: center;
    color: #dc2626;
    padding: 40px;
    background: #fef2f2;
    border-radius: 8px;
}

/* ============ Notifications ============ */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 99999;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-info {
    background: #eff6ff;
    color: #1d4ed8;
}

.notification-success {
    background: #f0fdf4;
    color: #166534;
}

.notification-error {
    background: #fef2f2;
    color: #dc2626;
}

.notification-warning {
    background: #fffbeb;
    color: #d97706;
}

/* ============ Tooltips ============ */
.tooltip {
    position: fixed;
    background: #0f172a;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 1200;
    pointer-events: none;
}

/* ============ Date Badge ============ */
.date-badge {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 8px;
}

/* ============ Year Badge (ARR section) ============ */
.year-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

/* ============ Clickable Elements ============ */
.clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.clickable:hover {
    opacity: 0.7;
}

.card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ============ Source Tag ============ */
.source-tag {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    margin-top: 12px;
}

/* ============ Orange Info Box ============ */
.info-box.orange {
    background: #fff7ed;
    border-left: 4px solid #f97316;
}

/* ============ BTW Indicator ============ */
.btw-indicator {
    margin-left: auto;
    padding: 4px 12px;
    background: #dbeafe;
    border-radius: 4px;
    font-size: 12px;
}

/* ============ Formula Box ============ */
.formula {
    background: #f1f5f9;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    line-height: 1.8;
}

/* ============ Text Utility Classes ============ */
.text-muted {
    color: #94a3b8;
}

/* ============ Safe Zone Indicators ============ */
.safe-zone-ok {
    color: #16a34a;
}

.safe-zone-warning {
    color: #dc2626;
    font-weight: 600;
}

.safe-zone-legend {
    font-size: 12px;
    color: #64748b;
}

/* ============ Modal Enhancements ============ */
.modal-body h4 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: #1e293b;
}

.modal-body table {
    font-size: 13px;
    margin: 12px 0;
}

.modal-body table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #64748b;
    padding: 8px 10px;
    border-bottom: 2px solid #e2e8f0;
}

.modal-body table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-body table tr.total td {
    font-weight: 600;
    border-top: 2px solid #e2e8f0;
}

.modal-body table.compact {
    font-size: 12px;
}

.modal-body table.compact th,
.modal-body table.compact td {
    padding: 6px 8px;
}

.modal-body td.truncate {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modal section organization */
.modal-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.modal-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.modal-section-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.modal-kpi-grid .info-box {
    margin: 0;
}

.modal-body .source {
    color: #64748b;
    font-size: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* ============ App-wide Modal (Sessie 92) ============ */
/* Vervangt browser alert(), confirm(), prompt() door gestijlde modals */
.app-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    animation: appModalFadeIn .15s ease;
}
@keyframes appModalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.app-modal {
    background: #fff; border-radius: 12px; padding: 24px; max-width: 440px;
    width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center;
    animation: appModalSlideIn .15s ease;
}
@keyframes appModalSlideIn { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

.app-modal h3 { margin: 0 0 8px; font-size: 16px; }
.app-modal h3.modal-title-info { color: #1e40af; }
.app-modal h3.modal-title-warn { color: #92400e; }
.app-modal h3.modal-title-error { color: #991b1b; }
.app-modal h3.modal-title-success { color: #166534; }

.app-modal .modal-body { color: #4b5563; font-size: 13px; margin-bottom: 16px; line-height: 1.5; text-align: left; }
.app-modal .modal-body p { margin: 0; }

.app-modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.app-modal .modal-actions button {
    padding: 8px 20px; border-radius: 6px; font-size: 13px; cursor: pointer; border: none; font-weight: 500;
    transition: background .15s;
}
.app-modal .btn-modal-primary { background: #3b82f6; color: #fff; }
.app-modal .btn-modal-primary:hover { background: #2563eb; }
.app-modal .btn-modal-danger { background: #ef4444; color: #fff; }
.app-modal .btn-modal-danger:hover { background: #dc2626; }
.app-modal .btn-modal-warn { background: #f59e0b; color: #fff; }
.app-modal .btn-modal-warn:hover { background: #d97706; }
.app-modal .btn-modal-cancel { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.app-modal .btn-modal-cancel:hover { background: #e5e7eb; }

.app-modal input[type="text"], .app-modal input[type="number"], .app-modal textarea {
    width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; margin-bottom: 12px; box-sizing: border-box; font-family: inherit;
}
.app-modal input:focus, .app-modal textarea:focus {
    outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ============ Print Styles ============ */
@media print {
    html, body {
        background: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        margin: 0 !important;
        padding: 0 !important;
    }
    .sidebar, .btn, .controls, .run-dropdown, .modal-overlay { display: none !important; }
    .main-content {
        margin-left: 0 !important;
    }
    .container {
        max-width: 100%;
        padding: 16px !important;
        margin: 0 !important;
    }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #e2e8f0; }
    .chart-container { height: 250px; }
    .grid { gap: 12px; }
    header { margin-bottom: 16px; }
    .section { margin-bottom: 16px; }
    .info-box { padding: 12px; }
    .deep-link-banner { display: none !important; }
    .kpi-tabs, .kpi-calc-btn, .kpi-cell input { display: none !important; }
}

/* ============ Deep-Link Filter Banner ============ */
.deep-link-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 12px;
    color: #1e40af;
    margin-bottom: 12px;
}
.deep-link-banner .deep-link-icon {
    font-size: 14px;
}
.deep-link-banner .deep-link-clear {
    margin-left: auto;
    background: none;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    color: #2563eb;
    cursor: pointer;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.deep-link-banner .deep-link-clear:hover {
    background: #dbeafe;
}

/* ============ Audit History Panel (Shared) ============ */
.audit-history {
    margin-top: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}
.audit-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
}
.audit-history-header:hover {
    background: #f1f5f9;
}
.audit-history-title {
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}
.audit-history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
}
.audit-history-chevron {
    font-size: 12px;
    color: #94a3b8;
    transition: transform 0.2s;
}
.audit-history.expanded .audit-history-chevron {
    transform: rotate(90deg);
}
.audit-history-body {
    display: none;
    max-height: 400px;
    overflow-y: auto;
}
.audit-history.expanded .audit-history-body {
    display: block;
}
.audit-history-empty {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
}
.audit-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.audit-history-table th {
    text-align: left;
    padding: 6px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 600;
    font-size: 11px;
    position: sticky;
    top: 0;
    z-index: 1;
}
.audit-history-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: top;
}
.audit-history-table tr:hover td {
    background: #f8fafc;
}
.audit-history-table .history-time {
    color: #94a3b8;
    white-space: nowrap;
    font-size: 11px;
}
.audit-history-table .history-summary {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.audit-history-table .history-detail {
    color: #64748b;
    font-size: 11px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}
/* Operation badges — shared with pipeline history */
.history-op-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}
.history-op-badge.op-create { background: #d1fae5; color: #065f46; }
.history-op-badge.op-update { background: #e0e7ff; color: #3730a3; }
.history-op-badge.op-delete { background: #fee2e2; color: #991b1b; }
.history-op-badge.op-import { background: #fef3c7; color: #92400e; }
.history-op-badge.op-status_change { background: #ede9fe; color: #5b21b6; }
.history-op-badge.op-generate { background: #d5f5f6; color: #0e7490; }
.history-op-badge.op-reconcile { background: #fce7f3; color: #9d174d; }
.history-op-badge.op-from_billings { background: #f0fdf4; color: #166534; }
.history-op-badge.op-reschedule { background: #fff7ed; color: #9a3412; }
.history-op-badge.op-rename { background: #fdf4ff; color: #86198f; }
.history-op-badge.op-start { background: #dbeafe; color: #1e40af; }
.history-op-badge.op-deactivate { background: #fef2f2; color: #b91c1c; }
.history-op-badge.op-move { background: #fef9c3; color: #854d0e; }
.history-op-badge.op-line_moved_out { background: #ffedd5; color: #9a3412; }
.history-op-badge.op-line_moved_in { background: #dcfce7; color: #166534; }
/* Pagination */
.audit-history-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    color: #64748b;
}
.audit-history-footer button {
    padding: 2px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #475569;
    font-size: 11px;
    cursor: pointer;
}
.audit-history-footer button:hover {
    background: #f1f5f9;
}
.audit-history-footer button:disabled {
    opacity: 0.5;
    cursor: default;
}
/* Print: hide audit panels */
@media print {
    .audit-history { display: none !important; }
}

/* ============ Currency Support ============ */
.currency-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}
.currency-badge.usd {
    background: #dbeafe;
    color: #1e40af;
}
.currency-badge.eur {
    background: #d1fae5;
    color: #065f46;
}
.currency-select {
    padding: 2px 4px;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: white;
    min-width: 70px;
}
.non-eur-info-box {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 10px;
    font-size: 13px;
    color: #92400e;
}
.non-eur-info-box .non-eur-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.non-eur-info-box .non-eur-amount {
    font-weight: 600;
    font-size: 14px;
}

/* ===== Page Help Panel ===== */
.page-help-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.15);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.page-help-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.page-help-panel {
    position: fixed;
    top: 0; right: -540px; bottom: 0;
    width: 520px;
    max-width: 90vw;
    background: #fff;
    z-index: 201;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transition: right 0.3s ease;
}
.page-help-panel.open {
    right: 0;
}
.page-help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f0f9ff;
    border-bottom: 1px solid #e0f2fe;
    flex-shrink: 0;
}
.page-help-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1e3a5f;
}
.page-help-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #64748b;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}
.page-help-close:hover {
    background: #e0f2fe;
    color: #1e3a5f;
}
.page-help-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.page-help-footer {
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.page-help-footer a {
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
}
.page-help-footer a:hover {
    text-decoration: underline;
}
.page-help-tour-btn {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}
.page-help-tour-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.btn-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-help:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* Help Content CSS (shared with help.html) */
.help-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.help-section h2 {
    font-size: 18px;
    color: #1e3a5f;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}
.help-section h3 {
    font-size: 15px;
    color: #334155;
    margin: 20px 0 12px 0;
}
.help-section p {
    color: #475569;
    line-height: 1.6;
    margin-bottom: 12px;
}
.help-section ul, .help-section ol {
    color: #475569;
    line-height: 1.6;
    margin-bottom: 12px;
    padding-left: 20px;
}
.formula-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 13px;
    margin: 16px 0;
    overflow-x: auto;
}
.formula-box .highlight { color: #2563eb; font-weight: 600; }
.formula-box .green { color: #16a34a; }
.formula-box .red { color: #dc2626; }
.formula-box .orange { color: #ea580c; }
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}
.info-table th {
    background: #f1f5f9;
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
}
.info-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
}
.info-table tr:last-child td { border-bottom: none; }
.icon-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 16px 0;
}
.icon-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}
.icon-item .icon { font-size: 16px; }
.example-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}
.example-box strong { color: #92400e; }
.tip-box {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}
.tip-box strong { color: #065f46; }
.warning-box {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}
.warning-box strong { color: #991b1b; }

/* In help panel, help-sections have no shadow (panel provides container) */
.page-help-body .help-section {
    box-shadow: none;
    padding: 16px 0;
    border-radius: 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
}
.page-help-body .help-section:last-child {
    border-bottom: none;
}

/* Print: hide help panel and button */
@media print {
    .page-help-overlay, .page-help-panel, .btn-help { display: none !important; }
}

/* ============================================
   AUTH / LOGIN STYLES
   ============================================ */

/* Login page */
.login-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px 0;
}

.login-brand p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.login-field input,
.login-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.login-field input:focus,
.login-field select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
    background: #fff;
}

.login-btn {
    width: 100%;
    padding: 11px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.login-btn:hover { background: #2563eb; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-btn-secondary {
    background: #64748b;
}
.login-btn-secondary:hover { background: #475569; }

.login-msg-hidden {
    display: none !important;
}

.login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #fecaca;
}

.login-success {
    background: #f0fdf4;
    color: #16a34a;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #bbf7d0;
}

.login-divider {
    text-align: center;
    margin: 20px 0;
    border-top: 1px solid #e2e8f0;
    position: relative;
}
.login-divider span {
    background: #fff;
    padding: 0 12px;
    font-size: 12px;
    color: #94a3b8;
    position: relative;
    top: -9px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}
.login-footer a {
    font-size: 13px;
    color: #3b82f6;
    text-decoration: none;
}
.login-footer a:hover { text-decoration: underline; }

.login-hint {
    font-size: 12px;
    color: #94a3b8;
    margin: 6px 0 0;
}

.login-pw-rules {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    font-size: 12px;
    color: #94a3b8;
}
.login-pw-rules li {
    position: relative;
    padding-left: 18px;
}
.login-pw-rules li::before {
    content: '○';
    position: absolute;
    left: 0;
    top: 0;
    color: #cbd5e1;
}
.login-pw-rules li.ok {
    color: #16a34a;
}
.login-pw-rules li.ok::before {
    content: '✓';
    color: #16a34a;
}

.field-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
}

/* Change password page */
.change-pw-container {
    max-width: 480px;
    margin: 40px auto;
    padding: 0 20px;
}

.change-pw-card {
    background: #fff;
    border-radius: 8px;
    padding: 28px;
    border: 1px solid #e2e8f0;
}

.change-pw-card h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px 0;
}

.change-pw-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid #bfdbfe;
}

/* Password strength */
.pw-strength {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin: -8px 0 8px 0;
    overflow: hidden;
}
.pw-strength-bar {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transition: width 0.3s, background 0.3s;
}
.pw-strength-bar.weak { background: #dc2626; }
.pw-strength-bar.fair { background: #f59e0b; }
.pw-strength-bar.good { background: #3b82f6; }
.pw-strength-bar.strong { background: #16a34a; }

.pw-requirements {
    margin-bottom: 16px;
}
.pw-req {
    font-size: 12px;
    color: #94a3b8;
    padding: 2px 0;
}
.pw-req.met { color: #16a34a; }
.pw-req-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
}

/* ============================================
   ADMIN STYLES
   ============================================ */

.admin-container {
    max-width: 1100px;
    margin: 0 auto;
}

.admin-section {
    margin-bottom: 32px;
}
.admin-section-header {
    margin-bottom: 12px;
}
.admin-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.admin-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: #1e293b; }
.admin-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.admin-panel-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.admin-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.admin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.admin-table tr:hover td { background: #f8fafc; }
.admin-table .inactive-row td { opacity: 0.5; }

.admin-actions {
    display: flex;
    gap: 4px;
}

.btn-icon-sm {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    color: #64748b;
    transition: background 0.15s;
}
.btn-icon-sm:hover { background: #f1f5f9; color: #1e293b; }
.btn-danger-sm { color: #dc2626; }
.btn-danger-sm:hover { background: #fef2f2; color: #dc2626; }

/* v3.273.0 — filter-chip used for PayrollGlMapping category filter */
.filter-chip {
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 9999px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.filter-chip:hover { background: #f1f5f9; color: #1e293b; }
.filter-chip.filter-chip-active {
    background: #1B5E42;
    color: #fff;
    border-color: #1B5E42;
}
.btn-success-sm { color: #16a34a; }
.btn-success-sm:hover { background: #f0fdf4; color: #16a34a; }

.role-badge {
    background: #eff6ff;
    color: #3b82f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.system-badge {
    background: #f1f5f9;
    color: #64748b;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
}

.perm-badge {
    display: inline-block;
    background: #f0fdf4;
    color: #16a34a;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin: 1px 2px;
}

/* status-badge is defined globally above — admin uses .active/.expired variants */
.status-active { background: #f0fdf4; color: #16a34a; }
.status-inactive { background: #f1f5f9; color: #94a3b8; }
.status-warning { background: #fef3c7; color: #92400e; }

/* Admin modals */
.admin-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.admin-modal {
    background: #fff;
    border-radius: 10px;
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.admin-modal-sm { width: 400px; }

.admin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.admin-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.admin-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.admin-modal-close:hover { color: #1e293b; }

.admin-modal form,
.admin-modal-body {
    padding: 20px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
}

.permission-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.permission-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.permission-item:hover { background: #f8fafc; }
.permission-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

/* RBAC Matrix Table (Sessie 91) */
.rbac-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.rbac-matrix-table thead th {
    background: #f8fafc;
    padding: 6px 4px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #64748b;
    position: sticky;
    top: 0;
    z-index: 1;
}
.rbac-matrix-table tbody td {
    padding: 3px 4px;
    border-bottom: 1px solid #f1f5f9;
}
.rbac-matrix-table .rbac-module-header td {
    padding: 6px 10px;
}
.rbac-matrix-table input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #3b82f6;
    cursor: pointer;
}
.rbac-matrix-table .rbac-module-toggle {
    accent-color: #6366f1;
}
.rbac-matrix-table .rbac-row-toggle {
    accent-color: #22c55e;
}
.perm-badge-partial {
    background: #fef3c7 !important;
    color: #92400e !important;
}

/* Exact Online sync cards */
.exact-sync-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
}
.exact-sync-card:hover {
    border-color: #cbd5e1;
}
.exact-sync-count {
    font-size: 11px;
    color: #64748b;
    background: #e2e8f0;
    padding: 1px 6px;
    border-radius: 10px;
}
.exact-sync-result {
    font-size: 11px;
    margin-top: 8px;
    padding: 6px 8px;
    background: #f1f5f9;
    border-radius: 4px;
}

/* GL Account & Article Code badges (Sessie 67) */
.gl-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}
.gl-ref-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
    white-space: nowrap;
}
.article-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: #ccfbf1;
    color: #0d9488;
    white-space: nowrap;
}
.gl-code-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    white-space: nowrap;
}

/* ID badges for entity traceability */
.id-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    white-space: nowrap;
    margin-right: 4px;
    vertical-align: middle;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

/* Larger ID badge for detail page headers */
.id-badge-lg {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
    margin-right: 8px;
    vertical-align: middle;
    letter-spacing: 0.3px;
    line-height: 1.5;
}

/* ID badge color variants for entity types */
.id-badge-contract { background: #f1f5f9; color: #475569; }
.id-badge-line { background: #f3f0ff; color: #7c3aed; }
.id-badge-billing { background: #fef3c7; color: #92400e; }
.id-badge-invoice { background: #dbeafe; color: #1d4ed8; }
.id-badge-po { background: #e0f2fe; color: #0369a1; }

.reset-url-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    word-break: break-all;
    color: #334155;
}

/* Activity badges */
.activity-op {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}
.activity-op.op-create { background: #f0fdf4; color: #16a34a; }
.activity-op.op-update { background: #eff6ff; color: #3b82f6; }
.activity-op.op-delete { background: #fef2f2; color: #dc2626; }
.activity-op.op-login { background: #faf5ff; color: #7c3aed; }
.activity-op.op-logout { background: #f1f5f9; color: #64748b; }
.activity-op.op-login_failed { background: #fffbeb; color: #d97706; }
.activity-op.op-password_change { background: #eff6ff; color: #3b82f6; }
.activity-op.op-password_reset { background: #faf5ff; color: #7c3aed; }

/* Sidebar user info */
.sidebar-user {
    padding: 6px 10px;
    border-top: 1px solid #1e293b;
    flex-shrink: 0;
}
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.sidebar-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-user-name {
    font-size: 12px;
    color: #e2e8f0;
    font-weight: 500;
    line-height: 1.3;
}
.sidebar-user-role {
    font-size: 10px;
    color: #94a3b8;
    display: block;
}
.sidebar-user-actions {
    display: flex;
    gap: 8px;
    font-size: 11px;
}
.sidebar-user-actions a {
    color: #94a3b8;
    text-decoration: none;
}
.sidebar-user-actions a:hover {
    color: #e2e8f0;
}

/* Generic btn classes for admin */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    border-radius: 6px;
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn:hover { background: #f8fafc; }
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn-primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.btn-primary:hover { background: #2563eb; }

/* ============ KPI Page ============ */
.kpi-tabs          { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; }
.kpi-tab           { padding: 8px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; color: #64748b; font-size: 13px; font-weight: 500; transition: all 0.15s; background: none; border-top: none; border-left: none; border-right: none; }
.kpi-tab:hover     { color: #334155; }
.kpi-tab.active    { border-bottom-color: #3b82f6; font-weight: 600; color: #1e40af; }

.kpi-grid          { width: 100%; border-collapse: collapse; font-size: 12px; }
.kpi-grid th       { background: #f8fafc; padding: 6px 8px; text-align: left; border-bottom: 2px solid #e2e8f0; position: sticky; top: 0; z-index: 10; font-weight: 600; color: #475569; white-space: nowrap; }
.kpi-grid td       { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; }
.kpi-grid th.col-value, .kpi-grid td.col-value { text-align: right; }
.kpi-grid .kpi-dept-header td { font-weight: 700; font-size: 13px; padding-top: 12px; background: #f8fafc; }
.kpi-grid .kpi-strategy-row td { font-weight: 600; font-size: 11px; color: #64748b; padding-top: 8px; text-transform: uppercase; letter-spacing: 0.05em; }

.kpi-cell            { min-width: 56px; text-align: right; cursor: pointer; padding: 3px 6px !important; border-radius: 3px; transition: background 0.1s; }
.kpi-cell:hover      { background: #f1f5f9; }
.kpi-cell.green      { background: #dcfce7; color: #166534; }
.kpi-cell.red        { background: #fee2e2; color: #991b1b; }
.kpi-cell.auto       { font-style: italic; }
.kpi-cell.empty      { color: #cbd5e1; }
.kpi-cell input      { width: 60px; padding: 2px 4px; border: 1px solid #93c5fd; border-radius: 3px; font-size: 12px; text-align: right; outline: none; }

.kpi-norm-badge      { display: inline-block; padding: 1px 6px; border-radius: 3px; background: #f3f4f6; font-size: 10px; color: #6b7280; white-space: nowrap; }
.kpi-auto-badge      { display: inline-block; padding: 1px 4px; border-radius: 2px; background: #dbeafe; font-size: 9px; color: #1d4ed8; margin-left: 4px; }
.kpi-direction-badge { display: inline-block; padding: 1px 4px; border-radius: 2px; font-size: 9px; margin-left: 2px; }
.kpi-direction-badge.higher { background: #dcfce7; color: #166534; }
.kpi-direction-badge.lower  { background: #fef3c7; color: #92400e; }

/* Department border-left accents */
.kpi-dept-finance td:first-child    { border-left: 4px solid #3b82f6; }
.kpi-dept-sales td:first-child      { border-left: 4px solid #22c55e; }
.kpi-dept-operations td:first-child { border-left: 4px solid #8b5cf6; }
.kpi-dept-product td:first-child    { border-left: 4px solid #f59e0b; }

/* KPI Q-cell for quarterly view */
.kpi-q-header { text-align: center; font-size: 11px; }
.kpi-q-sub    { font-size: 10px; color: #94a3b8; font-weight: 400; }
.kpi-q-cell   { text-align: right; min-width: 50px; }
.kpi-q-cell.target { color: #64748b; }
.kpi-q-cell.actual { font-weight: 600; }

/* KPI Beheer tab */
.kpi-admin-table       { width: 100%; border-collapse: collapse; font-size: 12px; }
.kpi-admin-table th    { background: #f8fafc; padding: 8px; text-align: left; border-bottom: 2px solid #e2e8f0; font-weight: 600; }
.kpi-admin-table td    { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; }
.kpi-admin-table tr:hover td { background: #f8fafc; }

/* KPI Calc button */
.kpi-calc-btn { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-weight: 500; }
.kpi-calc-btn:hover { background: #bfdbfe; }

/* Timestamp button (Sessie 78) — used next to notes labels */
.btn-timestamp { background: none; border: none; cursor: pointer; font-size: 14px; padding: 0 4px; vertical-align: middle; opacity: 0.6; }
.btn-timestamp:hover { opacity: 1; }

/* Override indicator (Sessie 78) — shows deviation from customer defaults */
.override-indicator { color: #f59e0b; font-size: 11px; cursor: help; margin-left: 4px; }

/* ============ Slide-in Detail Panel (Sessie 82 — shared) ============ */
.detail-panel-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,0.15);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.detail-panel-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.detail-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: white;
    box-shadow: -8px 0 24px rgba(0,0,0,0.12);
    z-index: 101;
    transition: right 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.detail-panel.open { right: 0; }
.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}
.detail-panel-header h2 { margin: 0; font-size: 17px; font-weight: 700; color: #1e293b; }
.detail-panel-header .subtitle { font-size: 12px; color: #64748b; font-weight: 400; margin-top: 2px; }
.detail-panel-actions { display: flex; gap: 6px; align-items: center; }
.panel-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: #94a3b8; padding: 0; line-height: 1;
}
.panel-close:hover { color: #1e293b; }

/* Panel tabs */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 20px;
    flex-shrink: 0;
    background: white;
}
.panel-tab {
    padding: 10px 14px; font-size: 13px; font-weight: 500;
    color: #64748b; cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s; white-space: nowrap;
}
.panel-tab:hover { color: #1e293b; }
.panel-tab.active { color: #3b82f6; border-bottom-color: #3b82f6; }
.panel-body { flex: 1; overflow-y: auto; padding: 20px; }

/* Panel field rows */
.field-section { margin-bottom: 20px; }
.field-section h4 {
    font-size: 11px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 10px 0;
}
.field-row {
    display: flex; align-items: baseline; padding: 7px 0;
    border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.field-row .label { width: 140px; color: #64748b; flex-shrink: 0; }
.field-row .value { flex: 1; color: #1e293b; font-weight: 500; }
.field-row .value.empty { color: #cbd5e1; font-style: italic; font-weight: 400; }

/* Mini table in panel */
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th {
    text-align: left; font-weight: 600; color: #475569; font-size: 11px;
    text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid #e2e8f0;
}
.mini-table td { padding: 8px 8px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.mini-table tr:hover td { background: #f8fafc; }
.mini-table .clickable-row { cursor: pointer; }
.mini-table .clickable-row:hover td { background: #eff6ff; }

/* Invoice status badges in panel */
.inv-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.inv-status.draft { background: #f1f5f9; color: #64748b; }
.inv-status.approved { background: #dbeafe; color: #2563eb; }
.inv-status.sent_to_exact { background: #fef3c7; color: #92400e; }
.inv-status.invoiced { background: #dcfce7; color: #16a34a; }
.inv-status.paid { background: #d1fae5; color: #065f46; }

.link-btn { display: inline-block; margin-top: 10px; color: #3b82f6; text-decoration: none; font-weight: 500; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ============ Multi-Select Dropdown Component (Sessie 82c) ============ */
.ms-container { position: relative; display: inline-block; min-width: 140px; }
.ms-trigger {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px; width: 100%;
    border: 1px solid #e2e8f0; border-radius: 8px;
    background: white; cursor: pointer;
    font-size: 14px; color: #1e293b;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none; white-space: nowrap;
}
.ms-trigger:hover { border-color: #cbd5e1; }
.ms-trigger.active { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.ms-trigger-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ms-trigger-text.placeholder { color: #94a3b8; }
.ms-badge { background: #dbeafe; color: #1e40af; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 10px; }
.ms-chevron { font-size: 10px; color: #94a3b8; transition: transform 0.15s; margin-left: 2px; }
.ms-trigger.active .ms-chevron { transform: rotate(180deg); }
.ms-clear { font-size: 14px; color: #94a3b8; cursor: pointer; line-height: 1; padding: 0 2px; }
.ms-clear:hover { color: #ef4444; }
.ms-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    min-width: 180px;
    background: white; border: 1px solid #e2e8f0;
    border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000; display: none;
    max-height: 280px; overflow-y: auto;
}
.ms-dropdown.open { display: block; }
.ms-search {
    display: block; width: 100%; padding: 8px 12px;
    border: none; border-bottom: 1px solid #e2e8f0;
    font-size: 13px; outline: none;
    border-radius: 8px 8px 0 0;
}
.ms-search::placeholder { color: #94a3b8; }
.ms-option {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; cursor: pointer;
    font-size: 13px; color: #374151;
    transition: background 0.1s;
}
.ms-option:hover { background: #f1f5f9; }
.ms-option.selected { background: #eff6ff; }
.ms-option input[type="checkbox"] {
    width: 15px; height: 15px; accent-color: #3b82f6;
    cursor: pointer; flex-shrink: 0;
}
.ms-option label { cursor: pointer; flex: 1; }

/* ============ Column Header Filter Dropdowns (Sessie 93) ============ */
.th-label { display: inline-flex; align-items: center; gap: 4px; }
.th-filter-dot {
    display: inline-block; width: 6px; height: 6px;
    border-radius: 50%; background: #3b82f6;
    margin-left: 4px; vertical-align: middle;
}
.col-dropdown {
    position: absolute; top: 100%; left: 0; min-width: 200px;
    background: white; border: 1px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 100;
    padding: 6px 0; text-transform: none; letter-spacing: 0;
    font-weight: 400; font-size: 13px; color: #1e293b; display: none;
}
.col-dropdown.open { display: block; }
.col-dropdown.align-right { left: auto; right: 0; }
.col-dd-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px; cursor: pointer; white-space: nowrap;
    transition: background 0.1s;
}
.col-dd-item:hover { background: #f1f5f9; }
.col-dd-item.active { background: #eff6ff; color: #2563eb; font-weight: 600; }
.col-dd-item .dd-icon { width: 16px; text-align: center; font-size: 12px; flex-shrink: 0; }
.col-dd-divider { height: 1px; background: #e2e8f0; margin: 4px 0; }
.col-dd-label {
    padding: 6px 14px; font-size: 11px; color: #64748b;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.col-dd-input {
    margin: 4px 10px 6px; padding: 6px 8px;
    border: 1px solid #cbd5e1; border-radius: 4px;
    font-size: 12px; background: white;
    width: calc(100% - 20px); box-sizing: border-box;
}
.col-dd-input:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
.col-dd-search {
    margin: 4px 10px 4px; padding: 6px 8px 6px 28px;
    border: 1px solid #cbd5e1; border-radius: 4px;
    font-size: 12px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 8px center;
    width: calc(100% - 20px); box-sizing: border-box;
}
.col-dd-search:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }
.col-dd-checklist { max-height: 200px; overflow-y: auto; margin: 2px 0; }
.col-dd-check-item {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 14px; cursor: pointer; font-size: 12px;
    transition: background 0.1s; white-space: nowrap;
}
.col-dd-check-item:hover { background: #f1f5f9; }
.col-dd-check-item input[type="checkbox"] { width: 14px; height: 14px; accent-color: #3b82f6; cursor: pointer; flex-shrink: 0; }
.col-dd-check-item.hidden { display: none; }
.col-dd-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: #3b82f6; color: white; font-size: 10px; font-weight: 700; margin-left: 4px;
}
.col-dd-clear {
    padding: 6px 14px; font-size: 12px; color: #dc2626;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.col-dd-clear:hover { background: #fef2f2; }

/* ========================================
   Staging environment banner
   ======================================== */
.staging-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #f59e0b;
    color: #000;
    text-align: center;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.staging-banner ~ .app-layout {
    padding-top: 32px;
}
.staging-banner ~ .login-container {
    padding-top: 32px;
}

/* ==========================================================================
   Tijdlijn-cel hover-popover (gedeeld over contracts/contract-detail/
   contract-line-detail/billing-schedule)
   ========================================================================== */
.tl-month-has-billing { cursor: pointer; }
.tl-month-has-billing:hover { z-index: 100; }
.tl-month-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
    min-width: 240px;
    max-width: 320px;
    z-index: 1000;
    font-size: 11px;
    color: #1e293b;
    text-align: left;
    pointer-events: auto;
    white-space: normal;
    line-height: 1.4;
}
/* Onzichtbare hover-bridge tussen popover en trigger zodat de mouse-over
   niet onderbroken wordt bij het bewegen van circle naar popover. */
.tl-month-popover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: -8px;
    right: -8px;
    height: 12px;
    background: transparent;
}
.tl-month-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ffffff;
    pointer-events: none;
    z-index: 1;
}
.tl-month-has-billing:hover .tl-month-popover { display: block; }
.tl-pop-item { display: flex; flex-direction: column; gap: 2px; }
.tl-pop-divider { height: 1px; background: #e2e8f0; margin: 8px 0; }
.tl-pop-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 4px;
}
.tl-pop-period { font-weight: 600; color: #475569; font-size: 11px; white-space: nowrap; }
.tl-pop-amt {
    font-weight: 700; color: #0f172a; font-size: 14px;
    display: flex; align-items: baseline; gap: 6px;
}
.tl-pop-amt-sub { font-size: 9px; font-weight: 500; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.4px; }
.tl-pop-amt-incl { font-size: 11px; color: #64748b; font-weight: 500; }
.tl-pop-meta {
    font-size: 10px; color: #64748b; line-height: 1.35;
    word-break: break-word; overflow-wrap: anywhere;
}
.tl-pop-note {
    font-style: italic;
    border-left: 2px solid #e2e8f0;
    padding-left: 6px;
    margin-top: 2px;
}
.tl-pop-links {
    display: flex; gap: 10px; margin-top: 6px; padding-top: 6px;
    border-top: 1px solid #f1f5f9; flex-wrap: wrap;
}
.tl-pop-link {
    color: #3b82f6; text-decoration: none; font-size: 11px; font-weight: 500;
    white-space: nowrap;
}
.tl-pop-link:hover { text-decoration: underline; }

/* Info-badge: billings bestaan elders (ander jaar) — geen alarm, gewoon info.
   Onderscheid met .tl-empty-warn (rood, écht ontbrekende billings). */
.tl-empty-info {
    position: absolute;
    top: -2px;
    right: 0;
    font-size: 10px;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 6px;
    pointer-events: none;
    font-weight: 500;
    white-space: nowrap;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Per-event regel: chronologische event-historie i.p.v. 12-maands track. */
.evt-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    padding: 8px 12px;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 12px;
}
.evt-count { font-weight: 700; color: #92400e; }
.evt-total { color: #78350f; font-weight: 600; }
.evt-hint { color: #a16207; font-size: 11px; flex: 1; text-align: right; }
.evt-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.evt-row-wrap {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 0;
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    transition: border-color 0.15s, background 0.15s;
}
.evt-row-wrap:hover { border-color: #93c5fd; background: #f8fafc; }
.evt-row {
    display: grid;
    grid-template-columns: 1fr 120px 100px;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}
.evt-row.evt-row-link {
    color: inherit;
    text-decoration: none;
}
.evt-row.evt-row-link:hover { text-decoration: none; }
.evt-row-wrap .evt-inv {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-left: 1px solid #f1f5f9;
}
.evt-date { font-weight: 600; color: #1e293b; }
.evt-amt { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; text-align: right; }
.evt-link { color: #3b82f6; text-decoration: none; font-size: 11px; }
.evt-link:hover { text-decoration: underline; }

/* ============================================================
   DirtyTracker — autosave status badge
   ============================================================
   Spec: docs/plans/unsaved-changes-warning.md
   Rendered by static/js/dirty_tracker.js next to save buttons.
   ============================================================ */
.dirty-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    padding: 2px 8px;
    font-size: 12px;
    line-height: 18px;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: transparent;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    user-select: none;
    white-space: nowrap;
    vertical-align: middle;
}
.dirty-status:empty {
    border-color: transparent;
    background: transparent;
    padding: 0;
    margin-left: 0;
}
.dirty-status--dirty {
    background: var(--warning-bg, #FFFBEB);
    color: var(--warning-text, #B45309);
    border-color: var(--warning-border, #FCD34D);
}
.dirty-status--saving {
    background: #F3F4F6;
    color: #4B5563;
    border-color: #E5E7EB;
}
.dirty-status--saved {
    background: var(--success-bg, #ECFDF5);
    color: var(--success-text, #047857);
    border-color: var(--success-border, #6EE7B7);
}
.dirty-status--error {
    background: var(--danger-bg, #FEF2F2);
    color: var(--danger-text, #DC2626);
    border-color: var(--danger-border, #FCA5A5);
}

/* Save-button busy marker — set by DirtyTracker while a save is in-flight.
   Keeps the button clickable (no `disabled`) but visually de-emphasised. */
[data-saving="true"] {
    opacity: 0.7;
    cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
    .dirty-status { transition: none; }
}

/* ============================================================
   LeaveConfirmModal — custom Orbital-modal voor in-app navigatie
   met niet-opgeslagen wijzigingen. Vervangt Chrome's native dialog.
   ============================================================ */
html.leave-modal-open,
html.leave-modal-open body {
    overflow: hidden;
}
.leave-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
}
.leave-modal-overlay.is-open {
    display: flex;
    animation: leaveModalFadeIn 0.12s ease-out;
}
@keyframes leaveModalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.leave-modal {
    background: #fff;
    border-radius: 10px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 50px -10px rgba(0,0,0,0.3), 0 8px 16px -8px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: leaveModalPop 0.15s ease-out;
}
@keyframes leaveModalPop {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.leave-modal-header {
    padding: 20px 24px 0;
}
.leave-modal-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}
.leave-modal-body {
    padding: 12px 24px 20px;
}
.leave-modal-body p {
    margin: 0;
    font-size: 14px;
    color: #475569;
    line-height: 1.55;
}
.leave-modal-actions {
    display: flex;
    gap: 8px;
    padding: 16px 24px 20px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.leave-modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, opacity 0.12s;
    background: #fff;
    color: #1e293b;
    line-height: 1.4;
}
.leave-modal-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.leave-modal-btn--cancel {
    border-color: #cbd5e1;
    background: #fff;
    color: #334155;
}
.leave-modal-btn--cancel:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.leave-modal-btn--leave {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}
.leave-modal-btn--leave:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #f87171;
}
.leave-modal-btn--save {
    background: var(--brand-primary, #1B5E42);
    border-color: var(--brand-primary, #1B5E42);
    color: #fff;
}
.leave-modal-btn--save:hover:not(:disabled) {
    background: var(--brand-hover, #155237);
    border-color: var(--brand-hover, #155237);
}
.leave-modal-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .leave-modal-overlay.is-open,
    .leave-modal { animation: none; }
}
