/* ============================================================================
   HTIT · HSSE Field — HỆ THỐNG THIẾT KẾ v2 (Đợt 8 — UI v2 & responsive)
   Một nguồn token theo VAI TRÒ (semantic). Sáng / Tối / Ngoài trời / Ca đêm CHỈ định nghĩa lại token.
   Brand HTIT: navy #436AB3 (+ #2E4E88 / #1E3A6E / #152A52) · gold #E7CF7F (active) · font Barlow.
   Breakpoint (mobile-first): xs <480 · sm ≥480 · md ≥768 · lg ≥1024 · xl ≥1440 · 2xl ≥1920.
   KHÔNG co font-size gốc (html) theo màn hình. Chữ thân ≥14px, ô nhập ≥16px trên màn ≤900px.
   Tên token cũ (--navy, --ink, --muted, --line, --card, --err…) giữ làm ALIAS để không vỡ trang cũ.
   Contrast (WCAG 2.2, đã tính): chữ thường ≥4.5:1 trên --bg và --surface-1 ở mọi chế độ.
   ============================================================================ */

/* ---------------------------------------------------------------- 1. TOKEN */
:root {
    color-scheme: light;

    /* Thang thương hiệu — CỐ ĐỊNH, không lật theo chế độ */
    --brand-500: #436AB3; --brand-600: #2E4E88; --brand-700: #1E3A6E; --brand-800: #152A52; --brand-900: #0B1C39;
    --gold-300: #ECD391; --gold-400: #E7CF7F; --gold-600: #D8982C; --gold-ink: #9A5B00;

    /* Bề mặt & chữ (Sáng) */
    --bg: #F3F6FB;
    --surface-1: #FFFFFF;          /* thẻ */
    --surface-2: #F7F9FC;          /* nền phụ, header bảng */
    --surface-3: #EDF2FA;          /* hover, tint */
    --border: #E1E7F0;
    --border-soft: #EDF1F7;
    --border-strong: #C9D3E2;
    --field-border: #7D8CA3;       /* viền ô nhập ≥3:1 (WCAG 1.4.11) */
    --text-1: #0F1B2E;             /* 17.3:1 */
    --text-1s: #2A3A52;            /* chữ thân mềm hơn — 11:1 */
    --text-2: #5B6B82;             /* phụ — 5.43:1 trắng / 5.0:1 bg */
    --text-3: #7B8AA0;             /* placeholder/disabled — chỉ chữ ≥18px hoặc không thiết yếu */
    --primary: #436AB3;            /* 5.3:1 với chữ trắng */
    --primary-strong: #2E4E88;     /* tiêu đề, link — 8.6:1 */
    --on-primary: #FFFFFF;
    --accent: #E7CF7F;             /* active */
    --on-accent: #152A52;          /* 10:1 */

    --danger: #C62828;  --danger-bg: #FDECEC;  --danger-line: #F2C1BB;
    --warning: #9A5B00; --warning-bg: #FFF4E0; --warning-line: #EBCB8F;
    --success: #1E7A46; --success-bg: #E8F5EE; --success-line: #B7E0C6;
    --info: #3D63AA;    --info-bg: #EAF0FA;    --info-line: #C9D8F2;

    --focus-color: #2E4E88;
    --overlay: rgba(11, 28, 57, .52);

    /* Vỏ ứng dụng (header Field, sidebar Admin) */
    --chrome-bg: linear-gradient(180deg, #152A52 0%, #1E3A6E 100%);
    --chrome-solid: #1E3A6E;
    --chrome-ink: #FFFFFF;
    --chrome-ink-2: rgba(255, 255, 255, .80);
    --chrome-line: rgba(255, 255, 255, .14);
    --chrome-hover: rgba(255, 255, 255, .10);

    /* Ngữ nghĩa nghiệp vụ — THỐNG NHẤT mọi màn (HeatMap / Stats / Records / Detail / Field) */
    --kind-obs: var(--primary);      /* Quan sát = navy */
    --kind-inc: var(--danger);       /* Sự cố = đỏ */
    --kind-nearmiss: var(--warning);
    --lv-hi: var(--danger);          /* Cao (≥4) */
    --lv-mid: var(--warning);        /* Trung bình (3) */
    --lv-lo: var(--success);         /* Thấp (1–2) */
    --lv-none: var(--text-3);
    --s-obs: #436AB3; --s-inc: #C62828;  /* chuỗi biểu đồ */

    /* Thang nhiệt tuần tự 1 hue ấm (an toàn mù màu hơn cầu vồng) — đồng bộ hsse-map.js */
    --heat-0: #FFF3C4; --heat-1: #F9D57A; --heat-2: #F2B24C; --heat-3: #E3762B; --heat-4: #C62828; --heat-5: #7F1D1D;
    --heat-scale: linear-gradient(90deg, #FFF3C4 0%, #F9D57A 20%, #F2B24C 40%, #E3762B 60%, #C62828 80%, #7F1D1D 100%);

    /* Biểu đồ */
    --chart-axis: #5B6B82; --chart-grid: #EDF1F7; --chart-grid-strong: #D5DDE9; --chart-muted: #9AA7BC;

    /* Typography (Barlow self-host 400–800) */
    --font-sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --text-xs: .75rem;                                           /* 12px — nhãn phụ tối thiểu */
    --text-sm: clamp(.875rem, .86rem + .08vw, .9375rem);         /* 14–15px — meta, bảng */
    --text-md: clamp(1rem, .97rem + .1vw, 1.0625rem);            /* 16–17px — chữ thân */
    --text-lg: clamp(1.125rem, 1.07rem + .25vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.1rem + .6vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.25rem + 1vw, 2rem);
    --text-kpi: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
    --text-display: clamp(2.25rem, 1.5rem + 3vw, 4.5rem);
    --lh-tight: 1.15; --lh-body: 1.5;

    /* Spacing 4pt */
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px;
    --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;
    --gutter: clamp(16px, 4vw, 32px);
    --stack: clamp(16px, 2.5vw, 24px);

    /* Radius */
    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 24px; --radius-full: 999px;

    /* Elevation */
    --elev-0: none;
    --elev-1: 0 1px 2px rgba(15, 27, 46, .06), 0 1px 3px rgba(15, 27, 46, .04);
    --elev-2: 0 4px 12px rgba(15, 27, 46, .08), 0 2px 4px rgba(15, 27, 46, .05);
    --elev-3: 0 16px 40px rgba(15, 27, 46, .18);
    --border-w: 1px;

    /* Motion */
    --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
    --ease-standard: cubic-bezier(.2, 0, 0, 1);
    --ease-emphasized: cubic-bezier(.3, 0, 0, 1.15);
    --ease-exit: cubic-bezier(.3, 0, 1, 1);

    /* Chạm */
    --tap-min: 44px;
    --tap-field: 48px;
    --chevron: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6B82' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

    /* ---- ALIAS tên cũ (Đợt 1–7) → token v2. Không dùng cho mã mới. ---- */
    --navy: var(--primary-strong); --navy-2: var(--brand-700); --navy-3: var(--brand-800); --navy-light: var(--primary);
    --gold: var(--gold-300); --gold-mid: var(--gold-400); --gold-deep: var(--gold-600); --gold-deep-2: #C2851F;
    --gold-text: var(--gold-ink);
    --ink: var(--text-1); --ink-soft: var(--text-1s); --muted: var(--text-2);
    --line: var(--border); --line-soft: var(--border-soft); --hairline: var(--border);
    --card: var(--surface-1); --surface: var(--surface-2); --surface-tint: var(--surface-3);
    --tint-navy: color-mix(in srgb, var(--primary) 8%, transparent);
    --tint-gold: color-mix(in srgb, var(--gold-600) 10%, transparent);
    --ok: var(--success); --ok-bg: var(--success-bg); --ok-line: var(--success-line);
    --warn: var(--warning); --warn-bg: var(--warning-bg); --warn-line: var(--warning-line);
    --err: var(--danger); --err-bg: var(--danger-bg); --err-line: var(--danger-line);
    --danger-solid: var(--danger);
    --tint-info: var(--info-bg); --on-info: var(--info);
    --tint-warn: var(--warning-bg); --on-warn: var(--warning); --warn-border: var(--warning-line);
    --r-xs: 6px; --r-sm: var(--radius-sm); --r-md: var(--radius-md); --r-lg: var(--radius-lg); --r-pill: var(--radius-full);
    --sh-xs: var(--elev-1); --sh-sm: var(--elev-1); --sh-md: var(--elev-2); --sh-lg: var(--elev-3); --sh-hover: var(--elev-2);
    --focus: 0 0 0 3px color-mix(in srgb, var(--focus-color) 30%, transparent);
    --focus-navy: var(--focus);
}

/* ---- Tối ---- */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0B1422; --surface-1: #121C2E; --surface-2: #172338; --surface-3: #1D2A42;
    --border: #26354F; --border-soft: #1D2A42; --border-strong: #34466A; --field-border: #5E7396;
    --text-1: #E6ECF5; --text-1s: #C9D3E3; --text-2: #A9B6CC; --text-3: #8B98AD;
    --primary: #7FA3E6; --primary-strong: #9DBAF0; --on-primary: #0B1422;
    --danger: #F08A80;  --danger-bg: rgba(240, 138, 128, .14); --danger-line: rgba(240, 138, 128, .38);
    --warning: #F2B24C; --warning-bg: rgba(242, 178, 76, .14);  --warning-line: rgba(242, 178, 76, .38);
    --success: #5FD08F; --success-bg: rgba(95, 208, 143, .14);  --success-line: rgba(95, 208, 143, .38);
    --info: #8DB0EE;    --info-bg: rgba(127, 163, 230, .14);    --info-line: rgba(127, 163, 230, .38);
    --focus-color: #E7CF7F;
    --overlay: rgba(0, 0, 0, .62);
    --gold-ink: #E7CF7F;
    --chrome-bg: linear-gradient(180deg, #0E1A30 0%, #12213D 100%);
    --chrome-solid: #0E1A30;
    --s-obs: #7FA3E6; --s-inc: #F08A80;
    --chart-axis: #A9B6CC; --chart-grid: #1D2A42; --chart-grid-strong: #26354F; --chart-muted: #6B7A93;
    --elev-1: 0 0 0 1px var(--border);
    --elev-2: 0 0 0 1px var(--border-strong), 0 8px 24px rgba(0, 0, 0, .45);
    --elev-3: 0 16px 48px rgba(0, 0, 0, .6);
    --chevron: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A9B6CC' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ---- Ngoài trời (nắng gắt) — tương phản rất cao, viền 2px, tắt bóng/gradient/glass ---- */
:root[data-mode="outdoor"] {
    color-scheme: light;
    --bg: #FFFFFF; --surface-1: #FFFFFF; --surface-2: #F2F4F7; --surface-3: #E6EAF0;
    --border: #5B6B82; --border-soft: #8A96A8; --border-strong: #1F2A3A; --field-border: #1F2A3A;
    --text-1: #000000; --text-1s: #0B0F17; --text-2: #1F2A3A; --text-3: #3B4758;
    --primary: #003A8C; --primary-strong: #002A66; --on-primary: #FFFFFF;   /* 10.6:1 */
    --accent: #FFD84D; --on-accent: #000000;                                 /* 15:1 */
    --danger: #B00020;  --danger-bg: #FFE3E6;  --danger-line: #B00020;       /* 7.3:1 */
    --warning: #6B3D00; --warning-bg: #FFEFC7; --warning-line: #6B3D00;
    --success: #0B5A2E; --success-bg: #DDF3E5; --success-line: #0B5A2E;
    --info: #003A8C;    --info-bg: #E1EAFA;    --info-line: #003A8C;
    --focus-color: #000000;
    --gold-ink: #6B3D00;
    --chrome-bg: #002A66; --chrome-solid: #002A66; --chrome-ink-2: #FFFFFF; --chrome-line: rgba(255, 255, 255, .5);
    --s-obs: #003A8C; --s-inc: #B00020;
    --chart-axis: #1F2A3A; --chart-grid: #C9D1DC; --chart-grid-strong: #5B6B82;
    --elev-1: none; --elev-2: 0 0 0 2px #1F2A3A; --elev-3: 0 0 0 2px #000;
    --border-w: 2px;
    --text-md: clamp(1.0625rem, 1.04rem + .1vw, 1.125rem);   /* 17–18px */
    --text-sm: clamp(.9375rem, .92rem + .08vw, 1rem);
    --chevron: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
:root[data-mode="outdoor"] body { font-weight: 500; }

/* ---- Ca đêm — nền rất tối, tông ấm, không trắng thuần (giữ thích nghi bóng tối) ---- */
:root[data-mode="night"] {
    color-scheme: dark;
    --bg: #05080F; --surface-1: #0B1018; --surface-2: #0F151F; --surface-3: #151C28;
    --border: #232C3A; --border-soft: #151C28; --border-strong: #2F3A4C; --field-border: #5E6878;
    --text-1: #D6D0C4; --text-1s: #C4BDAF; --text-2: #A39C8E; --text-3: #877F72;
    --primary: #C9A86A; --primary-strong: #D8BC85; --on-primary: #05080F;
    --accent: #C9A86A; --on-accent: #05080F;
    --danger: #E58A7E;  --danger-bg: rgba(229, 138, 126, .13); --danger-line: rgba(229, 138, 126, .36);
    --warning: #D9A55A; --warning-bg: rgba(217, 165, 90, .13);  --warning-line: rgba(217, 165, 90, .36);
    --success: #8FBF8A; --success-bg: rgba(143, 191, 138, .13); --success-line: rgba(143, 191, 138, .36);
    --info: #9FB3C8;    --info-bg: rgba(159, 179, 200, .13);    --info-line: rgba(159, 179, 200, .36);
    --kind-obs: #9FB3C8;   /* xanh xám, tách khỏi vàng "trung bình" */
    --focus-color: #C9A86A;
    --gold-ink: #D8BC85;
    --chrome-bg: #0A0D14; --chrome-solid: #0A0D14; --chrome-ink: #D6D0C4; --chrome-ink-2: #A39C8E;
    --chrome-line: rgba(214, 208, 196, .12); --chrome-hover: rgba(214, 208, 196, .08);
    --s-obs: #9FB3C8; --s-inc: #E58A7E;
    --chart-axis: #A39C8E; --chart-grid: #151C28; --chart-grid-strong: #232C3A; --chart-muted: #5E6878;
    --overlay: rgba(0, 0, 0, .7);
    --chevron: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A39C8E' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- 2. NỀN (base) */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh;
    font-family: var(--font-sans); font-size: var(--text-md); line-height: var(--lh-body);
    color: var(--text-1); background: var(--bg);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
}
img, svg, video, canvas, iframe { max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--primary-strong); }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
h1, h2, h3 { line-height: var(--lh-tight); }
h1:focus, h1:focus-visible { outline: none; }     /* FocusOnNavigate focus h1 — không tương tác */
:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
::placeholder { color: var(--text-3); opacity: 1; }
::selection { background: color-mix(in srgb, var(--primary) 28%, transparent); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
        transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }

/* Ô nhập trên màn ≤900px: ≥16px để iOS Safari KHÔNG tự phóng to khi focus (UX-11) */
@media (max-width: 900px) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: max(16px, 1rem) !important; }
}

/* PortIcon */
.pico { display: inline-block; vertical-align: -.14em; flex: 0 0 auto; }
.pico-color { vertical-align: -.14em; }
.pico-emoji { font-style: normal; line-height: 1; }

/* A11y */
.visually-hidden, .sr-only {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important;
}
.skip-link {
    position: fixed; left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); z-index: 2000;
    background: var(--surface-1); color: var(--text-1); padding: 10px 16px; border-radius: var(--radius-sm);
    font-weight: 700; text-decoration: none; box-shadow: var(--elev-3);
    /* Đẩy lên quá cả vùng tai thỏ: chỉ -160% thì trên iPhone (safe-area-top ~59px) vẫn lòi xuống dưới thanh trạng thái. */
    transform: translateY(calc(-100% - max(8px, env(safe-area-inset-top)) - 8px));
}
.skip-link:focus { transform: none; }

