@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Sora:wght@600;700;800&display=swap");

/* ─────────────────────────────────────────────
   Design Tokens — 8px spacing system
   ───────────────────────────────────────────── */
:root {
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;

    --bg: #eef4f7;
    --ink: #0f172a;
    --muted: #475569;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --primary: #0f766e;
    --primary-strong: #0b5f59;
    --danger: #ea580c;
    --border: rgba(15, 23, 42, 0.1);

    --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-nav: 0 -6px 22px rgba(15, 23, 42, 0.12);

    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 20px;

    /* ── Responsive grid tokens ──
       These drive every adaptive grid in the file.
       Change here → changes everywhere.            */
    --grid-action-min: 140px;
    /* action tiles: min column width  */
    --grid-stats-min: 200px;
    /* stat cards:  min column width   */
}

/* ─────────────────────────────────────────────
   Base
   ───────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

body {
    font-family: "Manrope", sans-serif;
    color: var(--ink);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    background:
        radial-gradient(circle at 10% -10%, rgba(20, 184, 166, 0.18), transparent 34%),
        radial-gradient(circle at 95% 8%, rgba(14, 165, 233, 0.14), transparent 30%),
        var(--bg);
}

.font-display {
    font-family: "Sora", sans-serif;
}

.bg-sand {
    background-color: var(--bg);
}

.text-ink {
    color: var(--ink);
}

/* ─────────────────────────────────────────────
   Minimal utility layer
   (only what Tailwind CDN may not provide)
   ───────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.w-full {
    width: 100%;
}

.min-w-0 {
    min-width: 0;
}

.text-white {
    color: #fff;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.space-y-2> :not([hidden])~ :not([hidden]) {
    margin-top: 0.5rem;
}

.space-y-3> :not([hidden])~ :not([hidden]) {
    margin-top: 0.75rem;
}

/* ── Grid display helper ──
   Classes only set `display:grid`.
   Column counts are handled by adaptive rules below,
   NOT by static grid-cols-N classes.               */
.grid {
    display: grid;
}

/* ── Legacy static grid classes — DEPRECATED ──
   Kept only for any non-layout HTML that still references them.
   Do NOT use these to control responsive columns.
   Use the adaptive grid rules in each component section. */
.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* sm: overrides — kept for HTML compatibility only */
@media (min-width: 640px) {
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sm\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .sm\:flex-row {
        flex-direction: row;
    }

    .sm\:items-center {
        align-items: center;
    }

    .sm\:items-end {
        align-items: flex-end;
    }

    .sm\:justify-between {
        justify-content: space-between;
    }
}

/* ─────────────────────────────────────────────
   Layout shell
   ───────────────────────────────────────────── */

/* main: full width available area without artificial clamping */
main {
    max-width: 100% !important;
    width: 100% !important;
    margin-inline: 0 !important;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}

/* ─────────────────────────────────────────────
   Surface / Card
   ───────────────────────────────────────────── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    padding: var(--space-4);
    box-shadow: var(--shadow-card);
    /* Prevent cards from ever overflowing their column */
    min-width: 0;
    overflow: hidden;
}

