/* =========================================================================
   OMNIGUARD WEBGIS - HỆ THỐNG GIAO DIỆN
   1. Token   2. Nền tảng   3. Thành phần dùng chung   4. Thanh trên cùng
   5. Panel điều hướng   6. Hồ sơ trạm   7. Chú giải & hộp thoại
   8. Bản đồ (marker, tooltip, nhãn chủ quyền)   9. Responsive
   Quy ước: 4 màu rủi ro CHỈ dùng cho mức rủi ro; cyan (--accent) chỉ cho
   phần tương tác; chữ tối thiểu 12px.
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------------------------------------------------------------- 1. TOKEN */
:root {
    --bg: #090d16;
    --surface-1: rgba(13, 18, 30, 0.96);   /* panel, topbar */
    --surface-2: #151d2e;                  /* thẻ */
    --surface-3: #1c2639;                  /* hover, ô lồng */
    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.3);

    --text: #e6e9ef;
    --text-2: #a7b0bf;
    --text-3: #7f8a9c;

    --accent: #22c3ee;
    --accent-soft: rgba(34, 195, 238, 0.14);

    /* Khớp bảng màu tô tỉnh do backend trả về */
    --risk-critical: #ff3b30;
    --risk-high: #ff9500;
    --risk-warning: #ffcc00;
    --risk-safe: #34c759;
    --risk-pending: #6c757d;
    --risk-critical-soft: rgba(255, 59, 48, 0.14);
    --risk-high-soft: rgba(255, 149, 0, 0.14);
    --risk-warning-soft: rgba(255, 204, 0, 0.12);
    --risk-safe-soft: rgba(52, 199, 89, 0.12);
    --risk-pending-soft: rgba(108, 117, 125, 0.18);

    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-md: 15px;
    --fs-lg: 18px;
    --fs-xl: 24px;

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --panel-w: 420px;
    --topbar-h: 56px;
}