/* ---------------------------------------------------------------- 3. THÀNH PHẦN CHUNG */
/* Nút */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; position: relative;
    min-height: var(--tap-min); padding: .55rem 1rem; border: var(--border-w) solid var(--border-strong);
    border-radius: var(--radius-md); background: var(--surface-1); color: var(--text-1);
    font-weight: 700; font-size: var(--text-sm); line-height: 1.2; text-decoration: none; text-align: center;
    transition: background var(--dur-1) var(--ease-standard), border-color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; transform: none; }
.btn-primary, .btn[data-variant="primary"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover, .btn[data-variant="primary"]:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-ghost, .btn[data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--primary-strong); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger, .btn[data-variant="danger"] { background: var(--surface-1); border-color: var(--danger-line); color: var(--danger); }
.btn-gold, .btn[data-variant="gold"] { background: linear-gradient(135deg, var(--gold-300), var(--gold-400)); border-color: var(--gold-600); color: var(--on-accent); }
.btn-sm { min-height: 36px; padding: .35rem .7rem; font-size: var(--text-xs); }
@media (pointer: coarse) { .btn-sm { min-height: var(--tap-min); } }

.icon-btn {
    position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
    width: var(--tap-min); height: var(--tap-min); padding: 0; border: 0; border-radius: var(--radius-md);
    background: transparent; color: inherit; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-3); }

/* Segmented control (2D|3D, 7|30|90, Bảng|Lưới) — nhãn được phép xuống dòng (EN dài hơn VI) */
.segmented {
    display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px;
    border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface-1); max-width: 100%;
}
.segmented > button, .segmented > a {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 38px; min-width: 0;
    padding: .35rem .8rem; border: 0; border-radius: calc(var(--radius-md) - 3px); background: transparent;
    color: var(--text-2); font-weight: 700; font-size: var(--text-sm); line-height: 1.15; text-align: center;
    white-space: normal; text-wrap: balance; text-decoration: none;
    transition: background var(--dur-1), color var(--dur-1);
}
/* Hover: tô xanh nhạt + chữ xanh đậm + viền xanh mảnh — trước đây surface-3 trên nền surface-2 gần trùng màu nên "chìm" */
.segmented > button:not(.on):not([aria-pressed="true"]):hover, .segmented > a:not(.on):not([aria-current="true"]):hover {
    color: var(--primary-strong); background: color-mix(in srgb, var(--primary) 12%, var(--surface-1));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}
.segmented > button:focus-visible, .segmented > a:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 1px; }
.segmented > .on, .segmented > [aria-pressed="true"], .segmented > [aria-current="true"] {
    background: var(--primary); color: var(--on-primary); box-shadow: var(--elev-1);
}
@media (pointer: coarse) { .segmented > button, .segmented > a { min-height: var(--tap-min); } }

/* Chip (bộ lọc đang áp dụng) */
.chip {
    display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; max-width: 100%;
    padding: .2rem .35rem .2rem .7rem; border: var(--border-w) solid var(--border); border-radius: var(--radius-full);
    background: var(--surface-2); color: var(--text-1); font-size: var(--text-xs); font-weight: 700;
}
.chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip > button {
    position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; flex: 0 0 auto;
    border: 0; border-radius: 50%; background: var(--surface-3); color: var(--text-2);
}
.chip > button::after { content: ""; position: absolute; inset: -10px; }   /* vùng chạm ≥44px */
.chip > button:hover { color: var(--danger); }

/* Pill mức rủi ro — Cao / TB / Thấp THỐNG NHẤT */
.pill {
    display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .55rem; border-radius: var(--radius-full);
    border: 1px solid transparent; font-size: var(--text-xs); font-weight: 800; line-height: 1.35; white-space: nowrap;
}
.pill.lv-hi { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.pill.lv-mid { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.pill.lv-lo { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.pill.lv-none { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.pill.lv-safe { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }   /* mức 0 — An toàn (phiếu Không phát hiện mối nguy) */
/* Trạng thái xử lý */
.status {
    display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .5rem; border-radius: var(--radius-sm);
    font-size: var(--text-xs); font-weight: 700; line-height: 1.35; white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status.t-new { background: var(--info-bg); color: var(--info); }
.status.t-work { background: var(--warning-bg); color: var(--warning); }
.status.t-done { background: var(--success-bg); color: var(--success); }
/* Loại sự vụ — quan sát navy / sự cố đỏ */
.kind-tag {
    display: inline-block; padding: .05rem .4rem; border-radius: 5px; font-size: var(--text-xs); font-weight: 800;
    line-height: 1.4; vertical-align: 1px; white-space: nowrap;
}
.kind-tag.obs { background: var(--info-bg); color: var(--kind-obs); }
.kind-tag.inc { background: var(--danger-bg); color: var(--kind-inc); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--lv-none); }
.dot.lv-hi { background: var(--lv-hi); } .dot.lv-mid { background: var(--lv-mid); } .dot.lv-lo { background: var(--lv-lo); }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; display: block; min-height: 14px; border-radius: 6px; background: var(--surface-3); }
.skeleton-line { height: 12px; margin: 8px 0; }
.skeleton-line.w-40 { width: 40%; } .skeleton-line.w-60 { width: 60%; } .skeleton-line.w-80 { width: 80%; }
@media (prefers-reduced-motion: no-preference) {
    .skeleton::after {
        content: ""; position: absolute; inset: 0; transform: translateX(-100%);
        background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-1) 60%, transparent), transparent);
        animation: shimmer 1.3s infinite;
    }
}

/* Trạng thái trang: rỗng / lỗi / không quyền — dùng chung Admin (+ Field nếu cần) */
.state {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
    padding: clamp(24px, 5vw, 44px) var(--space-4); text-align: center; color: var(--text-2);
}
.state-ic {
    display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: .35rem; border-radius: 50%;
    background: var(--surface-3); color: var(--primary);
}
.state-title { margin: 0; font-size: var(--text-lg); font-weight: 800; color: var(--text-1); text-wrap: balance; }
.state-msg { margin: 0; max-width: 46ch; font-size: var(--text-sm); line-height: 1.55; }
.state-ref { font-size: var(--text-xs); color: var(--text-2); }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .6rem; }
.state.is-error .state-ic { background: var(--danger-bg); color: var(--danger); }
.state.is-warn .state-ic { background: var(--warning-bg); color: var(--warning); }

/* Cuộn ngang có bóng mép báo còn nội dung */
.scroll-x {
    overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    background:
        linear-gradient(to right, var(--surface-1) 30%, transparent) left / 32px 100% no-repeat local,
        linear-gradient(to left, var(--surface-1) 30%, transparent) right / 32px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(15, 27, 46, .20), transparent) left / 12px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(15, 27, 46, .20), transparent) right / 12px 100% no-repeat scroll;
}