.section-title {
    font-size: 1rem;
    line-height: 1.2;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────
   Hero
   ───────────────────────────────────────────── */
.cash-hero {
    border-radius: var(--r-lg);
    background:
        radial-gradient(circle at 100% 0, rgba(255, 255, 255, 0.3), transparent 34%),
        radial-gradient(circle at 0% 100%, rgba(34, 211, 238, 0.24), transparent 34%),
        linear-gradient(120deg, #0f766e 0%, #0c9a8a 54%, #0284c7 100%);
}

.cash-hero .font-display {
    letter-spacing: -0.02em;
}

.cash-hero>div>div:last-child {
    align-self: flex-start;
    border-radius: 14px !important;
    padding: 8px 12px !important;
    font-weight: 800;
    line-height: 1;
    background: rgba(255, 255, 255, 0.24) !important;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 10px rgba(2, 6, 23, 0.16);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────
   ACTION TILES — adaptive responsive grid
   ─────────────────────────────────────────────
   Formula: auto-fit + minmax()
   • Mobile  (≤ 640px)       → 2 columns  (minmax collapses to ~50%)
   • Tablet  (641–1023px)    → 2–3 cols   (browser picks naturally)
   • Desktop (≥ 1024px)      → 4 columns  (tiles are wide enough)

   No HTML class changes required — this rule targets the
   container that wraps .action-tile elements directly.        */

/* Selector targets any grid container holding action tiles.
   Works whether the wrapper has .grid, .actions-grid, or any
   other class, because we rely on the child element pattern. */
.action-tile {
    /* Tile sizing */
    min-height: 92px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: linear-gradient(180deg, #fff 0%, #f8fbfe 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    text-align: center;
    color: #0f172a;
    font-weight: 800;
    font-size: 0.78rem;
    line-height: 1.1;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    /* Prevent overflow in tight columns */
    min-width: 0;
    overflow: hidden;
}

/* Adaptive grid for any parent that contains action tiles.
   Using :has() where supported; fallback grid is set on
   the wrapper via the data-grid="actions" attribute pattern.

   PRIMARY APPROACH — applied to every element that contains
   .action-tile children, regardless of its own class name.   */
*:has(> .action-tile) {
    display: grid;
    /* auto-fit: fills as many columns as fit; never fewer than 2.
       minmax(var(--grid-action-min), 1fr):
         - min 140px → forces 2-col on phones, 3–4 on larger screens
         - 1fr        → stretches evenly when space is available      */
    grid-template-columns: repeat(auto-fit, minmax(var(--grid-action-min), 1fr));
    gap: var(--space-3);
}

/* Clamp: guarantee exactly 2 columns on small phones so tiles
   never collapse to 1 column on very narrow viewports.        */
@media (max-width: 640px) {
    *:has(> .action-tile) {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Clamp: guarantee exactly 4 columns on desktop — prevents the
   auto-fit formula from sometimes landing on 3 at ~900px.     */
@media (min-width: 1024px) {
    *:has(> .action-tile) {
        grid-template-columns: repeat(4, 1fr);
    }
}

.action-tile span:last-child {
    display: block;
    line-height: 1.15;
    letter-spacing: 0.01em;
}

.action-tile:hover {
    transform: translateY(-1px);
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 10px 22px rgba(6, 182, 212, 0.12);
}

.action-tile:active {
    transform: scale(0.985);
}

/* ─────────────────────────────────────────────
   STATS CARDS — adaptive responsive grid
   ─────────────────────────────────────────────
   • Mobile  (≤ 640px) → 1 column (stacked, full width)
   • Tablet+ (≥ 641px) → 2 columns                       */

*:has(> .stat-card) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--grid-stats-min), 1fr));
    gap: var(--space-3);
}

/* Force single column on mobile — cards must not compress */
@media (max-width: 640px) {
    *:has(> .stat-card) {
        grid-template-columns: 1fr;
    }
}

/* Force exactly 2 columns on tablet and above */
@media (min-width: 641px) {
    *:has(> .stat-card) {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Individual card constraints */
.stat-card {
    min-width: 0;
    overflow: hidden;
}

.stat-card.with-icon {
    position: relative;
    padding-left: 56px;
}

.stat-card.with-icon .icon-wrap {
    position: absolute;
    top: 16px;
    left: 16px;
}

.stat-card .label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    opacity: 0.9;
}

.stat-card .value {
    margin-top: var(--space-2);
    font-size: 2.25rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    text-wrap: balance;
}

/* ─────────────────────────────────────────────
   Icon wrap
   ───────────────────────────────────────────── */
.icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #d1fae5;
    color: #0f766e;
    flex-shrink: 0;
}

.icon-wrap svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.icon-wrap.warning {
    background: #ffedd5;
    color: #c2410c;
}

/* ─────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────── */
.btn-primary,
.btn-secondary {
    min-height: 44px;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary {
    border: 0;
    color: #fff;
    background: linear-gradient(120deg, #0f766e 0%, #0d9488 100%);
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.28);
}

.btn-primary:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
}

.btn-out {
    background: linear-gradient(120deg, #ea580c 0%, #f97316 100%);
    box-shadow: 0 8px 18px rgba(234, 88, 12, 0.26);
}

.btn-out:hover {
    filter: brightness(0.98);
}

.btn-secondary {
    border: 1px solid #d7e0ea;
    color: #334155;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.985);
    filter: brightness(0.98);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.nav-btn:focus-visible,
.action-tile:focus-visible,
.search-input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

.btn-compact {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 0.84rem;
}

/* ─────────────────────────────────────────────
   Inputs
   ───────────────────────────────────────────── */
.field {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid #cfd8e3;
    padding: 12px 14px;
    font-size: 0.96rem;
    outline: none;
    background: #fff;
}

.field:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.17);
}

/* Search */
.search-shell {
    position: relative;
    display: block;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #64748b;
    pointer-events: none;
}

.search-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.search-input {
    width: 100%;
    min-height: 44px;
    border-radius: 14px;
    border: 1px solid #d3dde8;
    padding: 11px 12px 11px 40px;
    font-size: 0.94rem;
    color: #0f172a;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    outline: none;
}

.search-input::placeholder {
    color: #64748b;
}

.search-input:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

/* ─────────────────────────────────────────────
   Pills & entity rows
   ───────────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #dcfdf7;
    color: #0f766e;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border: 1px solid rgba(15, 118, 110, 0.16);
}

.entity-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Product card action row — stays horizontal, full touch target */
.actions-row {
    display: flex;
    flex-direction: row;
    gap: var(--space-2);
    flex-shrink: 0;
}

.actions-row .btn-compact {
    min-width: 92px;
}

/* ─────────────────────────────────────────────
   BOTTOM NAVIGATION (fixed)
   ─────────────────────────────────────────────
   The nav is fixed to the bottom. The `main` padding-bottom
   already accounts for its height. No rigid pixel hacks here. */
body>nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: 100%;
    /* env() pads below the nav on phones with a home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

body>nav>div {
    border-radius: 0 !important;
    box-shadow: var(--shadow-nav);
    border: 1px solid #d8e2ec !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
}

/* Nav inner grid — always 4 equal columns; nav items are fixed */
body>nav>div>div {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.nav-btn {
    min-height: 52px;
    border-radius: 12px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    text-align: center;
    line-height: 1;
    font-size: 0.67rem;
    font-weight: 800;
    color: #334155;
    position: relative;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    opacity: 0.9;
}

.nav-btn:hover {
    background: #f8fafc;
}

.nav-btn:active {
    transform: scale(0.985);
}

.nav-btn.is-active {
    color: #0f766e;
    background: #f0fdfa;
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
}

.nav-btn.is-active::after {
    content: "";
    position: absolute;
    left: 24%;
    right: 24%;
    bottom: 3px;
    height: 2px;
    border-radius: 999px;
    background: #0f766e;
}

/* ─────────────────────────────────────────────
   Specific elements
   ───────────────────────────────────────────── */
#generateOffersBtn {
    min-height: 44px;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.24);
}

#generateOffersBtn:disabled {
    opacity: 0.82;
    cursor: wait;
    transform: none;
    filter: none;
}

