/* ==========================================================================
   SihatSokmo Audiometri — sistem reka bentuk

   Ini alat kerja klinik, bukan laman pemasaran. Ia dibuka lapan jam sehari
   oleh juruteknik, doktor dan pegawai HR yang membaca nombor dan membuat
   keputusan perubatan. Reka bentuknya mengikut keutamaan itu:

     - Ketumpatan maklumat lebih penting daripada ruang putih hiasan
     - Nombor mesti mudah diimbas: fon tabular, penjajaran kanan
     - Warna membawa makna klinikal, bukan hiasan
     - Tiada animasi yang melambatkan kerja berulang

   Token di bawah adalah satu-satunya sumber warna, jarak dan tipografi.
   Jangan tulis nilai heksadesimal terus dalam templat.
   ========================================================================== */

:root {
    /* --- Neutral ---------------------------------------------------------
       Sedikit sejuk, bukan kelabu tepu. Teks pada kertas putih sepanjang
       hari lebih selesa dengan hitam yang dilembutkan. */
    --ink-900: #0d1117;
    --ink-800: #1a212b;
    --ink-700: #2c3644;
    --ink-600: #475467;
    --ink-500: #667085;
    --ink-400: #98a2b3;
    --ink-300: #d0d5dd;
    --ink-200: #e4e7ec;
    --ink-100: #f2f4f7;
    --ink-050: #f9fafb;
    --paper: #ffffff;

    /* --- Jenama ----------------------------------------------------------
       Teal perubatan. Digunakan untuk tindakan dan navigasi aktif sahaja,
       supaya ia kekal bermakna dan tidak menjadi hiasan. */
    --brand-700: #0f5f5c;
    --brand-600: #14807b;
    --brand-500: #17968f;
    --brand-100: #d5efed;
    --brand-050: #eef8f7;

    /* --- Warna klinikal --------------------------------------------------
       Terikat kepada makna dalam sistem, bukan kepada rasa:
         normal   keputusan dalam julat
         watch    STS dikesan, perlu ujian ulangan
         alert    kehilangan pendengaran disyaki, perlu rujukan
       Dipilih supaya masih dapat dibezakan pada penglihatan warna deutan. */
    --normal-600: #10796a;
    --normal-100: #d6f0e9;
    --watch-700: #96631a;
    --watch-600: #b8801f;
    --watch-100: #fdf0d5;
    --alert-700: #a52c2c;
    --alert-600: #c73b3b;
    --alert-100: #fbe0e0;
    --info-600: #2563a8;
    --info-100: #dbeafe;

    /* --- Tipografi -------------------------------------------------------
       Fon sistem: tiada muat turun, tiada anjakan susun atur, dan ia sudah
       kelihatan betul pada Windows di kaunter klinik. */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
        "Liberation Mono", monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;

    /* --- Jarak: skala 4px ------------------------------------------------ */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;

    /* --- Bayang ----------------------------------------------------------
       Halus. Bayang tebal pada setiap kad ialah tanda paling jelas antara
       muka yang direka tanpa tujuan. */
    --shadow-sm: 0 1px 2px rgba(13, 17, 23, 0.06);
    --shadow-md: 0 1px 3px rgba(13, 17, 23, 0.08), 0 4px 12px rgba(13, 17, 23, 0.04);
    --shadow-lg: 0 4px 6px rgba(13, 17, 23, 0.04), 0 12px 32px rgba(13, 17, 23, 0.08);

    --ring: 0 0 0 3px var(--brand-100);

    /* --- Pelonggaran ------------------------------------------------------
       Gerakan yang terasa mahal ialah gerakan yang bermula pantas dan
       mendarat perlahan, bukan yang laju sepanjang masa. `ease-back`
       melepasi sasaran sedikit sebelum kembali — digunakan HANYA untuk
       elemen yang muncul, tidak pernah untuk apa-apa yang pengguna
       sedang tunggu. */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Reset
   Padding dan sempadan mesti dikira ke dalam lebar. Tanpa ini, medan
   `width:100%` dengan padding terkeluar daripada bekasnya.
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
}

/* ==========================================================================
   Asas
   ========================================================================== */
.ss-root {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--ink-800);
    -webkit-font-smoothing: antialiased;
}

/* Nombor mesti berbaris menegak dalam jadual keputusan supaya perbezaan
   magnitud kelihatan sekali pandang. */
.ss-num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ==========================================================================
   Tipografi
   ========================================================================== */
.ss-title {
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink-900);
    margin: 0;
}

.ss-subtitle {
    font-size: var(--text-base);
    color: var(--ink-500);
    margin: var(--space-1) 0 0;
}

.ss-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 550;
    color: var(--ink-700);
    margin-bottom: var(--space-2);
}

/* Label kecil di atas kumpulan medan. Huruf besar sepenuhnya hanya
   dibenarkan di sini, di mana teksnya satu atau dua patah perkataan. */
.ss-eyebrow {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
}

.ss-help {
    font-size: var(--text-sm);
    color: var(--ink-500);
}

/* ==========================================================================
   Medan borang
   ========================================================================== */
.ss-field {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    font-size: var(--text-md);
    color: var(--ink-900);
    background: var(--paper);
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-md);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.ss-field::placeholder {
    color: var(--ink-400);
}

.ss-field:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: var(--ring);
}

.ss-field:disabled {
    background: var(--ink-100);
    color: var(--ink-500);
    cursor: not-allowed;
}

.ss-field[aria-invalid="true"] {
    border-color: var(--alert-600);
}

/* Medan dengan butang di dalamnya (contoh: togol lihat kata laluan). */
.ss-field-group {
    position: relative;
    display: block;
}

.ss-field-group .ss-field {
    padding-right: 2.75rem;
}

.ss-field-affix {
    position: absolute;
    top: 50%;
    right: var(--space-2);
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: var(--ink-500);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.ss-field-affix:hover {
    color: var(--ink-700);
    background: var(--ink-100);
}

.ss-field-affix:focus-visible {
    outline: none;
    color: var(--brand-600);
    box-shadow: var(--ring);
}

/* ==========================================================================
   Butang
   ========================================================================== */
.ss-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 550;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.ss-btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.ss-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ss-btn-primary {
    color: var(--paper);
    background: var(--brand-600);
}

.ss-btn-primary:hover:not(:disabled) {
    background: var(--brand-700);
}

.ss-btn-secondary {
    color: var(--ink-700);
    background: var(--paper);
    border-color: var(--ink-300);
}

.ss-btn-secondary:hover:not(:disabled) {
    background: var(--ink-050);
    border-color: var(--ink-400);
}

.ss-btn-ghost {
    color: var(--ink-600);
    background: transparent;
}

.ss-btn-ghost:hover:not(:disabled) {
    color: var(--ink-900);
    background: var(--ink-100);
}

.ss-btn-danger {
    color: var(--paper);
    background: var(--alert-600);
}

.ss-btn-danger:hover:not(:disabled) {
    background: var(--alert-700);
}

.ss-btn-block {
    width: 100%;
}

/* Butang padat untuk lajur Tindakan dalam jadual (Giliran). Ketinggian sama
   untuk semua varian supaya satu baris butang kelihatan sebagai satu set. */
.ss-btn-sm {
    height: 2rem;
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    white-space: nowrap;
    text-decoration: none;
}

/* Kerja tertunggak (gambar gegendang, Appendix 6, soal selidik). Warna
   "watch" = perlu perhatian, selari dengan makna klinikalnya. */
.ss-btn-task {
    color: var(--watch-700);
    background: var(--watch-100);
    border-color: rgba(184, 128, 31, 0.45);
}

.ss-btn-task:hover:not(:disabled) {
    background: #fbe6bb;
    border-color: var(--watch-600);
}

/* Tindakan berbahaya yang jarang digunakan — teks merah, tiada latar. */
.ss-btn-ghost-danger {
    color: var(--alert-600);
    background: transparent;
}

.ss-btn-ghost-danger:hover:not(:disabled) {
    color: var(--alert-700);
    background: var(--alert-100);
}

/* Titik status di hadapan label butang. */
.ss-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex: none;
    border-radius: 999px;
    background: currentColor;
}