/* Bottom-sheet (xs–sm) / drawer phải (md+) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 1200; background: var(--overlay); }
.sheet {
    position: fixed; z-index: 1201; left: 0; right: 0; bottom: 0; max-height: 88dvh; display: flex; flex-direction: column;
    background: var(--surface-1); color: var(--text-1); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--elev-3); padding-bottom: env(safe-area-inset-bottom);
}
.sheet-head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .9rem max(1rem, env(safe-area-inset-right)) .6rem max(1rem, env(safe-area-inset-left));
    border-bottom: 1px solid var(--border);
}
.sheet-head::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
    border-radius: 4px; background: var(--border-strong);
}
.sheet-title { margin: 0; font-size: var(--text-lg); font-weight: 800; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left)); }
.sheet-foot { display: flex; gap: .6rem; padding: .75rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.sheet-foot > * { flex: 1 1 0; }
@media (min-width: 768px) {
    .sheet { left: auto; top: 0; width: min(420px, 92vw); max-height: none; border-radius: var(--radius-xl) 0 0 var(--radius-xl); padding-bottom: 0; }
    .sheet-head::before { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
    .sheet { animation: sheet-up var(--dur-3) var(--ease-standard); }
    .sheet-backdrop { animation: fade var(--dur-2) var(--ease-standard); }
    @media (min-width: 768px) { .sheet { animation-name: sheet-left; } }
}

/* Popover menu (chế độ hiển thị, …) */
.pop { position: relative; display: inline-flex; }
.pop-backdrop { position: fixed; inset: 0; z-index: 1100; }
.pop-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 1101; min-width: 232px; max-width: calc(100vw - 24px);
    padding: 6px; border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
    background: var(--surface-1); color: var(--text-1); box-shadow: var(--elev-3);
}
/* Header app hiện trường: nút mở menu nằm giữa header ⇒ right:0 theo nút làm menu tràn ra mép trái.
   Neo theo khung nhìn (header sticky ở top:0, không có transform) — luôn nằm trọn trong màn hình. */
.field-shell .fs-top .pop-menu {
    position: fixed; top: calc(56px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); left: auto;
    max-width: calc(100vw - 24px);
}
.pop-h { padding: .45rem .6rem .35rem; font-size: var(--text-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.pop-item {
    display: flex; align-items: center; gap: .6rem; width: 100%; min-height: var(--tap-min); padding: .45rem .6rem;
    border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-1);
    font-size: var(--text-sm); font-weight: 600; text-align: left;
}
.pop-item:hover { background: var(--surface-3); }
.pop-item[aria-checked="true"] { background: var(--info-bg); color: var(--primary-strong); font-weight: 800; }
.pop-item .pop-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); color: var(--primary-strong); flex: 0 0 auto; }
.pop-item[aria-checked="true"] .pop-ic { background: var(--accent); color: var(--on-accent); }
.pop-item .pop-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pop-item small { font-weight: 500; font-size: var(--text-xs); color: var(--text-2); }
.pop-item .pop-check { margin-left: auto; color: var(--primary-strong); }
@media (prefers-reduced-motion: no-preference) { .pop-menu { animation: pop-in var(--dur-2) var(--ease-standard); transform-origin: top right; } }

/* Chế độ hiển thị (DisplayMode) — nút 44px trên thanh navy hoặc thanh sáng */
.dm-btn {
    position: relative; display: inline-grid; place-items: center; width: var(--tap-min); height: var(--tap-min);
    padding: 0; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-1s);
}
.dm-btn:hover { background: var(--surface-3); color: var(--primary-strong); }
.dm-btn[aria-expanded="true"] { border-color: var(--primary); }
.dm-btn.on-chrome { border-color: var(--chrome-line); background: rgba(255, 255, 255, .08); color: var(--chrome-ink); }
.dm-btn.on-chrome:hover { background: var(--chrome-hover); color: var(--chrome-ink); }
.dm-btn .dm-flag { position: absolute; right: 5px; bottom: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--chrome-solid); }

/* Chọn ngôn ngữ VI | EN (LangSwitch) */
.lsw { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--radius-full); line-height: 1; }
.lsw .lsw-ic { margin: 0 3px 0 6px; flex: 0 0 auto; }
.lsw .lsw-b {
    position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 36px;
    padding: 0 10px; border-radius: var(--radius-full); font-size: .8125rem; font-weight: 800; letter-spacing: .06em; text-decoration: none;
}
.lsw .lsw-b::after { content: ""; position: absolute; inset: -4px 0; }   /* vùng chạm ≥44px */
.lsw-light { background: var(--surface-1); border: 1px solid var(--border-strong); box-shadow: var(--elev-2); color: var(--primary-strong); }
.lsw-light .lsw-b { color: var(--primary-strong); }
.lsw-light .lsw-b:hover { background: var(--surface-3); }
.lsw-light .lsw-b.on { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 -2px 0 var(--accent); }
.lsw-dark { background: rgba(255, 255, 255, .08); border: 1px solid var(--chrome-line); padding: 2px; }
.lsw-dark .lsw-b { min-width: 38px; color: var(--chrome-ink-2); }
.lsw-dark .lsw-b:hover { background: var(--chrome-hover); color: var(--chrome-ink); }
.lsw-dark .lsw-b.on { background: var(--accent); color: var(--on-accent); }

