/* =========================================================
   Mushker's DMS — Corporate Theme
   Neutral greys · one blue accent.  Loaded AFTER each page's own CSS
   (from includes/navigation.php, login, forgot & reset pages),
   so it restyles every page without editing its markup.
   Selectors are prefixed with `body` to out-rank page rules.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --cream:        #F4F5F7;   /* page background */
    --cream-2:      #EEF0F3;
    --cream-3:      #E3E6EB;
    --paper:        #FFFFFF;
    --ink:          #1B1F27;
    --ink-2:        #454C59;
    --ink-3:        #6B7280;
    --line:         #D9DDE3;

    --accent:       #2557D6;   /* the one accent */
    --accent-deep:  #1B44AD;
    --accent-soft:  #E8EEFC;

    --ok:           #1E7A4A;
    --ok-bg:        #E2F3E9;
    --warn:         #8A5A00;
    --warn-bg:      #FBEFD2;
    --bad:          #B3261E;
    --bad-bg:       #FBE4E1;
    --info:         #2557D6;
    --info-bg:      #E8EEFC;

    --radius:       10px;
    --radius-sm:    8px;
    --chunk:        0 1px 2px rgba(20,24,33,.06);
    --soft:         0 1px 2px rgba(20,24,33,.06), 0 4px 14px rgba(20,24,33,.05);

    --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-head:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

    --sidebar-w:    248px;
}

/* ---------- Base ---------- */

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background: var(--cream);
    background-image: radial-gradient(circle at 1px 1px, rgba(23,19,15,.055) 1px, transparent 0);
    background-size: 22px 22px;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body h1, body h2, body h3, body h4 {
    font-family: var(--font-head);
    color: var(--ink);
    letter-spacing: -.01em;
    line-height: 1.15;
}
body h1 { font-size: 2rem; font-weight: 800; }
body h2 { font-size: 1.25rem; font-weight: 700; }
body h3 { font-size: 1.05rem; font-weight: 700; }

body p { color: var(--ink-2); }

body a { color: var(--ink); text-decoration-color: var(--accent-deep); text-underline-offset: 3px; }
body a:hover { color: var(--accent-deep); }

::selection { background: var(--accent); color: var(--ink); }

body :focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Page shell (sidebar offset) ---------- */

@media (min-width: 1000px) {
    body.has-sidebar { padding-left: var(--sidebar-w); }
}

body .page-container {
    max-width: 1240px;
    padding: 32px 36px 24px;
}

body .page-header,
body .dashboard-header,
body .invoice-page-header,
body .statement-header {
    border-bottom: 0;
}

/* Page title block: friendly underline squiggle */
body .page-container > div:first-child h1,
body .page-heading h1,
body .dashboard-heading h1 {
    margin: 0 0 4px;
    position: relative;
    display: inline-block;
}
body .page-container > div:first-child h1::after,
body .page-heading h1::after,
body .dashboard-heading h1::after {
    content: "";
    display: block;
    height: 6px;
    margin-top: 2px;
    border-radius: 6px;
    background: var(--accent);
    width: 56%;
}
body .page-container > div:first-child p { margin: 6px 0 0 !important; color: var(--ink-3) !important; }

/* ---------- Cards ---------- */

body .card,
body .kpi-card,
body .status-card,
body .summary-card,
body .financial-card,
body .detail-card,
body .payment-card,
body .upload-card,
body .invoice-summary-box,
body .payment-summary-item,
body .profile-item,
body .summary-item,
body .status-box,
body .distributor-box,
body .allocation-summary {
    background: var(--paper);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: var(--chunk);
    color: var(--ink);
}

body .card { padding: 24px; margin-bottom: 26px; }

/* nested cards inside a card: flatter, lighter */
body .card .kpi-card,
body .card .status-card,
body .card .summary-card,
body .card .financial-card,
body .card .detail-card,
body .card .payment-card,
body .card .profile-item,
body .card .summary-item {
    background: var(--cream);
    border: 1.5px solid var(--cream-3);
    box-shadow: none;
}

body .kpi-card,
body .status-card,
body .summary-card,
body .financial-card {
    transition: transform .15s ease, box-shadow .15s ease;
}
body .kpi-card:hover,
body .status-card:hover,
body .summary-card:hover,
body .financial-card:hover {
    transform: translateY(-2px);
}

body .kpi-label,
body .status-label,
body .summary-label,
body .financial-label,
body .detail-label,
body .profile-label,
body .payment-summary-label {
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

body .kpi-value,
body .status-number,
body .summary-value,
body .financial-value,
body .payment-summary-value,
body .invoice-summary-value {
    font-family: var(--font-head);
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}
body .kpi-value { font-size: 1.7rem; }

/* Hero KPI (add class kpi-hero): the number that needs attention */
body .kpi-card.kpi-hero { background: var(--accent); }
body .card .kpi-card.kpi-hero { background: var(--accent-soft); border-color: var(--accent-deep); }
body .kpi-card.kpi-hero .kpi-label { color: var(--ink); opacity: .75; }

/* Progress bar (dashboard) */
.meter { margin: 6px 0 0; }
.meter-top { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; font-weight:700; color:var(--ink-2); margin-bottom:8px; }
.meter-track { height: 22px; border:1.5px solid var(--ink); border-radius:999px; background:var(--cream-2); overflow:hidden; }
.meter-fill { height:100%; background: repeating-linear-gradient(45deg, var(--accent) 0 12px, #FFC95C 12px 24px); border-right:1.5px solid var(--ink); transition: width .6s ease; }

/* ---------- Tables ---------- */

body .table-wrap,
body .invoice-history-wrapper {
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-sm);
    background: var(--paper);
    overflow-x: auto;
}

body table {
    background: var(--paper);
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}

body th,
body td {
    border: 0;
    border-bottom: 1px solid var(--cream-3);
    padding: 12px 14px;
    color: var(--ink);
    vertical-align: middle;
}

body th {
    background: var(--cream-2);
    color: var(--ink-2);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    border-bottom: 1.5px solid var(--ink);
    white-space: nowrap;
}

body tbody tr { transition: background .12s ease; }
body tbody tr:hover td { background: var(--accent-soft); }
body tbody tr:last-child td { border-bottom: 0; }

/* ---------- Buttons ---------- */

body .nav-button,
body .button,
body a.button,
body button,
body input[type="submit"],
body input[type="button"] {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 14px;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}

/* default = outlined chunky button */
body .nav-button,
body .button,
body a.button,
body .quick-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--paper);
    color: var(--ink) !important;
    border: 1.5px solid var(--ink);
    padding: 8px 16px;
    box-shadow: 0 2px 0 var(--ink);
}
body .nav-button:hover,
body .button:hover,
body a.button:hover,
body .quick-actions a:hover {
    background: var(--accent);
    color: var(--ink) !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 0 var(--ink);
}
body .nav-button:active,
body .button:active,
body .quick-actions a:active,
body button:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 var(--ink);
}