.ss-dot-alert { background: var(--alert-600); }
.ss-dot-brand { background: var(--brand-500); }
.ss-dot-watch { background: var(--watch-600); }

/* Kad bilangan (Giliran, Tempahan): kad putih, nombor gelap, titik warna
   sebagai petunjuk sahaja — tiada sempadan pelangi (semakan visual 6/11/2026). */
.ss-stat {
    display: block;
    padding: var(--space-3) var(--space-4);
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    text-align: left;
    text-decoration: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

a.ss-stat:hover { border-color: var(--ink-300); box-shadow: var(--shadow-sm); }

.ss-stat-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--ink-500);
}

.ss-stat-value {
    margin-top: var(--space-1);
    font-size: var(--text-2xl);
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
}

.ss-stat-value.is-alert { color: var(--alert-600); }
.ss-dot-info { background: var(--info-600); }
.ss-dot-normal { background: var(--normal-600); }
.ss-dot-muted { background: var(--ink-400); }

/* Label status kecil di dalam butang (cth. "Menunggu OHD", "Draf"). */
.ss-btn-tag {
    padding: 0.0625rem 0.375rem;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-sm);
    color: var(--ink-600);
    background: var(--ink-100);
}

.ss-btn-tag-info { color: var(--info-600); background: var(--info-100); }
.ss-btn-tag-normal { color: var(--normal-600); background: var(--normal-100); }
.ss-btn-tag-watch { color: var(--watch-700); background: var(--watch-100); }
.ss-btn-tag-alert { color: var(--alert-700); background: var(--alert-100); }

/* Senarai definisi padat: label | nilai kanan | nilai kiri (Semakan OHD).
   Nombor neutral; titik ss-dot membawa makna klinikal. */
.ss-dl {
    display: grid;
    grid-template-columns: minmax(7.5rem, max-content) minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-4);
    margin: 0;
    font-size: var(--text-sm);
}

.ss-dl > dt,
.ss-dl > dd {
    margin: 0;
    padding: var(--space-2) 0;
    border-top: 1px solid var(--ink-100);
}

.ss-dl > dt { color: var(--ink-500); }

.ss-dl > dd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--space-2);
    color: var(--ink-900);
}

.ss-dl > .ss-dl-head {
    padding-top: 0;
    border-top: 0;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--ink-500);
}

.ss-dl > .ss-dl-full { grid-column: 1 / -1; display: block; }

/* ==========================================================================
   Permukaan
   ========================================================================== */
.ss-card {
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.ss-card-pad {
    padding: var(--space-5);
}

.ss-divider {
    height: 1px;
    background: var(--ink-200);
    border: 0;
    margin: var(--space-5) 0;
}

/* ==========================================================================
   Mesej
   ========================================================================== */
.ss-note {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
}

.ss-note-info {
    color: var(--info-600);
    background: var(--info-100);
    border-color: color-mix(in srgb, var(--info-600) 22%, transparent);
}

.ss-note-alert {
    color: var(--alert-700);
    background: var(--alert-100);
    border-color: color-mix(in srgb, var(--alert-600) 24%, transparent);
}

.ss-note-watch {
    color: var(--watch-700);
    background: var(--watch-100);
    border-color: color-mix(in srgb, var(--watch-600) 26%, transparent);
}

.ss-note-normal {
    color: var(--normal-600);
    background: var(--normal-100);
    border-color: color-mix(in srgb, var(--normal-600) 22%, transparent);
}

/* ==========================================================================
   Lencana status klinikal
   ========================================================================== */
.ss-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
    border-radius: var(--radius-sm);
}

.ss-badge-normal { color: var(--normal-600); background: var(--normal-100); }
.ss-badge-watch  { color: var(--watch-700);  background: var(--watch-100); }
.ss-badge-alert  { color: var(--alert-700);  background: var(--alert-100); }
.ss-badge-info   { color: var(--info-600);   background: var(--info-100); }
.ss-badge-muted  { color: var(--ink-600);    background: var(--ink-100); }

/* ==========================================================================
   Atribusi pengendali

   Audex ialah perisiannya; Akasia Medicare Sdn Bhd yang mengendalikannya.
   Pekerja syarikat klien yang log masuk untuk melihat rekod pendengaran
   mereka sepatutnya nampak siapa bertanggungjawab ke atas data itu.
   ========================================================================== */
.ss-powered {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--ink-500);
}

/* Menggunakan akasia-mark.png, bukan logo penuh. Logo penuh ialah lencana
   bulat dengan nama syarikat melengkung mengelilinginya; pada saiz ini teks
   itu menjadi cincang kelabu. Tanda tengah dibaca sebagai bentuk, dan label
   teks di sebelahnya menyampaikan nama. */
.ss-powered img {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

.ss-powered strong {
    font-weight: 600;
    color: var(--ink-600);
}

/* Pada permukaan gelap, teks perlu lebih cerah untuk kekal terbaca. */
.ss-powered-dark {
    color: var(--ink-400);
}

.ss-powered-dark strong {
    color: var(--ink-300);
}

/* ==========================================================================
   Kebolehcapaian
   ========================================================================== */

/* Kelihatan hanya apabila difokus melalui papan kekunci. */
.ss-skip-link {
    position: absolute;
    left: var(--space-4);
    top: calc(var(--space-4) * -4);
    z-index: 100;
    padding: var(--space-2) var(--space-4);
    color: var(--paper);
    background: var(--ink-900);
    border-radius: var(--radius-md);
    transition: top 0.15s ease;
}

.ss-skip-link:focus {
    top: var(--space-4);
}

.ss-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hormati tetapan sistem. Beberapa pengguna mengalami pening dengan
   gerakan, dan tiada satu pun animasi di sini menyampaikan maklumat. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ======================================================================
   Maklum balas tindakan (toast) — dikongsi rangka admin & portal HR
   ====================================================================== */
/* ---------- Maklum balas tindakan ----------
   Toast duduk di atas segalanya (termasuk modal pratonton
   laporan pada z-index 50) supaya kegagalan tidak pernah
   tersembunyi di belakang lapisan lain. */
#toast-stack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: min(26rem, calc(100vw - 2rem));
    pointer-events: none;
}

.ss-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-left-width: 4px;
    box-shadow: 0 8px 28px rgba(13, 17, 23, 0.16);
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--ink-800);
}

.ss-toast-success { border-left-color: #15803d; }
.ss-toast-error { border-left-color: var(--alert-600); }
.ss-toast-info { border-left-color: var(--brand-600); }

.ss-toast-icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
}

.ss-toast-success .ss-toast-icon { background: #15803d; }
.ss-toast-error .ss-toast-icon { background: var(--alert-600); }
.ss-toast-info .ss-toast-icon { background: var(--brand-600); }

.ss-toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.ss-toast-close {
    flex-shrink: 0;
    border: 0;
    background: none;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--ink-400);
    cursor: pointer;
    padding: 0 0.1rem;
}

.ss-toast-close:hover { color: var(--ink-700); }

@media (prefers-reduced-motion: no-preference) {
    .ss-toast { animation: toast-in 0.18s var(--ease-out); }
    .ss-toast.is-leaving { opacity: 0; transition: opacity 0.2s ease; }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ------------------------------------------------------------------
 * Konsol ujian audiometri (carta kanan | borang | carta kiri).
 *
 * Dahulu kedua-dua carta berlebar tetap 500px dengan overflow tersembunyi:
 * pada skrin di bawah ~1500px (laptop klinik 1366px) lajur borang tengah
 * runtuh kepada lebar 0 — butang "Simpan Audiogram" hilang di belakang
 * carta. Kini carta mengecil dahulu dan borang kekal boleh digunakan;
 * di bawah 1280px lajur disusun menegak.
 * ------------------------------------------------------------------ */
.console-ear { width: clamp(260px, 24vw, 500px); }
.console-ear.is-expanded { width: auto; flex: 1 1 0%; }

/* Pemilik 10/11/2026: "chart ... nampak terlalu kecil, dan sepatutnya ianya dilebarkan
   lagi sehingga ke tengah". Borang tengah selebar kandungannya sahaja (maks 750px);
   kedua-dua carta mengambil SEMUA baki ruang — tiada lagi ruang kosong di sisi borang. */
@media (min-width: 1280px) {
    #main-console > .console-ear { width: auto; flex: 1 1 0%; min-width: 320px; }
    #main-console > #center-panel { flex: 0 0 auto; width: clamp(520px, 36vw, 760px); min-width: 0; }
}

@media (max-width: 1279px) {
    #main-console {
        flex-direction: column;
        overflow-y: auto;
    }
    #main-console > .console-ear {
        width: 100%;
        height: 460px;
        flex: none;
    }
    #main-console > #center-panel {
        height: auto;
        overflow: visible;
        flex: none;
    }
}