/* FileUpload — InputFile ẩn TRỰC QUAN (vẫn nhận Tab/Enter/Space), vòng focus trên nhãn (UX-07) */
.file-upload { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 100%; min-width: 0; }
.file-upload-btn { position: relative; cursor: pointer; margin: 0; }
.file-upload .fu-input {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
    overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; border: 0 !important; opacity: 0;
}
.file-upload-btn:has(.fu-input:focus-visible) { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.file-upload-btn:focus-within { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.file-upload-btn:has(.fu-input:focus:not(:focus-visible)) { outline: none; }
.file-upload-hint { min-width: 0; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--text-2); font-weight: 500; }
.file-upload-hint.has { color: var(--primary-strong); font-weight: 700; }
.file-upload-sm { gap: 7px; }

/* Banner chung (legacy) */
.banner { padding: .7rem .9rem; border-radius: var(--radius-md); margin-bottom: .9rem; font-size: var(--text-sm); line-height: 1.5; border: 1px solid transparent; }
.banner-ok { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.banner-warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.banner-err { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }

/* ---------------------------------------------------------------- 4. MẤT KẾT NỐI BLAZOR (UX-03)
   #components-reconnect-modal: Blazor chỉ gắn class .components-reconnect-show | -failed | -rejected.
   Thẻ nổi dưới đáy (trên tab bar), KHÔNG phủ toàn màn — người dùng vẫn đọc được dữ liệu đang nhập. */
#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex; position: fixed; z-index: 3000; justify-content: center; pointer-events: none;
    left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom) + var(--rc-offset, 0px));
}
body:has(.fs-tabs) #components-reconnect-modal,
body:has(.adm-bnav) #components-reconnect-modal { --rc-offset: calc(var(--tab-clear) - env(safe-area-inset-bottom) - 2px); }
@media (min-width: 768px) { body:has(.adm-bnav) #components-reconnect-modal { --rc-offset: 0px; } }
.rc-card {
    pointer-events: auto; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .55rem .8rem; align-items: start;
    width: min(560px, 100%); padding: .9rem 1rem; border-radius: var(--radius-lg);
    background: var(--brand-800); color: #fff; box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
    border: 1px solid rgba(231, 207, 127, .45); font-family: var(--font-sans);
}
:root[data-mode="night"] .rc-card { background: #151C28; color: var(--text-1); }
.rc-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(231, 207, 127, .16); color: var(--gold-400); }
.rc-txt p { margin: 0; display: none; }
.rc-txt b { display: block; font-size: 1rem; font-weight: 800; }
.rc-txt span { display: block; margin-top: 2px; font-size: .9375rem; line-height: 1.45; color: rgba(255, 255, 255, .86); }
.components-reconnect-show .rc-show,
.components-reconnect-failed .rc-failed,
.components-reconnect-rejected .rc-rejected { display: block; }
.rc-act { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.rc-act button {
    min-height: var(--tap-min); padding: .5rem 1rem; border-radius: var(--radius-md); font-weight: 800; font-size: .9375rem;
    border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff;
}
.rc-act .rc-reload { background: var(--gold-400); border-color: var(--gold-400); color: var(--brand-800); }
.components-reconnect-show .rc-retry { display: none; }
.rc-spin { display: none; width: 16px; height: 16px; margin-right: .35rem; vertical-align: -3px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; }
.components-reconnect-show .rc-spin { display: inline-block; }
@media (prefers-reduced-motion: no-preference) { .rc-spin { animation: spin .8s linear infinite; } }
.rc-attempt { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 5. VỎ HIỆN TRƯỜNG (FieldLayout)
   Tất cả bọc trong .field-shell — không rò rỉ. Giữ tương thích class các trang Field
   (fld-field, fld-btn, fld-card, fld-banner, fld-thumbs, fld-quick, fld-mine, fld-kv, …). */
.field-shell {
    min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
    background: var(--bg); color: var(--text-1); font-size: var(--text-md);
}
.field-shell .fs-top {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    padding: calc(.45rem + env(safe-area-inset-top)) max(.9rem, env(safe-area-inset-right)) .45rem max(.9rem, env(safe-area-inset-left));
    min-height: calc(56px + env(safe-area-inset-top));
    background: var(--chrome-bg); color: var(--chrome-ink); box-shadow: 0 2px 10px rgba(0, 0, 0, .22);
}
.field-shell .fs-brand { display: flex; align-items: center; gap: .55rem; min-width: 0; color: inherit; text-decoration: none; }
.logo-plate { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 4px 7px; border-radius: 9px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.logo-plate img { display: block; height: 22px; width: auto; }
.field-shell .fs-title { min-width: 0; font-weight: 700; font-size: clamp(1rem, .9rem + .5vw, 1.15rem); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-shell .fs-user { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.field-shell .fs-title .t-short { display: none; }
@media (max-width: 419px) { .field-shell .fs-title .t-long { display: none; } .field-shell .fs-title .t-short { display: inline; } }
.field-shell .fs-net { display: none; }
html[data-offline] .field-shell .fs-net { display: inline-flex; }
@media (max-width: 419px) { .field-shell .fs-net > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.field-shell .fs-net { align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: var(--radius-full); background: var(--danger); color: #fff; font-size: var(--text-xs); font-weight: 800; }
.field-shell .fs-logout {
    display: inline-grid; place-items: center; width: var(--tap-min); height: var(--tap-min); border-radius: var(--radius-md);
    color: var(--chrome-ink); text-decoration: none;
}
.field-shell .fs-logout.txt { width: auto; padding: 0 .8rem; font-weight: 700; }
.field-shell .fs-logout:hover { background: var(--chrome-hover); }
/* 30/09/2026: MỌI nút thanh trên là Ô VUÔNG có viền (cùng dáng nút chế độ hiển thị .dm-btn.on-chrome và thanh trên AdminLayout):
   ngôi nhà (admin) · chế độ hiển thị · ngôn ngữ · chuông · đăng xuất */
.field-shell .fs-user :is(.fs-logout, .fs-bell) { border: 1px solid var(--chrome-line); background: rgba(255, 255, 255, .08); }
.field-shell .fs-user :is(.fs-logout, .fs-bell):hover { background: var(--chrome-hover); }
.field-shell .fs-lang { font-size: .8125rem; font-weight: 800; letter-spacing: .05em; }
/* Máy rất hẹp: quản trị viên có 5 ô (thêm ngôi nhà) ⇒ thu ô 44 → 38px để vẫn vừa một hàng với logo */
@media (max-width: 359px) {
    .field-shell .fs-user:has(.fs-adm) :is(.fs-logout, .fs-bell, .dm-btn) { width: 38px; min-width: 38px; }
}
/* ≤430px (iPhone thường/Pro/Plus): thu khoảng cách các nút thanh trên (avatar tròn đã bỏ hẳn khỏi thanh trên) */
@media (max-width: 430px) {
    .field-shell .fs-user { gap: .2rem; }
    .field-shell .fs-top { gap: .4rem; }
    .field-shell .fs-title { font-size: 1rem; }
}
/* ≤339px: trước ẩn logo để nhường chỗ chữ HSSE — nay thanh trên chỉ còn logo nên GIỮ logo */

.field-shell .fs-body {
    flex: 1 1 auto; width: 100%; max-width: 560px; margin: 0 auto; min-width: 0;
    padding: var(--space-4) max(var(--space-4), env(safe-area-inset-right)) calc(var(--tab-clear) + 16px) max(var(--space-4), env(safe-area-inset-left));
}
@media (min-width: 768px) { .field-shell .fs-body { max-width: 760px; padding-top: var(--space-6); } }
@media (min-width: 1024px) { .field-shell .fs-body { max-width: 960px; } }

/* ---- Thanh tab NỔI dùng chung (Field .fs-tabs + quản trị .adm-bnav) — kiểu iOS tab bar / M3 NavigationBar:
   viên thuốc nền navy mờ cách đáy, 4 đích ngang hàng (icon trên nhãn ngắn), tab chọn tô màu nhấn (vàng),
   tab khác mờ; không hiệu ứng trượt khi đổi màn; chừa env(safe-area-inset-bottom) cho thanh home iPhone. ---- */
/* ---- Ô NGÀY / NGÀY-GIỜ trên iPhone/iPad (Safari + WebView của app iOS) — 30/09/2026 ----
   iOS KHÔNG vẽ icon lịch cho <input type=date|datetime-local> (Chrome/Android/desktop thì có) và tự canh GIỮA giá trị,
   tự đặt bề rộng/chiều cao riêng ⇒ ô ngày trông khác và lệch so với các ô bên cạnh. Chuẩn hoá cho MỌI trình duyệt:
   bỏ dáng mặc định, canh trái, không ép bề rộng tối thiểu. Riêng iOS: tự vẽ icon lịch ở mép phải (nền SVG). */
input[type="date"], input[type="datetime-local"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; box-sizing: border-box; text-align: left; }
input[type="date"]::-webkit-date-and-time-value, input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; margin: 0; min-height: 1.2em; }
@supports (-webkit-touch-callout: none) {
    input[type="date"], input[type="datetime-local"] {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 9h18M8 3v4M16 3v4'/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important; background-position: right .7rem center !important; background-size: 18px 18px !important;
        padding-right: 2.3rem !important;
    }
}
/* --tab-clear = mép TRÊN của thanh tab nổi tính từ đáy màn hình = cao thanh (48 + 2×4 đệm + 2 viền = 58px) + khoảng cách đáy
   (cùng công thức padding-bottom bên dưới). Nội dung trang, toast, thẻ nổi bám theo biến này ⇒ luôn cách thanh tab một khoảng
   NHỎ và ĐỀU trên mọi máy. Trước 30/09/2026 dùng "84–88px + toàn bộ safe-area" ⇒ iPhone hở ~46px giữa nội dung/pop-up và thanh tab. */
:root { --tab-clear: calc(58px + max(8px, calc(env(safe-area-inset-bottom) - 20px))); }
.field-shell .fs-tabs, .adm-shell .adm-bnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: center; pointer-events: none;
    /* Cách đáy: iPhone (inset ~34px) ⇒ ~14px, vẫn trên thanh Home; Android / không inset ⇒ 8px. Trước: 10px + toàn bộ inset (~44px) — trông cao */
    padding: 0 max(12px, env(safe-area-inset-right)) max(8px, calc(env(safe-area-inset-bottom) - 20px)) max(12px, env(safe-area-inset-left));
}
.field-shell .fs-tabs-in, .adm-shell .adm-bnav-in {
    pointer-events: auto; display: flex; width: 100%; max-width: 440px; padding: 4px; border-radius: 999px;
    /* Xanh navy kính mờ. Giao diện SÁNG: gần đặc (.9) để giữ đúng sắc navy trên nền trắng (nền quá trong sẽ bị
       nhạt thành xanh nhạt); giao diện TỐI: trong hơn (.62) — bên dưới */
    background: rgba(30, 58, 110, .9);
    -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, .12);   /* không đổ bóng */
}
:root[data-mode="outdoor"] .field-shell .fs-tabs-in, :root[data-mode="outdoor"] .adm-shell .adm-bnav-in {
    background: var(--chrome-solid); -webkit-backdrop-filter: none; backdrop-filter: none; border: 2px solid #000;
}
:root[data-theme="dark"]:not([data-mode="outdoor"]) .field-shell .fs-tabs-in, :root[data-theme="dark"]:not([data-mode="outdoor"]) .adm-shell .adm-bnav-in { background: rgba(30, 58, 110, .62); }   /* giao diện tối: trong hơn */
.field-shell .fs-tab, .adm-shell .adm-bnav a {
    position: relative; flex: 1 1 0; min-width: 0; min-height: 48px; border-radius: 999px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: .3rem .2rem; text-decoration: none; color: var(--chrome-ink-2);
    font-size: .6875rem; font-weight: 700; line-height: 1.15; text-align: center; -webkit-tap-highlight-color: transparent;
}
.field-shell .fs-tab > span:not(.fs-tab-ic), .adm-shell .adm-bnav a > span:not(.ic) { display: block; max-width: 100%; overflow-wrap: anywhere; }
.field-shell .fs-tab .fs-tab-ic, .adm-shell .adm-bnav .ic { position: relative; display: grid; place-items: center; width: 32px; height: 26px; }
.field-shell .fs-tab:hover, .adm-shell .adm-bnav a:hover { color: var(--chrome-ink); }
.field-shell .fs-tab.active, .adm-shell .adm-bnav a.on { color: var(--accent); }
/* Chạm chọn tab ⇒ ICON + CHỮ của tab vừa chọn nảy nhẹ một nhịp; huy hiệu số đỏ đứng yên
   (chỉ áp lên <svg> và nhãn chữ, không lên cả khối .fs-tab-ic / .ic đang chứa .tab-badge) */
.field-shell .fs-tab, .adm-shell .adm-bnav a { transition: color .2s ease; }
.field-shell .fs-tab.active .fs-tab-ic > svg, .field-shell .fs-tab.active > span:not(.fs-tab-ic),
.adm-shell .adm-bnav a.on .ic > svg, .adm-shell .adm-bnav a.on > span:not(.ic):not(.sr-only) {
    animation: tab-pop .36s cubic-bezier(.34, 1.4, .64, 1);
}
@keyframes tab-pop { 0% { transform: scale(.9); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
    .field-shell .fs-tab.active .fs-tab-ic > svg, .field-shell .fs-tab.active > span:not(.fs-tab-ic),
    .adm-shell .adm-bnav a.on .ic > svg, .adm-shell .adm-bnav a.on > span:not(.ic) { animation: none; }
}
.field-shell .fs-tab:focus-visible, .adm-shell .adm-bnav a:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
/* Huy hiệu đếm (góc trên-phải icon) — viền cùng màu nền thanh để tách khỏi icon */
.tab-badge {
    position: absolute; top: -5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    display: inline-grid; place-items: center; background: var(--danger); color: #fff;
    font-size: .6875rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--chrome-solid);
}

/* --- Nguyên thủy các trang Field --- */
.field-shell .fld-card {
    background: var(--surface-1); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
    padding: var(--space-4); margin-bottom: var(--space-4); box-shadow: var(--elev-1); min-width: 0;
}
/* Thẻ CUỐI trang (vd "Của tôi" ở Trang chủ): bỏ margin-bottom — khoảng cách tới thanh tab đã do padding-bottom của .fs-body lo */
.field-shell .fs-body > .fld-card:last-child { margin-bottom: 0; }
.field-shell .fld-h1 { font-size: var(--text-xl); font-weight: 800; margin: .15rem 0 .2rem; color: var(--text-1); text-wrap: balance; }
.field-shell .fld-sub { color: var(--text-2); font-size: var(--text-sm); margin: 0 0 var(--space-4); }
.field-shell .fld-field { display: block; margin-bottom: var(--space-4); min-width: 0; }
.field-shell .fld-field > span.lbl, .field-shell .fld-field > .lbl {
    display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
    font-weight: 700; font-size: var(--text-sm); margin-bottom: .35rem; color: var(--text-1);
}
.field-shell .fld-field select,
.field-shell .fld-field input:not([type=checkbox]):not([type=radio]):not([type=file]),
.field-shell .fld-field textarea {
    width: 100%; min-height: var(--tap-field); font-size: max(16px, 1rem); line-height: 1.35; padding: .7rem .8rem;
    border: var(--border-w) solid var(--field-border); border-radius: var(--radius-md);
    background-color: var(--surface-1); color: var(--text-1); -webkit-appearance: none; appearance: none;
}
/* Chevron cho select (UX-10) */
.field-shell .fld-field select {
    padding-right: 2.6rem; background-image: var(--chevron); background-repeat: no-repeat;
    background-position: right .85rem center; background-size: 16px 16px; text-overflow: ellipsis;
}
.field-shell .fld-field textarea { min-height: 112px; resize: vertical; field-sizing: content; max-height: 50vh; }
/* Bộ đếm ký tự dưới ô (Mô tả ≥ 10): xám khi chưa đủ, xanh khi đạt */
.field-shell .fld-meta { display: flex; align-items: baseline; gap: .25rem .75rem; margin-top: .3rem; }
.field-shell .fld-meta > .frp-err { margin-top: 0; flex: 1 1 auto; min-width: 0; }
.field-shell .fld-field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field-shell .fld-inl-err { flex: 1 1 auto; min-width: 0; color: var(--danger); font-size: .85rem; font-weight: 600; }   /* lỗi chữ đỏ nhỏ dưới ô nhập (dùng chung) */
.field-shell .fld-count { margin-left: auto; flex: 0 0 auto; white-space: nowrap; padding-right: 2px; text-align: right; font-size: var(--text-xs); font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.field-shell .fld-count.ok { color: var(--success); }
.field-shell .fld-field select:focus-visible,
.field-shell .fld-field input:focus-visible,
.field-shell .fld-field textarea:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 1px; border-color: var(--primary); }
/* Tablet: form 2 cột (trường ngắn), trường dài/ảnh/nút chiếm cả hàng — chỉ CSS, không đổi markup */
@media (min-width: 768px) {
    .field-shell .fld-card:has(> label.fld-field) {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-4); align-items: start;
    }
    .field-shell .fld-card:has(> label.fld-field) > * { grid-column: 1 / -1; }
    .field-shell .fld-card:has(> label.fld-field) > label.fld-field:has(select),
    .field-shell .fld-card:has(> label.fld-field) > label.fld-field:has(input:not([type=file])) { grid-column: auto; }
}

/* Nút lớn (≥48px) */
.field-shell .fld-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap;
    width: 100%; min-height: 52px; padding: .75rem 1rem;
    border: var(--border-w) solid transparent; border-radius: var(--radius-md);
    font-size: 1.0625rem; font-weight: 800; line-height: 1.2; text-align: center; text-decoration: none;
    color: var(--on-primary); background: var(--primary);
    transition: background var(--dur-1), transform var(--dur-1);
}
.field-shell .fld-btn:hover { background: var(--primary-strong); }
.field-shell .fld-btn:active { transform: scale(.98); }
/* ---- Cảm giác ỨNG DỤNG (03/10/2026) ----
   1) Giữ lâu link / nút / thẻ: không bật menu "Mở · Sao chép link · Chia sẻ" của iOS (app iOS còn tắt bản xem trước link
      bằng allowsLinkPreview = false) và không bôi chọn chữ. Ô nhập liệu, đoạn mô tả vẫn chọn / sao chép bình thường.
   2) Nhấn: nút / thẻ / chip hơi LÚN xuống (−3%) và sẫm nhẹ khi ngón tay chạm, nhả ra bật lại (< 0,15 s).
      Không áp cho thanh tab (đã có icon nảy) và dòng bảng. */
a, button, [role="button"] { -webkit-touch-callout: none; }
button, [role="button"], .fld-btn, .fld-card[href], a.fld-card, .fma-home, .fld-mine-row, .fma-row, .arl-card, .ast-kpi,
.adm-link, .adm-tool, .adm-btn, .arl-pill, .fld-fchip, .ard-tool, .rcp-btn, .aus-a, .fs-tabs, .adm-bnav, .lsw-b {
    -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
:is(button, [role="button"], a.fld-card, .fma-home, .fld-mine-row, .fma-row, .arl-card, .ast-kpi, .adm-btn, .adm-tool,
    .arl-pill, .fld-fchip, .ard-tool, .rcp-btn, .aus-a, .ast-pager-btn, .lsw-b):not(.fs-tab):not(:disabled) {
    transition: transform .12s ease, filter .12s ease;
}
:is(button, [role="button"], a.fld-card, .fma-home, .fld-mine-row, .fma-row, .arl-card, .ast-kpi, .adm-btn, .adm-tool,
    .arl-pill, .fld-fchip, .ard-tool, .rcp-btn, .aus-a, .ast-pager-btn, .lsw-b):not(.fs-tab):not(:disabled):active {
    transform: scale(.97); filter: brightness(.95);
}
@media (prefers-reduced-motion: reduce) {
    :is(button, [role="button"], a.fld-card, .fma-home, .fld-mine-row, .fma-row, .arl-card, .ast-kpi, .adm-btn, .adm-tool,
        .arl-pill, .fld-fchip, .ard-tool, .rcp-btn, .aus-a, .ast-pager-btn, .lsw-b):active { transform: none; }
}
.field-shell .fld-btn:disabled { opacity: .55; transform: none; }
.field-shell .fld-btn.gold { background: var(--accent); color: var(--on-accent); }
.field-shell .fld-btn.danger { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .field-shell .fld-btn.danger { color: #1a0a08; }
.field-shell .fld-btn.ghost { background: var(--surface-2); color: var(--text-1); border-color: var(--border-strong); }
.field-shell .fld-btn.ghost:hover { background: var(--surface-3); }

/* CTA Trang chủ — 2 cột khi ≥600px (auto-fit) */
.field-shell .fld-quick-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.field-shell .fld-quick {
    display: flex; align-items: center; gap: .9rem; width: 100%; min-height: 96px; padding: 1rem;
    margin-bottom: var(--space-3); border-radius: var(--radius-lg); border: 0; text-decoration: none; text-align: left;
    color: #fff; box-shadow: var(--elev-2);
}
.field-shell .fld-quick.obs { background: linear-gradient(135deg, var(--brand-700), var(--brand-500)); }
.field-shell .fld-quick.inc { background: linear-gradient(135deg, #9E1F1F, #C62828); }
/* 04/10/2026: nút admin "Chuyển sang giao diện quản trị" — tông xám đậm, khác hẳn 2 nút báo cáo để không bấm nhầm */
.field-shell .fld-quick.adm { background: linear-gradient(135deg, #273449, #3D4D66); }
:root[data-mode="outdoor"] .field-shell .fld-quick.adm { background: #1F2937; }
:root[data-mode="night"] .field-shell .fld-quick.adm { background: #1A2130; color: var(--text-1); }
:root[data-mode="outdoor"] .field-shell .fld-quick.obs { background: var(--primary); }
:root[data-mode="outdoor"] .field-shell .fld-quick.inc { background: var(--danger); }
:root[data-mode="night"] .field-shell .fld-quick.obs { background: #1C2534; color: var(--text-1); }
:root[data-mode="night"] .field-shell .fld-quick.inc { background: #3A1814; color: var(--text-1); }
.field-shell .fld-quick .q-ic { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 14px; background: rgba(255, 255, 255, .18); }
.field-shell .fld-quick .q-main { min-width: 0; }
.field-shell .fld-quick .q-t { display: block; font-size: var(--text-lg); font-weight: 800; }
.field-shell .fld-quick .q-d { font-size: var(--text-sm); opacity: .92; }
/* ≥600px: 2 CTA cạnh nhau (không cần thẻ bọc — Home.razor giữ nguyên markup) */
@media (min-width: 600px) {
    .field-shell .fld-quick.obs:has(+ .fld-quick.inc),
    .field-shell .fld-quick.obs + .fld-quick.inc { display: inline-flex; vertical-align: top; width: calc(50% - .6rem); min-height: 112px; }
    .field-shell .fld-quick.obs:has(+ .fld-quick.inc) { margin-right: .8rem; }
}

/* Ảnh: 2 ô chọn lớn 50/50 + lưới thumbnail tự co */
.field-shell .fld-photo { margin-top: .6rem; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.field-shell .fld-photo img { display: block; width: 100%; height: auto; }
.field-shell .fld-photo-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: .6rem; }
.field-shell .fld-photo-btns .file-upload { display: block; }
.field-shell .fld-photo-btns .file-upload-hint { display: none; }
.field-shell .fld-photo-btns .file-upload-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; width: 100%;
    min-height: 88px; padding: .7rem; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
    background: var(--surface-2); color: var(--primary-strong); font-size: var(--text-sm); font-weight: 800; text-align: center;
}
.field-shell .fld-photo-btns .file-upload-btn:hover { background: var(--surface-3); border-color: var(--primary); }
.field-shell .fld-photo-btns .file-upload-btn .pico { width: 28px; height: 28px; }
.field-shell .fld-photo-count { margin-left: auto; font-size: var(--text-xs); font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.field-shell .fld-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; margin-top: .7rem; }
.field-shell .fld-thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); }
.field-shell .fld-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Ảnh đang chọn: cả ô là nút mở xem ảnh lớn; nút xoá = chấm tròn 28px gọn ở góc (vùng chạm mở rộng 40px) */
.field-shell .fld-thumb-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.field-shell .fld-thumb-open:focus-visible { outline: 3px solid var(--focus-color); outline-offset: -3px; }
.field-shell .fld-thumb-x {
    position: absolute; top: 6px; right: 6px; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
    border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .9); background: rgba(15, 23, 42, .72); color: #fff; cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); transition: background var(--dur-1), transform var(--dur-1);
}
.field-shell .fld-thumb-x::after { content: ""; position: absolute; inset: -6px; }   /* vùng chạm ~40px */
.field-shell .fld-thumb-x:hover:not(:disabled) { background: var(--danger); transform: scale(1.06); }
.field-shell .fld-thumb-x:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.field-shell .fld-thumb-x:disabled { opacity: .45; cursor: default; }
@media (prefers-reduced-motion: no-preference) { .field-shell .fld-thumb { animation: thumb-in var(--dur-2) var(--ease-standard); } }

/* Băng thông báo */
.field-shell .fld-banner { padding: .75rem .9rem; border-radius: var(--radius-md); font-size: var(--text-sm); line-height: 1.5; margin-bottom: var(--space-4); border: var(--border-w) solid transparent; overflow-wrap: anywhere; }
.field-shell .fld-banner.err { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.field-shell .fld-banner.ok { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.field-shell .fld-banner.info { background: var(--info-bg); color: var(--text-1); border-color: var(--info-line); }
.field-shell .fld-banner.warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }

/* Thanh hành động cuối form (Lưu tiến độ / Hoàn thành) — nằm YÊN ở cuối trang như nút Gửi của Gemba/Sự cố,
   không dính đáy khi cuộn (phải điền xong nội dung phía trên mới bấm). */
.field-shell .fld-actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: var(--space-4) 0 0; }
.field-shell .fld-actionbar .fld-btn { width: auto; flex: 1 1 auto; }
/* Toast trạng thái dưới đáy (UX-09) — role=status / role=alert do trang đặt */
.field-shell .fld-toast {
    position: fixed; z-index: 60; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
    bottom: calc(var(--tab-clear) + 10px); max-width: 540px; margin: 0 auto;
    padding: .8rem 1rem; border-radius: var(--radius-lg); box-shadow: var(--elev-3); font-weight: 600;
    background: var(--text-1); color: var(--surface-1);
}
.field-shell .fld-toast.err { background: var(--danger); color: #fff; }
.field-shell .fld-toast.ok { background: var(--success); color: #fff; }
:root[data-theme="dark"] .field-shell .fld-toast.err, :root[data-theme="dark"] .field-shell .fld-toast.ok { color: #06101c; }

/* Danh sách "Của tôi" */
/* "Của tôi" (Trang chủ Field): tiêu đề + tổng, bộ lọc loại/trạng thái, phân trang */
.field-shell .fld-mine-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.field-shell .fld-mine-head .fld-h1 { margin: 0; }
/* Bộ lọc gọn: hàng chip loại dưới tiêu đề; ô chọn trạng thái ở hàng tiêu đề (bên phải) */
.field-shell .fld-mine-filters { display: flex; align-items: center; gap: .5rem; margin: .6rem 0 .35rem; }
/* 3 chip chia ĐỀU hết hàng ngang */
.field-shell .fld-chips { flex: 1 1 auto; display: flex; gap: .4rem; min-width: 0; }
.field-shell .fld-chips > .fld-fchip { flex: 1 1 auto; }   /* lấp đầy hàng, chip dài (Incident 99+) được rộng hơn chip ngắn (All) */
.field-shell .fld-fchip {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-width: 0; min-height: 36px; padding: 0 .5rem; border-radius: 999px;
    border: var(--border-w) solid var(--border); background: var(--surface-1); color: var(--text-2);
    font-size: var(--text-sm); font-weight: 700; line-height: 1; cursor: pointer; transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}
.field-shell .fld-fchip .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-shell .fld-fchip .n {
    flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
    background: var(--surface-3); color: var(--text-2); font-size: .6875rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
/* Màn hẹp (≤380px): thu đệm + chữ để "Gemba 99+" không bị cắt thành "Gem…" */
@media (max-width: 380px) {
    .field-shell .fld-chips { gap: .3rem; }
    .field-shell .fld-fchip { gap: .25rem; padding: 0 .3rem; font-size: .8125rem; }
    .field-shell .fld-fchip .n { min-width: 18px; height: 18px; padding: 0 4px; font-size: .625rem; }
}
@media (max-width: 340px) {
    .field-shell .fld-fchip { font-size: .75rem; }
}
/* Màu theo loại (khớp quy ước app): Tất cả = navy trung tính (màu chữ chính) · Gemba = xanh (--kind-obs) · Sự cố = đỏ (--kind-inc) */
.field-shell .fld-fchip { --fc: var(--text-1); }
.field-shell .fld-fchip.k-obs { --fc: var(--kind-obs); }
.field-shell .fld-fchip.k-inc { --fc: var(--kind-inc); }
.field-shell .fld-fchip:hover { color: var(--fc); border-color: color-mix(in srgb, var(--fc) 45%, var(--border)); }
.field-shell .fld-fchip.on { color: var(--fc); border-color: var(--fc); background: color-mix(in srgb, var(--fc) 10%, var(--surface-1)); }
.field-shell .fld-fchip.on .n { background: var(--fc); color: var(--surface-1); }   /* chữ = màu nền thẻ ⇒ tương phản đúng cả Sáng lẫn Tối */
.field-shell .fld-fchip:focus-visible, .field-shell .fld-fsel:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 1px; }
.field-shell .fld-fsel {
    flex: 0 1 auto; min-width: 0; min-height: 36px; padding: 0 2rem 0 .8rem; border-radius: 999px; max-width: 60%; text-overflow: ellipsis;
    border: var(--border-w) solid var(--border); background: var(--surface-1) var(--chevron) no-repeat right .6rem center / 14px;
    -webkit-appearance: none; appearance: none; color: var(--text-2); font: inherit; font-size: var(--text-sm); font-weight: 700; cursor: pointer;
}
.field-shell .fld-fsel.on { color: var(--primary-strong); border-color: var(--primary); background-color: color-mix(in srgb, var(--primary) 10%, var(--surface-1)); }
/* Ô lọc trạng thái đang chọn: CÙNG màu nhãn trạng thái trong danh sách — Mới xanh dương · Action vàng cam · Đã xử lý xanh lá */
.field-shell .fld-fsel.on.st-new    { color: var(--info);    border-color: var(--info-line, var(--info));       background-color: var(--info-bg); }
.field-shell .fld-fsel.on.st-action { color: var(--warning); border-color: var(--warning-line, var(--warning)); background-color: var(--warning-bg); }
.field-shell .fld-fsel.on.st-closed { color: var(--success); border-color: var(--success-line, var(--success)); background-color: var(--success-bg); }
/* Danh sách lựa chọn khi mở dropdown giữ màu thường (trình duyệt máy tính / Android cho <option> thừa hưởng màu của ô) */
.field-shell .fld-fsel option { color: var(--text-1); background-color: var(--surface-1); }
.field-shell .fld-mine-empty { margin: .5rem 0; }
/* Thanh lọc trang Việc được giao: 2 nút thả xuống (menu tự vẽ) + nút ↺ đặt lại; hàng chip loại bên dưới */
.field-shell .fma-filters { display: grid; gap: .45rem; margin: .6rem 0 .8rem; }
.field-shell .fma-bar { display: flex; align-items: center; gap: .4rem; }
.field-shell .fma-dd { position: relative; flex: 1 1 0; min-width: 0; }
.field-shell .fma-dd-btn {
    display: flex; align-items: center; gap: .35rem; width: 100%; min-height: 36px; padding: 0 .6rem 0 .7rem; border-radius: 999px;
    border: var(--border-w) solid var(--border); background: var(--surface-1); color: var(--text-2);
    font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1), color var(--dur-1);
}
.field-shell .fma-dd-btn .lbl { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.field-shell .fma-dd-btn:hover { color: var(--primary-strong); border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.field-shell .fma-dd-btn.on { color: var(--primary-strong); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface-1)); }
.field-shell .fma-dd-btn[aria-expanded="true"] { border-color: var(--primary); }
.field-shell .fma-dd-menu {
    position: absolute; z-index: 61; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(78vw, 280px);
    list-style: none; margin: 0; padding: .3rem; border-radius: var(--radius-md);
    border: var(--border-w) solid var(--border); background: var(--surface-1); box-shadow: var(--elev-3);
}
.field-shell .fma-dd + .fma-dd .fma-dd-menu { left: auto; right: 0; }
.field-shell .fma-dd-menu button {
    display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 40px; padding: 0 .6rem; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--text-1); font: inherit; font-size: .875rem; font-weight: 600; text-align: left; cursor: pointer;
}
.field-shell .fma-dd-menu button:hover { background: var(--surface-3); }
.field-shell .fma-dd-menu button[aria-selected="true"] { color: var(--primary-strong); font-weight: 800; background: color-mix(in srgb, var(--primary) 10%, var(--surface-1)); }
.field-shell .fma-dd-menu .lbl { flex: 1 1 auto; white-space: nowrap; }
.field-shell .fma-dd-menu .n { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: .6875rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.field-shell .fma-dd-menu .ck { display: inline-grid; width: 16px; color: var(--primary-strong); }
.field-shell .fma-dd-scrim { position: fixed; inset: 0; z-index: 60; }
.field-shell .fma-reset {
    flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%;
    border: var(--border-w) solid var(--border); background: var(--surface-1); color: var(--primary-strong); cursor: pointer;
}
.field-shell .fma-reset:hover:not(:disabled) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface-1)); }
.field-shell .fma-reset:disabled { opacity: .4; cursor: default; color: var(--text-2); }
/* Lọc theo HẠN: ô đang chọn + số đếm trong menu tô theo mức — Quá hạn đỏ · Sắp đến hạn cam · Còn hạn xanh lá */
.field-shell .fma-dd-btn.on.t-due-over { color: var(--danger);  border-color: var(--danger-line, var(--danger));   background: var(--danger-bg); }
.field-shell .fma-dd-btn.on.t-due-soon { color: var(--warning); border-color: var(--warning-line, var(--warning)); background: var(--warning-bg); }
.field-shell .fma-dd-btn.on.t-due-ok   { color: var(--success); border-color: var(--success-line, var(--success)); background: var(--success-bg); }
.field-shell .fma-dd-menu .t-due-over .n { background: var(--danger-bg);  color: var(--danger); }
.field-shell .fma-dd-menu .t-due-soon .n { background: var(--warning-bg); color: var(--warning); }
.field-shell .fma-dd-menu .t-due-ok .n   { background: var(--success-bg); color: var(--success); }
/* Nút ↺ đặt lại: đỏ khi đang có bộ lọc Trạng thái / Hạn */
.field-shell .fma-reset.on:not(:disabled) { color: var(--danger); border-color: var(--danger-line, var(--danger)); background: var(--danger-bg); }
.field-shell .fma-dd-btn:focus-visible, .field-shell .fma-reset:focus-visible, .field-shell .fma-dd-menu button:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 1px; }
.field-shell .fld-pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--border-soft); }
.field-shell .fld-pager-t { font-size: var(--text-sm); font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.field-shell .fld-pager-btn {
    display: grid; place-items: center; width: var(--tap-min); height: var(--tap-min); padding: 0; border-radius: var(--radius-md);
    border: var(--border-w) solid var(--border); background: var(--surface-1); color: var(--primary-strong); cursor: pointer;
}
.field-shell .fld-pager-btn:hover:not(:disabled) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface-1)); }
.field-shell .fld-pager-btn:disabled { opacity: .4; cursor: default; }
.field-shell .fld-pager-btn:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 1px; }
.field-shell .fld-mine { list-style: none; padding: 0; margin: 0; container-type: inline-size; }
.field-shell .fld-mine li { border-bottom: 1px solid var(--border-soft); }
.field-shell .fld-mine li:last-child { border-bottom: none; }
.field-shell .fld-mine-row {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: .6rem;
    min-height: 60px; padding: .6rem .25rem; color: inherit; text-decoration: none; border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
}
.field-shell .fld-mine-row:active, .field-shell .fld-mine-row:hover { background: var(--surface-3); }
.field-shell .fld-mine-row > * { min-width: 0; }
.field-shell .fld-mine .m-no { font-weight: 800; font-size: var(--text-sm); overflow-wrap: anywhere; }
.field-shell .fld-mine .m-meta { color: var(--text-2); font-size: var(--text-xs); }
.field-shell .fld-mine span.m-meta { white-space: nowrap; }   /* ngày + giờ không bị tách dòng trên máy nhỏ */
.field-shell .fld-mine div.m-meta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: var(--text-sm); }
.field-shell .fld-chip {
    font-size: var(--text-xs); font-weight: 800; padding: .15rem .55rem; border-radius: var(--radius-full);
    background: var(--info-bg); color: var(--info); white-space: nowrap;
}
.field-shell .fld-chip.st-ok { background: var(--success-bg); color: var(--success); }
.field-shell .fld-chip.st-new { background: var(--info-bg); color: var(--info); }
.field-shell .fld-chip.st-work { background: var(--warning-bg); color: var(--warning); }
/* Điện thoại (khung danh sách ≤ 340px — vd iPhone 16): GIỮ một hàng icon · nội dung · nhãn · ›, chỉ thu gọn */
@container (max-width: 340px) {
    .field-shell .fld-mine-row { gap: .45rem; padding-inline: .1rem; }
    .field-shell .fld-mine div.m-meta { -webkit-line-clamp: 1; }
    .field-shell .fld-mine-row > .fld-chip { font-size: .6875rem; padding: .12rem .45rem; }
}
/* Chỉ khung cực hẹp (≤ 240px) mới đẩy nhãn xuống dưới + ẩn › */
@container (max-width: 240px) {
    .field-shell .fld-mine-row { grid-template-columns: auto minmax(0, 1fr); }
    .field-shell .fld-mine-row > .fld-chip { grid-column: 2; justify-self: start; }
    .field-shell .fld-mine-row > svg:last-child { display: none; }
}

/* Xem bản ghi (mobile, chỉ đọc) */
.field-shell .fld-view { display: flex; flex-direction: column; gap: .8rem; }
.field-shell .fld-back {
    display: inline-flex; align-items: center; gap: .3rem; align-self: flex-start; min-height: var(--tap-min);
    color: var(--primary-strong); text-decoration: none; font-weight: 700; font-size: var(--text-sm);
}
.field-shell .fld-back svg { transform: rotate(180deg); }
.field-shell .fld-view-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.field-shell .fld-view-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--info-bg); color: var(--kind-obs); flex: 0 0 auto; }
.field-shell .fld-view-no { font-weight: 800; font-size: var(--text-lg); color: var(--text-1); overflow-wrap: anywhere; }
.field-shell .fld-view-type { font-size: var(--text-sm); color: var(--text-2); }
.field-shell .fld-kv { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: .45rem .7rem; margin: 0; }
.field-shell .fld-kv dt { color: var(--text-2); font-size: var(--text-sm); }
.field-shell .fld-kv dd { margin: 0; font-weight: 600; font-size: var(--text-sm); color: var(--text-1); overflow-wrap: anywhere; }
@media (max-width: 339px) { .field-shell .fld-kv { grid-template-columns: minmax(0, 1fr); } .field-shell .fld-kv dd { margin-bottom: .35rem; } }
.field-shell .fld-view-lbl { font-weight: 800; color: var(--primary-strong); font-size: var(--text-sm); margin: .8rem 0 .3rem; }
.field-shell .fld-card > .fld-view-lbl:first-child { margin-top: 0; }   /* tiêu đề đầu thẻ: không cộng thêm khoảng trống trên padding thẻ */
.field-shell .fld-view-desc p { margin: 0; line-height: 1.55; color: var(--text-1); overflow-wrap: anywhere; }
/* ---- Trang chi tiết báo cáo (Field /field/view/{obs|inc}/{id}) — .rv ---- */
.field-shell .rv { --kc: var(--kind-obs); display: grid; gap: var(--space-3, .75rem); }
.field-shell .rv.k-inc { --kc: var(--kind-inc); }
.field-shell .rv > .fld-card { margin: 0; }
.field-shell .rv-back { display: inline-flex; align-items: center; gap: .45rem; justify-self: start; min-height: var(--tap-min); padding-right: .6rem; color: var(--primary-strong); font-weight: 700; font-size: var(--text-sm); text-decoration: none; }
.field-shell .rv-back-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: var(--border-w) solid var(--border); background: var(--surface-1); }
.field-shell .rv-back:hover .rv-back-ic { border-color: var(--primary); }
.field-shell .rv-hero { border-top: 4px solid var(--kc); }
.field-shell .rv-hero-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem; }
.field-shell .rv-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: var(--kc); background: color-mix(in srgb, var(--kc) 12%, var(--surface-1)); }
.field-shell .rv-hero-main { display: flex; flex-direction: column; min-width: 0; }
.field-shell .rv-kind { font-size: var(--text-xs); font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--kc); overflow-wrap: anywhere; }
.field-shell .rv-no { margin: .1rem 0 0; font-size: 1.35rem; font-weight: 800; line-height: 1.15; color: var(--text-1); overflow-wrap: anywhere; }
.field-shell .rv-hero-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--border-soft); font-size: var(--text-sm); color: var(--text-2); }
.field-shell .rv-hero-meta > span { display: inline-flex; align-items: center; gap: .35rem; }
.field-shell .rv-sevs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.field-shell .rv-sev { --lc: var(--text-2); display: flex; flex-direction: column; gap: .2rem; padding: .7rem .85rem; border-radius: var(--radius-lg); border: var(--border-w) solid color-mix(in srgb, var(--lc) 35%, var(--border)); border-left: 4px solid var(--lc); background: color-mix(in srgb, var(--lc) 8%, var(--surface-1)); }
.field-shell .rv-sev.lv-lo { --lc: var(--lv-lo); } .field-shell .rv-sev.lv-mid { --lc: var(--lv-mid); } .field-shell .rv-sev.lv-hi { --lc: var(--lv-hi); }
.field-shell .rv-sev-l { font-size: var(--text-xs); font-weight: 700; color: var(--text-2); }
.field-shell .rv-sev-v { display: flex; align-items: baseline; gap: .45rem; min-width: 0; color: var(--lc); }
.field-shell .rv-sev-v b { font-size: 1.6rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.field-shell .rv-sev-v span { font-size: var(--text-sm); font-weight: 800; overflow-wrap: anywhere; }
.field-shell .rv-h { display: flex; align-items: center; gap: .4rem; margin: 0 0 .45rem; font-size: var(--text-sm); font-weight: 800; color: var(--primary-strong); }
.field-shell .rv-h:not(:first-child) { margin-top: 1rem; }
.field-shell .rv-count { margin-left: .15rem; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: var(--text-xs); }
.field-shell .rv-text { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--text-1); white-space: pre-wrap; overflow-wrap: anywhere; }
.field-shell .rv-imm { padding: .6rem .75rem; border-radius: var(--radius-md); background: var(--surface-2); border-left: 3px solid var(--success); }
.field-shell .rv-list { list-style: none; margin: 0; padding: 0; }
.field-shell .rv-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .7rem; padding: .6rem 0; border-top: 1px solid var(--border-soft); }
.field-shell .rv-list li:first-child { border-top: 0; padding-top: .2rem; }
.field-shell .rv-list li:last-child { padding-bottom: 0; }
.field-shell .rv-li-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.field-shell .rv-li-t { display: flex; flex-direction: column; min-width: 0; }
.field-shell .rv-li-l { font-size: var(--text-xs); color: var(--text-2); }
.field-shell .rv-li-v { font-size: var(--text-sm); font-weight: 700; color: var(--text-1); overflow-wrap: anywhere; }
.field-shell .fld-atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .6rem; }
.field-shell .fld-att-img { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius-md); }
.field-shell .fld-att-img:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }
.field-shell .fld-att-img img { width: 100%; aspect-ratio: 1; height: auto; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); }
.field-shell .fld-att-file {
    grid-column: 1 / -1; display: inline-flex; align-items: center; gap: .4rem; min-height: var(--tap-min); padding: .5rem .7rem;
    border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-1); text-decoration: none; font-size: var(--text-sm); max-width: 100%;
}
.field-shell .fld-att-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Màn thành công */
.field-shell .fld-success { text-align: center; padding: 1.6rem 1rem; }
.field-shell .fld-success .ok-ring { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 1rem; background: var(--success-bg); color: var(--success); }
.field-shell .fld-success .ok-no { font-size: var(--text-xl); font-weight: 800; color: var(--primary-strong); margin: .3rem 0 1.2rem; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) { .field-shell .fld-success .ok-ring { animation: pop-in var(--dur-3) var(--ease-emphasized); } }

