/* ============================================================
   SELANIM HOSPITAL PRO — Fonti za chapa
   Inter (maandishi) na Poppins (vichwa), zikiwa ndani ya mfumo.
   Hakuna CDN: mfumo unafanya kazi bila intaneti.
   Inter ni variable (wght 100-900) — faili moja, uzito wote.
   ============================================================ */

@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-var.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   SELANIM HOSPITAL PRO — Tokens za rangi / Colour tokens
   Hakuna rangi ya moja kwa moja kwenye CSS ya moduli.
   ============================================================ */

:root {
    /* Nyuso */
    --bg:            #f7f8fa;
    --surface:       #ffffff;
    --surface-2:     #fafbfc;
    --surface-3:     #eff1f5;
    --overlay:       rgba(18, 20, 28, .48);

    /* Maandishi */
    --text:          #12141c;
    --text-muted:    #5c6373;
    --text-faint:    #8a90a0;
    --text-invert:   #ffffff;

    /* Mipaka */
    --border:        #e4e7ed;
    --border-strong: #cbd2de;

    /* Chapa */
    --brand:         #8f6a05;
    --brand-hover:   #745604;
    --brand-soft:    #fdf7e7;
    --brand-text:    #ffffff;


    /* Gold ya Selanim — accent adimu (10% ya uwiano 60/30/10).
       HAITUMIKI kama mandharinyuma ya maandishi marefu: gold kwenye nyeupe
       ni 1.8:1. Maandishi ya gold kwenye mwanga ni --brand (Deep Amber, 4.9:1). */
    --accent:        #f0b91b;
    --accent-strong: #c8930a;
    --accent-soft:   #fdf7e7;
    --accent-ink:    #12141c;

    /* Hali */
    --danger:        #d93636;
    --danger-soft:   #fdecea;
    --warning:       #c8930a;
    --warning-soft:  #fdf7e7;
    --success:       #1f9d55;
    --success-soft:  #e9f6ee;
    --info:          #1b5a99;
    --info-soft:     #eaf2fa;
    --purple:        #6b3fa0;
    --purple-soft:   #f2ecfa;
    --grey:          #5c6373;
    --grey-soft:     #eff1f5;

    /* Vivuli na mviringo */
    --shadow:        0 1px 3px rgba(18, 20, 28, .08);
    --shadow-md:     0 4px 12px rgba(18, 20, 28, .10);
    --shadow-lg:     0 12px 32px rgba(18, 20, 28, .16);
    --radius:        8px;
    --radius-sm:     5px;
    --radius-lg:     14px;

    /* Mwinuko uliopangwa / elevation */
    --elev-1:        0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
    --elev-2:        0 2px 4px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .08);
    --elev-3:        0 8px 16px rgba(16, 24, 40, .08), 0 16px 32px rgba(16, 24, 40, .12);
    --radius-xs:     4px;
    --radius-xl:     20px;
    --radius-full:   999px;

    /* Focus inayoonekana */
    --focus-ring:    0 0 0 3px rgba(240, 185, 27, .45);

    /* Mwendo */
    --t-fast:        .12s ease;
    --t:             .18s ease;
    --t-slow:        .28s cubic-bezier(.2, .8, .2, 1);

    /* Nafasi — kipimo kimoja kwa mfumo mzima. Hakuna rem ngumu kwenye moduli. */
    --space-1:       .25rem;   /*  4px */
    --space-2:       .5rem;    /*  8px */
    --space-3:       .75rem;   /* 12px */
    --space-4:       1rem;     /* 16px */
    --space-5:       1.5rem;   /* 24px */
    --space-6:       2rem;     /* 32px */
    --space-7:       3rem;     /* 48px */

    /* Nafasi */
    --sidebar-w:     248px;
    --sidebar-full:  248px;
    --sidebar-rail:  72px;
    --topbar-h:      56px;

    /* Msongamano / density */
    --row-h:         42px;
    --pad-cell:      .55rem .75rem;
    --font-ui:       14px;
    --font-family:   'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display:  'Poppins', 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Maandishi juu ya rangi imara (danger, success) — nyeupe hali zote */
    --on-solid:      #ffffff;
    /* Mandharinyuma ya hakikisho la logo ya usiku */
    --preview-dark:  #12141c;

    /* Chati (zinasoma tokens zile zile) */
    --chart-1: #c8930a;  --chart-2: #1b5a99;  --chart-3: #8f6a05;
    --chart-4: #5c6373;  --chart-5: #d93636;  --chart-6: #1f9d55;
    --chart-grid: #e4e7ed;
}

/* ---------- Dark: mweusi laini, si #000 ---------- */