/* ------------------------------------------------------------------
 * Mod Auto audiometer (amplivox-serial.js: enterAutoLayout / exitAutoLayout).
 *
 * Pemilik 5/11/2026: "masih nampak sidebar", "Tamat perlu gerak tetikus
 * baru nampak", carta mesti terang dari jauh. body.auto-mode menjadikan
 * konsol 100% skrin: bar sisi & panel tengah disorok, dua lajur carta yang
 * SAMA (tiada skrin pendua) memenuhi ruang di bawah jalur atas pejal.
 * Tanpa Fullscreen API pun susun atur menutup seluruh tetingkap pelayar.
 * ------------------------------------------------------------------ */
:root { --auto-bar-h: 84px; }

body.auto-mode { overflow: hidden; }
/* Nenek moyang dengan transform (animasi .page-content) menjadikan position:fixed
   relatif kepadanya, bukan skrin — matikan semasa Mod Auto. */
body.auto-mode .page-content { animation: none !important; transform: none !important; }
body.auto-mode .app-sidebar,
body.auto-mode .app-scrim,
body.auto-mode .app-main > header,
body.auto-mode #patient-mode-controls,
body.auto-mode #center-panel { display: none !important; }

body.auto-mode #main-console {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: auto !important;
    margin: 0 !important;
    flex-direction: row !important;
    overflow: hidden !important;
    background: #ffffff;
}

body.auto-mode #main-console > .console-ear {
    width: auto !important;
    height: 100% !important;
    flex: 1 1 0% !important;
    min-width: 0;
    padding: 10px;
    background: #ffffff;
    border: 0;
    transition: none;
}
body.auto-mode #main-console > .console-ear > div {
    padding: 8px 12px 10px;
    border-width: 4px;
    border-radius: 14px;
    box-shadow: none;
}
body.auto-mode #right-ear-column > div { border-color: #dc2626; }
body.auto-mode #left-ear-column > div { border-color: #1d4ed8; }

/* Tajuk telinga besar + simbol carta (O merah / X biru). */
body.auto-mode .console-ear h3 {
    font-size: 1.75rem;
    line-height: 1.15;
    font-weight: 900;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom-width: 2px;
}
body.auto-mode #right-ear-column h3 { color: #b91c1c; border-color: #fecaca; }
body.auto-mode #left-ear-column h3 { color: #1e40af; border-color: #bfdbfe; }
body.auto-mode .console-ear h3 > span:first-child > span { width: 18px; height: 18px; }
body.auto-mode #right-ear-column h3 > span:first-child > span { background: #dc2626; }
body.auto-mode #left-ear-column h3 > span:first-child > span { background: #1d4ed8; }
body.auto-mode .console-ear h3 > span:last-child { display: none; }
body.auto-mode .console-ear h3 > span:first-child::after {
    margin-left: 0.5rem;
    padding: 0 0.6rem;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
}
body.auto-mode #right-ear-column h3 > span:first-child::after { content: "O"; background: #dc2626; }
body.auto-mode #left-ear-column h3 > span:first-child::after { content: "X"; background: #1d4ed8; }
body.auto-mode #side_res_r_container,
body.auto-mode #side_res_l_container { display: none; }

/* Jalur atas TERSOROK (pemilik 5/11/2026: "biarkan chart sahaja sepenuhnya"):
   carta memenuhi 100% skrin; jalur turun menindih carta hanya apabila tetikus
   di tepi atas skrin atau ada ralat (body.auto-bar-shown, amplivox-serial.js). */
#auto-mode-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 130;
    height: var(--auto-bar-h);
    gap: 16px;
    padding: 0 18px;
    background: #ffffff;
    border-bottom: 6px solid #059669;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
    transform: translateY(calc(-100% - 12px));
    visibility: hidden;
    transition: transform 0.18s ease-out, visibility 0s linear 0.18s;
}
body.auto-bar-shown #auto-mode-bar {
    transform: none;
    visibility: visible;
    transition: transform 0.18s ease-out, visibility 0s;
}
#auto-mode-bar .auto-bar-badge {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 10px;
    background: #047857;
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
#auto-mode-bar .auto-bar-dot {
    width: 14px;
    height: 14px;
    border-radius: 9999px;
    background: #6ee7b7;
    box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.35);
}
@media (prefers-reduced-motion: no-preference) {
    #auto-mode-bar .auto-bar-dot { animation: auto-bar-pulse 1.4s ease-in-out infinite; }
}
@keyframes auto-bar-pulse { 50% { opacity: 0.35; } }

/* Status langsung (kelas warna ditetapkan oleh autoStatus()). */
#auto-mode-bar #auto-mode-status {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.2rem;
    line-height: 1.3;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#auto-mode-bar .auto-bar-btn:not(.hidden) {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: 0 18px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}
#auto-mode-bar .auto-bar-btn-use { color: #065f46; background: #ecfdf5; border: 3px solid #10b981; }
#auto-mode-bar .auto-bar-btn-use:hover { background: #d1fae5; }
#auto-mode-bar .auto-bar-btn-full { color: #ffffff; background: #1e293b; border: 3px solid #1e293b; }
#auto-mode-bar .auto-bar-btn-full:hover { background: #334155; }

#auto-mode-bar .auto-bar-stop {
    flex: none;
    min-height: 62px;
    padding: 0 44px;
    border-radius: 12px;
    background: #dc2626;
    border: 3px solid #991b1b;
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 3px 0 #7f1d1d;
}
#auto-mode-bar .auto-bar-stop:hover { background: #b91c1c; }
#auto-mode-bar .auto-bar-stop:active { transform: translateY(2px); box-shadow: 0 1px 0 #7f1d1d; }
#auto-mode-bar button:focus-visible { outline: 4px solid #f59e0b; outline-offset: 2px; }

@media (max-width: 1100px) {
    :root { --auto-bar-h: 76px; }
    #auto-mode-bar { gap: 10px; padding: 0 10px; }
    #auto-mode-bar .auto-bar-badge { font-size: 1.1rem; padding: 8px 12px; }
    #auto-mode-bar #auto-mode-status { font-size: 1rem; }
    #auto-mode-bar .auto-bar-stop { padding: 0 26px; font-size: 1.35rem; }
}

/* ------------------------------------------------------------------
 * Bar sisi konsol ujian (console-sidebar.js, skrin >= 1024px): rel ikon
 * nipis yang menindih tepi kiri — kandungan konsol guna lebar penuh.
 * Sorok sendiri selepas 2.5 s; klik ikon -> bar penuh berlabel.
 * ------------------------------------------------------------------ */
@media (min-width: 64rem) {
    body.sidebar-auto .app-main { margin-left: 0 !important; }
    body.sidebar-auto .app-sidebar {
        width: 4.25rem;
        overflow: hidden;
        box-shadow: 4px 0 18px rgba(15, 23, 42, 0.25);
        transition: transform 0.2s ease-out, width 0.18s ease-out;
    }
    body.sidebar-auto.sidebar-hidden .app-sidebar { transform: translateX(-100%); box-shadow: none; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar > a > span.leading-tight,
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar .nav-link > span,
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar .nav-chevron,
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar .nav-sub,
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar-scroll > :not(ul) { display: none !important; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar > a { padding-left: 0; padding-right: 0; justify-content: center; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar-scroll { padding: 0 0.5rem; overflow-x: hidden; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar .nav-link svg { opacity: 1; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar > div { padding-left: 0.5rem; padding-right: 0.5rem; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar > div .leading-tight { display: none; }
    body.sidebar-auto:not(.sidebar-wide) .app-sidebar > div > div { justify-content: center; padding: 0; }
    body.sidebar-auto.sidebar-wide .app-sidebar { width: 16rem; }
}

/* company portal
   Portal HR syarikat (semakan visual 6/11/2026). Kelas baharu sahaja —
   peraturan sedia ada di atas tidak diubah. Satu kepala halaman, satu
   jadual, satu keadaan kosong untuk setiap halaman HR. */
.hr-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3) var(--space-4);
}

.hr-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.hr-stat-on {
    border-color: var(--brand-500);
    box-shadow: inset 0 0 0 1px var(--brand-500);
}

.hr-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--ink-200);
}

.hr-card-title {
    margin: 0;
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--ink-900);
}

.hr-scroll { overflow-x: auto; }

.hr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

.hr-table th {
    padding: var(--space-2) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--ink-500);
    background: var(--ink-050);
    border-bottom: 1px solid var(--ink-200);
    white-space: nowrap;
}