.field-shell .fld-gps { font-size: var(--text-sm); color: var(--text-2); margin-top: .45rem; overflow-wrap: anywhere; }
.field-shell .fld-gps.set { color: var(--success); font-weight: 700; }

/* ---------------------------------------------------------------- 6. VỎ QUẢN TRỊ (AdminLayout)
   xs–sm (<768): thanh trên 56px + bottom nav 3 mục · md (768–1023): rail icon 80px · lg+: sidebar 240px
   2xl (≥1920): nội dung tối đa 1680px canh giữa (Bản đồ nhiệt full-bleed). */
.adm-shell { min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text-1); font-size: 1rem; }
@media (min-width: 1024px) { .adm-shell { font-size: .9375rem; } }   /* 15px — mật độ cao desktop, vẫn ≥14px */

.adm-shell .adm-side { display: none; }
.adm-shell .adm-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; min-height: 100dvh; }
/* Chiều cao thanh trên — dùng chung cho khối logo sidebar (lg+) để 2 vạch kẻ dưới thẳng hàng */
.adm-shell { --adm-top-h: calc(56px + env(safe-area-inset-top)); }
.adm-shell .adm-top {
    position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    min-height: var(--adm-top-h);
    padding: env(safe-area-inset-top) max(.75rem, env(safe-area-inset-right)) 0 max(.75rem, env(safe-area-inset-left));
    /* nền đặc, KHÔNG backdrop-filter: filter tạo containing block cho position:fixed → menu/popup trong thanh trên bị cắt */
    background: var(--surface-1); border-bottom: var(--border-w) solid var(--border); box-shadow: var(--elev-1);
}
.adm-shell .adm-top-brand { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; text-decoration: none; color: var(--text-1); }
.adm-shell .adm-top-brand .logo-plate { box-shadow: 0 0 0 1px var(--border); }
.adm-shell .adm-top-brand b { font-weight: 800; font-size: 1.05rem; }
.adm-shell .adm-top-t { display: none; min-width: 0; }
.adm-shell .adm-top-h { margin: 0; font-size: 1.0625rem; font-weight: 800; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-shell .adm-top-s { display: block; font-size: var(--text-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-shell .adm-top-a { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.adm-shell .adm-tool {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-width: var(--tap-min); height: var(--tap-min);
    padding: 0 .6rem; border: var(--border-w) solid var(--border); border-radius: var(--radius-md); cursor: pointer;
    background: var(--surface-2); color: var(--text-1s); text-decoration: none; font-size: var(--text-sm); font-weight: 700;
}
.adm-shell .adm-tool:hover { background: var(--surface-3); color: var(--primary-strong); }
.adm-shell .adm-lang { font-size: .8125rem; font-weight: 800; letter-spacing: .05em; }
/* Ô người dùng: icon người + tên, viền bo như các nút .adm-tool bên cạnh (không còn hình tròn chữ cái đầu) */
.adm-shell .adm-user {
    display: none; align-items: center; gap: .4rem; height: var(--tap-min); padding: 0 .7rem;
    border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-1s);
}
.adm-shell .adm-ava { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--gold-400); color: var(--brand-800); font-weight: 800; font-size: .95rem; flex: 0 0 auto; }
.adm-shell .adm-user-n { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); font-weight: 700; }
@media (max-width: 380px) { .adm-shell .adm-top-brand b { display: none; } }

.adm-shell .adm-body {
    flex: 1 1 auto; width: 100%; min-width: 0; margin: 0 auto;
    padding: var(--space-4) max(var(--space-4), env(safe-area-inset-right)) calc(var(--tab-clear) + 16px) max(var(--space-4), env(safe-area-inset-left));
}

/* Bottom nav (xs–sm): thanh tab nổi — CSS chung với .fs-tabs ở mục Field phía trên */

.adm-shell .adm-out .lbl-short { display: none; }
@media (min-width: 768px) and (max-width: 1023px) {
    .adm-shell .adm-out .lbl-long { display: none; }
    .adm-shell .adm-out .lbl-short { display: inline; }
}

/* Sidebar / rail (md+) */
@media (min-width: 768px) {
    .adm-shell .adm-field-link { display: none; }
    .adm-shell { display: flex; align-items: stretch; }
    .adm-shell .adm-bnav { display: none; }
    .adm-shell .adm-body { padding-bottom: var(--space-8); padding-inline: max(var(--gutter), env(safe-area-inset-right)) max(var(--gutter), env(safe-area-inset-left)); }
    .adm-shell .adm-top-brand { display: none; }
    .adm-shell .adm-top-t { display: block; }
    .adm-shell .adm-side {
        display: flex; flex-direction: column; flex: 0 0 84px; width: 84px; position: sticky; top: 0; align-self: flex-start;
        height: 100vh; height: 100dvh; padding-left: env(safe-area-inset-left);
        background: var(--chrome-bg); color: var(--chrome-ink); box-shadow: 2px 0 14px rgba(11, 28, 57, .22); z-index: 55;
    }
    .adm-shell .adm-brand {
        display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .9rem .4rem .8rem;
        text-decoration: none; color: var(--chrome-ink); border-bottom: 1px solid var(--chrome-line);
    }
    .adm-shell .adm-brand .logo-plate img { height: 24px; }
    .adm-shell .adm-brand-t { display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-width: 0; text-align: center; }
    .adm-shell .adm-brand-t b { font-size: 1rem; font-weight: 800; letter-spacing: .04em; }
    .adm-shell .adm-brand-t i { font-style: normal; font-size: .75rem; color: var(--gold-400); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
    :root[data-mode="night"] .adm-shell .adm-brand-t i { color: var(--primary); }
    .adm-shell .adm-brand-t i { display: none; }   /* rail 84px: "Quản trị/ADMINISTRATION" tràn cột ⇒ chỉ giữ "HSSE" (hiện lại ở lg+) */
    .adm-shell .adm-nav { flex: 1 1 auto; overflow-y: auto; padding: .7rem .45rem; display: flex; flex-direction: column; gap: .25rem; }
    .adm-shell .adm-nav-h { display: none; }
    .adm-shell .adm-link {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
        min-height: 64px; padding: .5rem .25rem; border-radius: var(--radius-md); text-decoration: none; color: var(--chrome-ink-2);
        font-size: .75rem; font-weight: 700; line-height: 1.15; text-align: center; overflow-wrap: anywhere;
        transition: background var(--dur-1), color var(--dur-1);
    }
    .adm-shell .adm-link:hover { background: var(--chrome-hover); color: var(--chrome-ink); }
    .adm-shell .adm-link.on { background: rgba(231, 207, 127, .16); color: var(--chrome-ink); }
    .adm-shell .adm-link.on::before { content: ""; position: absolute; left: -.45rem; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
    .adm-shell .adm-link.on .pico { color: var(--accent); }
    .adm-shell .adm-side-foot { padding: .6rem .45rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--chrome-line); }
    .adm-shell .adm-out {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 56px;
        padding: .4rem .25rem; border-radius: var(--radius-md); text-decoration: none; background: var(--chrome-hover); color: var(--chrome-ink);
        font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.15;
    }
    .adm-shell .adm-out:hover { background: var(--accent); color: var(--on-accent); }
}
@media (min-width: 1024px) {
    .adm-shell .adm-side { flex-basis: 240px; width: 240px; }
    /* Cao đúng bằng thanh trên (.adm-top) ⇒ vạch dưới logo ngang vạch dưới header */
    .adm-shell .adm-brand { flex-direction: row; justify-content: flex-start; gap: .65rem; height: var(--adm-top-h); padding: env(safe-area-inset-top) .95rem 0; border-bottom-width: var(--border-w);
        position: relative; z-index: 1; box-shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 1px 3px rgba(0, 0, 0, .2); }   /* bóng giống --elev-1 của header (đậm hơn cho nền navy) ⇒ vạch dày tương đương */
    .adm-shell .adm-brand-t { align-items: flex-start; text-align: left; }
    .adm-shell .adm-brand-t b { font-size: 1.12rem; }
    .adm-shell .adm-brand-t i { display: inline; }
    .adm-shell .adm-nav { padding: .9rem .6rem; }
    .adm-shell .adm-nav-h { display: block; padding: .2rem .5rem .5rem; font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--chrome-ink-2); }
    .adm-shell .adm-link { flex-direction: row; justify-content: flex-start; gap: .65rem; min-height: var(--tap-min); padding: .55rem .75rem; font-size: .9375rem; text-align: left; }
    .adm-shell .adm-link.on::before { left: -.6rem; top: 8px; bottom: 8px; }
    .adm-shell .adm-out { flex-direction: row; gap: .45rem; min-height: var(--tap-min); font-size: .875rem; }
    .adm-shell .adm-user { display: inline-flex; }
    .adm-shell .adm-top { padding-inline: var(--gutter); }
}
@media (min-width: 1920px) {
    .adm-shell .adm-body { max-width: 1760px; }
    .adm-shell .adm-body.is-wide { max-width: none; }
}

/* Nguyên thủy dùng chung trang /admin/* */
.adm-shell .adm-card {
    background: var(--surface-1); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
    padding: clamp(.9rem, .8rem + .4vw, 1.2rem); margin-bottom: var(--stack); box-shadow: var(--elev-1); min-width: 0;
}
.adm-shell .adm-h1 { margin: 0 0 .2rem; font-size: var(--text-2xl); font-weight: 800; color: var(--text-1); text-wrap: balance; }
.adm-shell .adm-sub { margin: 0 0 var(--space-4); color: var(--text-2); font-size: var(--text-sm); max-width: 80ch; }
.adm-shell .adm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--tap-min); padding: .5rem 1rem;
    border: 0; border-radius: var(--radius-md); background: var(--primary); color: var(--on-primary); font-size: var(--text-sm); font-weight: 800;
    text-decoration: none; cursor: pointer;
}
.adm-shell .adm-btn:hover { background: var(--primary-strong); }
.adm-shell .adm-btn.ghost { background: var(--surface-2); color: var(--text-1); border: var(--border-w) solid var(--border-strong); }
.adm-shell .adm-deny {
    max-width: 560px; margin: 3rem auto; text-align: center; background: var(--surface-1); border: var(--border-w) solid var(--border);
    border-radius: var(--radius-lg); padding: 2.2rem 1.6rem; box-shadow: var(--elev-2);
}
.adm-shell .adm-deny .adm-deny-ic { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background: var(--warning-bg); color: var(--warning); }
.adm-shell .adm-deny h3 { margin: 0 0 .5rem; font-size: var(--text-lg); font-weight: 800; color: var(--text-1); }
.adm-shell .adm-deny p { margin: 0 0 1.2rem; color: var(--text-2); font-size: var(--text-sm); line-height: 1.55; }