/* ------------------------------------------------------------ 2. NỀN TẢNG */
* { margin: 0; padding: 0; box-sizing: border-box; }

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: var(--fs-sm);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app-container { position: relative; width: 100vw; height: 100vh; }
#map { position: absolute; inset: 0; z-index: 1; background: var(--bg); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.25); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------- 3. THÀNH PHẦN DÙNG CHUNG */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    height: 36px;
    padding: 0 var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover, .btn.active { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.btn.active { border-color: var(--accent); }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-block { width: 100%; justify-content: center; height: 40px; }
.btn-danger { background: var(--risk-critical-soft); border-color: rgba(255, 59, 48, 0.5); color: #ffb3ad; }
.btn-danger:hover { background: rgba(255, 59, 48, 0.24); color: #fff; border-color: var(--risk-critical); }

.level-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid transparent;
}
.level-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.level--critical { color: #ff8a80; background: var(--risk-critical-soft); border-color: rgba(255, 59, 48, 0.4); }
.level--high { color: #ffb44d; background: var(--risk-high-soft); border-color: rgba(255, 149, 0, 0.4); }
.level--warning { color: #ffd84d; background: var(--risk-warning-soft); border-color: rgba(255, 204, 0, 0.35); }
.level--safe { color: #6fdc8c; background: var(--risk-safe-soft); border-color: rgba(52, 199, 89, 0.35); }
.level--pending { color: #a8b0b8; background: var(--risk-pending-soft); border-color: rgba(108, 117, 125, 0.4); }

.count-pill {
    font-size: var(--fs-xs);
    color: var(--text-3);
    padding: 1px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: var(--fs-xs); }
.input-icon input {
    width: 100%;
    height: 36px;
    padding: 0 var(--sp-3) 0 34px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    outline: none;
}
.input-icon input::placeholder, .search-box input::placeholder { color: var(--text-3); }
.input-icon input:focus { border-color: var(--accent); }

.segmented { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.segmented > button {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: var(--fs-xs);
    font-weight: 600;
}
.segmented > button:hover { color: var(--text); border-color: var(--border-strong); }
.segmented > button.active { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }

.notice {
    display: flex;
    gap: var(--sp-2);
    align-items: flex-start;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: var(--fs-xs);
}
.notice i { margin-top: 2px; }
.notice--muted { border-style: dashed; }
.notice--critical { border-color: rgba(255, 59, 48, 0.45); background: var(--risk-critical-soft); color: #ffc9c4; }
.notice--high { border-color: rgba(255, 149, 0, 0.45); background: var(--risk-high-soft); color: #ffd6a3; }
.notice--warning { border-color: rgba(255, 204, 0, 0.4); background: var(--risk-warning-soft); color: #ffe9a3; }
.notice--safe { border-color: rgba(52, 199, 89, 0.4); background: var(--risk-safe-soft); color: #bdeccb; }

.hint { font-size: var(--fs-xs); color: var(--text-3); }
.empty-note { font-size: var(--fs-xs); color: var(--text-3); padding: var(--sp-3) 0; }
.empty-note i { margin-right: var(--sp-1); }
.loading-block { padding: var(--sp-5) 0; text-align: center; color: var(--text-2); font-size: var(--fs-sm); }
.loading-block i { color: var(--accent); margin-right: var(--sp-2); }

.trend { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.trend.up { color: #ffb44d; }
.trend.down { color: #6fdc8c; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot--critical { background: var(--risk-critical); }
.dot--high { background: var(--risk-high); }
.dot--warning { background: var(--risk-warning); }
.dot--safe { background: var(--risk-safe); }

.meter { height: 6px; border-radius: 3px; background: rgba(148, 163, 184, 0.15); overflow: hidden; }
.meter > span { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 3px; }
.meter--critical > span { background: var(--risk-critical); }
.meter--warning > span { background: var(--risk-warning); }
.meter--safe > span { background: var(--risk-safe); }

.progress-note {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    font-size: var(--fs-xs);
    color: var(--text-2);
    transition: opacity 0.6s;
}
.progress-note i { color: var(--accent); margin-right: var(--sp-1); }
.progress-note.is-done i { color: var(--risk-safe); }
.progress-note.is-leaving { opacity: 0; }

/* -------------------------------------------------- 4. THANH TRÊN CÙNG */
.topbar {
    position: absolute;
    top: var(--sp-3);
    left: var(--sp-3);
    right: calc(var(--panel-w) + var(--sp-3) * 2);
    max-width: calc(100vw - var(--panel-w) - var(--sp-3) * 3);
    z-index: 1005;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    height: 40px;
    padding: 0 12px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow);
    flex-shrink: 0;
}
.brand > i { color: var(--accent); font-size: 17px; }
.brand h1 { font-size: 14.5px; font-weight: 800; letter-spacing: 0.2px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-3); line-height: 1.2; white-space: nowrap; }
.brand-loading { color: var(--risk-warning); }

.search-box { position: relative; flex: 1 1 170px; min-width: 150px; max-width: 320px; }
.search-box > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12px; }
.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 var(--sp-3) 0 34px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow);
    font-size: 12.5px;
    outline: none;
}
.search-box input:focus { border-color: var(--accent); }

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-width: 0;
    max-width: 100%;
}
.topbar-actions .btn {
    height: 40px;
    padding: 0 10px;
    gap: 6px;
    font-size: 12.5px;
    background: var(--surface-1);
    box-shadow: var(--shadow);
    border-radius: var(--r-md);
}
.topbar-actions .btn-icon { width: 40px; padding: 0; }

.menu { position: relative; }
.menu-panel {
    position: absolute;
    top: calc(100% + var(--sp-2));
    right: 0;
    width: 270px;
    padding: var(--sp-2);
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    z-index: 1010;
}
.menu-group + .menu-group { border-top: 1px solid var(--border); margin-top: var(--sp-1); padding-top: var(--sp-1); }
.menu-title { font-size: var(--fs-xs); color: var(--text-3); padding: var(--sp-2) var(--sp-2) var(--sp-1); }
.menu-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 6px var(--sp-2);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    color: var(--text-2);
    cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item input { accent-color: var(--accent); }

/* Gợi ý tìm kiếm */
.search-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + var(--sp-2));
    left: 0;
    right: 0;
    max-height: 380px;
    overflow-y: auto;
    padding: var(--sp-1);
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    z-index: 9999;
    display: none;
}
.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: 7px var(--sp-2);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.autocomplete-item:hover, .autocomplete-item.selected { background: var(--surface-3); }
.autocomplete-item-main { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; flex: 1; }
.autocomplete-item-icon {
    width: 28px; height: 28px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--text-2);
    font-size: var(--fs-xs);
}
.autocomplete-item-text { min-width: 0; flex: 1; }
.autocomplete-item-name { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-item-name mark { background: transparent; color: var(--accent); }
.autocomplete-item-sub { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-item-tag { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; flex-shrink: 0; }
.autocomplete-footer-hint {
    display: flex; justify-content: space-between;
    margin-top: var(--sp-1);
    padding: 6px var(--sp-2);
    border-top: 1px solid var(--border);
    font-size: var(--fs-xs);
    color: var(--text-3);
}
.autocomplete-footer-hint kbd { padding: 0 4px; border-radius: 3px; background: var(--surface-3); color: var(--text-2); font-family: inherit; }

/* ------------------------------------------------ 5. PANEL ĐIỀU HƯỚNG */
.panel {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    bottom: var(--sp-3);
    width: var(--panel-w);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    min-height: 48px;
    padding: var(--sp-1) var(--sp-3);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-sm); }
.crumb { color: var(--text-2); white-space: nowrap; }
button.crumb:hover { color: var(--accent); text-decoration: underline; }
.crumb.is-current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { font-size: 10px; color: var(--text-3); }

.panel-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.panel-head {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border);
}
.panel-title { font-size: var(--fs-lg); font-weight: 700; }
.panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.panel-foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }

.summary-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.summary-pill {
    display: flex;
    flex-direction: column;
    padding: 6px var(--sp-2);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    font-size: var(--fs-xs);
    color: var(--text-2);
}
.summary-pill b { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.summary-pill.critical b { color: var(--risk-critical); }
.summary-pill.high b { color: var(--risk-high); }
.summary-pill.warning b { color: var(--risk-warning); }
.summary-pill.safe b { color: var(--risk-safe); }

/* Danh sách tỉnh */
.province-cards-list { display: flex; flex-direction: column; gap: 6px; }
.province-card {
    position: relative;
    padding: 10px var(--sp-3) 10px calc(var(--sp-3) + 4px);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.province-card::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--risk-pending);
}
.province-card.critical::before { background: var(--risk-critical); }
.province-card.high::before { background: var(--risk-high); }
.province-card.warning::before { background: var(--risk-warning); }
.province-card.safe::before { background: var(--risk-safe); }
.province-card:hover { background: var(--surface-3); border-color: var(--border-strong); }
.province-card.active { border-color: var(--accent); }
.province-card-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.province-card-name { font-size: var(--fs-sm); font-weight: 600; }
.province-card-footer { display: flex; justify-content: space-between; gap: var(--sp-2); margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }
.province-card-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.province-card-count { white-space: nowrap; }

/* Chi tiết tỉnh */
.province-head-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.province-head h2 { font-size: var(--fs-lg); font-weight: 700; }
.province-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-top: var(--sp-2); }
.list-head h3, .sd-section-head h3 { font-size: var(--fs-sm); font-weight: 700; color: var(--text); }

.station-list { display: flex; flex-direction: column; gap: 6px; }
.station-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    text-align: left;
    padding: 10px var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: background 0.15s, border-color 0.15s;
}
.station-item:hover { background: var(--surface-3); border-color: var(--border-strong); }
.station-item.is-pending { opacity: 0.75; }
.station-item-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.station-item-name { font-size: var(--fs-sm); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-item-name i { color: var(--text-3); margin-right: 6px; font-size: 11px; }
.station-item-addr, .station-item-meta { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* KPI */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.kpi-row--4 { grid-template-columns: repeat(4, 1fr); }
.kpi {
    padding: 10px var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    min-width: 0;
}
.kpi-label { font-size: var(--fs-xs); color: var(--text-3); }
.kpi-value { font-size: var(--fs-xl); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi-note { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }
.kpi-hint { color: var(--text-3); }
.kpi--critical .kpi-value { color: var(--risk-critical); }
.kpi--high .kpi-value { color: var(--risk-high); }
.kpi--warning .kpi-value { color: var(--risk-warning); }
.kpi--safe .kpi-value { color: var(--risk-safe); }
.kpi-row--4 .kpi-value { font-size: var(--fs-lg); }

/* --------------------------------------------------- 6. HỒ SƠ TRẠM */
.station-detail { gap: var(--sp-4); }
.sd-head h2 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; }
.sd-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

.verdict {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    border-left-width: 4px;
    background: var(--surface-2);
}
.verdict--critical { border-left-color: var(--risk-critical); background: linear-gradient(90deg, var(--risk-critical-soft), var(--surface-2) 70%); }
.verdict--high { border-left-color: var(--risk-high); background: linear-gradient(90deg, var(--risk-high-soft), var(--surface-2) 70%); }
.verdict--warning { border-left-color: var(--risk-warning); background: linear-gradient(90deg, var(--risk-warning-soft), var(--surface-2) 70%); }
.verdict--safe { border-left-color: var(--risk-safe); }
.verdict-top { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.verdict-kind { font-size: var(--fs-xs); color: var(--text-3); }
.verdict-title { font-size: var(--fs-md); font-weight: 700; line-height: 1.35; margin-top: var(--sp-2); }
.verdict-reason { font-size: var(--fs-xs); color: var(--text-2); margin-top: var(--sp-1); }
.verdict-action { font-size: var(--fs-sm); color: var(--text); margin-top: var(--sp-2); }
.verdict-action i { color: var(--accent); margin-right: 4px; }
.verdict-more { margin-top: var(--sp-3); border-top: 1px solid var(--border); padding-top: var(--sp-2); }
.verdict-more summary, .sd-foot summary { cursor: pointer; font-size: var(--fs-xs); color: var(--accent); }
.verdict-more ul { list-style: none; display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-2); }
.verdict-more-title { font-size: var(--fs-sm); font-weight: 600; display: flex; gap: var(--sp-2); align-items: baseline; flex-wrap: wrap; }
.verdict-more-reason, .verdict-more-action { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }
.verdict-more-action i { color: var(--accent); }

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: calc(var(--sp-4) * -1);
    background: var(--surface-1);
    z-index: 2;
    margin: 0 calc(var(--sp-4) * -1);
    padding: 0 var(--sp-4);
}
.tab {
    padding: 10px var(--sp-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.tab i { font-size: 12px; margin-right: 2px; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-pane { display: flex; flex-direction: column; gap: var(--sp-5); }

.sd-section { display: flex; flex-direction: column; gap: var(--sp-3); }
.sd-section-head { display: flex; justify-content: space-between; align-items: center; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.stat-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stat {
    padding: 10px var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    min-width: 0;
}
.stat-label { font-size: var(--fs-xs); color: var(--text-3); }
.stat-value { font-size: var(--fs-md); font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value small { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); margin-left: 2px; }
.stat-sub { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }
.stat--critical .stat-value { color: var(--risk-critical); }
.stat--high .stat-value { color: var(--risk-high); }
.stat--warning .stat-value { color: var(--risk-warning); }
.stat--safe .stat-value { color: var(--risk-safe); }
.is-missing { color: var(--text-3); cursor: help; }

.meta-list { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); }
.meta-list > div { display: grid; grid-template-columns: 112px 1fr; gap: var(--sp-2); }
.meta-list dt { color: var(--text-3); }
.meta-list dd { color: var(--text-2); }

/* Mực nước */
.wl-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.wl-value { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; margin-right: var(--sp-1); }
.wl-gauge { padding: var(--sp-1) 0 var(--sp-4); }
.wl-track { position: relative; height: 10px; border-radius: 5px; background: rgba(148, 163, 184, 0.15); }
.wl-zone { position: absolute; top: 0; bottom: 0; }
.wl-zone--warning { background: rgba(255, 204, 0, 0.35); }
.wl-zone--high { background: rgba(255, 149, 0, 0.45); }
.wl-zone--critical { background: rgba(255, 59, 48, 0.5); border-radius: 0 5px 5px 0; }
.wl-marker {
    position: absolute;
    top: -5px;
    width: 4px;
    height: 20px;
    margin-left: -2px;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 0 0 2px var(--bg);
}
.wl-ticks { position: relative; height: 16px; margin-top: 6px; }
.wl-ticks span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* Bảng dữ liệu */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.data-table th { text-align: left; font-weight: 600; color: var(--text-3); padding: 6px 4px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.data-table td:first-child { color: var(--text); }
.data-table td small { display: block; color: var(--text-3); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Biểu đồ mưa */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: var(--sp-1); }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-val { font-size: 11px; color: var(--text-2); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.bar-fill { width: 100%; height: var(--h); max-height: 80px; min-height: 2px; background: rgba(34, 195, 238, 0.45); border-radius: 3px 3px 0 0; }
.bar-label { font-size: 11px; color: var(--text-3); margin-top: 4px; white-space: nowrap; }
.bar.is-today .bar-fill { background: var(--accent); }
.bar.is-today .bar-label, .bar.is-today .bar-val { color: var(--text); font-weight: 600; }

.amc-line { font-size: var(--fs-xs); color: var(--text-2); display: flex; gap: var(--sp-2); align-items: baseline; flex-wrap: wrap; }

/* Chống chịu */
.uri-head { display: flex; align-items: center; gap: var(--sp-3); }
.uri-score { font-size: 32px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.uri-score small { font-size: var(--fs-sm); color: var(--text-3); font-weight: 500; }
.uri--critical { color: var(--risk-critical); }
.uri--high { color: var(--risk-high); }
.uri--warning { color: var(--risk-warning); }
.uri--safe { color: var(--risk-safe); }
.uri-label { font-size: var(--fs-md); font-weight: 600; }
.caps { display: flex; flex-direction: column; gap: var(--sp-3); }
.cap-head { display: flex; justify-content: space-between; font-size: var(--fs-sm); margin-bottom: 4px; }
.cap-head strong { font-variant-numeric: tabular-nums; }
.cap-metric { font-size: var(--fs-xs); color: var(--text-3); margin-top: 3px; }
.cap-metric.is-estimated { color: #ffd6a3; }

.rec-list { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.rec { padding: var(--sp-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.rec-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-sm); }
.rec-head i { color: var(--text-3); }
.rec-head strong { flex: 1; min-width: 160px; }
.rec p { font-size: var(--fs-xs); color: var(--text-2); margin: 6px 0 4px; }

/* Ứng phó */
.shelter-list { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.shelter-list li { padding: 10px var(--sp-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px; }
.shelter-head { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-sm); }
.shelter-head strong { font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
.dispatch { padding-left: 20px; display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-2); }
.dispatch strong { color: var(--text); margin-right: 4px; }

.sd-foot { border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.sd-foot ul { margin: var(--sp-2) 0 0 18px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--text-3); }

/* --------------------------------------------- 7. CHÚ GIẢI & HỘP THOẠI */
.legend {
    position: absolute;
    left: var(--sp-3);
    bottom: var(--sp-5);
    z-index: 1000;
    max-width: 340px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    font-size: var(--fs-xs);
}
.legend summary { padding: var(--sp-2) var(--sp-3); cursor: pointer; color: var(--text-2); font-weight: 600; list-style: none; }
.legend summary::-webkit-details-marker { display: none; }
.legend summary i { color: var(--text-3); margin-right: 4px; }
.legend[open] summary { border-bottom: 1px solid var(--border); }
.legend-body { padding: var(--sp-2) var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: 6px; }
.legend-title { color: var(--text-3); }
.legend-title:not(:first-child) { margin-top: 4px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px var(--sp-3); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.swatch.critical { background: var(--risk-critical); }
.swatch.high { background: var(--risk-high); }
.swatch.warning { background: var(--risk-warning); }
.swatch.safe { background: var(--risk-safe); }
.swatch.pending { background: var(--risk-pending); }
.shape { display: inline-block; width: 11px; height: 11px; background: var(--text-2); }
.shape.circle { border-radius: 50%; border: 2px solid #fff; background: var(--risk-pending); }
.shape.triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); background: var(--text-2); }
.shape.island { width: 9px; height: 9px; border-radius: 50%; background: rgba(0, 229, 255, 0.95); border: 1.5px solid #ffd700; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 1999; display: none; }
.modal-backdrop.active { display: block; }
.dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, calc(100vw - 32px));
    max-height: 85vh;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}
.dialog-head { display: flex; gap: var(--sp-3); align-items: flex-start; justify-content: space-between; padding: var(--sp-4); border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: var(--fs-lg); font-weight: 700; }
.dialog-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 4px; }
.priority-list { overflow-y: auto; padding: var(--sp-3) var(--sp-4) var(--sp-4); display: flex; flex-direction: column; gap: 6px; }
.priority-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    width: 100%;
    text-align: left;
    padding: 10px var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}
.priority-row:hover { background: var(--surface-3); border-color: var(--border-strong); }
.priority-rank { width: 28px; text-align: center; font-size: var(--fs-md); font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.priority-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.priority-name { font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.priority-meta { font-size: var(--fs-xs); color: var(--text-3); }
.priority-score { text-align: right; display: flex; flex-direction: column; }
.priority-score small { font-size: var(--fs-xs); color: var(--text-3); }
.priority-score strong { font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.priority-foot { margin-top: var(--sp-2); }

/* ---------------------------------------------------------- 8. BẢN ĐỒ */
/* Marker trạm */
.custom-marker-wrapper { background: transparent !important; border: none !important; cursor: pointer; }
.custom-pulsing-marker { display: flex; justify-content: center; align-items: center; position: relative; width: 100%; height: 100%; }
.marker-pin {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    z-index: 2;
    transition: transform 0.15s;
}
.marker-pin:hover { transform: scale(1.25); }
.marker-pin.critical { background: var(--risk-critical); }
.marker-pin.high { background: var(--risk-high); }
.marker-pin.warning { background: var(--risk-warning); }
.marker-pin.safe { background: var(--risk-safe); }
.marker-pin.pending { background: var(--risk-pending); }
.marker-pulse {
    position: absolute;
    top: calc(50% - 22px);
    left: calc(50% - 22px);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    animation: pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: 1;
    pointer-events: none;
}
.marker-pulse.critical { background: rgba(255, 59, 48, 0.35); border: 2px solid var(--risk-critical); }
.marker-pulse.high { background: rgba(255, 149, 0, 0.3); border: 2px solid var(--risk-high); }
.marker-pulse.warning, .marker-pulse.safe, .marker-pulse.pending { display: none; }
@keyframes pulse-ring {
    0% { transform: scale(0.4); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .marker-pulse { animation: none; opacity: 0.35; } }

/* Popup MapLibre: bỏ khung mặc định, nội dung tự mang style tooltip */
.og-popup { z-index: 10; pointer-events: none; }
.og-popup .maplibregl-popup-content { background: transparent; padding: 0; box-shadow: none; border-radius: 0; pointer-events: auto; }
.og-popup .maplibregl-popup-tip { display: none; }

.custom-leaflet-tooltip,
.province-polygon-tooltip {
    max-width: 300px;
    padding: 10px var(--sp-3);
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: var(--fs-xs);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.custom-leaflet-tooltip { cursor: pointer; pointer-events: auto; }
.tip-title { font-size: var(--fs-sm); font-weight: 700; display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.tip-tag { font-size: 11px; font-weight: 500; color: var(--text-3); }
.tip-row { color: var(--text-2); }
.tip-row b { color: var(--text); }
.tip-text { line-height: 1.4; }
.tip-hint { color: var(--accent); margin-top: 2px; }

/* Đảo & nhãn chủ quyền */
.island-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(0, 229, 255, 0.95); border: 1.5px solid #ffd700; cursor: pointer; }
.sovereignty-badge-wrapper { background: transparent !important; border: none !important; box-shadow: none !important; }
.sovereignty-geo-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(10, 15, 28, 0.85);
    border: 1px solid rgba(255, 204, 0, 0.5);
    border-radius: var(--r-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sovereignty-geo-label:hover { border-color: #ffd700; }
.sovereignty-geo-label .geo-flag { font-size: 14px; line-height: 1; }
.sovereignty-geo-label .geo-title { font-weight: 700; font-size: var(--fs-xs); color: #ffd700; letter-spacing: 0.5px; }
.sovereignty-geo-label .geo-sub { font-size: 11px; color: rgba(255, 255, 255, 0.75); }

/* Tiến độ & thông báo nổi trên bản đồ (căn giữa vùng không bị panel che) */
.map-status, .map-toast {
    position: absolute;
    left: calc((100% - var(--panel-w)) / 2);
    transform: translateX(-50%);
    z-index: 1000;
    max-width: min(460px, calc(100vw - var(--panel-w) - 48px));
    padding: 9px var(--sp-4);
    border-radius: var(--r-md);
    background: var(--surface-1);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: var(--fs-xs);
    text-align: center;
    pointer-events: none;
}
.map-status { top: calc(var(--topbar-h) + var(--sp-5)); border: 1px solid rgba(255, 204, 0, 0.45); }
.map-status i { color: var(--risk-warning); margin-right: 6px; }
.map-status.done { border-color: rgba(52, 199, 89, 0.5); }
.map-status.done i { color: var(--risk-safe); }
.map-status-bar { display: block; height: 4px; margin-top: 7px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.map-status-bar > span { display: block; height: 100%; background: var(--risk-warning); transition: width 0.4s ease; }
.map-status-hint { display: block; margin-top: 5px; color: var(--text-3); }
.map-toast { bottom: 28px; border: 1px solid var(--border-strong); }
.map-toast i { color: var(--accent); margin-right: 6px; }

/* Điều khiển MapLibre cùng tông tối */
.maplibregl-ctrl-group { background: var(--surface-1) !important; border: 1px solid var(--border); }
.maplibregl-ctrl-group button + button { border-top-color: var(--border) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.85); }
.maplibregl-ctrl-bottom-right { right: calc(var(--panel-w) + var(--sp-3)); }

/* -------------------------------------------------------- 9. RESPONSIVE */
@media (max-width: 1620px) {
    .brand-sub { display: none; }
    .brand, .search-box input, .topbar-actions .btn { height: 36px; }
    .topbar-actions .btn { padding: 0 9px; font-size: 12px; gap: 5px; }
    .topbar-actions .btn-icon { width: 36px; padding: 0; }
    .search-box { min-width: 140px; max-width: 240px; }
}

@media (max-width: 1360px) {
    :root { --topbar-h: 92px; }
    .topbar-actions .btn span, #btn-open-priority { font-size: var(--fs-xs); }
}

@media (max-width: 768px) {
    :root { --panel-w: 100vw; }
    .topbar { left: var(--sp-2); right: var(--sp-2); max-width: none; top: var(--sp-2); flex-wrap: wrap; gap: var(--sp-2); }
    .brand { display: none; }
    .search-box { max-width: none; flex-basis: 100%; order: 2; }
    .topbar-actions { order: 1; width: 100%; justify-content: flex-end; }
    .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 45vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
    .legend { display: none; }
    .map-status, .map-toast { left: 50%; max-width: calc(100vw - 32px); }
    .map-toast { bottom: calc(45vh + 12px); }
    .maplibregl-ctrl-bottom-right { right: 0; bottom: 45vh; }
    #menu-group-3d { display: none; }
    .kpi-row--4 { grid-template-columns: repeat(2, 1fr); }
}

/* -------------------------------------------------------- 10. COMMANDER PANEL & ESTIMATION DISCLAIMER (§6) */
.disclaimer-card {
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-md);
    padding: var(--sp-3);
    font-size: var(--fs-xs);
    line-height: 1.5;
    color: var(--text-2);
}
.disclaimer-title {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.disclaimer-formula {
    margin-top: 5px;
    font-size: 11px;
    color: var(--text-3);
    font-style: italic;
}

.dispatch-factors-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 11.5px;
    margin-bottom: 10px;
}
.factor-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    background: var(--surface-3);
    border-radius: 4px;
    color: var(--text-2);
}
.factor-tag strong { color: var(--text); }

.commander-panel {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.98) 100%);
    border: 1px solid rgba(255, 204, 0, 0.35);
    border-radius: var(--r-md);
    padding: var(--sp-3);
    margin-top: var(--sp-3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.commander-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--sp-2);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.commander-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--risk-warning);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
}
.commander-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 204, 0, 0.16);
    border: 1px solid var(--risk-warning);
    color: #ffd84d;
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}
.commander-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-top: 10px;
}
.commander-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.commander-field label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 18px;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.commander-field label i {
    color: var(--risk-warning);
    font-size: 11px;
    flex-shrink: 0;
}
.commander-field input, .commander-field select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    height: 34px;
    padding: 0 10px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.commander-field select {
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    padding-right: 22px;
}
.commander-field input:focus, .commander-field select:focus {
    border-color: var(--risk-warning);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.18);
}
.commander-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}
.commander-actions .btn {
    height: 32px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    border-radius: var(--r-sm);
    transition: all 0.2s ease;
}
#btn-recalc-dispatch {
    flex: 1 1 auto;
    font-weight: 600;
    background: var(--risk-warning-soft);
    border: 1px solid var(--risk-warning);
    color: #ffd84d;
    cursor: pointer;
}
#btn-recalc-dispatch:hover {
    background: rgba(255, 204, 0, 0.25);
    border-color: #ffd84d;
    box-shadow: 0 2px 8px rgba(255, 204, 0, 0.2);
}
#btn-reset-dispatch {
    flex: 0 0 auto;
    color: var(--text-2);
    cursor: pointer;
}
#btn-reset-dispatch:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

/* -------------------------------------------------------- 11. TACTICAL TEAMS & FORCE ALLOCATION */
.team-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.team-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    transition: all 0.2s ease;
}
.team-card:hover {
    border-color: rgba(0, 229, 255, 0.4);
    background: rgba(30, 41, 59, 0.7);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.team-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.team-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 7px;
    line-height: 1.35;
}
.team-card-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: var(--accent);
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}
.team-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.team-card-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.team-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}
.team-card-label i {
    color: var(--accent);
    font-size: 11px;
}
.team-card-text {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.5;
}
.team-card-eq {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px dashed rgba(255, 204, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 2px;
}
.team-card-eq-head {
    color: #ffd84d;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.team-card-eq-text {
    color: rgba(255, 216, 77, 0.95);
    font-size: 11.5px;
    line-height: 1.45;
}

/* -------------------------------------------------------- 12. 7-STEP WORKFLOW STEPPER & RESPONSIBILITY MATRIX (§5) */
.wf-verified-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 229, 255, 0.16);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 600;
    margin-left: auto;
}

.wf-stepper-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 12px;
    margin-bottom: var(--sp-3);
}
.wf-stepper-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.wf-stepper-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
}
.wf-stepper-meta {
    font-size: 10.5px;
    color: var(--text-3);
}
.wf-stepper-track {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}
.wf-step {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 6px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-3);
    font-family: inherit;
    transition: all 0.18s ease;
}
.wf-step:hover {
    border-color: var(--accent);
    color: var(--text);
}
.wf-step-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-3);
}
.wf-step-label {
    font-size: 9.5px;
    line-height: 1.2;
    text-align: center;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wf-step--completed {
    border-color: rgba(52, 199, 89, 0.4);
    color: var(--text-2);
}
.wf-step--completed .wf-step-dot {
    background: rgba(52, 199, 89, 0.2);
    color: var(--risk-safe);
}
.wf-step--active {
    border-color: var(--risk-warning);
    background: rgba(255, 204, 0, 0.1);
    color: #fff;
}
.wf-step--active .wf-step-dot {
    background: var(--risk-warning);
    color: #0b1120;
}

.wf-assign-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wf-assign-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--risk-warning);
    border-radius: var(--r-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wf-assign--completed {
    border-left-color: var(--risk-safe);
    opacity: 0.92;
}
.wf-assign--in_progress {
    border-left-color: var(--accent);
}
.wf-assign-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.wf-trigger-tag {
    font-size: 11px;
    font-weight: 600;
    color: #ffd84d;
    background: rgba(255, 204, 0, 0.12);
    border: 1px solid rgba(255, 204, 0, 0.3);
    padding: 2px 7px;
    border-radius: 4px;
}
.wf-sla-badge {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(0, 229, 255, 0.12);
    padding: 2px 7px;
    border-radius: 999px;
}
.wf-assign-role {
    font-size: 12px;
    color: var(--text);
}
.wf-assign-role i {
    color: var(--accent);
    margin-right: 4px;
}
.wf-assignee-chip {
    color: var(--risk-safe);
    font-weight: 600;
}
.wf-assign-title {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}
.wf-assign-title i {
    color: var(--risk-warning);
    margin-right: 4px;
}
.wf-assign-detail {
    font-size: 11.5px;
    color: var(--text-2);
    line-height: 1.45;
}
.wf-assign-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.wf-assign-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.wf-assignee-input {
    height: 26px;
    width: 145px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text);
}
.btn-xs {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}
.wf-btn-complete {
    background: rgba(52, 199, 89, 0.18);
    border: 1px solid rgba(52, 199, 89, 0.5);
    color: #5ce07a;
}