/* primary = marigold */
body button[type="submit"],
body input[type="submit"],
body .login-button,
body .primary,
body .btn-primary {
    background: var(--accent);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    padding: 9px 20px;
    box-shadow: 0 3px 0 var(--ink);
}
body button[type="submit"]:hover,
body input[type="submit"]:hover,
body .login-button:hover {
    background: #FFC24F;
    transform: translateY(-1px);
}

/* generic <button> without a class: neutral chunky */
body button:not([type="submit"]):not([class]) {
    background: var(--paper);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    padding: 8px 16px;
    box-shadow: 0 2px 0 var(--ink);
}

/* destructive actions keep a clear red signal */
body [class*="delete"]:is(button, a, input),
body button[class*="danger"],
body .danger {
    background: var(--bad-bg);
    color: var(--bad) !important;
    border: 1.5px solid var(--bad);
    box-shadow: 0 2px 0 var(--bad);
}
body [class*="delete"]:is(button, a, input):hover,
body .danger:hover {
    background: var(--bad);
    color: #fff !important;
}

body button:disabled,
body .nav-button[disabled],
body .disabled-page {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---------- Forms ---------- */

body label,
body .form-group label,
body .filter-group label,
body .field label {
    font-weight: 700;
    color: var(--ink-2);
    font-size: 13px;
}

body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
body select,
body textarea {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
    border: 1.5px solid var(--ink-3);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
body input:not([type="checkbox"]):not([type="radio"]):focus,
body select:focus,
body textarea:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 4px rgba(245,179,53,.45);
}
body input[type="checkbox"],
body input[type="radio"] { accent-color: var(--ink); width: 17px; height: 17px; }
body ::placeholder { color: var(--ink-3); opacity: .75; }

/* ---------- Status badges (class added by nav script from the text) ---------- */

body .status,
body .status-badge,
body .pdf-import-status,
body [data-status] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 11px;
    border-radius: 999px;
    border: 1.5px solid var(--ink-3);
    background: var(--cream-2);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    white-space: nowrap;
}
body [data-status]::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
}
body [data-status="paid"]    { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok); }
body [data-status="partial"] { background: var(--warn-bg); color: var(--warn); border-color: var(--accent-deep); }
body [data-status="pending"] { background: var(--bad-bg);  color: var(--bad);  border-color: var(--bad); }

/* ---------- Messages / alerts ---------- */

body .message,
body .error-message,
body .success-message,
body .info-message {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--ink);
    background: var(--accent-soft);
    color: var(--ink);
    padding: 12px 16px;
    font-weight: 600;
}
body .error-message { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
body .success-message { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

/* ---------- Pagination ---------- */

body .pagination-bar,
body .pagination-controls,
body .pagination-links,
body .invoice-pagination-buttons { gap: 8px; }

/* ---------- Sidebar ---------- */

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 9100;
    display: flex;
    flex-direction: column;
    background: var(--ink);
    color: var(--cream);
    padding: 20px 14px 16px;
    overflow-y: auto;
    border-right: 3px solid var(--accent);
}

.side-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 6px;
    box-shadow: 0 3px 0 var(--accent);
}
.side-brand img { width: 170px; height: auto; display: block; }

.side-tag {
    font-family: var(--font-head);
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    text-align: center;
    margin: 12px 0 18px;
}

.side-group {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #9D9381;
    margin: 18px 12px 6px;
}

