/* ══════════════════════════════════════════════════════════════════
   ระบบบริหารจัดการตำแหน่งและกำลังคน · เขตสุขภาพที่ 9
   ══════════════════════════════════════════════════════════════════ */
:root {
  --bg: #f2f6f8;
  --bg-2: #eaf1f4;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --surface-3: #f1f6f8;
  --ink: #102a35;
  --ink-2: #294a57;
  --muted: #6b8491;
  --muted-2: #8ba1ac;
  --line: #e1e9ed;
  --line-2: #edf3f5;
  --brand: #0e7490;
  --brand-2: #0b5b70;
  --brand-3: #0a3b4a;
  --brand-4: #082e3a;
  --teal: #0f9d8e;
  --teal-soft: #d9f5ef;
  --amber: #c9821a;
  --amber-soft: #fdf1da;
  --red: #b93f37;
  --red-soft: #fbe9e7;
  --green: #0d7a68;
  --green-soft: #dcf4ee;
  --blue-soft: #e5f0f6;
  --violet: #6d5aa8;
  --violet-soft: #eeeaf8;
  --shadow-sm: 0 1px 2px rgba(16, 42, 53, .05);
  --shadow: 0 1px 2px rgba(16, 42, 53, .04), 0 10px 30px rgba(16, 42, 53, .06);
  --shadow-lg: 0 30px 70px rgba(6, 32, 41, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Sarabun", "Noto Sans Thai", "IBM Plex Sans Thai", "Thonburi",
          -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", "IBM Plex Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
svg { display: block; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
::selection { background: #bfe6e0; color: var(--brand-3); }

/* ─────────────── Boot ─────────────── */
.boot-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: radial-gradient(1100px 700px at 50% -10%, #143f4e, #071e27 70%);
  color: #cfe4ea; transition: opacity .35s ease;
}
.boot-screen.fade { opacity: 0; pointer-events: none; }
.boot-mark {
  width: 66px; height: 66px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(145deg, #127d92, #0a3b4a);
  border: 1px solid rgba(125, 211, 199, .35);
  color: #a9ece1; font-weight: 800; font-size: 24px; letter-spacing: -.02em;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .3);
}
.boot-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .15); border-top-color: #6fd3c4;
  animation: spin .8s linear infinite;
}
.boot-screen p { font-size: 13px; color: #8fb3bf; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────── Login ─────────────── */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: #f4f8f9;
}
.login-hero {
  position: relative; overflow: hidden;
  padding: clamp(30px, 5vw, 68px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 36px;
  background:
    radial-gradient(900px 620px at 8% 0%, rgba(35, 128, 140, .55), transparent 62%),
    radial-gradient(700px 500px at 100% 92%, rgba(20, 113, 126, .4), transparent 58%),
    linear-gradient(150deg, #0d3d4c 0%, #082d39 58%, #06222b 100%);
  color: #e8f4f6;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
  pointer-events: none;
}
.hero-orb {
  position: absolute; border-radius: 50%; filter: blur(6px); pointer-events: none;
}
.orb-a {
  width: 420px; height: 420px; right: -180px; top: 18%;
  background: radial-gradient(circle at 30% 30%, rgba(94, 210, 194, .22), transparent 65%);
  border: 1px solid rgba(125, 211, 199, .1);
}
.orb-b {
  width: 260px; height: 260px; left: -120px; bottom: 6%;
  background: radial-gradient(circle at 60% 40%, rgba(242, 184, 75, .12), transparent 65%);
}
.hero-top { position: relative; display: flex; align-items: center; gap: 14px; z-index: 1; }
.brand-mark {
  width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center;
  font-weight: 800; font-size: 21px; letter-spacing: -.03em; color: #a9ece1;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(125, 211, 199, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  flex: none;
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 12px; font-size: 17px; color: var(--brand); background: var(--blue-soft); border: none; }
.hero-kicker { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: #7fb9c4; }
.hero-org { font-size: 15px; font-weight: 600; color: #e2f1f3; margin-top: 2px; }
.hero-copy { position: relative; max-width: 540px; z-index: 1; }
.hero-copy h1 {
  font-size: clamp(32px, 3.4vw, 48px); line-height: 1.18; font-weight: 750;
  letter-spacing: -.025em; color: #f4fbfc;
}
.hero-copy h1 span { color: #7dd3c7; }
.hero-copy p {
  margin-top: 20px; font-size: 14.5px; line-height: 1.75; color: #a9c9d2; max-width: 460px;
}
.hero-points { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 13px; }
.hero-points li { display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: #c3dce2; }
.hero-points .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #6fd3c4; flex: none;
  box-shadow: 0 0 0 4px rgba(111, 211, 196, .12);
}
.hero-foot {
  position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 12px;
  font-size: 11.5px; color: #6f9aa6; border-top: 1px solid rgba(255, 255, 255, .08);
  padding-top: 18px;
}
.hero-version { font-family: var(--mono); }

.login-panel {
  display: flex; align-items: center; justify-content: center; padding: 32px clamp(20px, 4vw, 64px);
  background:
    radial-gradient(700px 500px at 100% 0%, #e9f2f4, transparent 55%),
    #f4f8f9;
}
.login-card {
  width: 100%; max-width: 430px; background: #fff; border-radius: 20px;
  padding: clamp(28px, 3.4vw, 44px);
  box-shadow: 0 2px 4px rgba(16, 42, 53, .04), 0 26px 60px rgba(16, 42, 53, .1);
  border: 1px solid #e9eff2;
}
.login-mobile-brand { display: none; align-items: center; gap: 11px; font-weight: 650; color: var(--brand-3); margin-bottom: 22px; }
.login-card h2 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
.login-sub { margin-top: 7px; margin-bottom: 28px; font-size: 13px; color: var(--muted); }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 7px; }
.input-icon { position: relative; margin-bottom: 17px; }
.input-icon > svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; stroke: var(--muted-2); fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}
.input-icon input {
  width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 11px;
  padding: 0 44px 0 40px; background: #fbfdfe; transition: border-color .15s, box-shadow .15s, background .15s;
  font-size: 14px;
}
.input-icon input:focus {
  outline: none; border-color: #63b3c4; background: #fff;
  box-shadow: 0 0 0 4px rgba(14, 116, 144, .1);
}
.pw-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; background: transparent; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted);
}
.pw-toggle:hover { background: var(--surface-3); color: var(--brand); }
.pw-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.login-error {
  display: flex; gap: 8px; align-items: flex-start; background: var(--red-soft); color: #8f2f29;
  border: 1px solid #f2cbc7; border-radius: 10px; padding: 10px 12px; font-size: 12.5px;
  margin: -3px 0 15px;
}
.login-note {
  display: flex; gap: 9px; align-items: flex-start; margin-top: 22px; padding: 12px 13px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px;
  color: var(--muted); font-size: 12px; line-height: 1.6;
}
.login-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.login-foot { margin-top: 22px; text-align: center; font-size: 11px; color: var(--muted-2); }

/* ─────────────── Buttons ─────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: #cfdde2; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid #63b3c4; outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary {
  background: linear-gradient(180deg, #0f7f9b, #0b657c); border-color: #0b657c; color: #fff;
  box-shadow: 0 1px 2px rgba(11, 101, 124, .2), 0 6px 16px rgba(11, 101, 124, .18);
}
.btn-primary:hover { background: linear-gradient(180deg, #0d728b, #0a586c); border-color: #0a586c; }
.btn-danger { background: #fff; border-color: #efc5c1; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-sm { height: 31px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 48px; font-size: 14.5px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary.btn-lg { margin-top: 5px; }

/* ─────────────── App shell ─────────────── */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 50;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, #0a3543 0%, #082b36 55%, #07242e 100%);
  color: #cfe3ea;
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 20px; }
.sb-brand .brand-mark {
  width: 42px; height: 42px; border-radius: 12px; font-size: 16px;
  background: rgba(125, 211, 199, .12); border-color: rgba(125, 211, 199, .22);
}
.sb-brand-name { font-size: 13.5px; font-weight: 700; color: #eef8fa; letter-spacing: -.01em; }
.sb-brand-sub { font-size: 10.5px; color: #7da3ae; letter-spacing: .08em; margin-top: 1px; }
.sb-section {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: #648e9a; padding: 14px 12px 6px; font-weight: 600;
}
.sb-nav { display: grid; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px; background: transparent;
  color: #a9c6d1; font-size: 13px; font-weight: 500; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: .9; }
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #eaf6f8; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(111, 211, 196, .17), rgba(111, 211, 196, .06));
  color: #f2fbfc; box-shadow: inset 2px 0 0 #6fd3c4;
}
.nav-item .nav-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; background: rgba(242, 184, 75, .16); color: #f2c46b;
}
.nav-item.active .nav-badge { background: rgba(242, 184, 75, .22); }
.sb-spacer { flex: 1; }
.sb-user {
  border-top: 1px solid rgba(255, 255, 255, .08); padding: 14px 8px 4px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: linear-gradient(145deg, #16778a, #0d5265); color: #d9f6f1;
  border: 1px solid rgba(255, 255, 255, .12);
}
.avatar.light { background: var(--blue-soft); color: var(--brand); border-color: #cfe3ea; }
.sb-user-name { font-size: 12.5px; font-weight: 600; color: #e6f2f5; line-height: 1.35; }
.sb-user-role { font-size: 10.5px; color: #7fa8b3; }
.sb-logout {
  margin-left: auto; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: #7fa8b3; display: grid; place-items: center;
}
.sb-logout:hover { background: rgba(255, 255, 255, .08); color: #ffd9d4; }
.sb-logout svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.app-main { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; }
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 45; background: rgba(5, 25, 32, .5);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* ─────────────── Topbar ─────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: 70px;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(18px, 3vw, 34px);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.tb-title h1 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; color: var(--ink); line-height: 1.3; }
.tb-title p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tb-spacer { flex: 1; }
.tb-meta {
  display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line-2); padding: 7px 10px; border-radius: 8px;
}
.tb-meta svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.tb-actions { display: flex; align-items: center; gap: 8px; }
.tb-user { display: flex; align-items: center; gap: 9px; padding-left: 6px; }
.tb-user .avatar { width: 34px; height: 34px; border-radius: 10px; }
.tb-user-name { font-size: 12.5px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.tb-user-role { font-size: 10.5px; color: var(--muted); }
.menu-btn {
  display: none; width: 38px; height: 38px; border: 1px solid var(--line); background: #fff;
  border-radius: 9px; place-items: center; color: var(--ink-2);
}
.menu-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.view { padding: 26px clamp(18px, 3vw, 34px) 64px; width: 100%; max-width: 1560px; margin: 0 auto; outline: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head h1 { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.view-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.view-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .rule { flex: 1; height: 1px; background: var(--line); }

/* ─────────────── Cards / grid ─────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px 18px 0; }
.card-h h3 { font-size: 14px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.card-h p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.card-h .card-tools { display: flex; gap: 6px; align-items: center; }
.card-b { padding: 15px 18px 18px; }
.card-pad { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-dash { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-dash-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: grid; gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px; display: flex; gap: 13px; align-items: flex-start;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px;
  border-radius: 50%; background: radial-gradient(circle, rgba(14, 116, 144, .05), transparent 70%);
}
.kpi-ico {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--brand);
}
.kpi-ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.kpi-ico.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-ico.red { background: var(--red-soft); color: var(--red); }
.kpi-ico.green { background: var(--green-soft); color: var(--green); }
.kpi-ico.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 550; }
.kpi-value { font-size: 27px; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; margin-top: 3px; color: var(--ink); }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kpi-sub .up { color: var(--green); font-weight: 650; }
.kpi-sub .warn { color: var(--amber); font-weight: 650; }
.kpi-sub .bad { color: var(--red); font-weight: 650; }

/* ─────────────── Badges / chips ─────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 650; line-height: 1.5;
  white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge.no-dot::before { display: none; }
.badge-filled { background: var(--green-soft); color: #0a6757; border-color: #c2e9df; }
.badge-vacant { background: var(--amber-soft); color: #98620d; border-color: #f3dfb6; }
.badge-high { background: var(--red-soft); color: #9c3028; border-color: #f3cdc8; }
.badge-normal { background: var(--surface-3); color: var(--ink-2); border-color: var(--line); }
.badge-low { background: #f2f4f6; color: var(--muted); border-color: var(--line); }
.badge-stage { background: var(--blue-soft); color: #0b6176; border-color: #cde5ee; }
.badge-stage.announced { background: #e7f1fb; color: #1e5f93; border-color: #cfe3f5; }
.badge-stage.screening { background: var(--violet-soft); color: #5a4894; border-color: #ddd6f0; }
.badge-stage.proposed { background: #e3f4ef; color: #0b6b5b; border-color: #c6e9df; }
.badge-stage.cancelled { background: #f1f2f4; color: #6f7c84; border-color: #e2e6e9; }
.badge-risk-high { background: var(--red-soft); color: #9c3028; }
.badge-risk-medium { background: var(--amber-soft); color: #8f5c09; }
.badge-risk-low { background: var(--green-soft); color: #0a6757; }
.dot-sep { color: var(--line); }
.chipbar { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-2); font-size: 12.5px; font-weight: 550; transition: .15s;
}
.chip:hover { border-color: #bdd3da; background: var(--surface-2); }
.chip.active { background: var(--brand-3); border-color: var(--brand-3); color: #fff; }
.chip .n { font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--muted); padding: 1px 6px; border-radius: 999px; }
.chip.active .n { background: rgba(255, 255, 255, .16); color: #d8f1f5; }

/* ─────────────── Filters / forms ─────────────── */
.filters {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.filter-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; align-items: end; }
.filter { display: flex; flex-direction: column; gap: 5px; grid-column: span 2; min-width: 0; }
.filter.wide { grid-column: span 4; }
.filter.xwide { grid-column: span 3; }
.filter label { font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: .01em; white-space: nowrap; }
.filter input, .filter select {
  height: 38px; width: 100%; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; padding: 0 10px; font-size: 12.5px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.filter input:focus, .filter select:focus { outline: none; border-color: #63b3c4; box-shadow: 0 0 0 3px rgba(14, 116, 144, .09); }
.filter-actions { display: flex; gap: 7px; align-items: center; grid-column: span 3; justify-content: flex-end; }
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; fill: none; stroke: var(--muted-2); stroke-width: 1.8; pointer-events: none;
}
.search-wrap input { padding-left: 31px; }
.filter-more {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  border-top: 1px dashed var(--line); margin-top: 11px; padding-top: 11px;
}
.filter-more .filter { grid-column: auto; min-width: 170px; }
.checkline { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.checkline input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.result-count { font-size: 12.5px; color: var(--muted); }
.result-count strong { color: var(--ink); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff;
  padding: 9px 11px; font-size: 13px; min-height: 40px;
}
.form-field textarea { min-height: 86px; resize: vertical; line-height: 1.6; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: #63b3c4; box-shadow: 0 0 0 3px rgba(14, 116, 144, .09);
}
.form-hint { font-size: 11px; color: var(--muted); }
.form-error { color: var(--red); font-size: 12px; margin-top: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; }
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfdbe0; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::before { transform: translateX(17px); }

/* ─────────────── Tables ─────────────── */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
table.data thead th {
  position: sticky; top: 0; z-index: 1; background: #f7fafb; text-align: left;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #f8fbfc; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.overdue { background: #fffaf6; }
table.data tbody tr.overdue:hover { background: #fff5ec; }
.pos-no { font-family: var(--mono); font-size: 12.5px; font-weight: 650; color: var(--brand-3); letter-spacing: -.01em; }
.unit-cell { display: flex; flex-direction: column; gap: 1px; min-width: 150px; }
.unit-cell strong { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.unit-cell span { font-size: 10.5px; color: var(--muted); }
.job-cell { display: flex; flex-direction: column; gap: 1px; }
.job-cell strong { font-size: 12.5px; font-weight: 550; }
.job-cell span { font-size: 10.5px; color: var(--muted); }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }
.icon-btn {
  width: 29px; height: 29px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  display: inline-grid; place-items: center; color: var(--muted); transition: .15s;
}
.icon-btn:hover { color: var(--brand); border-color: #bad6de; background: var(--surface-2); }
.icon-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 15px; border-top: 1px solid var(--line-2); background: #fcfdfe;
}
.page-info { font-size: 11.5px; color: var(--muted); }
.page-btns { display: flex; gap: 5px; align-items: center; }
.page-btns button {
  min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line);
  background: #fff; border-radius: 7px; font-size: 11.5px; color: var(--ink-2);
}
.page-btns button:hover:not([disabled]) { border-color: #b8d2da; color: var(--brand); }
.page-btns button.active { background: var(--brand-3); border-color: var(--brand-3); color: #fff; font-weight: 600; }
.page-btns button[disabled] { opacity: .4; cursor: not-allowed; }

/* ─────────────── Charts ─────────────── */
.bar-list { display: grid; gap: 13px; }
.bar-item { display: grid; gap: 5px; }
.bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bar-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.bar-name small { font-weight: 500; color: var(--muted); font-size: 10.5px; margin-left: 5px; }
.bar-val { font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-val small { font-weight: 500; color: var(--muted); font-size: 10.5px; margin-left: 4px; }
.bar-track { height: 7px; border-radius: 99px; background: #eef3f5; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #2196a8, #0e7490); transition: width .5s cubic-bezier(.2,.7,.3,1); }
.bar-fill.amber { background: linear-gradient(90deg, #e3a63f, #c9821a); }
.bar-fill.red { background: linear-gradient(90deg, #d96a5f, #b93f37); }
.bar-fill.green { background: linear-gradient(90deg, #34b79f, #0d7a68); }
.bar-fill.violet { background: linear-gradient(90deg, #8f7cc4, #6d5aa8); }
.donut-wrap { display: flex; align-items: center; gap: 22px; padding: 4px 0 2px; }
.donut {
  --p: 94.8; width: 148px; height: 148px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), #e8eef1 0);
  display: grid; place-items: center;
}
.donut::before { content: ""; position: absolute; inset: 14px; background: #fff; border-radius: 50%; }
.donut-center { position: relative; text-align: center; }
.donut-center strong { display: block; font-size: 25px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.donut-center span { font-size: 10.5px; color: var(--muted); }
.legend { display: grid; gap: 10px; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row .lg-name { color: var(--muted); }
.legend-row .lg-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-row .lg-pct { color: var(--muted); font-size: 10.5px; width: 42px; text-align: right; }
.vbars { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding-top: 6px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; min-width: 0; }
.vbar .col {
  width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #2d9db0, #0e7490); min-height: 3px;
  position: relative; transition: height .5s ease;
}
.vbar.risk .col { background: linear-gradient(180deg, #e0a23c, #c9821a); }
.vbar .v { font-size: 10px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.vbar .x { font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.pipeline-list { display: grid; gap: 8px; }
.pipeline-row {
  display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: center;
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2);
  width: 100%; text-align: left;
}
.pipeline-row:hover { border-color: #c5dce3; background: #fff; }
.pipeline-name { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.pipeline-count { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipeline-bar { grid-column: 1 / -1; height: 4px; border-radius: 9px; background: #e9eff2; overflow: hidden; }
.pipeline-bar i { display: block; height: 100%; background: linear-gradient(90deg, #62b7c4, #0e7490); border-radius: 9px; }

/* ─────────────── Timeline / activity ─────────────── */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 16px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.tl-item:not(:last-child)::before {
  content: ""; position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--line);
}
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: #c9d9df; margin-top: 4px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tl-dot.brand { background: var(--brand); box-shadow: 0 0 0 1px #9fc7d1; }
.tl-body { min-width: 0; }
.tl-title { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.tl-title strong { font-weight: 650; color: var(--ink); }
.tl-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }
.activity-item { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px dashed var(--line-2); }
.activity-item:last-child { border-bottom: 0; }
.activity-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); flex: none; }
.activity-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.activity-body { min-width: 0; }
.activity-title { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.activity-title strong { font-weight: 650; color: var(--ink); }
.activity-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* ─────────────── Drawer ─────────────── */
.drawer-root { position: fixed; inset: 0; z-index: 90; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(5, 28, 36, .45); backdrop-filter: blur(2px); animation: fade .2s ease; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100%);
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slidein .24s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slidein { from { transform: translateX(36px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-h {
  padding: 20px 22px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px;
  align-items: flex-start; background: linear-gradient(180deg, #fbfdfe, #fff); flex: none;
}
.drawer-h .dh-main { flex: 1; min-width: 0; }
.drawer-kicker { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.drawer-title { font-size: 20px; font-weight: 750; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.drawer-title .mono { font-family: var(--mono); font-size: 19px; color: var(--brand-3); }
.drawer-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.drawer-close {
  width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 9px;
  display: grid; place-items: center; color: var(--muted); flex: none;
}
.drawer-close:hover { color: var(--ink); background: var(--surface-2); }
.drawer-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--line); background: #fff; flex: none; }
.tab {
  border: 0; background: transparent; padding: 11px 12px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--brand-3); border-bottom-color: var(--brand); }
.drawer-b { padding: 20px 22px 34px; overflow-y: auto; flex: 1; }
.drawer-f { padding: 13px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #fbfdfe; flex: none; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 20px; }
.detail-item { min-width: 0; }
.detail-item label { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.detail-item .val { font-size: 13px; color: var(--ink); font-weight: 500; line-height: 1.5; word-break: break-word; }
.detail-item .val.mono { font-family: var(--mono); font-size: 12.5px; }
.detail-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.detail-section h4 { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.detail-section h4 svg { width: 15px; height: 15px; fill: none; stroke: var(--brand); stroke-width: 1.8; }
.info-banner {
  display: flex; gap: 9px; padding: 11px 13px; border-radius: 10px; font-size: 12px;
  background: var(--amber-soft); color: #7c520c; border: 1px solid #f1dfba; line-height: 1.55;
}
.info-banner svg { width: 16px; height: 16px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.occupant-card {
  border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: var(--surface-2);
  display: flex; gap: 12px; align-items: flex-start;
}
.occupant-avatar { width: 38px; height: 38px; border-radius: 10px; background: var(--blue-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.occupant-name { font-size: 13px; font-weight: 650; }
.occupant-name.unnamed { color: var(--muted); font-weight: 500; font-style: italic; }
.occupant-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.vacancy-form { display: grid; gap: 12px; }
.vacancy-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─────────────── Modal ─────────────── */
.modal-root { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 18px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(5, 28, 36, .5); backdrop-filter: blur(2px); animation: fade .18s; }
.modal {
  position: relative; width: min(540px, 100%); max-height: calc(100vh - 40px);
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: pop .2s cubic-bezier(.2,.8,.3,1);
}
.modal.wide { width: min(680px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-h { padding: 18px 20px 12px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.modal-h h3 { font-size: 16px; font-weight: 700; letter-spacing: -.015em; }
.modal-h p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.modal-b { padding: 4px 20px 18px; overflow-y: auto; }
.modal-f { padding: 12px 20px 16px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }

/* ─────────────── Toast ─────────────── */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  background: #10333f; color: #e9f6f8; border-radius: 10px; padding: 11px 14px;
  font-size: 12.5px; box-shadow: 0 14px 34px rgba(5, 25, 32, .3);
  display: flex; gap: 9px; align-items: flex-start; animation: toastin .22s ease;
  border-left: 3px solid #5ec8b8;
}
.toast.error { border-left-color: #e0796d; }
.toast.warn { border-left-color: #e0a23c; }
.toast svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; margin-top: 1px; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─────────────── Empty / loading ─────────────── */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 12px; color: var(--muted-2); }
.empty-ico svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.empty strong { display: block; color: var(--ink-2); font-size: 13.5px; margin-bottom: 3px; }
.empty p { font-size: 12px; }
.loading { padding: 50px 20px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line);
  border-top-color: var(--brand); animation: spin .8s linear infinite;
}
.skeleton { background: linear-gradient(90deg, #eef3f5 25%, #f7fafb 37%, #eef3f5 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.progress-line { height: 6px; background: #e9eff2; border-radius: 99px; overflow: hidden; }
.progress-line i { display: block; height: 100%; background: linear-gradient(90deg, #37b7a2, #0d7a68); border-radius: 99px; }

/* ─────────────── Misc layout ─────────────── */
.split-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.callout {
  display: flex; gap: 11px; align-items: flex-start; background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--amber); border-radius: 10px; padding: 12px 14px; font-size: 12px;
  color: var(--ink-2); line-height: 1.6;
}
.callout svg { width: 17px; height: 17px; flex: none; margin-top: 1px; fill: none; stroke: var(--amber); stroke-width: 1.8; }
.callout a { font-weight: 650; color: var(--brand); text-decoration: none; }
.callout a:hover { text-decoration: underline; }
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-pill {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line-2); font-size: 11.5px; color: var(--muted);
}
.stat-pill strong { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.readonly-note { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.readonly-note svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ─────────────── Responsive ─────────────── */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash { grid-template-columns: 1fr; }
  .grid-dash-wide { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .app-main { margin-left: 0; }
  .menu-btn { display: grid; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .filter { grid-column: span 4; }
  .filter.wide { grid-column: span 6; }
  .filter.xwide { grid-column: span 4; }
  .filter-actions { grid-column: span 12; justify-content: flex-start; }
}
@media (max-width: 860px) {
  .login-view { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel { min-height: 100vh; padding: 22px; }
  .login-mobile-brand { display: flex; }
  .topbar { min-height: 62px; gap: 10px; }
  .tb-meta { display: none; }
  .tb-title h1 { font-size: 16px; }
  .tb-user-name, .tb-user-role { display: none; }
  .view { padding: 18px 14px 48px; }
  .detail-grid { grid-template-columns: 1fr; }
  .vacancy-form .row2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: flex-start; gap: 14px; }
  .kpi-value { font-size: 24px; }
  .vbars { gap: 4px; height: 130px; }
  .vbar .x { font-size: 8.5px; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .filter, .filter.wide, .filter.xwide { grid-column: span 12; }
  .filter-actions { grid-column: span 12; }
  .pagination { flex-direction: column; align-items: flex-start; }
  .drawer-h, .drawer-b, .drawer-f { padding-left: 16px; padding-right: 16px; }
  .tabs { padding: 0 10px; }
  .view-head h1 { font-size: 19px; }
  .toast-root { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

@media print {
  .sidebar, .topbar, .filters, .view-head-actions, .pagination, .drawer-root, .modal-root, .toast-root { display: none !important; }
  .app-main { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ─────────────── Added components ─────────────── */
.bar-item.clickable { cursor: pointer; border: 1px solid transparent; border-radius: 9px; padding: 6px 8px; margin: -6px -8px; transition: .15s; }
.bar-item.clickable:hover { background: var(--surface-2); border-color: var(--line-2); }
table.data.compact { min-width: 0; }
table.data.compact th { padding: 8px 10px; font-size: 9.5px; }
table.data.compact td { padding: 8px 10px; font-size: 12px; }
.stage-select { height: 30px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 11.5px; padding: 0 6px; max-width: 148px; color: var(--ink-2); }
.stage-select:focus { outline: none; border-color: #63b3c4; }
.link-btn { border: 0; background: transparent; color: var(--brand); font-weight: 600; font-size: 12px; padding: 2px; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.mini-stat { display: grid; gap: 2px; }
.mini-stat .v { font-size: 19px; font-weight: 750; letter-spacing: -.02em; }
.mini-stat .l { font-size: 10.5px; color: var(--muted); }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; }
.checkbox-grid label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.checkbox-grid input { accent-color: var(--brand); }
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-cell .avatar { width: 31px; height: 31px; border-radius: 9px; font-size: 11px; }
.user-cell .u-name { font-size: 12.5px; font-weight: 600; }
.user-cell .u-sub { font-size: 10.5px; color: var(--muted); }
.province-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.province-tag { font-size: 10px; background: var(--surface-3); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 999px; color: var(--ink-2); }
.table-note { font-size: 11px; color: var(--muted); padding: 9px 14px; border-top: 1px solid var(--line-2); background: #fcfdfe; }
.report-total td { background: #f7fafb; font-weight: 700; border-top: 1px solid var(--line); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.drawer-loading { padding: 60px 20px; display: flex; justify-content: center; }
.modal-scroll { max-height: 60vh; overflow-y: auto; }
.kpi.compact { padding: 13px 15px; gap: 10px; }
.kpi.compact .kpi-ico { width: 36px; height: 36px; border-radius: 10px; }
.kpi.compact .kpi-value { font-size: 22px; }
.kpi.compact .kpi-label { font-size: 11px; }
.searching { position: relative; }
.searching.busy::after { content: ""; position: absolute; right: 10px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
.toolbar-tight { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tagline { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.tagline svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.select-inline { height: 36px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 0 10px; font-size: 12.5px; color: var(--ink); }
.select-inline:focus { outline: none; border-color: #63b3c4; box-shadow: 0 0 0 3px rgba(14,116,144,.09); }
.mt-16 { margin-top: 16px; }
.hide-sm { display: inline; }
@media (max-width: 720px) { .hide-sm { display: none; } }

.page-btns button svg { width: 14px; height: 14px; }
.dq-flag { color: var(--amber); margin-left: 4px; display: inline-flex; vertical-align: -2px; }
.dq-flag svg { width: 13px; height: 13px; }
.vbar .x { font-size: 8.5px; letter-spacing: -.02em; }
.vbar .v { font-size: 9px; letter-spacing: -.03em; }
input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px; min-height: 0; padding: 0; flex: none;
  accent-color: var(--brand);
}
.switch input[type="checkbox"] { width: 0; height: 0; }

/* ─────────────── Dashboard filter buttons / picker ─────────────── */
.dash-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 2px 0;
}
.df-label {
  display: inline-flex; align-items: center; gap: 6px; margin-right: 2px;
  font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.df-label svg { width: 14px; height: 14px; }
.filter-pill {
  display: flex; align-items: center; gap: 9px; min-width: 158px; max-width: 250px;
  padding: 7px 11px; background: #fff; border: 1px solid var(--line); border-radius: 11px;
  text-align: left; box-shadow: var(--shadow-sm); transition: .15s;
}
.filter-pill:hover { border-color: #bdd3da; background: #fbfdfe; }
.filter-pill.active {
  border-color: #9fc7d1; background: #f0f9fb;
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .06);
}
.fp-ico {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center; background: var(--surface-3); color: var(--brand);
}
.fp-ico svg { width: 15px; height: 15px; }
.filter-pill .fp-body { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.fp-k { font-size: 9.5px; color: var(--muted); letter-spacing: .02em; }
.filter-pill strong {
  font-size: 12px; font-weight: 650; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}
.filter-pill > svg { width: 13px; height: 13px; color: var(--muted-2); flex: none; }
.filter-pill.active > svg { color: var(--brand); }
.df-clear { margin-left: 2px; }
.picker-search-wrap { position: relative; margin-bottom: 10px; }
.picker-search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--muted-2); stroke-width: 1.8;
  pointer-events: none;
}
.picker-search-wrap input {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px 0 36px; font-size: 13px; background: #fbfdfe;
}
.picker-search-wrap input:focus {
  outline: none; border-color: #63b3c4; background: #fff;
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .09);
}
.picker-list { display: grid; gap: 3px; max-height: 52vh; overflow-y: auto; padding-right: 2px; }
.picker-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
  border-radius: 8px; padding: 9px 10px; font-size: 12.5px; color: var(--ink-2);
}
.picker-item:hover { background: var(--surface-2); border-color: var(--line-2); }
.picker-item.active { background: var(--blue-soft); border-color: #cde5ee; color: var(--brand-3); font-weight: 650; }
.picker-item > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item .cnt { font-size: 10.5px; color: var(--muted); font-weight: 400; white-space: nowrap; }
@media (max-width: 720px) {
  .df-label { width: 100%; }
  .filter-pill { flex: 1 1 calc(50% - 8px); min-width: 0; max-width: none; }
}

/* ─────────────── Global province scope bar ─────────────── */
.scope-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px clamp(18px, 3vw, 34px);
  background: #fff; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.scope-bar::-webkit-scrollbar { display: none; }
.scope-label {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.scope-label svg { width: 14px; height: 14px; }
.scope-pills { display: flex; align-items: center; gap: 4px; flex: none; }
.scope-pill {
  height: 30px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 600;
  white-space: nowrap; transition: .15s;
}
.scope-pill:hover { background: var(--surface-2); border-color: #c8dbe2; }
.scope-pill.active {
  background: var(--brand-3); border-color: var(--brand-3); color: #fff;
  box-shadow: 0 2px 6px rgba(10, 59, 74, .18);
}
.scope-note {
  margin-left: auto; padding-left: 12px; font-size: 11px; color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 860px) {
  .scope-bar { padding: 8px 14px; gap: 8px; }
  .scope-note { display: none; }
  .scope-pill { height: 28px; padding: 0 11px; font-size: 11.5px; }
  .scope-label { font-size: 9px; }
}

@media (max-width: 860px) {
  .scope-bar { flex-wrap: wrap; overflow: visible; row-gap: 7px; }
  .scope-label { width: 100%; }
  .scope-pills { width: 100%; flex-wrap: wrap; }
}

.scope-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.scope-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.scope-bar { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
@media (max-width: 860px) {
  .scope-group { width: 100%; }
  .scope-sep { display: none; }
}

/* ─────────────── Masked names / reveal ─────────────── */
.u-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.u-name-row .u-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-action {
  width: 22px; height: 22px; flex: none; display: inline-grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
}
.name-action:hover { background: var(--blue-soft); color: var(--brand); }
.name-action svg { width: 13px; height: 13px; }
.occupant-card .u-name-row { margin-bottom: 1px; }

/* ─────────────── Credentials tab ─────────────── */
.credential-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-2);
}
.cred-k { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.credential-id { font-family: var(--mono); font-size: 15px; font-weight: 650; letter-spacing: .04em; }
.cred-card { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; background: #fff; }
.cred-card:last-child { margin-bottom: 0; }
.cred-title { font-size: 11px; font-weight: 700; color: var(--brand-3); margin-bottom: 7px; }
.cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; }
.cred-item label { display: block; font-size: 9.5px; color: var(--muted); margin-bottom: 1px; }
.cred-item div { font-size: 12px; color: var(--ink); line-height: 1.45; word-break: break-word; }
@media (max-width: 720px) {
  .cred-grid { grid-template-columns: 1fr; }
  .credential-box { align-items: flex-start; }
  .credential-id { font-size: 13px; }
}

/* ─────────────── Employment / pay table ─────────────── */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; flex: none; }
.pay-table td:first-child { width: 68%; }
.pay-table td, .pay-table th { white-space: normal; }
.pay-table .num-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ─────────────── Vacancy map ─────────────── */
.map-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.map-tab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 150px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; cursor: pointer; font-family: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.map-tab:hover { border-color: var(--brand-2); transform: translateY(-1px); }
.map-tab.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(12, 91, 78, .12); background: #f3faf7; }
.map-tab span { font-size: 12px; font-weight: 650; color: var(--ink); }
.map-tab strong { font-size: 16px; color: var(--brand); line-height: 1.15; }
.map-tab small { font-size: 10px; color: var(--muted); }
.map-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
.map-card { overflow: hidden; }
.map-canvas {
  position: relative; margin: 0 14px; border: 1px solid var(--line);
  border-radius: 11px; background: linear-gradient(160deg, #f7fbfa, #eef5f3);
  overflow: hidden;
}
.map-canvas svg { display: block; width: 100%; height: auto; }
.map-canvas-province svg { max-height: 260px; }
.map-canvas-district svg { max-height: 520px; }
.map-area { stroke: #fff; stroke-width: .8; cursor: pointer; transition: fill .15s, stroke .15s; vector-effect: non-scaling-stroke; }
.map-area:hover { stroke: #0f2e2a; stroke-width: 1.6; }
.map-area.active { stroke: #0b3d36; stroke-width: 2.4; }
.map-area.rate-good { fill: #8fd0b0; }
.map-area.rate-warn { fill: #f0c36a; }
.map-area.rate-bad { fill: #e08b7e; }
.map-area.rate-na { fill: #dbe3e6; }
.map-label { text-anchor: middle; font-size: 11px; font-weight: 700; fill: #123b35; pointer-events: none; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; }
.map-label-sub { text-anchor: middle; font-size: 9.5px; font-weight: 600; fill: #2d5a52; pointer-events: none; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; }
.map-tip {
  position: absolute; z-index: 4; display: none; min-width: 170px; padding: 9px 11px;
  border-radius: 9px; background: rgba(12, 32, 30, .94); color: #fff;
  box-shadow: 0 10px 26px rgba(0,0,0,.25); pointer-events: none; font-size: 11px;
}
.map-tip.show { display: block; }
.map-tip strong { display: block; font-size: 12px; margin-bottom: 5px; }
.map-tip-row { display: flex; justify-content: space-between; gap: 14px; line-height: 1.7; color: #d9e7e3; }
.map-tip-row b { color: #fff; font-variant-numeric: tabular-nums; }
.map-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 10px 14px 13px; font-size: 10.5px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.lg.rate-good { background: #8fd0b0; }
.lg.rate-warn { background: #f0c36a; }
.lg.rate-bad { background: #e08b7e; }
.lg.rate-na { background: #dbe3e6; }
.map-rate { font-weight: 700; font-variant-numeric: tabular-nums; }
.map-rate.rate-good { color: #157a55; }
.map-rate.rate-warn { color: #a66a08; }
.map-rate.rate-bad { color: #b03d2f; }
.map-table-card { margin-top: 14px; }
.map-row { cursor: pointer; }
.map-row:hover td { background: #f3faf7; }
.map-row.selected td { background: #eaf7f1; }
.map-selected-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted);
}
.map-selected-note strong { color: var(--ink); font-size: 12px; }
.map-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 12px; }
@media (max-width: 1000px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-canvas-province svg { max-height: 300px; }
  .map-canvas-district svg { max-height: 480px; }
}
.map-source { padding: 8px 15px 12px; font-size: 9.5px; color: var(--muted); border-top: 1px solid var(--line); }

/* ─────────────── Dashboard vacancy map ─────────────── */
.dash-map {
  position: relative; overflow: hidden; margin: 0 0 16px; padding: 19px 20px 18px;
  border-radius: 18px; color: #fff;
  background:
    radial-gradient(700px 300px at 88% -20%, rgba(111, 214, 181, .22), transparent 65%),
    radial-gradient(500px 300px at 0% 120%, rgba(232, 179, 84, .14), transparent 70%),
    linear-gradient(135deg, #0a3732 0%, #0d4a40 48%, #0b3a35 100%);
  box-shadow: 0 18px 42px rgba(8, 43, 38, .18);
}
.dash-map::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.22) 1px, transparent 1px);
  background-size: 34px 34px; mask-image: linear-gradient(to bottom, #000, transparent 70%);
}
.dash-map > * { position: relative; z-index: 1; }
.dash-map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.map-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 9px; letter-spacing: .14em; font-weight: 700; color: #8fe0c4; text-transform: uppercase; }
.map-kicker svg { width: 13px; height: 13px; }
.dash-map-title h2 { margin: 5px 0 2px; font-size: 22px; letter-spacing: -.02em; color: #fff; }
.dash-map-title p { margin: 0; font-size: 11.5px; color: rgba(255,255,255,.62); }
.dash-map-target { text-align: right; min-width: 158px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.15); border-radius: 11px; background: rgba(255,255,255,.07); }
.dash-map-target span { display: block; font-size: 9.5px; color: rgba(255,255,255,.58); }
.dash-map-target strong { display: block; font-size: 19px; color: #fff; line-height: 1.2; }
.dash-map-target small { display: block; font-size: 9.5px; margin-top: 1px; }
.dash-map-target small.over { color: #ffc978; }
.dash-map-target small.ok { color: #8fe0c4; }
.map-dark-note { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding: 7px 10px; border-radius: 8px; background: rgba(232, 179, 84, .13); border: 1px solid rgba(232, 179, 84, .25); color: #ffe0aa; font-size: 10.5px; }
.map-dark-note svg { width: 14px; height: 14px; flex: none; }
.map-tabs-dash { margin: 14px 0 12px; }
.dash-map .map-tab { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); }
.dash-map .map-tab:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); }
.dash-map .map-tab span { color: rgba(255,255,255,.76); }
.dash-map .map-tab strong { color: #fff; }
.dash-map .map-tab small { color: rgba(255,255,255,.52); }
.dash-map .map-tab.active { background: #fff; border-color: #fff; box-shadow: 0 5px 18px rgba(0,0,0,.18); }
.dash-map .map-tab.active span { color: #18443c; }
.dash-map .map-tab.active strong { color: #0b6b57; }
.dash-map .map-tab.active small { color: #66847d; }
.dash-map-body { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 14px; align-items: stretch; }
.dash-map-main { padding: 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.055); }
.dash-map-canvas { position: relative; overflow: hidden; border-radius: 10px; background: linear-gradient(155deg, #f7fcf9, #eaf5f1); }
.dash-map-canvas svg { display: block; width: 100%; height: auto; }
.map-float { position: absolute; top: 11px; left: 11px; z-index: 3; padding: 7px 10px; border-radius: 9px; background: rgba(9, 46, 41, .9); border: 1px solid rgba(255,255,255,.16); box-shadow: 0 8px 22px rgba(0,0,0,.2); }
.map-float span { display: block; font-size: 9px; letter-spacing: .04em; color: #99d8c5; }
.map-float strong { display: block; font-size: 20px; line-height: 1.1; color: #fff; }
.map-float small { display: block; font-size: 9px; color: rgba(255,255,255,.6); }
.map-legend-dash { color: rgba(255,255,255,.66); padding: 9px 2px 0; }
.map-legend-note { margin-left: auto; color: rgba(255,255,255,.42); font-size: 9.5px; }
.dash-map-aside { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.map-mini-card { padding: 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.065); }
.map-mini-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 9.5px; color: rgba(255,255,255,.68); margin-bottom: 7px; }
.map-mini-head span:last-child { color: #9de1c9; font-weight: 650; }
.map-mini-canvas { position: relative; overflow: hidden; border-radius: 8px; background: #eef7f3; }
.map-mini-canvas svg { display: block; width: 100%; height: auto; max-height: 135px; }
.map-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.map-stat-grid > div { padding: 8px 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; background: rgba(255,255,255,.055); }
.map-stat-grid span { display: block; font-size: 9px; color: rgba(255,255,255,.52); }
.map-stat-grid strong { display: block; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; }
.map-top-card { padding: 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.065); }
.map-top-head { display: flex; justify-content: space-between; gap: 8px; font-size: 9.5px; color: rgba(255,255,255,.68); margin-bottom: 4px; }
.map-top-head span:last-child { color: rgba(255,255,255,.42); }
.map-top-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; align-items: center; gap: 7px; width: 100%; padding: 6px 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.07); background: transparent; color: #fff; cursor: pointer; font-family: inherit; text-align: left; }
.map-top-row:last-of-type { border-bottom: 0; }
.map-top-row:hover { color: #a8ecd6; }
.mt-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.mt-dot.rate-good { background: #6fd6b5; } .mt-dot.rate-warn { background: #f0c36a; } .mt-dot.rate-bad { background: #e08b7e; } .mt-dot.rate-na { background: #829b95; }
.mt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.mt-vac { font-size: 9.5px; color: rgba(255,255,255,.45); font-variant-numeric: tabular-nums; }
.mt-rate { font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mt-rate.rate-good { color: #8fe0c4; } .mt-rate.rate-warn { color: #ffd382; } .mt-rate.rate-bad { color: #ffb0a4; }
.map-more { color: #9de1c9; font-size: 10px; padding: 8px 0 1px; }
.map-selected-note { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; min-height: 34px; padding: 8px 10px; border: 1px dashed rgba(255,255,255,.18); border-radius: 9px; color: rgba(255,255,255,.55); font-size: 9.5px; }
.map-selected-note strong { color: #fff; font-size: 11px; }
.map-selected-note .muted { color: rgba(255,255,255,.42); }
.map-selected-note .map-rate.rate-good { color: #8fe0c4; } .map-selected-note .map-rate.rate-warn { color: #ffd382; } .map-selected-note .map-rate.rate-bad { color: #ffb0a4; }
@media (max-width: 1100px) { .dash-map-body { grid-template-columns: minmax(0, 1fr) 250px; } }
@media (max-width: 900px) {
  .dash-map { padding: 16px; }
  .dash-map-body { grid-template-columns: 1fr; }
  .dash-map-aside { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .map-mini-card { grid-column: 1 / -1; }
  .map-mini-canvas svg { max-height: 180px; }
  .map-selected-note { grid-column: 1 / -1; }
  .map-legend-note { width: 100%; margin-left: 0; }
}
@media (max-width: 600px) {
  .dash-map-head { flex-direction: column; }
  .dash-map-target { width: 100%; text-align: left; }
  .dash-map-aside { grid-template-columns: 1fr; }
  .map-mini-card, .map-selected-note { grid-column: auto; }
  .dash-map-title h2 { font-size: 19px; }
  .map-float { top: 8px; left: 8px; padding: 6px 8px; }
  .map-float strong { font-size: 17px; }
}
.map-top-row.active { color: #a8ecd6; }
.map-top-row.active .mt-name { font-weight: 700; }
.map-tab-all { border-style: dashed; opacity: .92; }
.map-tab-all strong { font-size: 12px; }

/* ─────────────── Brand / scope order / powered ─────────────── */
.scope-bar {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  padding: 5px clamp(18px, 3vw, 34px); overflow: visible;
}
.scope-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; min-width: 0; }
.scope-row-top { padding: 2px 0 6px; border-bottom: 1px solid var(--line); }
.scope-row-bottom { padding-top: 6px; }
.scope-row .scope-note { margin-left: auto; }
.sb-powered {
  padding: 6px 12px 12px; text-align: center; font-size: 10.5px;
  color: #8fb6bf; letter-spacing: .015em; line-height: 1.4;
}
.sb-powered strong {
  display: block; margin-top: 2px; color: #dcf7ef;
  font-size: 12px; font-weight: 750; letter-spacing: .015em;
}
.login-foot .powered-line {
  display: block; margin-top: 6px; font-size: 11.5px;
  color: var(--muted); letter-spacing: .01em;
}
.login-foot .powered-line strong {
  color: var(--brand); font-size: 12.5px; font-weight: 750;
  letter-spacing: .01em;
}
@media (max-width: 860px) {
  .scope-row-top { padding-bottom: 7px; }
  .scope-row-bottom { padding-top: 7px; }
  .scope-row .scope-note { display: none; }
}

/* ─────────────── ThaiD login ─────────────── */
.login-divider {
  display: flex; align-items: center; gap: 10px; margin: 20px 0 14px;
  color: var(--muted-2); font-size: 10.5px; letter-spacing: .08em;
}
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.btn-thaid {
  height: 46px; border: 0; color: #fff; font-size: 14px; font-weight: 650;
  background: linear-gradient(135deg, #0066a8 0%, #0b82b8 55%, #1495bf 100%);
  box-shadow: 0 8px 18px rgba(0, 102, 168, .22);
}
.btn-thaid:hover { background: linear-gradient(135deg, #00578f, #0a74a6 55%, #0f86ad); color: #fff; }
.btn-thaid .thaid-mark {
  display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  font-size: 9px; font-weight: 800; letter-spacing: .03em;
}
.btn-thaid.is-disabled { opacity: .48; pointer-events: none; box-shadow: none; }
.login-thaid-note {
  margin: 8px 0 0; text-align: center; font-size: 10.5px; color: var(--muted-2);
  line-height: 1.5;
}

.sb-user-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.tb-user-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

.tb-scope {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 18px; border-radius: 999px; background: #eaf7f3;
  border: 1px solid #cde7df; color: #075e4d;
  font-size: 15px; font-weight: 750; letter-spacing: -.01em; line-height: 1.3;
  max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(9, 70, 58, .04);
}
.tb-scope svg { width: 18px; height: 18px; flex: none; stroke-width: 2; }
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; }
  .tb-scope {
    position: static; transform: none; order: 10; width: 100%;
    max-width: 100%; margin-top: 1px; font-size: 13px; padding: 5px 12px;
  }
  .tb-scope svg { width: 15px; height: 15px; }
}
@media (max-width: 860px) {
  .tb-scope { font-size: 13.5px; }
}

.agency-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 12px;
  letter-spacing: -.02em; color: #d9f6f1; border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(145deg, #16778a, #0d5265);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}
.agency-mark.regional { font-size: 13px; }
.agency-mark.province { font-size: 12px; background: linear-gradient(145deg, #0f766e, #0b5a55); }
.agency-mark.unit { font-size: 12px; background: linear-gradient(145deg, #0b6b8f, #084f6a); }

.sb-user .agency-mark { width: 36px; height: 36px; border-radius: 10px; }

.hero-manual { position: relative; z-index: 1; margin-top: auto; display: flex; }
.hero-manual a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px;
  border-radius: 9px; border: 1px solid rgba(125, 211, 199, .32);
  background: rgba(255, 255, 255, .08); color: #dff7f1;
  font-size: 12.5px; font-weight: 650;
}
.hero-manual a:hover { background: rgba(255, 255, 255, .14); border-color: rgba(125, 211, 199, .55); text-decoration: none; }
.hero-manual svg, .login-manual-mobile svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.login-manual-mobile { display: none; }
@media (max-width: 860px) {
  .login-manual-mobile {
    display: inline-flex; align-items: center; gap: 6px; margin: 12px auto 0;
    padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
    color: var(--brand-3); background: var(--surface-2);
    font-size: 11.5px; font-weight: 650; text-align: center;
  }
}