/* Logout button */
form[action$="/logout"] button {
    min-height: 44px;
    border-radius: 14px !important;
    border: 1px solid #d6deea !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    color: #334155 !important;
    font-weight: 700 !important;
    box-shadow: var(--shadow-soft);
    padding: 12px 16px !important;
}

form[action$="/logout"] button:hover {
    background: #f8fafc !important;
}

/* Modals */
#barcodeModal,
#deleteProductModal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.75);
}

#barcodeModal.flex,
#deleteProductModal.flex {
    display: flex;
}

#barcodeModal>div,
#deleteProductModal>div {
    width: 100%;
    max-width: 28rem;
}

/* Movement / history lists */
#recentMovements,
#historyList {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#recentMovements>li,
#historyList>li {
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

#recentMovements>li strong,
#historyList>li strong {
    font-size: 0.92rem;
    font-weight: 800;
}

#recentMovements>li p,
#historyList>li p {
    margin-top: 6px !important;
    color: #64748b !important;
    font-size: 0.76rem !important;
    line-height: 1.35;
}

.movement-reason {
    margin-top: 8px;
    border-top: 1px dashed #d8e2ec;
    padding-top: 8px;
    font-size: 0.74rem;
    color: #475569;
}

/* ═══════════════════════════════════════════════════════
   BREAKPOINTS
   ═══════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────
   MOBILE — max-width: 640px
   ────────────────────────────────────────────── */
