/* Shared appearance, loaded after each page's original styles. */
:root { --vi-surface:#fff; --vi-raised:#f7f9fc; --vi-hover:#eef2f7; --vi-ink:#172338; --vi-line:#e2e8f0; --vi-accent:#d6a84f; }
html[data-look="ocean"] { --navy:#123c47; --navy-light:#1b515c; --gold:#28b7aa; --bg:#eef7f7; --vi-accent:#28b7aa; }
html[data-theme="dark"] { color-scheme:dark; --bg:#0e1521; --white:#182233; --text:#e5edf7; --ink:#e5edf7; --muted:#a6b5ca; --border:#334155; --green:#5cd7a9; --red:#ff9999; --vi-surface:#182233; --vi-raised:#202e42; --vi-hover:#26364e; --vi-ink:#e5edf7; --vi-line:#334155; }
html[data-theme="dark"][data-look="ocean"] { --bg:#0b1c22; --navy:#0a2a32; --navy-light:#15404a; --vi-surface:#122e36; --vi-raised:#1b3c45; --vi-hover:#244b55; --vi-line:#355b65; --border:#355b65; }
html[data-look="ocean"] .sidebar,html[data-look="ocean"] .business-sidebar { background:var(--navy); }
html[data-look="ocean"] .nav-link.active,html[data-look="ocean"] .business-nav.selected { background:var(--navy-light); color:#8eede1; border-left-color:var(--gold); }
html[data-look="ocean"] .panel,html[data-look="ocean"] .stat-card,html[data-look="ocean"] .stat { border-top:3px solid var(--gold); border-radius:18px; }
html[data-look="ocean"] .btn-primary,html[data-look="ocean"] .btn:not(.secondary):not(.btn-secondary):not(.btn-archive):not(.btn-restore) { background:var(--navy); }
html[data-theme="dark"] body,html[data-theme="dark"] .body-content { background:var(--bg); color:var(--vi-ink); }
html[data-theme="dark"] :is(.panel,.stat,.stat-card,.topbar,.date-button,.collapse-btn,.donut-inner,.vi-confirm-box,.vi-toast,.login-card,.register-card,.card) { background:var(--vi-surface); color:var(--vi-ink); border-color:var(--vi-line); }
html[data-theme="dark"] :is(.vi-toast-title,.vi-confirm-title) { color:var(--vi-ink); }
html[data-theme="dark"] a:not(.btn):not(.row-action):not(.business-nav):not(.nav-link):not(.brand) { color:#7dd3cf; }
html[data-theme="dark"][data-look="ocean"] :is(.panel,.stat,.stat-card) { border-top-color:var(--gold); }
html[data-theme="dark"] :is(input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),select,textarea) { background:var(--vi-raised); color:var(--vi-ink); border-color:var(--vi-line); }
html[data-theme="dark"] :is(input,select,textarea):focus { outline:2px solid var(--vi-accent); outline-offset:1px; }
html[data-theme="dark"] :is(.btn.secondary,.btn-secondary,.row-action,.vi-confirm-cancel) { background:var(--vi-raised); color:var(--vi-ink); border-color:var(--vi-line); }
html[data-theme="dark"] :is(table.data-grid,table.items-table,table) :is(th,td) { border-color:var(--vi-line); }
html[data-theme="dark"] table th { background:var(--vi-raised); color:#b7c7dc; }
html[data-theme="dark"] :is(table.data-grid,table.items-table) tr:hover td { background:var(--vi-hover); }
html[data-theme="dark"] :is(.invoice,.action,.breadcrumb strong,.inventory-legend strong) { color:var(--vi-ink); }
html[data-theme="dark"] .action:hover { background:var(--vi-raised); }
html[data-theme="dark"] :is(.subtitle,.help,.stat-label,.stat-foot,.stat-top,.nav-label,.footer,.count,.vi-toast-message,.vi-confirm-message) { color:var(--muted); }
html[data-theme="dark"] :is(.message.error,.row-action.danger,.btn-archive,.pill-out) { background:#492731; color:#ffc4c4; border-color:#804552; }
html[data-theme="dark"] :is(.message.success,.status,.btn-restore,.pill-good) { background:#183e35; color:#9beac7; border-color:#346b58; }
html[data-theme="dark"] :is(.report-notice,.badge,.pill-low,.notice) { background:#3e3522; color:#f5d999; }
html[data-theme="dark"] :is(.stat-icon,.action-icon,.avatar) { background:var(--vi-raised); color:var(--vi-accent); }
html[data-theme="dark"] .chart-area svg text { fill:#a6b5ca; }
html[data-theme="dark"] .chart-area svg line { stroke:#334155; }
html[data-density="compact"] :is(.business-main,.content) { padding:20px; }
html[data-density="compact"] .panel { padding:16px; margin-bottom:14px; }
html[data-density="compact"] :is(.business-nav,.nav-link) { padding-top:7px; padding-bottom:7px; }
html[data-density="compact"] :is(table.data-grid,table.items-table) :is(th,td) { padding-top:8px; padding-bottom:8px; }
html[data-density="compact"] :is(.form-grid,.stats,.charts) { gap:10px; }
.appearance-preview { display:flex; gap:12px; align-items:center; padding:16px; border:1px solid var(--vi-line); border-radius:10px; background:var(--vi-raised); margin-bottom:18px; color:var(--vi-ink); }
.appearance-swatch { width:32px; height:32px; border-radius:50%; background:var(--vi-accent); flex-shrink:0; }
@media print { html[data-theme] body,html[data-theme] :is(.panel,.stat,.stat-card,table th,table td) { background:white!important; color:black!important; } html[data-theme] { color-scheme:light; } }

/* Sky-blue outlines make light-mode form controls and row dividers visible. */
html:not([data-theme="dark"]){--vi-line:#9ed8f2}
html:not([data-theme="dark"]) :is(input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea){border-color:#65bce4}
html:not([data-theme="dark"]) :is(input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea):focus{border-color:#0284c7;outline:2px solid #bae6fd;outline-offset:1px}
html:not([data-theme="dark"]) :is(.form-grid,.input-table-row){border-color:#9ed8f2;background:#9ed8f2}
/* Light-mode data tables: visible sky-blue grid and readable column headings. */
html:not([data-theme="dark"]) table{border-collapse:collapse;border:1px solid #65bce4;color:#172338}
html:not([data-theme="dark"]) table :is(th,td){border:1px solid #8acce9}
html:not([data-theme="dark"]) table th{background:#dff3ff;color:#164e73;font-weight:700}
html:not([data-theme="dark"]) table td{color:#172338}
html:not([data-theme="dark"]) table tr:nth-child(even)>td{background:#f2faff}
html:not([data-theme="dark"]) table tr:hover>td{background:#e1f3ff}

/* Additional saved Looks; Light and Dark remain independent mode choices. */
html[data-look="navy"]{--navy:#101c30;--navy-light:#203653;--gold:#d6a84f;--bg:#eaf0f7;--white:#fff;--text:#172338;--ink:#172338;--muted:#536780;--border:#b8c8da;--vi-surface:#fff;--vi-raised:#eaf0f7;--vi-hover:#dce8f5;--vi-ink:#172338;--vi-line:#b8c8da;--vi-accent:#bd850e}
html[data-theme="dark"][data-look="navy"]{--bg:#0b1423;--navy:#060d18;--navy-light:#172b46;--white:#142139;--text:#f0f5fc;--ink:#f0f5fc;--muted:#c0cde0;--border:#526987;--vi-surface:#142139;--vi-raised:#1c2e49;--vi-hover:#263b5b;--vi-ink:#f0f5fc;--vi-line:#526987;--vi-accent:#f4c663}
html[data-look="navy"] .business-sidebar,html[data-look="navy"] .sidebar{background:var(--navy)}
html[data-look="navy"] .business-nav.selected,html[data-look="navy"] .nav-link.active{background:var(--navy-light);color:#ffe09a;border-left-color:var(--gold)}

html[data-look="soft-gray"]{--navy:#354252;--navy-light:#46566a;--gold:#a87408;--bg:#e9ebef;--white:#fafbfc;--text:#263343;--ink:#263343;--muted:#526071;--border:#aeb8c4;--vi-surface:#fafbfc;--vi-raised:#edf0f4;--vi-hover:#e1e5ea;--vi-ink:#263343;--vi-line:#aeb8c4;--vi-accent:#a87408}
html[data-theme="dark"][data-look="soft-gray"]{--navy:#202833;--navy-light:#354252;--bg:#171b21;--white:#222831;--text:#f1f3f5;--ink:#f1f3f5;--muted:#c3cbd4;--border:#626d79;--vi-surface:#222831;--vi-raised:#2c333d;--vi-hover:#38414d;--vi-ink:#f1f3f5;--vi-line:#626d79;--vi-accent:#f5cd6b}

html[data-look="high-contrast"]{--navy:#000;--navy-light:#222;--gold:#ffe000;--bg:#fff;--white:#fff;--text:#000;--ink:#000;--muted:#222;--border:#000;--vi-surface:#fff;--vi-raised:#f1f1f1;--vi-hover:#fff2a6;--vi-ink:#000;--vi-line:#000;--vi-accent:#725900}
html[data-theme="dark"][data-look="high-contrast"]{--navy:#000;--navy-light:#242424;--bg:#000;--white:#000;--text:#fff;--ink:#fff;--muted:#f0f0f0;--border:#fff;--vi-surface:#080808;--vi-raised:#171717;--vi-hover:#353535;--vi-ink:#fff;--vi-line:#fff;--vi-accent:#ffe000}
html[data-look="high-contrast"] :is(.business-nav.selected,.nav-link.active){background:var(--navy-light);color:#ffe000;border:2px solid #ffe000}
html[data-look="high-contrast"] :is(.panel,.stat,.stat-card,table,input,select,textarea,.btn,.row-action){border-color:var(--vi-line)}
html[data-look="high-contrast"] :is(.subtitle,.help,.muted,.stat-label,.stat-foot,.footer){color:var(--muted)}
html[data-look="high-contrast"] :is(table th,table td){border:1px solid var(--vi-line)}
html[data-look="high-contrast"] table th{background:var(--vi-raised);color:var(--vi-ink)}
html[data-look="high-contrast"] table tr:nth-child(even)>td{background:var(--vi-raised)}
html[data-look="high-contrast"] table tr:hover>td{background:var(--vi-hover)}

/* Make unavailable actions visibly inactive in every theme and page. */
:where(button,input[type="button"],input[type="submit"],input[type="reset"],.btn,.row-action,[role="button"]):disabled,
:where(button,input[type="button"],input[type="submit"],input[type="reset"],.btn,.row-action,[role="button"])[disabled],
a[aria-disabled="true"],a[disabled]{background:#737982!important;color:#f3f4f6!important;border-color:#626a75!important;box-shadow:none!important;filter:none!important;opacity:1!important;cursor:not-allowed!important;pointer-events:none!important}

/* Keep the last data row enclosed and separate actions that follow tables. */
html table tbody tr:last-child>td{border-bottom:1px solid var(--vi-line,#9ed8f2)}
.table-scroll+:is(.statement-detail-buttons,.form-actions,.actions),
.table-wrap+:is(.statement-detail-buttons,.form-actions,.actions){margin-top:20px}
.table-scroll+.btn,.table-wrap+.btn{margin-top:20px}
.table-wrap+p{margin-top:18px}