.wf-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px;
}
.wf-panel-intro {
    font-size: 11.5px;
    color: var(--text-2);
    line-height: 1.5;
    margin-bottom: 8px;
}
.wf-subhead {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.wf-verify-history {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(15, 23, 42, 0.65);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.wf-verify-item {
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
    font-size: 11.5px;
}
.wf-verify-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}
.wf-verify-item-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 3px;
}
.wf-verify-meta {
    font-size: 11px;
    color: var(--text-2);
}
.wf-verify-note {
    font-size: 11.5px;
    color: #ffd84d;
    font-style: italic;
    margin-top: 2px;
}
.wf-inline-check {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-2);
}
.wf-inline-check label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.wf-btn-primary {
    width: 100%;
    font-weight: 600;
    background: rgba(0, 229, 255, 0.16);
    border: 1px solid var(--accent);
    color: var(--accent);
    cursor: pointer;
}
.wf-btn-success {
    width: 100%;
    font-weight: 600;
    background: rgba(52, 199, 89, 0.18);
    border: 1px solid var(--risk-safe);
    color: #5ce07a;
    cursor: pointer;
}
.wf-event-link {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.wf-event-link:hover {
    text-decoration: underline;
}

/* =========================================================================
   ENGINE SINH KHUYẾN NGHỊ TỰ ĐỘNG GẮN TỌA ĐỘ KHÔNG GIAN & CÔNG TRÌNH
   ========================================================================= */
.rec-target-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 6px 0;
    padding: 7px 9px;
    border-radius: 6px;
    background: rgba(0, 210, 255, 0.06);
    border-left: 2.5px solid var(--accent);
}
.rec-facility {
    font-size: 11.5px;
    color: var(--text);
    line-height: 1.4;
}
.rec-facility i {
    color: var(--accent);
    margin-right: 4px;
}
.rec-spec {
    font-size: 11px;
    color: #5ce07a;
    line-height: 1.4;
    font-weight: 500;
}
.rec-spec i {
    margin-right: 4px;
}
.rec-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.rec-coord-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
    color: var(--accent);
    background: rgba(0, 210, 255, 0.12);
    border: 1px solid rgba(0, 210, 255, 0.35);
    cursor: pointer;
    transition: all 0.15s ease;
}
.rec-coord-btn:hover {
    background: rgba(0, 210, 255, 0.22);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.rec-coord-btn small {
    font-family: var(--font-sans, sans-serif);
    font-weight: 500;
    opacity: 0.85;
}

.planning-target-marker {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.planning-pin-ring {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #00e5ff;
    background: rgba(0, 229, 255, 0.18);
    animation: planningPulse 1.8s infinite ease-out;
}
.planning-pin-core {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #061826;
    border: 2px solid #00e5ff;
    color: #00e5ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.7);
}
@keyframes planningPulse {
    0% { transform: scale(0.8); opacity: 0.95; }
    100% { transform: scale(1.7); opacity: 0; }
}
.planning-popup {
    padding: 2px 4px;
    font-size: 11.5px;
    line-height: 1.45;
    color: #e2e8f0;
}
.planning-popup-cat {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #00e5ff;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.planning-popup-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}
.planning-popup-row {
    font-size: 11px;
    color: #cbd5e1;
    margin-bottom: 2px;
}
.planning-popup-coord {
    margin-top: 5px;
    padding-top: 4px;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    color: #5ce07a;
    font-weight: 600;
}