.hr-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--ink-100);
    vertical-align: middle;
    color: var(--ink-800);
}

.hr-table tbody tr:last-child td { border-bottom: 0; }
.hr-table tbody tr:hover td { background: var(--ink-050); }
.hr-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hr-table .act { text-align: right; white-space: nowrap; }
.hr-table .act > * + * { margin-left: var(--space-2); }

.hr-name { font-weight: 600; color: var(--ink-900); }
.hr-sub { display: block; font-size: var(--text-sm); color: var(--ink-500); }
.hr-mono { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink-600); white-space: nowrap; }
.hr-date { font-variant-numeric: tabular-nums; white-space: nowrap; }

.hr-textlink {
    color: var(--brand-700);
    font-weight: 550;
    text-decoration: none;
}

.hr-textlink:hover { text-decoration: underline; }

.hr-empty {
    padding: var(--space-6) var(--space-5);
    text-align: center;
    color: var(--ink-500);
}

.hr-empty strong {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: 600;
    color: var(--ink-800);
}

.hr-empty .ss-btn { margin-top: var(--space-4); }

/* Langkah bernombor (papan pemuka syarikat baharu, borang). */
.hr-steps {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: hr-step;
}

.hr-steps > li {
    position: relative;
    padding-left: 2.25rem;
    counter-increment: hr-step;
}

.hr-steps > li::before {
    content: counter(hr-step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: var(--text-xs);
    font-weight: 650;
    color: var(--brand-700);
    background: var(--brand-050);
    border: 1px solid var(--brand-100);
    border-radius: 999px;
}

.hr-section-label {
    margin: 0 0 var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
}

/* Pilihan radio berbentuk kad (sesi tempahan). */
.hr-choice { display: block; cursor: pointer; }
.hr-choice > input:checked + .ss-stat {
    border-color: var(--brand-500);
    background: var(--brand-050);
    box-shadow: inset 0 0 0 1px var(--brand-500);
}
.hr-choice > input:focus-visible + .ss-stat { box-shadow: var(--ring); }

.hr-table-compact th,
.hr-table-compact td { padding-left: var(--space-3); padding-right: var(--space-3); }
.hr-table-compact th:first-child,
.hr-table-compact td:first-child { padding-left: var(--space-5); }
.hr-table-compact th:last-child,
.hr-table-compact td:last-child { padding-right: var(--space-5); }

/* Telefon: lajur sekunder disembunyikan supaya Keputusan & butang kelihatan
   tanpa skrol mendatar; maklumat yang sama dipaparkan di bawah nama. */
.hr-only-sm { display: none; }
@media (max-width: 639px) {
    .hr-hide-sm { display: none; }
    .hr-only-sm { display: block; }
    .hr-table th, .hr-table td { padding-left: var(--space-3); padding-right: var(--space-3); }
}

/* Jadual bertindan pada telefon (invois): setiap baris menjadi kad kecil. */
@media (max-width: 639px) {
    .hr-stack thead { display: none; }
    .hr-stack tbody tr { display: block; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--ink-100); }
    .hr-stack tbody tr:last-child { border-bottom: 0; }
    .hr-stack tbody td { display: block; padding: var(--space-1) 0; border: 0; text-align: left; }
    .hr-stack tbody tr:hover td { background: transparent; }
    .hr-stack .num, .hr-stack .act { text-align: left; white-space: normal; }
    .hr-stack .act > * + * { margin-left: 0; }
    .hr-stack td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: var(--text-xs);
        color: var(--ink-500);
        font-family: var(--font-sans);
        font-weight: 400;
    }
}

@media (min-width: 640px) { .hr-wide { min-width: 18rem; } }

/* hr flow
   Aliran tahunan Papan Pemuka HR (pemilik 7/11/2026): langkah bernombor,
   kumpulan berfolder (corak Perlu Tandatangan Doktor), satu langkah
   seterusnya di hujung setiap kumpulan. Token sahaja, tiada warna baharu. */
.hr-muted { color: var(--ink-500); }

.hr-flow {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--paper);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.hr-flow > li + li { border-left: 1px solid var(--ink-100); }
.hr-flow a {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: var(--space-2);
    row-gap: 2px;
    align-items: start;
    height: 100%;
    padding: var(--space-3) var(--space-4);
    color: inherit;
    text-decoration: none;
}
.hr-flow a:hover { background: var(--ink-050); }
.hr-flow a:focus-visible { box-shadow: var(--ring); outline: 0; }
.hr-flow-title { font-size: var(--text-sm); font-weight: 600; color: var(--ink-800); line-height: 1.4rem; }
.hr-flow-value {
    grid-column: 2;
    font-size: var(--text-sm);
    color: var(--ink-500);
    font-variant-numeric: tabular-nums;
}
.hr-flow-value strong { color: var(--ink-900); font-weight: 650; }
.hr-flow-value .is-alert { color: var(--alert-700); font-weight: 600; }

.hr-step-no {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    font-size: var(--text-sm);
    font-weight: 650;
    color: var(--brand-700);
    background: var(--brand-050);
    border: 1px solid var(--brand-100);
    border-radius: 999px;
}
.hr-flow .hr-step-no { width: 1.4rem; height: 1.4rem; font-size: var(--text-xs); grid-row: span 2; }

.hr-step { overflow: hidden; scroll-margin-top: var(--space-5); }
.hr-step-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--ink-200);
}
.hr-step-head .hr-sub { margin-top: 2px; }

.hr-step-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    color: var(--ink-600);
    background: var(--ink-050);
    border-bottom: 1px solid var(--ink-100);
}

.hr-folder { border-bottom: 1px solid var(--ink-100); }
.hr-folder:last-child { border-bottom: 0; }
.hr-folder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.hr-folder-head::-webkit-details-marker { display: none; }
details.hr-folder > .hr-folder-head:hover { background: var(--ink-050); }
details.hr-folder > .hr-folder-head:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-500); outline: 0; }
.hr-folder.is-empty .hr-folder-head { cursor: default; }
.hr-folder-name { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.hr-folder-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; color: var(--ink-500); }
.hr-folder.is-empty .hr-folder-icon { color: var(--ink-300); }
.hr-folder-title { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; color: var(--ink-900); }
.hr-folder.is-empty .hr-folder-title { font-weight: 500; color: var(--ink-500); }
.hr-folder-meta { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.hr-folder-chev { width: 1rem; height: 1rem; color: var(--ink-400); transition: transform 0.15s ease; }
details.hr-folder[open] .hr-folder-chev { transform: rotate(90deg); }
details.hr-folder[open] > .hr-folder-head { background: var(--ink-050); }
.hr-folder-body { border-top: 1px solid var(--ink-100); overflow-x: auto; }

.hr-pill {
    display: inline-block;
    padding: 2px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--ink-700);
    background: var(--ink-100);
    border-radius: 999px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.hr-pill.is-zero { color: var(--ink-400); background: var(--ink-050); }

.hr-group-label {
    padding: var(--space-3) var(--space-5) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
    background: var(--ink-050);
    border-bottom: 1px solid var(--ink-100);
}

.hr-next {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    color: var(--ink-700);
    background: var(--ink-050);
    border-top: 1px solid var(--ink-100);
}

.hr-step-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    color: var(--ink-500);
    border-top: 1px solid var(--ink-200);
    font-variant-numeric: tabular-nums;
}
.hr-step-foot strong { color: var(--ink-800); font-weight: 600; }