@media (max-width: 640px) {

    /* Content clears the fixed nav with extra breathing room on mobile */
    main {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
        /* 102px = taller nav on mobile + extra buffer */
        padding-bottom: calc(102px + env(safe-area-inset-bottom, 0px));
    }

    /* Cards */
    .card {
        border-radius: 14px;
        padding: var(--space-3);
    }

    /* Hero */
    .cash-hero {
        border-radius: 18px;
        padding: var(--space-4) !important;
    }

    .cash-hero>div {
        gap: var(--space-3);
    }

    .cash-hero>div>div:last-child {
        align-self: flex-start;
        margin-top: 0;
    }

    /* Typography */
    .section-title {
        font-size: 0.95rem;
    }

    /* Inputs & buttons */
    .field,
    .btn-primary,
    .btn-secondary {
        min-height: 44px;
    }

    .search-input {
        min-height: 44px;
        font-size: 0.92rem;
    }

    .btn-compact {
        min-height: 40px;
        font-size: 0.8rem;
        padding: 10px;
    }

    /* Action tiles */
    .action-tile {
        min-height: 84px;
        border-radius: 14px;
        padding: 10px var(--space-2);
        font-size: 0.72rem;
        gap: 6px;
    }

    /* Icons */
    .icon-wrap {
        width: 30px;
        height: 30px;
    }

    /* Stat card */
    .stat-card.with-icon {
        padding-left: 52px;
    }

    .stat-card .value {
        font-size: 2rem;
    }

    /* Messages */
    #appMessage {
        border-radius: 12px;
        font-size: 0.84rem;
    }

    /* Product action row: stretch buttons to fill width */
    .actions-row {
        width: 100%;
        gap: var(--space-2);
    }

    .actions-row .btn-compact {
        flex: 1;
        min-width: 0;
    }

    /* Nav */
    .nav-btn {
        min-height: 54px;
        border-radius: 12px;
        padding: 6px 4px 7px;
        font-size: 0.64rem;
    }

    .nav-btn svg {
        width: 17px;
        height: 17px;
    }

    /* Active states: slightly larger scale on touch */
    .btn-primary:active,
    .btn-secondary:active,
    .action-tile:active,
    .nav-btn:active {
        transform: scale(0.98);
    }

    /* Full-width utilities */
    #generateOffersBtn {
        width: 100%;
    }

    form[action$="/logout"] button {
        width: 100%;
    }

    /* Nav pill at bottom — rounded top corners on mobile */
    body>nav>div {
        border-top-left-radius: 14px !important;
        border-top-right-radius: 14px !important;
    }
}

/* ──────────────────────────────────────────────
   TABLET — 641px – 1023px
   ────────────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1023px) {
    main {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    /* Action tiles: auto-fit naturally lands on 2–3 cols here.
       The :has rule above handles it; this is a safety clamp.  */
    *:has(> .action-tile) {
        grid-template-columns: repeat(auto-fit, minmax(var(--grid-action-min), 1fr));
    }

    .action-tile {
        font-size: 0.76rem;
    }
}

/* ──────────────────────────────────────────────
   DESKTOP — 1024px+
   ────────────────────────────────────────────── */
@media (min-width: 1024px) {
    main {
        padding-left: var(--space-5);
        padding-right: var(--space-5);
    }

    .card {
        padding: 18px;
    }

    .stat-card .value {
        font-size: 2.4rem;
    }
}

/* ──────────────────────────────────────────────
   SMALL PHONES — max-width: 380px
   Extra polish for very narrow viewports
   ────────────────────────────────────────────── */
@media (max-width: 380px) {

    /* Prevent any horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* Slightly tighter spacing */
    main {
        padding-left: var(--space-2);
        padding-right: var(--space-2);
    }

    /* Reduce font scale to maintain readability */
    .section-title {
        font-size: 0.88rem;
    }

    .action-tile {
        font-size: 0.68rem;
        min-height: 76px;
    }

    .stat-card .value {
        font-size: 1.75rem;
    }

    /* Shrink icons slightly */
    .icon-wrap {
        width: 26px;
        height: 26px;
        border-radius: 8px;
    }

    .icon-wrap svg {
        width: 13px;
        height: 13px;
    }

    /* Nav labels and icons */
    .nav-btn {
        font-size: 0.58rem;
    }

    .nav-btn svg {
        width: 15px;
        height: 15px;
    }

    /* Pill labels: allow wrap to avoid overflow */
    .pill {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    /* Buttons: minimum touch target maintained */
    .btn-compact {
        padding: 8px;
        font-size: 0.75rem;
    }
}


/* ─────────────────────────────────────────────
   Modern Commercial ERP Redesign Styles
   ───────────────────────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35);
}

.sidebar-link svg {
    color: inherit;
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ─────────────────────────────────────────────
   Dark Theme System Overrides
   ───────────────────────────────────────────── */
html.dark {
    --bg: #0b0f19;
    --ink: #f8fafc;
    --muted: #94a3b8;
    --surface: #131b2e;
    --surface-soft: #1e293b;
    --border: rgba(255, 255, 255, 0.08);
}

html.dark body {
    background:
        radial-gradient(circle at 10% -10%, rgba(20, 184, 166, 0.12), transparent 34%),
        radial-gradient(circle at 95% 8%, rgba(14, 165, 233, 0.08), transparent 30%),
        #0b0f19 !important;
    color: #f8fafc !important;
}

html.dark .card,
html.dark .stat-card,
html.dark .action-tile,
html.dark .kpi-card {
    background-color: #131b2e !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
    background-color: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

html.dark table thead th {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
    border-color: #1e293b !important;
}

html.dark table tbody td {
    border-color: #1e293b !important;
}

html.dark table tbody tr:hover {
    background-color: #1e293b/50 !important;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

@media print {
    aside, header, button, .print\:hidden {
        display: none !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
}