:root[data-theme="dark"] {
    --bg:            #12141c;
    --surface:       #1b1e2a;
    --surface-2:     #212532;
    --surface-3:     #272b3a;
    --overlay:       rgba(0, 0, 0, .62);

    --text:          #e8eaf0;
    --text-muted:    #9aa0b0;
    --text-faint:    #6f7688;
    --text-invert:   #12141c;

    --border:        #2b3040;
    --border-strong: #3a4054;

    --brand:         #f0b91b;
    --brand-hover:   #f7d362;
    --brand-soft:    #2e2612;
    --brand-text:    #12141c;

    --accent:        #f0b91b;
    --accent-strong: #f7d362;
    --accent-soft:   #2e2612;
    --accent-ink:    #12141c;

    --danger:        #e56b5b;
    --danger-soft:   #3a1f1c;
    --warning:       #f0b91b;
    --warning-soft:  #2e2612;
    --success:       #4cb877;
    --success-soft:  #16301f;
    --info:          #5aa3e0;
    --info-soft:     #14283a;
    --purple:        #a684d8;
    --purple-soft:   #261b38;
    --grey:          #9aa0b0;
    --grey-soft:     #272b3a;

    --shadow:        0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md:     0 4px 12px rgba(0, 0, 0, .5);
    --shadow-lg:     0 12px 32px rgba(0, 0, 0, .6);
    --elev-1:        0 1px 2px rgba(0, 0, 0, .40), 0 1px 3px rgba(0, 0, 0, .50);
    --elev-2:        0 2px 4px rgba(0, 0, 0, .40), 0 4px 12px rgba(0, 0, 0, .45);
    --elev-3:        0 8px 16px rgba(0, 0, 0, .45), 0 16px 32px rgba(0, 0, 0, .55);
    --focus-ring:    0 0 0 3px rgba(240, 185, 27, .42);

    --chart-1: #f0b91b;  --chart-2: #5aa3e0;  --chart-3: #f7d362;
    --chart-4: #9aa0b0;  --chart-5: #e56b5b;  --chart-6: #4cb877;
    --chart-grid: #2b3040;
}

/* ---------- Auto: kufuata kifaa ikiwa mtumiaji hajachagua ---------- */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg:            #12141c;
        --surface:       #1b1e2a;
        --surface-2:     #212532;
        --surface-3:     #272b3a;
        --overlay:       rgba(0, 0, 0, .62);

        --text:          #e8eaf0;
        --text-muted:    #9aa0b0;
        --text-faint:    #6f7688;
        --text-invert:   #12141c;

        --border:        #2b3040;
        --border-strong: #3a4054;

        --brand:         #f0b91b;
        --brand-hover:   #f7d362;
        --brand-soft:    #2e2612;
        --brand-text:    #12141c;

        --accent:        #f0b91b;
        --accent-strong: #f7d362;
        --accent-soft:   #2e2612;
        --accent-ink:    #12141c;

        --danger:        #e56b5b;
        --danger-soft:   #3a1f1c;
        --warning:       #f0b91b;
        --warning-soft:  #2e2612;
        --success:       #4cb877;
        --success-soft:  #16301f;
        --info:          #5aa3e0;
        --info-soft:     #14283a;
        --purple:        #a684d8;
        --purple-soft:   #261b38;
        --grey:          #9aa0b0;
        --grey-soft:     #272b3a;

        --shadow:        0 1px 3px rgba(0, 0, 0, .45);
        --shadow-md:     0 4px 12px rgba(0, 0, 0, .5);
        --shadow-lg:     0 12px 32px rgba(0, 0, 0, .6);
        --elev-1:        0 1px 2px rgba(0, 0, 0, .40), 0 1px 3px rgba(0, 0, 0, .50);
        --elev-2:        0 2px 4px rgba(0, 0, 0, .40), 0 4px 12px rgba(0, 0, 0, .45);
        --elev-3:        0 8px 16px rgba(0, 0, 0, .45), 0 16px 32px rgba(0, 0, 0, .55);
        --focus-ring:    0 0 0 3px rgba(240, 185, 27, .42);

        --chart-1: #f0b91b;  --chart-2: #5aa3e0;  --chart-3: #f7d362;
        --chart-4: #9aa0b0;  --chart-5: #e56b5b;  --chart-6: #4cb877;
        --chart-grid: #2b3040;
    }
}

/* X-Ray na picha za kitabibu: mandharinyuma nyeusi hali zote */
.medical-image,
.medical-image img {
    background: #000000;
}

/* ---------- Msongamano wa jedwali / density ---------- */

:root[data-density="compact"] {
    --row-h:    34px;
    --pad-cell: .32rem .55rem;
    --font-ui:  13px;

    /*
     * "Fupi" inabana NDANI ya vipengele — safu za jedwali, vichwa vya kadi —
     * ili safu nyingi zaidi zitoshee kwenye skrini moja.
     *
     * HAIBANI pembeni za ukurasa wala nafasi kati ya kadi (--space-4 hadi -7).
     * Sababu: hizo ndizo zinazotenganisha kipengele kimoja na kingine. Zikibanwa,
     * kadi zinaonekana zimeungana na ukurasa unaonekana umesongwa — msongamano
     * unakuwa umeharibu usomekaji badala ya kuongeza maudhui.
     */
    --space-3:  .625rem;   /* 10px — kichwa cha kadi, nafasi za ndani */
}

/* ---------- Mwendo mdogo kwa wanaohitaji ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