.hr-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: var(--space-4) var(--space-5); }

.hr-records { margin: 0; padding: 0; list-style: none; }
.hr-records > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--ink-100);
}
.hr-records > li:last-child { border-bottom: 0; }
.hr-records-main { display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; flex: 1 1 20rem; }
.hr-check { width: 1.1rem; height: 1.1rem; margin-top: 2px; flex-shrink: 0; color: var(--normal-600); }
.hr-check.is-off { color: var(--ink-300); }

.hr-visits { display: grid; gap: 2px; }

/* Sahkan kedudukan pekerja: empat pilihan sebaris (radio berbentuk segmen). */
.hr-seg-choice { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.hr-seg-choice label { position: relative; cursor: pointer; }
.hr-seg-choice input { position: absolute; opacity: 0; pointer-events: none; }
.hr-seg-choice span {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink-700);
    background: var(--paper);
    border: 1px solid var(--ink-300);
    border-radius: var(--radius-md);
    white-space: nowrap;
}
.hr-seg-choice label:hover span { border-color: var(--ink-400); }
.hr-seg-choice input:focus-visible + span { box-shadow: 0 0 0 2px var(--brand-500); }
.hr-seg-choice input:checked + span { color: var(--brand-700); background: var(--brand-050); border-color: var(--brand-500); box-shadow: inset 0 0 0 1px var(--brand-500); }
.hr-seg-choice input[value="berhenti"]:checked + span,
.hr-seg-choice input[value="pencen"]:checked + span,
.hr-seg-choice input[value="tidak_bising"]:checked + span { color: var(--ink-800); background: var(--ink-100); border-color: var(--ink-500); box-shadow: inset 0 0 0 1px var(--ink-500); }

.hr-confirm-extra { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.hr-confirm-extra .ss-field { width: auto; padding-top: 0.3rem; padding-bottom: 0.3rem; font-size: var(--text-sm); }
.hr-confirm-extra label { font-size: var(--text-xs); color: var(--ink-500); }

.hr-sticky-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-5);
    background: var(--paper);
    border-top: 1px solid var(--ink-200);
}

@media (max-width: 1023px) {
    .hr-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hr-flow > li:nth-child(n + 4) { border-top: 1px solid var(--ink-100); }
    .hr-flow > li:nth-child(4) { border-left: 0; }
}
@media (max-width: 639px) {
    .hr-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hr-flow > li { border-left: 0; border-top: 1px solid var(--ink-100); }
    .hr-flow > li:nth-child(-n + 2) { border-top: 0; }
    .hr-flow > li:nth-child(even) { border-left: 1px solid var(--ink-100); }
    .hr-flow a { padding: var(--space-3); }
    .hr-step-head, .hr-folder-head, .hr-next, .hr-step-foot, .hr-step-note, .hr-records > li, .hr-sticky-bar, .hr-group-label { padding-left: var(--space-4); padding-right: var(--space-4); }
    .hr-tiles { grid-template-columns: 1fr; padding: var(--space-3) var(--space-4); }
    .hr-next .ss-btn, .hr-records .ss-btn { width: 100%; justify-content: center; }
}
.hr-folder-body .hr-table th:first-child { width: 34%; }
@media (min-width: 640px) { .hr-confirm-table td:nth-child(3) { min-width: 21rem; } }
a.hr-folder-link { color: inherit; text-decoration: none; }
a.hr-folder-link:hover { background: var(--ink-050); }
@media (max-width: 639px) {
    .hr-folder-icon { display: none; }
    .hr-step-head > .hr-textlink { flex-basis: 100%; padding-left: calc(1.75rem + var(--space-3)); }
}

/* hr flow (pusingan 2): jawapan utama, kumpulan tanpa ikon folder, ambar untuk
   "belum", merah hanya untuk "perlu tindakan anda sekarang". */
.ss-dot-ink { background: var(--ink-600); }
.hr-amber { color: var(--watch-700); }

.hr-headline {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
}
.hr-headline-text { margin: 0; font-size: var(--text-md); color: var(--ink-800); line-height: 1.5; }
.hr-headline-text strong { color: var(--ink-900); font-weight: 650; }
.hr-headline-text .hr-amber strong { color: var(--watch-700); }
.hr-progress {
    display: flex;
    height: 0.6rem;
    overflow: hidden;
    background: var(--ink-100);
    border-radius: 999px;
}
.hr-progress > span { display: block; height: 100%; background: var(--normal-600); }
.hr-progress > span.is-booked { background: var(--brand-100); }
.hr-headline > .hr-textlink { justify-self: start; }

.hr-flow > li.is-muted a { opacity: 0.55; }
.hr-flow-value .is-amber { color: var(--watch-700); font-weight: 600; }

.hr-step.is-muted { opacity: 0.7; }
.hr-step.is-muted .hr-step-head { border-bottom: 0; }

.hr-step-note-end { border-top: 1px solid var(--ink-100); border-bottom: 0; }

.hr-callout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-5);
    background: var(--watch-100);
    border-bottom: 1px solid var(--ink-100);
    border-left: 3px solid var(--watch-600);
}
.hr-callout .hr-name { display: flex; align-items: center; gap: var(--space-2); }
.hr-callout .hr-sub { color: var(--ink-700); }

.hr-pill-sm { margin-top: var(--space-1); }

.hr-check.is-doc { color: var(--ink-500); }
.hr-check-dot { display: grid; place-items: center; width: 1.1rem; height: 1.1rem; margin-top: 2px; flex-shrink: 0; }

.hr-names summary { cursor: pointer; list-style: none; color: var(--brand-700); }
.hr-names summary::-webkit-details-marker { display: none; }
.hr-names summary::after { content: " \25BE"; font-size: var(--text-xs); }
.hr-names ul { margin: var(--space-1) 0 0; padding: 0; list-style: none; font-weight: 400; font-size: var(--text-sm); color: var(--ink-700); }

.hr-row-pick td { background: var(--brand-050); }
.hr-row-done td { color: var(--ink-500); }
.hr-seg-select { width: auto; min-width: 10rem; }
.hr-live { margin: var(--space-3) var(--space-5) 0; }

@media (max-width: 639px) {
    .hr-seg-choice { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .hr-seg-choice span { display: flex; align-items: center; justify-content: center; min-height: 2.6rem; width: 100%; text-align: center; white-space: normal; }
    .hr-seg-select { width: 100%; }
    .hr-headline, .hr-callout { padding-left: var(--space-4); padding-right: var(--space-4); }
    .hr-live { margin-left: var(--space-4); margin-right: var(--space-4); }
    .hr-sticky-bar .ss-btn { flex: 1 1 auto; justify-content: center; }
}
.hr-seg-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 30rem; }
.hr-seg-choice span { display: flex; align-items: center; justify-content: center; width: 100%; text-align: center; }
@media (max-width: 639px) { .hr-step-head > .hr-step-badges { flex-basis: 100%; padding-left: calc(1.75rem + var(--space-3)); } }


/* ------------------------------------------------------------------
 * Mode Pesakit: lajur ikon di tepi kanan (pemilik 10/11/2026: butang besar
 * "Info / Pembaris / Tutup" sentiasa muncul nampak serabut). Tersorok; muncul
 * apabila tetikus menghampiri tepi kanan (audiometry-form.js patientRailNearEdge)
 * atau apabila pemegang kecil disentuh.
 * ------------------------------------------------------------------ */