body .side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: 12px;
    color: var(--cream);
    font-weight: 700;
    text-decoration: none;
    transition: background .12s ease, color .12s ease, transform .12s ease;
}
body .side-link svg {
    width: 20px; height: 20px; flex: 0 0 20px;
    fill: none; stroke: currentColor; stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round;
}
body .side-link:hover { background: rgba(251,247,236,.1); color: #fff; transform: translateX(2px); }
body .side-link.active {
    background: var(--accent);
    color: var(--ink);
    box-shadow: 0 3px 0 #8A5A00;
}

.side-spacer { flex: 1; min-height: 16px; }

body .side-link.logout { color: #F2B8AB; }
body .side-link.logout:hover { background: rgba(184,58,38,.25); color: #fff; }

/* Mobile top bar (hidden on desktop) */
.app-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    z-index: 9200;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: var(--ink);
    border-bottom: 3px solid var(--accent);
}
.app-topbar img { height: 34px; width: auto; background: var(--cream); border-radius: 10px; padding: 3px 8px; }
.app-topbar button {
    background: var(--accent);
    color: var(--ink);
    border: 1.5px solid var(--cream);
    border-radius: 999px;
    padding: 7px 16px;
    font-weight: 800;
    box-shadow: none;
}

.app-scrim { display: none; }

@media (max-width: 999px) {
    .app-topbar { display: flex; }
    body.has-sidebar { padding-top: 60px; }
    .app-sidebar {
        transform: translateX(-105%);
        transition: transform .22s ease;
        width: min(300px, 86vw);
        top: 60px;
        z-index: 9300;
    }
    .app-sidebar .side-brand, .app-sidebar .side-tag { display: none; }
    .app-sidebar.open { transform: none; box-shadow: 8px 0 30px rgba(0,0,0,.35); }
    .app-scrim.open {
        display: block;
        position: fixed; inset: 60px 0 0 0;
        background: rgba(23,19,15,.45);
        z-index: 9250;
    }
    body .page-container { padding: 20px 14px 16px; }
    body h1 { font-size: 1.6rem; }
    body .card { padding: 16px; border-radius: 14px; }
}

/* ---------- Footer ---------- */

body .dms-global-footer { color: var(--ink-3); }
body .dms-footer-rule { background: var(--ink); height: 2px; border-radius: 2px; }
body .dms-footer-brand strong { color: var(--ink); font-family: var(--font-head); font-size: 15px; }
body .dms-footer-brand span,
body .dms-footer-brand small,
body .dms-footer-status-item { color: var(--ink-3); }

/* ---------- Auth pages (login / forgot / reset) ---------- */

body.auth-page {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}
body .login-wrapper { max-width: 440px; }
body .logo-container { margin-bottom: 22px; }
body .logo-container img { width: 260px; max-width: 80%; }
body .login-card {
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 22px;
    box-shadow: 0 6px 0 var(--ink);
    padding: 32px 30px;
}
body .login-card h1 {
    font-size: 1.35rem;
    text-align: center;
}
body .login-card h1::after { margin-left: auto; margin-right: auto; width: 40%; }
body .form-group input { height: 46px; width: 100%; }
body .login-button { width: 100%; height: 48px; font-size: 16px; border-radius: 999px; background: var(--accent); color: var(--ink); border: 1.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
body .forgot-link { color: var(--ink-2); font-weight: 700; }

/* ---------- Print: keep documents clean ---------- */

@media print {
    .app-sidebar, .app-topbar, .app-scrim { display: none !important; }
    body.has-sidebar { padding: 0 !important; }
    body { background: #fff !important; background-image: none !important; }
    body .card, body .kpi-card { box-shadow: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------- Page-specific leftovers ---------- */

body .page-header,
body .dashboard-header,
body .invoice-page-header,
body .sticky-page-header {
    background: transparent !important;
    border: 0 !important;
    position: static !important;
    padding-top: 0 !important;
}

body input[type="file"] { font-family: var(--font-body); font-size: 14px; }
body input[type="file"]::file-selector-button,
body .pdf-upload-button {
    background: var(--accent);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    padding: 7px 16px;
    margin-right: 10px;
    font-family: var(--font-body);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--ink);
}
body .pdf-upload-button:hover,
body input[type="file"]::file-selector-button:hover { background: #FFC24F; }

body .pdf-import-box,
body .upload-box {
    background: var(--accent-soft);
    border: 1.5px dashed var(--accent-deep);
    border-radius: var(--radius-sm);
}


/* =========================================================
   Corporate overrides (flatter, quieter, one accent)
   ========================================================= */

body { background-image: none; font-size: 14.5px; }
body h1 { font-weight: 700; font-size: 1.75rem; letter-spacing: -.02em; }
body h2 { font-weight: 650; font-size: 1.1rem; }

/* plain title, no squiggle */
body .page-container > div:first-child h1::after,
body .page-heading h1::after,
body .dashboard-heading h1::after,
body .login-card h1::after { display: none; }

/* Cards: hairline border + soft shadow */
body .card,
body .kpi-card,
body .status-card,
body .summary-card,
body .financial-card,
body .detail-card,
body .payment-card,
body .upload-card,
body .invoice-summary-box,
body .payment-summary-item,
body .profile-item,
body .summary-item,
body .status-box,
body .distributor-box,
body .allocation-summary {
    border: 1px solid var(--line);
    box-shadow: var(--soft);
}
body .card .kpi-card, body .card .status-card, body .card .summary-card,
body .card .financial-card, body .card .detail-card, body .card .payment-card,
body .card .profile-item, body .card .summary-item {
    background: var(--cream);
    border: 1px solid var(--cream-3);
    box-shadow: none;
}
body .kpi-card:hover, body .status-card:hover,
body .summary-card:hover, body .financial-card:hover { transform: none; }

body .kpi-label, body .status-label, body .summary-label, body .financial-label,
body .detail-label, body .profile-label, body .payment-summary-label {
    font-weight: 600; letter-spacing: .04em;
}
body .kpi-value, body .status-number, body .summary-value, body .financial-value,
body .payment-summary-value, body .invoice-summary-value { font-weight: 700; letter-spacing: -.02em; }

/* Hero KPI = accent tint with a left bar */
body .kpi-card.kpi-hero,
body .card .kpi-card.kpi-hero {
    background: var(--accent-soft);
    border: 1px solid #C9D6F7;
    border-left: 4px solid var(--accent);
}
body .kpi-card.kpi-hero .kpi-value { color: var(--accent-deep); }

/* Tables */
body .table-wrap, body .invoice-history-wrapper { border: 1px solid var(--line); box-shadow: var(--soft); }
body th { background: var(--cream); border-bottom: 1px solid var(--line); font-weight: 600; letter-spacing: .05em; }
body tbody tr:hover td { background: #F7F9FD; }

/* Buttons: rectangular, flat */
body .nav-button, body .button, body a.button, body .quick-actions a,
body button:not([type="submit"]):not([class]) {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 2px rgba(20,24,33,.06);
    background: var(--paper);
    color: var(--ink) !important;
    font-weight: 600;
    padding: 8px 15px;
}
body .nav-button:hover, body .button:hover, body a.button:hover, body .quick-actions a:hover {
    background: var(--cream);
    border-color: var(--ink-3);
    color: var(--ink) !important;
    transform: none;
    box-shadow: 0 1px 2px rgba(20,24,33,.1);
}
body .nav-button:active, body .button:active, body .quick-actions a:active, body button:active {
    transform: none; box-shadow: none;
}

body button[type="submit"], body input[type="submit"], body .login-button, body .primary, body .btn-primary {
    background: var(--accent);
    color: #fff !important;
    border: 1px solid var(--accent-deep);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 2px rgba(20,24,33,.15);
    font-weight: 600;
    padding: 9px 20px;
}
body button[type="submit"]:hover, body input[type="submit"]:hover, body .login-button:hover {
    background: var(--accent-deep); transform: none;
}
body [class*="delete"]:is(button, a, input), body button[class*="danger"], body .danger {
    box-shadow: none; border-radius: var(--radius-sm);
}

/* Inputs */
body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
body select, body textarea { border: 1px solid #B9BFC9; border-radius: var(--radius-sm); }
body input:not([type="checkbox"]):not([type="radio"]):focus, body select:focus, body textarea:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,87,214,.18);
}
body input[type="checkbox"], body input[type="radio"] { accent-color: var(--accent); }
body :focus-visible { outline: 2px solid var(--accent); }
::selection { background: #C9D6F7; color: var(--ink); }

body input[type="file"]::file-selector-button, body .pdf-upload-button {
    background: var(--paper); color: var(--ink); border: 1px solid var(--line);
    border-radius: var(--radius-sm); box-shadow: none; font-weight: 600;
}
body .pdf-upload-button:hover, body input[type="file"]::file-selector-button:hover { background: var(--cream); }
body .pdf-import-box, body .upload-box { background: var(--cream); border: 1px dashed #B9BFC9; }

/* Badges */
body [data-status="partial"] { border-color: #E0B65A; }
body .status, body .status-badge, body .pdf-import-status, body [data-status] { border-width: 1px; font-weight: 600; }

/* Messages */
body .message, body .error-message, body .success-message, body .info-message { border-width: 1px; background: var(--accent-soft); border-color: #C9D6F7; font-weight: 500; }
body .error-message { background: var(--bad-bg); border-color: #F0B8B2; }
body .success-message { background: var(--ok-bg); border-color: #A9D8BC; }

/* Progress meter */
.meter-track { height: 10px; border: 0; background: var(--cream-3); }
.meter-fill { background: var(--accent); border-right: 0; border-radius: 999px; }

/* Sidebar: light, quiet */
.app-sidebar { background: var(--paper); color: var(--ink); border-right: 1px solid var(--line); }
.side-brand { background: transparent; box-shadow: none; padding: 6px 8px; justify-content: flex-start; }
.side-brand img { width: 128px; }
.side-tag { color: var(--ink-3); text-align: left; margin: 2px 10px 12px; letter-spacing: .1em; font-family: var(--font-body); font-weight: 600; }
.side-group { color: var(--ink-3); font-weight: 600; letter-spacing: .1em; }
body .side-link { color: var(--ink-2); font-weight: 600; border-radius: var(--radius-sm); padding: 9px 12px; }
body .side-link:hover { background: var(--cream-2); color: var(--ink); transform: none; }
body .side-link.active { background: var(--accent-soft); color: var(--accent-deep); box-shadow: inset 3px 0 0 var(--accent); }
body .side-link.logout { color: var(--bad); }
body .side-link.logout:hover { background: var(--bad-bg); color: var(--bad); }

.app-topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.app-topbar img { background: transparent; padding: 0; height: 30px; }
.app-topbar button { background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm); font-weight: 600; }
@media (max-width: 999px) {
    .app-sidebar { border-top: 1px solid var(--line); }
    .app-sidebar.open { box-shadow: 8px 0 24px rgba(20,24,33,.18); }
}

/* Footer */
body .dms-footer-rule { height: 1px; background: var(--line); }
body .dms-footer-brand strong { font-family: var(--font-body); font-weight: 600; font-size: 13px; }

/* Auth */
body.auth-page { background: var(--cream); }
body .login-card { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20,24,33,.08); }
body .login-card h1 { font-size: 1.2rem; }
body .login-button { border-radius: var(--radius-sm); box-shadow: 0 1px 2px rgba(20,24,33,.15); background: var(--accent); color: #fff; border: 1px solid var(--accent-deep); }
body .forgot-link { color: var(--accent); font-weight: 600; }


/* ---------- Inline POST actions (delete / toggle buttons in tables) ---------- */
.inline-action { display: inline-flex; margin: 0; }
body .inline-action button.nav-button {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 2px rgba(20,24,33,.06);
    font-weight: 600;
    padding: 8px 15px;
}
body .inline-action button.nav-button:hover { background: var(--cream); border-color: var(--ink-3); }
body .inline-action button.nav-danger { color: var(--bad); }
body .inline-action button.nav-danger:hover { background: var(--bad-bg); border-color: var(--bad); }

body .nav-button.nav-danger { color: var(--bad) !important; }
body .nav-button.nav-danger:hover { background: var(--bad-bg); border-color: var(--bad); }


/* =========================================================
   DARK THEME  (html[data-theme="dark"])
   Switched from the sidebar / top bar; remembered in the browser
   and defaults to the device setting. Screen only: printouts and
   PDFs always stay light.
   ========================================================= */

/* ---------- Theme toggle (both themes) ---------- */

body img.logo-on-dark { display: none; }

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 2px 0 6px;
    padding: 9px 12px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
.theme-toggle:hover { background: var(--cream-2); color: var(--ink); }
.theme-toggle svg {
    width: 20px; height: 20px; flex: 0 0 20px;
    fill: none; stroke: currentColor; stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round;
}
.theme-toggle .tt-sun { display: none; }
.tt-switch {
    margin-left: auto;
    position: relative;
    width: 36px; height: 20px;
    border-radius: 999px;
    background: var(--cream-3);
    border: 1px solid var(--line);
    transition: background .15s ease;
    flex: 0 0 36px;
}
.tt-switch::after {
    content: "";
    position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--paper);
    box-shadow: 0 1px 2px rgba(0,0,0,.3);
    transition: transform .15s ease;
}

/* compact icon button in the mobile top bar */
.app-topbar .actions { display: flex; align-items: center; gap: 8px; }
.app-topbar .theme-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; padding: 0;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
    cursor: pointer;
}
.app-topbar .theme-icon svg {
    width: 19px; height: 19px;
    fill: none; stroke: currentColor; stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round;
}
.app-topbar .theme-icon .tt-sun { display: none; }

@media screen {

html[data-theme="dark"] {
    color-scheme: dark;

    --cream:        #0E1116;
    --cream-2:      #1A1F27;
    --cream-3:      #2A303B;
    --paper:        #161B22;
    --ink:          #E8EBF1;
    --ink-2:        #B7BECB;
    --ink-3:        #8A94A5;
    --line:         #2C333F;

    --accent:       #3F6FE8;
    --accent-deep:  #86A9FF;     /* used for accent-coloured text */
    --accent-soft:  #16264D;

    --ok:           #5FD09A;  --ok-bg:   #123324;
    --warn:         #F2C265;  --warn-bg: #3A2D0D;
    --bad:          #FF8F86;  --bad-bg:  #3C1814;
    --info:         #86A9FF;  --info-bg: #16264D;

    --soft:         0 1px 2px rgba(0,0,0,.45), 0 6px 18px rgba(0,0,0,.28);
}

html[data-theme="dark"] body { background: var(--cream); color: var(--ink); }

/* toggle shows the sun while dark is active */
html[data-theme="dark"] .theme-toggle .tt-moon,
html[data-theme="dark"] .app-topbar .theme-icon .tt-moon { display: none; }
html[data-theme="dark"] .theme-toggle .tt-sun,
html[data-theme="dark"] .app-topbar .theme-icon .tt-sun { display: block; }
html[data-theme="dark"] .tt-switch { background: var(--accent); border-color: var(--accent); }
html[data-theme="dark"] .tt-switch::after { transform: translateX(16px); background: #fff; }

/* logo */
html[data-theme="dark"] body img.logo-on-light { display: none; }
html[data-theme="dark"] body img.logo-on-dark  { display: block; }

/* things the corporate theme hard-coded in light colours */
html[data-theme="dark"] ::selection { background: #2B4A9A; color: #fff; }
html[data-theme="dark"] body tbody tr:hover td { background: #1C2230; }
html[data-theme="dark"] body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
html[data-theme="dark"] body select,
html[data-theme="dark"] body textarea { border-color: #3A4250; background: var(--cream); color: var(--ink); }
html[data-theme="dark"] body input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] body select:focus,
html[data-theme="dark"] body textarea:focus { border-color: var(--accent-deep); box-shadow: 0 0 0 3px rgba(91,140,255,.30); }
html[data-theme="dark"] body ::placeholder { color: var(--ink-3); opacity: .8; }
html[data-theme="dark"] body option { background: var(--paper); color: var(--ink); }

html[data-theme="dark"] body .kpi-card.kpi-hero,
html[data-theme="dark"] body .card .kpi-card.kpi-hero { background: var(--accent-soft); border-color: #2E4A8F; border-left-color: var(--accent); }
html[data-theme="dark"] body .kpi-card.kpi-hero .kpi-value { color: #A9C2FF; }

html[data-theme="dark"] body .message,
html[data-theme="dark"] body .info-message { background: var(--accent-soft); border-color: #2E4A8F; color: var(--ink); }
html[data-theme="dark"] body .error-message { background: var(--bad-bg); border-color: #7A332B; color: var(--bad); }
html[data-theme="dark"] body .success-message { background: var(--ok-bg); border-color: #24694A; color: var(--ok); }

html[data-theme="dark"] body [data-status="partial"] { border-color: #8A6A22; }
html[data-theme="dark"] body [data-status="paid"]    { border-color: #24694A; }
html[data-theme="dark"] body [data-status="pending"] { border-color: #7A332B; }

html[data-theme="dark"] body button[type="submit"],
html[data-theme="dark"] body input[type="submit"],
html[data-theme="dark"] body .login-button { border-color: var(--accent); color: #fff !important; }
html[data-theme="dark"] body button[type="submit"]:hover,
html[data-theme="dark"] body input[type="submit"]:hover,
html[data-theme="dark"] body .login-button:hover { background: #5483F0; }

html[data-theme="dark"] body .nav-button,
html[data-theme="dark"] body .button,
html[data-theme="dark"] body a.button,
html[data-theme="dark"] body .quick-actions a { box-shadow: none; }
html[data-theme="dark"] body .nav-button:hover,
html[data-theme="dark"] body .button:hover,
html[data-theme="dark"] body .quick-actions a:hover { background: var(--cream-2); border-color: var(--ink-3); }
html[data-theme="dark"] body .nav-button.nav-danger:hover,
html[data-theme="dark"] body .inline-action button.nav-danger:hover { background: var(--bad-bg); border-color: var(--bad); }

html[data-theme="dark"] body input[type="file"]::file-selector-button,
html[data-theme="dark"] body .pdf-upload-button { background: var(--cream-2); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] body .pdf-import-box,
html[data-theme="dark"] body .upload-box { background: var(--cream-2); border-color: #3A4250; }

html[data-theme="dark"] .app-sidebar { box-shadow: none; }
html[data-theme="dark"] .app-topbar .theme-icon:hover { background: var(--cream-2); }
html[data-theme="dark"] body .login-card { box-shadow: 0 10px 30px rgba(0,0,0,.5); }
html[data-theme="dark"] .meter-track { background: var(--cream-3); }
html[data-theme="dark"] body .table-wrap,
html[data-theme="dark"] body .invoice-history-wrapper { box-shadow: none; }

/* inline style="color:#666" attributes used on some pages */
html[data-theme="dark"] [style*="color:#555"], html[data-theme="dark"] [style*="color: #555"] { color: var(--ink-2) !important; }
html[data-theme="dark"] [style*="color:#666"], html[data-theme="dark"] [style*="color: #666"],
html[data-theme="dark"] [style*="color:#777"], html[data-theme="dark"] [style*="color: #777"],
html[data-theme="dark"] [style*="color:#999"], html[data-theme="dark"] [style*="color: #999"] { color: var(--ink-3) !important; }
html[data-theme="dark"] [style*="color:#222"], html[data-theme="dark"] [style*="color: #222"],
html[data-theme="dark"] [style*="color:#000"], html[data-theme="dark"] [style*="color: #000"] { color: var(--ink) !important; }
html[data-theme="dark"] [style*="color:#b00020"], html[data-theme="dark"] [style*="color: #b00020"] { color: var(--bad) !important; }
html[data-theme="dark"] [style*="background:#fff"], html[data-theme="dark"] [style*="background: #fff"] { background: var(--paper) !important; }

/* ---- AUTO-GENERATED from the pages' own inline CSS: dark equivalents of their hard-coded colours ---- */
html[data-theme="dark"] .dashboard-heading p { color:var(--ink-2); }
html[data-theme="dark"] .kpi-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .kpi-label { color:var(--ink); color:var(--ink-2); }
html[data-theme="dark"] .kpi-value { color:var(--ink); }
html[data-theme="dark"] .status-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .status-label { color:var(--ink-2); color:var(--ink-3); }
html[data-theme="dark"] .status { border:1px solid var(--ink-3); background:var(--paper); color:var(--ink); }
html[data-theme="dark"] .page-heading p { color:var(--ink-2); }
html[data-theme="dark"] .detail-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .detail-row { border-bottom:1px solid var(--line); }
html[data-theme="dark"] .detail-label { color:var(--ink-3); }
html[data-theme="dark"] .status-badge { border:1px solid var(--ink-3); }
html[data-theme="dark"] .financial-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .financial-label { color:var(--ink-2); }
html[data-theme="dark"] .financial-value { color:var(--ink); }
html[data-theme="dark"] .invoice-status-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .invoice-status-label { color:var(--ink-2); }
html[data-theme="dark"] .retailer-city { color:var(--ink-3); }
html[data-theme="dark"] .empty-message { color:var(--ink-3); }
html[data-theme="dark"] .statement-subtitle { color:var(--ink-3); }
html[data-theme="dark"] .info-item { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .info-label { color:var(--ink-3); }
html[data-theme="dark"] .summary-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .summary-label { color:var(--ink-3); }
html[data-theme="dark"] .payment-details small { color:var(--ink-3); }
html[data-theme="dark"] .severity-critical { background:var(--bad-bg); color:var(--bad); }
html[data-theme="dark"] .severity-warning { background:var(--warn-bg); color:var(--warn); }
html[data-theme="dark"] .severity-info { background:var(--cream-3); color:var(--ink); }
html[data-theme="dark"] .filter-button.active { background:var(--accent); }
html[data-theme="dark"] .forgot-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .form-group input { background:var(--paper); color:var(--ink); border:1px solid var(--ink-3); }
html[data-theme="dark"] .form-group input:focus { border-color:var(--ink-3); }
html[data-theme="dark"] .message { background:var(--cream-2); border:1px solid var(--ink-3); }
html[data-theme="dark"] .error { background:var(--cream-2); border:1px solid var(--ink-3); }
html[data-theme="dark"] .back-link { color:var(--ink); }
html[data-theme="dark"] .upload-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .upload-box { background:var(--cream-2); border:2px dashed var(--ink-3); }
html[data-theme="dark"] .status-box.info { background:var(--cream-2); border:1px solid var(--line); }
html[data-theme="dark"] .status-box.success { background:var(--ok-bg); border:1px solid var(--ok); }
html[data-theme="dark"] .status-box.error { background:var(--bad-bg); border:1px solid var(--bad); }
html[data-theme="dark"] .summary-item { background:var(--cream-2); border:1px solid var(--line); }
html[data-theme="dark"] .bulk-table { background:var(--paper); }
html[data-theme="dark"] .bulk-table th { border:1px solid var(--line); background:var(--cream-2); }
html[data-theme="dark"] .bulk-table td { border:1px solid var(--line); }
html[data-theme="dark"] .file-name { color:var(--ink-2); }
html[data-theme="dark"] .status-ready { background:var(--ok-bg); border:1px solid var(--ok); }
html[data-theme="dark"] .status-warning { background:var(--warn-bg); }
html[data-theme="dark"] .status-error { background:var(--bad-bg); border:1px solid var(--bad); }
html[data-theme="dark"] .status-duplicate { background:var(--bad-bg); border:1px solid var(--bad); }
html[data-theme="dark"] .bulk-table tr.row-ready { background:var(--paper); }
html[data-theme="dark"] .bulk-table tr.row-warning { background:var(--warn-bg); }
html[data-theme="dark"] .bulk-table tr.row-error { background:var(--bad-bg); }
html[data-theme="dark"] .bulk-table tr.row-duplicate { background:var(--bad-bg); }
html[data-theme="dark"] .import-button { background:var(--accent); border:1px solid var(--ink-3); }
html[data-theme="dark"] .secondary-button { background:var(--paper); color:var(--ink); border:1px solid var(--ink-3); }
html[data-theme="dark"] .small-note { color:var(--ink-3); }
html[data-theme="dark"] .invoice-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .payment-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .info-box { border:1px solid var(--line); }
html[data-theme="dark"] .info-row { border-bottom:1px solid var(--line); }
html[data-theme="dark"] .summary-box { border:1px solid var(--line); }
html[data-theme="dark"] .summary-row { border-bottom:1px solid var(--line); }
html[data-theme="dark"] .payment-summary-item { border:1px solid var(--line); }
html[data-theme="dark"] .invoice-page-header { background:var(--cream-2); border-bottom:1px solid var(--line); }
html[data-theme="dark"] .invoice-summary-box { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .invoice-help { color:var(--ink-3); }
html[data-theme="dark"] .pdf-import-box { background:var(--cream-2); border:1px solid var(--line); }
html[data-theme="dark"] .pdf-import-description { color:var(--ink-3); }
html[data-theme="dark"] .pdf-import-status.info { background:var(--cream-2); border:1px solid var(--line); }
html[data-theme="dark"] .pdf-import-status.success { background:var(--ok-bg); }
html[data-theme="dark"] .pdf-import-status.error { background:var(--bad-bg); }
html[data-theme="dark"] .pdf-import-table { background:var(--paper); }
html[data-theme="dark"] .pdf-import-table
th { border:1px solid var(--line); background:var(--cream-2); }
html[data-theme="dark"] .pdf-import-table
td { border:1px solid var(--line); }
html[data-theme="dark"] .pdf-row-ready { background:var(--ok-bg); }
html[data-theme="dark"] .pdf-row-warning { background:var(--warn-bg); }
html[data-theme="dark"] .pdf-row-error { background:var(--bad-bg); }
html[data-theme="dark"] .pdf-import-primary { background:var(--accent); }
html[data-theme="dark"] .invoice-pagination { border-top:1px solid var(--line); }
html[data-theme="dark"] .invoice-pagination-buttons .pagination-current { background:var(--accent); }
html[data-theme="dark"] .pdf-upload-control { background:var(--paper); border:1px solid var(--ink-3); }
html[data-theme="dark"] .pdf-upload-selection { background:var(--paper); color:var(--ink); }
html[data-theme="dark"] .pdf-clear-button { background:var(--paper); color:var(--ink); border:1px solid var(--ink-3); }
html[data-theme="dark"] .pdf-clear-button:hover { background:var(--accent); }
html[data-theme="dark"] .bulk-delete-toolbar { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .bulk-delete-submit { background:var(--paper); color:var(--ink); }
html[data-theme="dark"] .bulk-delete-submit:hover:not(:disabled) { background:var(--accent); }
html[data-theme="dark"] .login-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .login-card h1 { color:var(--ink); }
html[data-theme="dark"] .error-message { background:var(--cream-2); border:1px solid var(--ink-3); }
html[data-theme="dark"] .forgot-link { color:var(--ink); }
html[data-theme="dark"] .page-header p { color:var(--ink-2); }
html[data-theme="dark"] .allocation-summary-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .allocation-summary-label { color:var(--ink-3); }
html[data-theme="dark"] .allocation-summary-value.unallocated { color:var(--bad); }
html[data-theme="dark"] .allocation-input:disabled { background:var(--cream-2); color:var(--ink-3); }
html[data-theme="dark"] .allocation-method:disabled { background:var(--cream-2); color:var(--ink-3); }
html[data-theme="dark"] .allocation-reference:disabled { background:var(--cream-2); color:var(--ink-3); }
html[data-theme="dark"] .allocation-total-row td { background:var(--cream-2); }
html[data-theme="dark"] .allocation-warning { color:var(--bad); }
html[data-theme="dark"] .allocation-info { color:var(--ink-2); }
html[data-theme="dark"] .allocation-success { background:var(--cream-2); border:1px solid var(--ink-3); }
html[data-theme="dark"] .allocation-error { background:var(--paper); color:var(--bad); border:1px solid var(--ink-3); }
html[data-theme="dark"] .override-invoice-link { background:var(--paper); color:var(--ink); }
html[data-theme="dark"] .override-invoice-link:hover { background:var(--accent); }
html[data-theme="dark"] .override-invoice-link:focus-visible { background:var(--accent); }
html[data-theme="dark"] .pagination-links a { background:var(--paper); color:var(--ink); border:1px solid var(--line); }
html[data-theme="dark"] .pagination-links span { background:var(--paper); color:var(--ink); border:1px solid var(--line); }
html[data-theme="dark"] .pagination-links .disabled-page { background:var(--cream-2); color:var(--ink-3); }
html[data-theme="dark"] .reset-card { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .kpi-detail { color:var(--ink-3); }
html[data-theme="dark"] .table-wrap td small { color:var(--ink-3); }
html[data-theme="dark"] .bulk-bar { background:var(--cream-2); border:1px solid var(--line); }
html[data-theme="dark"] .hint { color:var(--ink-2); }
html[data-theme="dark"] .payment-status { color:var(--ink); }
html[data-theme="dark"] .portal-action-button { background:var(--paper); color:var(--ink); border:1px solid var(--ink-3); }
html[data-theme="dark"] .portal-action-button:hover { background:var(--accent); }
html[data-theme="dark"] .alert { border:1px solid var(--line); }
html[data-theme="dark"] .alert-success { background:var(--ok-bg); color:var(--ok); border-color:var(--ok); }
html[data-theme="dark"] .alert-error { background:var(--bad-bg); color:var(--bad); border-color:var(--bad); }
html[data-theme="dark"] .alert-warning { background:var(--warn-bg); color:var(--warn); border-color:var(--warn); }
html[data-theme="dark"] .profile-item { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .profile-label { color:var(--ink-3); }
html[data-theme="dark"] .profile-value { color:var(--ink); }
html[data-theme="dark"] .financial-card .label { color:var(--ink-3); }
html[data-theme="dark"] .financial-card .value { color:var(--ink); }
html[data-theme="dark"] .status-card .label { color:var(--ink-3); }
html[data-theme="dark"] .retailer-status-stack small { color:var(--ink-3); }
html[data-theme="dark"] .distributor-box { background:var(--paper); border:1px solid var(--line); }
html[data-theme="dark"] .distributor-meta { color:var(--ink-3); }
html[data-theme="dark"] .field-help { color:var(--ink-3); }
html[data-theme="dark"] .pagination-controls a { background:var(--paper); color:var(--ink); border:1px solid var(--line); }
html[data-theme="dark"] .pagination-controls span { background:var(--paper); color:var(--ink); border:1px solid var(--line); }
html[data-theme="dark"] .pagination-controls .current-page { border-color:var(--bad); }
html[data-theme="dark"] .pagination-controls .disabled { background:var(--cream-2); color:var(--ink-3); }
html[data-theme="dark"] .pagination-size select { border:1px solid var(--line); }


html[data-theme="dark"] [style*="background:#f5f5f5"], html[data-theme="dark"] [style*="background: #f5f5f5"],
html[data-theme="dark"] [style*="background:#fafafa"], html[data-theme="dark"] [style*="background: #fafafa"] { background: var(--cream-2) !important; border-color: var(--line) !important; }
html[data-theme="dark"] body input[type="file"] { background: var(--cream); color: var(--ink); border-color: #3A4250; }
html[data-theme="dark"] body .btn-success,
html[data-theme="dark"] body .btn-primary { color: #fff !important; }

/* inline-styled message boxes whose colours are set in the page markup (e.g. invoice import result) */
html[data-theme="dark"] [style*="#edf8ed"] { background: var(--ok-bg) !important; border-color: #24694A !important; color: var(--ok) !important; }
html[data-theme="dark"] [style*="#fff0f0"] { background: var(--bad-bg) !important; border-color: #7A332B !important; color: var(--bad) !important; }
html[data-theme="dark"] [style*="#fff8e8"] { background: var(--warn-bg) !important; border-color: #8A6A22 !important; color: var(--ink) !important; }

/* bulk "Delete selected" button (the page forces a white button with !important) */
html[data-theme="dark"] body button[type="submit"].bulk-delete-submit { background: var(--bad-bg) !important; color: var(--bad) !important; border-color: var(--bad) !important; }
html[data-theme="dark"] body button[type="submit"].bulk-delete-submit:hover:not(:disabled) { background: var(--bad) !important; color: #fff !important; }
} /* end @media screen */


/* ---------- Page-specific buttons that used their own black/white style ---------- */

body .btn,
body .page-container .btn,
body .portal-action-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--paper);
    color: var(--ink) !important;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 15px;
    font-family: var(--font-body);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(20,24,33,.06);
    text-decoration: none !important;
}
body .btn:hover,
body .page-container .btn:hover,
body .portal-action-button:hover {
    background: var(--cream);
    border-color: var(--ink-3);
    color: var(--ink) !important;
}

/* Keep the shell's own buttons immune to page-level "button { ... }" rules */
body button.theme-toggle {
    display: flex;
    width: 100%;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--ink-2);
    font: inherit;
    font-weight: 600;
}
body button.theme-toggle:hover { background: var(--cream-2); color: var(--ink); }
body .app-topbar button.theme-icon {
    display: inline-flex;
    width: 38px; height: 38px; padding: 0;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink) !important;
    box-shadow: none;
}
body .app-topbar button#navToggle {
    background: var(--accent);
    color: #fff !important;
    border: 0;
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 8px 14px;
    box-shadow: none;
}


/* ---------- Mobile top-bar logo: never clip the artwork ---------- */
body .app-topbar img {
    height: 34px;
    width: auto;
    max-width: 60vw;
    padding: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    overflow: visible;
}


/* ---------- Sidebar: keep every menu label on ONE line (same font size) ---------- */
:root { --sidebar-w: 272px; }
body .side-link { white-space: nowrap; }
.app-sidebar { overflow-x: hidden; }

/* ---------- Bulk "Delete selected" button (invoices): visible in light mode too ---------- */
body button[type="submit"].bulk-delete-submit {
    background: var(--bad-bg) !important;
    color: var(--bad) !important;
    border: 1px solid var(--bad) !important;
    border-radius: var(--radius-sm);
    box-shadow: none;
}
body button[type="submit"].bulk-delete-submit:hover:not(:disabled) {
    background: var(--bad) !important;
    color: #fff !important;
}