/* ---------------------------------------------------------------- 7. ĐĂNG NHẬP & ĐỔI MẬT KHẨU
   Token hoá toàn bộ → không còn chữ vàng/xanh nhạt trên nền trắng khi đang ở chế độ tối (UX-02). */
.auth-layout {
    position: relative; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr);
    background: var(--bg); color: var(--text-1);
}
.auth-lang { position: absolute; z-index: 10; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.auth-hero {
    position: relative; display: flex; align-items: flex-end; overflow: hidden; min-height: 200px;
    padding: calc(64px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 22px max(20px, env(safe-area-inset-left));
    background-image: linear-gradient(105deg, rgba(11, 28, 57, .9) 0%, rgba(11, 28, 57, .62) 60%, rgba(11, 28, 57, .45) 100%), url('/img/login-bg.jpg');
    background-size: cover; background-position: center; color: #fff;
}
.auth-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--gold-400), transparent); }
.auth-hero-in { position: relative; z-index: 2; max-width: 620px; min-width: 0; }
.auth-hero .logo-plate { padding: 8px 14px; border-radius: 14px; margin-bottom: clamp(12px, 2.5vw, 30px); box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.auth-hero .logo-plate img { height: clamp(30px, 3.6vw, 54px); }
.auth-hero-title { margin: 0; font-size: clamp(1.9rem, 1.2rem + 3.4vw, 4.5rem); font-weight: 800; line-height: 1.03; letter-spacing: -.015em; text-shadow: 0 4px 22px rgba(0, 0, 0, .55); }
.auth-hero-sub { display: inline-block; margin: 12px 0 0; padding-top: 10px; border-top: 3px solid var(--gold-400); color: #FFE9A8; font-size: clamp(.95rem, .85rem + .8vw, 1.4rem); font-weight: 700; letter-spacing: .03em; }
.auth-hero-note { display: none; margin: 18px 0 0; max-width: 46ch; color: rgba(236, 243, 252, .92); font-size: clamp(.9375rem, .9rem + .2vw, 1.0625rem); line-height: 1.6; }
@media (min-width: 560px) { .auth-hero-note { display: block; } }

.auth-panel { display: grid; place-items: start center; padding: 20px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.auth-card {
    width: min(460px, 100%); padding: clamp(20px, 4vw, 34px); border-radius: var(--radius-xl);
    background: var(--surface-1); border: 2px solid var(--gold-400); box-shadow: var(--elev-3); min-width: 0;
}
:root[data-mode="outdoor"] .auth-card { border-color: #000; }
:root[data-mode="night"] .auth-card { border-color: var(--border-strong); }
.auth-eyebrow { margin: 0 0 4px; color: var(--gold-ink); font-size: var(--text-xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.auth-title { margin: 0 0 8px; color: var(--text-1); font-size: var(--text-2xl); font-weight: 800; }
.auth-note { margin: 0 0 18px; color: var(--text-2); font-size: var(--text-sm); line-height: 1.55; }
.auth-note + .auth-who { margin-top: -10px; }   /* dòng tên tài khoản sát câu hướng dẫn */
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-size: var(--text-sm); font-weight: 700; color: var(--text-1); }
.auth-form input {
    width: 100%; min-height: 48px; padding: 11px 12px; font-size: max(16px, 1rem); border: var(--border-w) solid var(--field-border);
    border-radius: var(--radius-md); background: var(--surface-1); color: var(--text-1);
}
.auth-form input:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 1px; border-color: var(--primary); }
.auth-pw { position: relative; display: block; }
.auth-pw input { padding-right: 52px; }
.auth-pw-t {
    position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
    width: var(--tap-min); height: var(--tap-min); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-2);
}
.auth-pw-t:hover { color: var(--primary-strong); background: var(--surface-3); }
.auth-pw-t[aria-pressed="true"] { color: var(--primary-strong); }
/* Icon mắt đổi theo trạng thái: đang ẩn ⇒ "eye" (bấm để hiện); đang hiện ⇒ "eye-off" (bấm để ẩn) */
.auth-pw-t .pw-ico-show, .auth-pw-t .pw-ico-hide { display: contents; }
.auth-pw-t .pw-ico-hide, .auth-pw-t[aria-pressed="true"] .pw-ico-show { display: none; }
.auth-pw-t[aria-pressed="true"] .pw-ico-hide { display: contents; }
.auth-caps { display: none; font-size: var(--text-xs); font-weight: 700; color: var(--warning); }
.auth-caps.on { display: block; }
.auth-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 52px; margin-top: 4px; padding: 12px;
    border: 1px solid var(--gold-600); border-radius: var(--radius-md); background: linear-gradient(135deg, var(--gold-300), var(--gold-400));
    color: var(--brand-800); font-weight: 800; font-size: 1.0625rem;
}
.auth-btn:hover { filter: brightness(1.04); }
.auth-btn:disabled { opacity: .7; cursor: progress; }
.auth-btn .rc-spin { display: none; }
.auth-btn.busy .rc-spin { display: inline-block; }
:root[data-mode="outdoor"] .auth-btn { background: var(--accent); border-color: #000; color: #000; }
:root[data-mode="night"] .auth-btn { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.auth-err { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius-md); background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger); font-size: var(--text-sm); }
.auth-meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.auth-meter > i { display: block; height: 100%; width: 0; background: var(--danger); transition: width var(--dur-2), background var(--dur-2); }
.auth-meter[data-lv="2"] > i { width: 50%; background: var(--warning); }
.auth-meter[data-lv="3"] > i { width: 75%; background: var(--success); }
.auth-meter[data-lv="4"] > i { width: 100%; background: var(--success); }
.auth-meter[data-lv="1"] > i { width: 25%; }
.auth-hint { font-size: var(--text-xs); font-weight: 600; color: var(--text-2); min-height: 1.2em; }
.auth-hint.bad { color: var(--danger); } .auth-hint.good { color: var(--success); }
.auth-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 3px; text-align: center; color: var(--text-2); font-size: var(--text-xs); line-height: 1.5; }
.auth-link { display: inline-flex; align-items: center; min-height: var(--tap-min); margin-top: 8px; color: var(--text-2); font-size: var(--text-sm); font-weight: 700; text-decoration: none; }
.auth-link:hover { color: var(--primary-strong); }
.auth-foot .auth-link { justify-self: center; margin-top: 0; }
/* /privacy — khung thẻ của trang đăng nhập, rộng hơn cho văn bản dài */
.privacy-card { width: min(760px, 100%); }
.privacy-card .auth-title { margin-bottom: 4px; }
.privacy-meta { margin: 0 0 8px; color: var(--text-2); font-size: var(--text-sm); }
.privacy-card h2 { margin: 24px 0 8px; color: var(--primary-strong); font-size: var(--text-lg); font-weight: 800; }
.privacy-card p, .privacy-card li { color: var(--text-1); font-size: var(--text-md); line-height: var(--lh-body); overflow-wrap: anywhere; }
.privacy-card p { margin: 0 0 10px; }
.privacy-card ul { margin: 0 0 10px; padding-left: 1.25em; }
.privacy-card li + li { margin-top: 6px; }
.privacy-card a:not(.auth-link) { color: var(--primary-strong); font-weight: 700; }
.auth-brand-small { display: inline-flex; margin-bottom: 14px; }
.auth-layout.is-center { place-items: center; padding: calc(64px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: var(--chrome-bg); }
@media (min-width: 1000px) {
    .auth-layout:not(.is-center) { grid-template-columns: 55% 45%; }
    .auth-hero { min-height: 100vh; min-height: 100dvh; padding: clamp(30px, 4.5vw, 72px); }
    .auth-hero::after { left: auto; top: 0; width: 3px; height: auto; background: linear-gradient(180deg, transparent, var(--gold-400), transparent); }
    .auth-panel { place-items: center; padding: clamp(24px, 3vw, 48px); }
}
@media (min-width: 1920px) { .auth-card { width: min(500px, 100%); } }

/* ---------------------------------------------------------------- 8. KEYFRAMES */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-left { from { transform: translateX(100%); } to { transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes thumb-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media print { .no-print { display: none !important; } }

/* 29/09/2026: chạy như APP (js/theme-init.js gắn html.hsse-app) — trình duyệt không tự chụm-zoom cả trang
   (Safari PWA bỏ qua user-scalable=no). Cuộn vẫn bình thường; bản đồ Leaflet (touch-action:none) tự xử lý zoom. */
html.hsse-app { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