.pm-rail { position: fixed; top: 0; right: 0; height: 100vh; z-index: 100; display: flex; align-items: center; pointer-events: none; }
.pm-rail.hidden { display: none; }
.pm-rail-handle {
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    width: 6px; height: 72px; border: 0; padding: 0; border-radius: 4px 0 0 4px;
    background: rgba(15, 23, 42, .22); pointer-events: auto; cursor: pointer; transition: opacity .15s;
}
.pm-rail.is-open .pm-rail-handle { opacity: 0; }
.pm-rail-panel {
    pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 10px 8px; background: var(--paper, #fff); border: 1px solid var(--ink-200); border-right: 0;
    border-radius: 14px 0 0 14px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    transform: translateX(105%); transition: transform .18s ease;
}
.pm-rail.is-open .pm-rail-panel { transform: none; }
.pm-rail-btn {
    position: relative; width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 10px; border: 1px solid var(--ink-200); background: var(--ink-050, #f8fafc); color: var(--ink-600);
    cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.pm-rail-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.pm-rail-btn.is-on { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pm-rail-exit { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.pm-rail-exit:hover { background: #fee2e2; color: #991b1b; }
.pm-rail-sep { width: 24px; height: 1px; background: var(--ink-200); }
.pm-rail-label {
    position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    white-space: nowrap; font-size: 12px; font-weight: 600; color: #fff; background: var(--ink-900, #0f172a);
    padding: 5px 9px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .12s;
}
.pm-rail-btn:hover .pm-rail-label, .pm-rail-btn:focus-visible .pm-rail-label { opacity: 1; }


/* ------------------------------------------------------------------
 * Giliran Hari Ini: borang "Tunda ujian ke hari lain" (pemilik 10/11/2026).
 * ------------------------------------------------------------------ */
.tunda-dialog {
    width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--ink-200);
    border-radius: 14px; box-shadow: 0 20px 48px rgba(15, 23, 42, .22); background: var(--paper, #fff); color: var(--ink-900);
    text-align: left;
}
.tunda-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.tunda-form { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.tunda-form fieldset { border: 0; padding: 0; margin: 0; }
.tunda-form label > .ss-label, .tunda-form legend.ss-label { display: block; margin-bottom: 6px; }
.tunda-title { font-size: 18px; font-weight: 700; color: var(--ink-900); }
.tunda-sub { margin-top: 2px; font-size: 14px; color: var(--ink-600); }
.tunda-reasons { display: grid; gap: 6px; }
.tunda-reason {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--ink-200);
    border-radius: 10px; font-size: 15px; cursor: pointer; transition: border-color .12s, background .12s;
}
.tunda-reason:hover { background: var(--ink-050, #f8fafc); }
.tunda-reason:has(input:checked) { border-color: var(--brand-600); background: color-mix(in srgb, var(--brand-600) 8%, #fff); font-weight: 600; }
.tunda-reason input { width: 18px; height: 18px; accent-color: var(--brand-600); flex: none; }
.tunda-row { display: flex; gap: 12px; }
.tunda-col { flex: 1; min-width: 0; }
.tunda-hint { font-size: 13px; color: var(--ink-600); background: var(--ink-050, #f8fafc); border-radius: 8px; padding: 8px 10px; }
.tunda-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tunda-card { border-left: 4px solid #ea580c; }
.tunda-eyebrow { color: #9a3412; }

/* Giliran Hari Ini › Tindakan: dua baris tetap — utama di atas, jarang (Tidak Datang · Tunda ·
 * Padam) di bawah. Kumpulan kosong disorok supaya jarak menegak tidak berubah. */
.giliran-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.giliran-acts > div:not(:has(*)) { display: none; }
/* Butang teks (ghost) dirapatkan supaya lajur Tindakan tidak menyempitkan nama pesakit. */
.giliran-acts .ss-btn-ghost, .giliran-acts .ss-btn-ghost-danger { padding-left: 6px; padding-right: 6px; }
@media (min-width: 1280px) { .giliran-acts > div { flex-wrap: nowrap; } }

/* Giliran Hari Ini pada laptop kecil 1024–1279 px (semakan 10/11/2026): jadual
 * terlebih ~75 px dan perlu ditatal ke sisi. Jarak sel dirapatkan dan teks butang
 * boleh membalut, supaya semua lajur muat tanpa tatal. */
@media (max-width: 1279px) {
    .giliran-table th, .giliran-table td { padding-left: .5rem; padding-right: .5rem; }
    .giliran-table .giliran-acts .ss-btn { white-space: normal; text-align: center; }
}

/* Urus Tempahan (admin) — semakan 10/11/2026: jadual terlebih ~130 px pada 1024 px
 * dan tidak boleh dibaca di telefon. */
@media (min-width: 640px) and (max-width: 1279px) {
    .bk-table > thead > tr > th, .bk-table > tbody > tr > td { padding-left: .5rem; padding-right: .5rem; }
    .bk-table .bk-src .w-8 { display: none; }               /* bulatan inisial — nama sudah ada */
    .bk-table .bk-staff-btn { max-width: 8.5rem; }
    .bk-table .bk-type > span { display: inline-block; padding: .25rem .5rem; white-space: normal; border-radius: .5rem; line-height: 1.3; }
}
/* Telefon: setiap tempahan = kad kecil (Sumber penuh; Tarikh | Status; Jenis | Pax; Tindakan penuh). */
@media (max-width: 639px) {
    .bk-table, .bk-table > tbody { display: block; width: 100%; }
    .bk-table > thead { display: none; }
    .bk-table .bk-src > div > div { min-width: 0; }
    .bk-table .bk-act-wrap > * { flex: 0 1 auto; }
    .bk-table > tbody > tr.booking-row {
        display: grid; grid-template-columns: 1fr 1fr; column-gap: .75rem; row-gap: .5rem;
        padding: .875rem 1rem; border-bottom: 1px solid var(--ink-100);
    }
    .bk-table > tbody > tr.booking-row > td { display: block; padding: 0; text-align: left; min-width: 0; }
    .bk-table > tbody > tr.booking-row > td[data-label]::before {
        content: attr(data-label); display: block; font-size: 11px; font-weight: 500;
        color: var(--ink-500); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px;
    }
    .bk-table .bk-src { grid-column: 1 / -1; order: 1; }
    .bk-table .bk-date { order: 2; }
    .bk-table .bk-status { order: 3; }
    .bk-table .bk-type { order: 4; }
    .bk-table .bk-pax { order: 5; }
    .bk-table .bk-act { grid-column: 1 / -1; order: 6; min-width: 0 !important; }
    .bk-table .bk-act-wrap { justify-content: flex-start; }
    .bk-table .bk-pax > button { font-size: 1rem; }
    .bk-table > tbody > tr.booking-workers:not(.hidden) { display: block; }
    .bk-table > tbody > tr.booking-workers > td { display: block; padding: 0 .75rem .75rem; }
    /* Panel pekerja: lajur "Ujian terakhir" disorok (ada di Profil) supaya muat tanpa tatal. */
    .bk-table .booking-workers table th:nth-child(4), .bk-table .booking-workers table td:nth-child(4) { display: none; }
}

/* ============================================================
   Jadual (kalendar ketersediaan) — reka bentuk semula 10/11/2026
   ============================================================ */
.cal-page { max-width: 72rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; }
.cal-head { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 1024px) { .cal-head { flex-direction: row; align-items: flex-end; justify-content: space-between; } }
.cal-lead { max-width: 40rem; }
.cal-role { display: inline-block; vertical-align: middle; margin-left: .35rem; padding: .1rem .55rem; border-radius: 999px;
    background: var(--ink-100); color: var(--ink-600); font-size: var(--text-xs); font-weight: 600; letter-spacing: .02em; }
.cal-staff { display: flex; flex-wrap: wrap; gap: .4rem; }
.cal-staff-pill { display: inline-flex; flex-direction: column; padding: .4rem .8rem; border-radius: .6rem;
    border: 1px solid var(--ink-200); background: var(--paper); text-decoration: none; line-height: 1.2; transition: border-color .15s, background .15s; }
.cal-staff-pill:hover { border-color: var(--brand-500); }
.cal-staff-pill.is-active { border-color: var(--brand-600); background: var(--brand-050); box-shadow: inset 0 0 0 1px var(--brand-600); }
.cal-staff-name { font-size: var(--text-sm); font-weight: 600; color: var(--ink-900); }
.cal-staff-role { font-size: 11px; color: var(--ink-500); }

.cal-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .cal-layout { grid-template-columns: minmax(0, 1fr) 20rem; } }

.cal-card { padding: 1.25rem; }
@media (max-width: 639px) { .cal-card { padding: .9rem .75rem; } }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.cal-month { font-size: var(--text-xl); font-weight: 700; color: var(--ink-900); letter-spacing: -.01em; margin: 0; }
.cal-count { font-size: var(--text-sm); color: var(--ink-500); margin: .1rem 0 0; }
.cal-nav { display: flex; align-items: center; gap: .25rem; }
.cal-nav-btn { width: 2.1rem; height: 2.1rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .5rem;
    border: 1px solid var(--ink-200); color: var(--ink-700); background: var(--paper); }
.cal-nav-btn:hover { border-color: var(--ink-300); background: var(--ink-050); }
.cal-nav-btn svg { width: 1rem; height: 1rem; }
.cal-nav-today { height: 2.1rem; display: inline-flex; align-items: center; padding: 0 .8rem; border-radius: .5rem;
    border: 1px solid var(--ink-200); font-size: var(--text-sm); font-weight: 600; color: var(--ink-700); text-decoration: none; }
.cal-nav-today:hover { background: var(--ink-050); }
.cal-nav-today { white-space: nowrap; }
@media (max-width: 639px) {
    .cal-toolbar { gap: .5rem; }
    .cal-month { font-size: var(--text-lg); white-space: nowrap; }
    .cal-nav-btn, .cal-nav-today { height: 2rem; }
    .cal-nav-btn { width: 2rem; }
    .cal-nav-today { padding: 0 .6rem; }
}

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; }
.cal-weekdays { margin-bottom: .4rem; }
.cal-weekdays > div { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); padding: .25rem 0; }
.cal-weekdays > .cal-wd-closed { color: var(--ink-300); }

.cal-day { position: relative; min-height: 5rem; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem;
    padding: .45rem .5rem; border-radius: .6rem; border: 1px solid var(--ink-200); background: var(--paper); text-align: left;
    color: var(--ink-800); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.cal-day:hover:not(:disabled) { border-color: var(--brand-500); }
.cal-day:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.cal-day.is-outside { border: 0; background: transparent; cursor: default; }
.cal-day.is-past { background: var(--ink-050); color: var(--ink-300); border-color: transparent; cursor: default; }
.cal-day.is-closed:not(.is-on):not(.is-past) { background: repeating-linear-gradient(135deg, var(--ink-050) 0 6px, var(--paper) 6px 12px); color: var(--ink-400); }
.cal-day.is-on { background: var(--brand-050); border-color: var(--brand-600); box-shadow: inset 3px 0 0 var(--brand-600); color: var(--ink-900); }
.cal-day-num { font-size: var(--text-sm); font-weight: 600; line-height: 1.6rem; }
.cal-day.is-today .cal-day-num { min-width: 1.6rem; height: 1.6rem; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 .3rem; border-radius: 999px; background: var(--ink-900); color: var(--paper); }
.cal-day-time { font-size: 11px; font-weight: 600; color: var(--brand-700); line-height: 1.2; }
.cal-day-note { font-size: 11px; color: var(--ink-400); }
.cal-day-booked { margin-top: auto; display: inline-flex; align-items: center; gap: .3rem; font-size: 11px; font-weight: 600; color: var(--info-600); line-height: 1.2; }
.cal-day-booked.is-confirmed { color: var(--watch-700); }
.cal-dot { width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; flex-shrink: 0; }
@media (max-width: 639px) {
    .cal-grid { gap: .25rem; }
    .cal-day { min-height: 3.4rem; padding: .3rem; align-items: center; }
    .cal-day-time, .cal-day-note, .cal-day-booked-text { display: none !important; }
    .cal-day-booked { position: absolute; right: .3rem; top: .3rem; margin: 0; }
    .cal-day.is-on::after { content: ""; width: 1.1rem; height: .2rem; border-radius: 999px; background: var(--brand-600); margin-top: auto; }
}

.cal-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--ink-100);
    font-size: var(--text-xs); color: var(--ink-500); }
.cal-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.cal-key { width: .8rem; height: .8rem; border-radius: .25rem; border: 1px solid var(--ink-200); display: inline-block; }
.cal-key.is-on { background: var(--brand-050); border-color: var(--brand-600); box-shadow: inset 2px 0 0 var(--brand-600); }
.cal-key.is-booked { border: 0; border-radius: 999px; width: .5rem; height: .5rem; background: var(--watch-700); }
.cal-key.is-today { border: 0; border-radius: 999px; background: var(--ink-900); }
.cal-key.is-closed { background: repeating-linear-gradient(135deg, var(--ink-100) 0 3px, var(--paper) 3px 6px); }

.cal-side { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 1024px) { .cal-side { position: sticky; top: 1rem; } }
.cal-panel { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem; }
.cal-panel-title { display: flex; align-items: center; justify-content: space-between; margin: 0; font-size: var(--text-sm); font-weight: 700; color: var(--ink-900); }
.cal-panel-count { min-width: 1.5rem; padding: 0 .45rem; border-radius: 999px; background: var(--ink-100); color: var(--ink-700); font-size: var(--text-xs); text-align: center; line-height: 1.4rem; }
.cal-quick { display: flex; flex-wrap: wrap; gap: .5rem; }
.cal-hours { display: flex; flex-direction: column; gap: .4rem; }
.cal-range { display: inline-flex; align-items: center; gap: .35rem; }
.cal-range-dash { color: var(--ink-400); }
.ss-field.cal-time { width: 5.4rem; height: 2.1rem; padding: 0 .5rem; font-size: var(--text-sm); }
.cal-link { align-self: flex-start; background: none; border: 0; padding: 0; font-size: var(--text-sm); font-weight: 600; color: var(--brand-700); cursor: pointer; }
.cal-link:hover { text-decoration: underline; }
.cal-empty { font-size: var(--text-sm); color: var(--ink-500); margin: 0; }
.cal-list { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow-y: auto; }
.cal-list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem .5rem; padding: .5rem 0; border-top: 1px solid var(--ink-100); }
.cal-list-row:first-child { border-top: 0; }
.cal-list-day { font-size: var(--text-sm); font-weight: 600; color: var(--ink-800); }
.cal-remove { width: 1.8rem; height: 1.8rem; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: .4rem;
    background: transparent; color: var(--ink-400); cursor: pointer; }
.cal-remove:hover { background: var(--alert-100); color: var(--alert-600); }
.cal-remove svg { width: .9rem; height: .9rem; }
.cal-bookings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.cal-bookings li { display: flex; gap: .7rem; font-size: var(--text-sm); color: var(--ink-800); }
.cal-bk-date { flex-shrink: 0; width: 3rem; padding: .15rem 0; border-radius: .4rem; background: var(--watch-100); color: var(--watch-700);
    font-size: var(--text-xs); font-weight: 700; text-align: center; height: fit-content; }
.cal-bk-meta { color: var(--ink-500); font-size: var(--text-xs); }
.cal-save { display: flex; flex-direction: column; gap: .5rem; }

/* Dialog "Pilih tarikh ujian" — hari tersedia staf (pemilik 10/11/2026) */
.pick-staff { display: flex; align-items: center; gap: .5rem; font-size: var(--text-sm); color: var(--ink-700); }
.pick-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: .4rem; max-height: 15rem; overflow-y: auto; padding: .1rem; }
.pick-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; padding: .45rem .3rem; border-radius: .6rem;
    border: 1px solid var(--ink-200); background: var(--paper); cursor: pointer; line-height: 1.25; transition: border-color .15s, background .15s; }
.pick-day:hover { border-color: var(--brand-500); }
.pick-day input { position: absolute; opacity: 0; pointer-events: none; }
.pick-day:has(input:checked) { border-color: var(--brand-600); background: var(--brand-050); box-shadow: inset 0 0 0 1px var(--brand-600); }
.pick-day:has(input:focus-visible) { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.pick-day-wd { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-500); }
.pick-day-date { font-size: var(--text-sm); font-weight: 700; color: var(--ink-900); }
.pick-day-slots { font-size: 11px; color: var(--brand-700); }
.pick-day.is-picked { border-color: var(--brand-600); background: var(--brand-050); box-shadow: inset 0 0 0 1px var(--brand-600); }
button.pick-day { font: inherit; }
.tunda-avail { display: flex; flex-direction: column; gap: .5rem; }
.tunda-avail .pick-days { max-height: 9.5rem; }
.pick-empty { padding: .8rem 1rem; border-radius: .6rem; border: 1px dashed var(--ink-300); font-size: var(--text-sm); color: var(--ink-600); }

/* Jadual klinik (pemilik 11/11/2026) — hari tutup mingguan + tarikh khas */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.cal-wk { position: relative; display: flex; align-items: center; justify-content: center; height: 2.3rem; border-radius: .5rem;
    border: 1px solid var(--ink-200); background: var(--paper); font-size: var(--text-xs); font-weight: 600; color: var(--ink-700);
    cursor: pointer; transition: border-color .15s, background .15s; }
.cal-wk:hover { border-color: var(--ink-400); }
.cal-wk input { position: absolute; opacity: 0; pointer-events: none; }
.cal-wk:has(input:checked) { background: repeating-linear-gradient(135deg, var(--ink-100) 0 5px, var(--paper) 5px 10px);
    border-color: var(--ink-500); color: var(--ink-900); box-shadow: inset 0 0 0 1px var(--ink-500); }
.cal-wk:has(input:focus-visible) { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.cal-day.is-special:not(.is-past) { border-style: dashed; border-color: var(--ink-500); }
.cal-day.is-special:not(.is-closed) .cal-day-time { color: var(--brand-700); }
.cal-key.is-special { border: 1px dashed var(--ink-500); }
.cal-tag { padding: .1rem .5rem; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; }
.cal-tag.is-closed { background: var(--ink-100); color: var(--ink-700); }
.cal-tag.is-open { background: var(--brand-050); color: var(--brand-700); }
.cal-bk-date.is-open { background: var(--brand-050); color: var(--brand-700); }

/* ============================================================
   Invois & bayaran klien (HR + klinik rakan) — pemilik 11/11/2026
   ============================================================ */
.inv-page { display: flex; flex-direction: column; gap: 1.25rem; max-width: 64rem; }
.inv-summary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (min-width: 1024px) { .inv-summary { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.inv-owed { border-left: 3px solid var(--alert-600); }
.inv-owed.is-clear { border-left-color: var(--normal-600, var(--brand-600)); }
.inv-owed-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-top: .25rem; }
.inv-owed-sub { font-size: var(--text-sm); color: var(--ink-500); }
.inv-owed-sub b { font-weight: 500; color: var(--ink-900); }
.inv-owed-note { font-size: var(--text-sm); color: var(--ink-500); margin-top: .75rem; }
.inv-sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .875rem 1.25rem; border-bottom: 1px solid var(--ink-100); }
.inv-sec-h h2, .inv-h2 { font-weight: 600; color: var(--ink-900); }
.inv-sec-h span { font-size: var(--text-sm); color: var(--ink-500); }
.inv-list { list-style: none; margin: 0; padding: 0; }
.inv-list > li + li { border-top: 1px solid var(--ink-100); }
.inv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1.25rem; padding: 1rem 1.25rem; align-items: start; }
@media (min-width: 640px) { .inv-row { grid-template-columns: minmax(0, 1fr) 9rem; } }
.inv-what { font-weight: 600; color: var(--ink-900); }
.inv-meta { font-size: .8125rem; line-height: 1.5; color: var(--ink-500); margin-top: .125rem; }
.inv-meta b { font-weight: 500; color: var(--ink-700); white-space: nowrap; }
.inv-amt { text-align: right; font-weight: 600; color: var(--ink-900); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 1.0625rem; }
.inv-state { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; margin-top: .5rem; }
.inv-state-text { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--ink-600, var(--ink-500)); }
.inv-acts { display: flex; flex-wrap: wrap; gap: .5rem; }
.inv-error { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--alert-600); }
.inv-muted .inv-what, .inv-muted .inv-amt { color: var(--ink-500); }
.inv-muted .inv-amt { text-decoration: line-through; }
.inv-empty-line { padding: 1rem 1.25rem; font-size: var(--text-sm); color: var(--ink-500); }
.inv-preparing { padding: .75rem 1.25rem; font-size: var(--text-sm); color: var(--ink-500); background: var(--ink-050); border-top: 1px solid var(--ink-100); }
.inv-howto { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
@media (min-width: 768px) { .inv-howto { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.inv-steps { margin: .75rem 0 0; padding-left: 1.25rem; list-style: decimal; display: flex; flex-direction: column; gap: .5rem; font-size: var(--text-sm); color: var(--ink-700); }
.inv-steps b { font-weight: 500; }
.inv-pay { font-size: var(--text-sm); }
.inv-pay dt { font-size: var(--text-xs); color: var(--ink-500); }
.inv-pay dd { font-weight: 500; color: var(--ink-900); margin: 0 0 .625rem; }
.inv-contact { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; padding: .75rem 1.25rem; font-size: var(--text-sm); color: var(--ink-500); border-top: 1px solid var(--ink-100); }
.inv-contact b { font-weight: 500; color: var(--ink-700); }
@media (max-width: 639px) {
    .inv-row { padding: .9rem 1rem; }
    .inv-sec-h, .inv-preparing, .inv-contact, .inv-empty-line { padding-left: 1rem; padding-right: 1rem; }
    .inv-acts { width: 100%; }
}

/* Urus Tempahan: pekerja tunda & amaran (pemilik 11/11/2026, kes MAHYUDIN) */
.bk-follow { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin-top: .3rem; font-size: var(--text-sm); color: var(--ink-900); }
.bk-flags > td { padding: 0 1rem .9rem; }
.bk-flag { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; font-size: var(--text-sm); }
.bk-flag + .bk-flag { margin-top: .4rem; }
@media (max-width: 767px) {
    .bk-table > tbody > tr.bk-flags { display: block; border: 0; padding: 0; }
    .bk-table > tbody > tr.bk-flags > td { display: block; padding: 0 .5rem .75rem; }
}

/* Invois kumpulan menunggu pekerja tunda (pemilik 11/11/2026) */
.bk-group-wait { margin-top: .35rem; display: flex; flex-direction: column; align-items: center; gap: .2rem;
    font-size: 11px; font-weight: 600; color: var(--watch-700); line-height: 1.3; }
.bk-group-btn { font-size: 11px; font-weight: 600; color: var(--ink-600); text-decoration: underline; background: none; border: 0; cursor: pointer; }
.bk-group-btn:hover { color: var(--ink-900); }

/* Giliran Hari Ini: subtab Belum Selesai / Selesai (pemilik 11/11/2026) */
.giliran-tabs { display: flex; gap: .25rem; padding: .6rem 1.25rem 0; border-bottom: 1px solid var(--ink-200); background: var(--paper); }
.giliran-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .9rem .65rem; margin-bottom: -1px;
    font-size: var(--text-sm); font-weight: 600; color: var(--ink-500); background: none; border: 0;
    border-bottom: 2px solid transparent; cursor: pointer; transition: color .15s, border-color .15s; }
.giliran-tab:hover { color: var(--ink-900); }
.giliran-tab.is-active { color: var(--ink-900); border-bottom-color: var(--brand-600); }
.giliran-tab-count { min-width: 1.5rem; padding: 0 .45rem; border-radius: 999px; background: var(--ink-100); color: var(--ink-700);
    font-size: var(--text-xs); line-height: 1.35rem; text-align: center; }
.giliran-tab.is-active .giliran-tab-count { background: var(--brand-050); color: var(--brand-700); }
.giliran-tab-empty { padding: 1.5rem 1.25rem; text-align: center; font-size: var(--text-sm); color: var(--ink-500); }
@media (max-width: 639px) { .giliran-tabs { padding: .5rem .75rem 0; } .giliran-tab { flex: 1; justify-content: center; } }

/* NRA baharu belum disemak (pemilik 11/11/2026) */
.nra-new { background: var(--watch-100, #fef3c7); }
.nra-new-card { border-color: var(--watch-700) !important; box-shadow: 0 0 0 1px var(--watch-700); }
.nra-new-tag { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; font-size: var(--text-sm); color: var(--ink-700); }

/* Komen audiologist AI: label model (pemilik 14/11/2026) */
.ai-model-tag { display: inline-block; margin-left: .35rem; padding: 0 .45rem; border-radius: 999px; font-size: 10px; font-weight: 600;
    line-height: 1.1rem; vertical-align: 1px; background: var(--ink-100); color: var(--ink-700); }
.ai-model-tag.is-sonnet { background: #ede9fe; color: #5b21b6; }
.ai-model-tag.is-gemini { background: var(--watch-100, #fef3c7); color: var(--watch-700, #92400e); }
