/* =========================================================================
   NAMAN Mission POC — Reusable components
   ========================================================================= */

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
  text-decoration: none !important;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled, .btn.is-loading { opacity: .65; cursor: not-allowed; }
.btn.primary { background: var(--teal-600); border-color: var(--teal-600); color: #fff; }
.btn.primary:hover { background: var(--teal-700); }
.btn.navy { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn.navy:hover { background: var(--navy-700); }
.btn.danger { background: #fff; border-color: #EBB5B5; color: var(--crit-ink); }
.btn.danger:hover { background: var(--crit-bg); }
.btn.danger.solid { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.light { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.btn.light:hover { background: rgba(255,255,255,.18); }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.btn-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.btn-group button { border: 0; background: #fff; padding: 0 12px; height: 32px; font-size: 12.5px; cursor: pointer; border-right: 1px solid var(--border); color: var(--text-2); }
.btn-group button:last-child { border-right: 0; }
.btn-group button.active { background: var(--navy-800); color: #fff; }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--crit); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .err { font-size: 11.5px; color: var(--crit-ink); display: none; }
.field.invalid .err { display: block; }
.field.invalid .input { border-color: var(--crit); box-shadow: 0 0 0 3px rgba(208,59,59,.12); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: #fff;
  font-size: 13.5px;
}
textarea.input { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--river-500); box-shadow: 0 0 0 3px rgba(42,120,214,.15); }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input.sm { height: 32px; font-size: 12.5px; border-radius: 8px; padding: 0 9px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 16px; }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--teal-700); border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--teal-600); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: 0 0 36px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: #CBD3DE; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--teal-600); }
.switch input:checked + span::before { transform: translateX(16px); }
input[type=range] { accent-color: var(--teal-600); width: 100%; }

/* ---------------- Cards & grid ---------------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-2-1 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.g-1-2 { grid-template-columns: minmax(0,1fr) minmax(0,2fr); }
.g-3-2 { grid-template-columns: minmax(0,3fr) minmax(0,2fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; min-height: 44px; flex-wrap: wrap; }
.card-h h3 { font-size: 14.5px; font-weight: 650; }
.card-h .sub { font-size: 12px; color: var(--muted); }
.card-h .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-b { padding: 14px 16px 16px; }
.card-b.flush { padding: 8px 0 0; }
.card-f { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 320px; }
.chart-box.xl { height: 380px; }
.info-i { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--muted); cursor: help; vertical-align: middle; }
.info-i:hover { color: var(--river-600); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; background: var(--info-bg); color: var(--info-ink); border: 1px solid #C7DCF6; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: #F2D58F; }
.notice.crit { background: var(--crit-bg); color: var(--crit-ink); border-color: #F0C2C2; }
.notice.good { background: var(--good-bg); color: var(--good-ink); border-color: #BFE3C6; }
.notice svg { flex: 0 0 16px; margin-top: 1px; }

/* ---------------- KPI cards ---------------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpis.k7 { grid-template-columns: repeat(7, minmax(0,1fr)); }
.kpis.k5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.kpi {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px 12px; box-shadow: var(--shadow-sm); min-width: 0; text-align: left;
  display: flex; flex-direction: column; gap: 3px; font: inherit; color: inherit;
}
button.kpi { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.kpi:hover { border-color: var(--teal-500); box-shadow: var(--shadow-md); }
.kpi .k-top { display: flex; align-items: center; gap: 8px; }
.kpi .k-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-700); flex: 0 0 28px; }
.kpi.tone-info .k-ic { background: var(--info-bg); color: var(--info-ink); }
.kpi.tone-good .k-ic { background: var(--good-bg); color: var(--good-ink); }
.kpi.tone-warn .k-ic { background: var(--warn-bg); color: var(--warn-ink); }
.kpi.tone-crit .k-ic { background: var(--crit-bg); color: var(--crit-ink); }
.kpi.tone-navy .k-ic { background: #E4EAF4; color: var(--navy-700); }
.kpi .k-label { font-size: 12px; color: var(--text-2); font-weight: 550; line-height: 1.2; }
.kpi .k-val { font-size: 23px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-val.txt { font-size: 17px; white-space: normal; line-height: 1.2; }
.kpi .k-val small { font-size: 13px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.kpi .k-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-sub .up { color: var(--good-ink); font-weight: 600; }
.kpi .k-sub .down { color: var(--crit-ink); font-weight: 600; }
.kpi .k-go { position: absolute; right: 10px; top: 12px; color: var(--border-strong); }
button.kpi:hover .k-go { color: var(--teal-600); }
.kpi.hero { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.kpi.hero .k-label, .kpi.hero .k-sub { color: #A9B9D2; }
.kpi.hero .k-ic { background: rgba(255,255,255,.1); color: #7FD3D9; }

/* ---------------- Badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; background: var(--neutral-bg); color: var(--neutral-ink); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.good { background: var(--good-bg); color: var(--good-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.serious { background: var(--serious-bg); color: var(--serious-ink); }
.badge.crit { background: var(--crit-bg); color: var(--crit-ink); }
.badge.info { background: var(--info-bg); color: var(--info-ink); }
.badge.navy { background: #E4EAF4; color: var(--navy-700); }
.badge.teal { background: var(--teal-50); color: var(--teal-700); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; margin: 1px 2px 1px 0; border: 1px solid var(--border); }
.code { font-family: var(--mono); font-size: 12px; color: var(--navy-700); }

/* ---------------- Progress ---------------- */
.prog { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.prog .bar { flex: 1; height: 7px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.prog .bar i { display: block; height: 100%; border-radius: 6px; background: var(--teal-500); transition: width .4s ease; }
.prog .bar i.good { background: var(--good); }
.prog .bar i.warn { background: var(--warn); }
.prog .bar i.crit { background: var(--crit); }
.prog .bar i.blue { background: var(--river-500); }
.prog span { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 36px; text-align: right; }
.prog.lg .bar { height: 10px; }
.stepper { display: flex; gap: 6px; }
.stepper .st { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); position: relative; padding-top: 22px; }
.stepper .st::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--surface-3); }
.stepper .st.done::before { background: var(--teal-500); }
.stepper .st.cur::before { background: var(--river-500); }
.stepper .st.done, .stepper .st.cur { color: var(--text); font-weight: 600; }

/* ---------------- Tables ---------------- */
.tbl-wrap { width: 100%; overflow-x: auto; }
.tbl-tools { display: flex; align-items: center; gap: 8px; padding: 12px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tbl-tools .search { position: relative; width: 260px; max-width: 100%; }
.tbl-tools .search input { display: block; margin: 0; padding-left: 32px; height: 34px; }
.tbl-tools .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); display: block; color: var(--muted); pointer-events: none; }
.tbl-tools .grow-space { flex: 1; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 11.5px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .si { display: inline-block; margin-left: 3px; opacity: .35; font-size: 10px; }
.tbl th.sorted .si { opacity: 1; color: var(--teal-700); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover td { background: #F7FAFD; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.sel td { background: var(--river-50); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .t-title { font-weight: 600; color: var(--text); }
.tbl td.wrap-min { min-width: 210px; }
.tbl .code, .tbl .dept-chip { white-space: nowrap; }
.tbl .t-sub { font-size: 11.5px; color: var(--muted); }
.tbl .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.tbl.compact td { padding: 6px 10px; }
.tbl.compact th { padding: 7px 10px; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); }
.tbl-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.pager { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pager button { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border); background: #fff; border-radius: 7px; cursor: pointer; font-size: 12.5px; }
.pager button.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.pager button:disabled { opacity: .45; cursor: default; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-size: 13.5px; font-weight: 550; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--teal-700); border-bottom-color: var(--teal-600); }
.tabs .cnt { font-size: 11px; background: var(--surface-3); border-radius: 999px; padding: 0 6px; color: var(--text-2); }
.tabs.in-card { padding: 0 12px; margin-bottom: 0; }

/* ---------------- Filter bar ---------------- */
.filterbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.filterbar .f { display: flex; flex-direction: column; gap: 3px; min-width: 140px; flex: 1 1 140px; max-width: 220px; }
.filterbar .f label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.filterbar .f-actions { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.filterbar .active-count { font-size: 12px; color: var(--teal-700); font-weight: 600; }

/* ---------------- Modal ---------------- */
.modal-back { position: fixed; inset: 0; background: rgba(7,20,40,.5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s ease; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; animation: pop .18s ease; display: flex; flex-direction: column; max-height: 90vh; }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1080px; }
.modal.sm { max-width: 440px; }
.modal-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.modal-h h3 { font-size: 17px; }
.modal-h .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-h .icon-btn { margin-left: auto; margin-top: -4px; }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.confirm-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn-ink); margin-bottom: 10px; }
.confirm-ic.danger { background: var(--crit-bg); color: var(--crit-ink); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* Drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(7,20,40,.35); z-index: 90; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100%; background: #fff; z-index: 95; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .2s ease; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-h { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.drawer-h h3 { font-size: 16px; }
.drawer-b { flex: 1; overflow-y: auto; }

/* ---------------- Toasts ---------------- */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: 360px; max-width: calc(100vw - 36px); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 10px; padding: 11px 12px; box-shadow: var(--shadow-lg); animation: pop .2s ease; font-size: 13px; }
.toast.success { border-left-color: var(--good); }
.toast.error { border-left-color: var(--crit); }
.toast.warning { border-left-color: var(--warn); }
.toast .t-ic { flex: 0 0 18px; margin-top: 1px; }
.toast.success .t-ic { color: var(--good-ink); }
.toast.error .t-ic { color: var(--crit-ink); }
.toast.warning .t-ic { color: var(--warn-ink); }
.toast.info .t-ic { color: var(--info-ink); }
.toast b { display: block; font-size: 13px; }
.toast .t-msg { color: var(--text-2); font-size: 12.5px; }
.toast .t-x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0; }
.toast.out { opacity: 0; transform: translateX(20px); transition: .25s; }

/* ---------------- Loaders ---------------- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(14,124,134,.18); border-top-color: var(--teal-600); animation: spin .8s linear infinite; display: inline-block; flex: 0 0 auto; }
.spinner.light { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.72); display: grid; place-items: center; z-index: 5; border-radius: inherit; }
.loader-overlay .lo-in { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.page-loader { position: fixed; top: 0; left: 0; height: 3px; background: var(--teal-500); z-index: 300; transition: width .3s ease, opacity .3s; box-shadow: 0 0 8px rgba(19,149,159,.6); }
.skel { background: linear-gradient(90deg, #EDF0F4 0%, #F6F8FA 50%, #EDF0F4 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-page .skel { margin-bottom: 14px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------------- Empty states ---------------- */
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty svg.ill { width: 120px; height: 84px; margin-bottom: 8px; }
.empty b { display: block; font-size: 14.5px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 13px; color: var(--muted); max-width: 380px; margin: 0 auto 12px; }

/* ---------------- Tooltip ---------------- */
.tip { position: fixed; z-index: 400; background: var(--navy-900); color: #fff; font-size: 12px; line-height: 1.4; padding: 7px 10px; border-radius: 8px; max-width: 280px; pointer-events: none; box-shadow: var(--shadow-md); }

/* ---------------- Lists / feeds ---------------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed .f-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: 0 0 28px; }
.feed .f-t { font-size: 11.5px; color: var(--muted); }
.alert-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.alert-row:last-child { border-bottom: 0; }
.sev-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--muted); flex: 0 0 4px; }
.sev-bar.Critical { background: var(--crit); } .sev-bar.High { background: var(--serious); } .sev-bar.Medium { background: var(--warn); } .sev-bar.Low { background: var(--info); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.kv.c2 { grid-template-columns: 150px 1fr 150px 1fr; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.mini-stat { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.mini-stat b { font-size: 18px; }
.mini-stat span { font-size: 11.5px; color: var(--muted); }

/* ---------------- Notification panel ---------------- */
.np-list { max-height: 420px; overflow-y: auto; }
.np-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.np-item:hover { background: var(--surface-2); }
.np-item.unread { background: #F5F9FE; }
.np-item.unread::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--river-500); margin-top: 6px; flex: 0 0 7px; }

/* ---------------- Timeline ---------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--border-strong); }
.tl-item.done::before { background: var(--good); border-color: var(--good); }
.tl-item.overdue::before { background: var(--crit); border-color: var(--crit); }
.tl-item.prog::before { background: var(--river-500); border-color: var(--river-500); }
.tl-item b { font-size: 13.5px; }
.gantt { position: relative; font-size: 12px; }
.gantt-row { display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.gantt-track { position: relative; height: 18px; background: var(--surface-2); border-radius: 5px; }
.gantt-bar { position: absolute; top: 3px; height: 12px; border-radius: 4px; background: var(--river-500); opacity: .85; }
.gantt-bar.done { background: var(--good); } .gantt-bar.overdue { background: var(--crit); }
.gantt-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--navy-800); }

/* ---------------- Map ---------------- */
.map { height: 420px; border-radius: 0 0 14px 14px; background: #E9EEF3; position: relative; z-index: 1; }
.map.tall { height: 620px; }
.map.sm { height: 300px; }
.gis-wrap { display: grid; grid-template-columns: 280px 1fr; min-height: 640px; }
.gis-wrap .map.tall { height: 100%; min-height: 700px; }
.gis-side { border-right: 1px solid var(--border); padding: 12px; overflow-y: auto; max-height: 700px; }
.layer-row { display: flex; align-items: center; gap: 9px; padding: 7px 6px; border-radius: 8px; font-size: 13px; }
.layer-row:hover { background: var(--surface-2); }
.layer-row .sw { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.layer-row .cnt { margin-left: auto; font-size: 11px; color: var(--muted); }
.map-legend { background: #fff; padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow-md); font-size: 11.5px; line-height: 1.7; max-width: 220px; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.map-note { position: absolute; left: 10px; bottom: 10px; z-index: 500; background: rgba(255,255,255,.92); font-size: 11px; padding: 4px 8px; border-radius: 6px; color: var(--text-2); max-width: 70%; }
.map-loading { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 600; background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12px; box-shadow: var(--shadow-md); display: flex; gap: 8px; align-items: center; }
.leaflet-popup-content { font-family: var(--font); font-size: 12.5px; margin: 12px 14px; min-width: 200px; }
.leaflet-popup-content h4 { font-size: 13.5px; margin-bottom: 4px; }
.pp-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
.pp-kv span { color: var(--muted); }
.pulse-marker { border-radius: 50%; background: rgba(208,59,59,.85); box-shadow: 0 0 0 0 rgba(208,59,59,.6); animation: pulse 1.8s infinite; border: 2px solid #fff; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(208,59,59,.55); } 70% { box-shadow: 0 0 0 14px rgba(208,59,59,0); } 100% { box-shadow: 0 0 0 0 rgba(208,59,59,0); } }
.dist-label { background: none; border: 0; box-shadow: none; font-size: 10.5px; font-weight: 700; color: var(--navy-700); text-shadow: 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; }

/* ---------------- AI assistant ---------------- */
.ai-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 16px; height: calc(100vh - 190px); min-height: 560px; }
.ai-chat { display: flex; flex-direction: column; min-height: 0; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; background: var(--surface-2); }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg.user { flex-direction: row-reverse; }
.msg .bubble { max-width: 82%; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; font-size: 13.5px; min-width: 0; }
.msg.user .bubble { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.msg .who { width: 32px; height: 32px; border-radius: 10px; flex: 0 0 32px; display: grid; place-items: center; background: var(--teal-600); color: #fff; }
.msg.user .who { background: var(--surface-3); color: var(--text-2); }
.resp-card h4 { font-size: 14.5px; margin-bottom: 6px; }
.resp-card .resp-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 10px 0; }
.resp-card .chart-box { height: 220px; margin: 10px 0; }
.resp-card .src { font-size: 11.5px; color: var(--muted); margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; }
.resp-card .fu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { border: 1px solid var(--border-strong); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); text-align: left; }
.chip:hover { border-color: var(--teal-500); color: var(--teal-700); background: var(--teal-50); }
.ai-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: #fff; border-radius: 0 0 14px 14px; }
.ai-input input { flex: 1; }
.resp-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ---------------- Misc ---------------- */
.score-pill { display: inline-grid; place-items: center; min-width: 40px; height: 24px; border-radius: 6px; font-weight: 700; font-size: 12px; padding: 0 6px; }
.heat-cell { text-align: center; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 5px 4px; }
.perm-grid td, .perm-grid th { text-align: center; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; }
.log-line { font-family: var(--mono); font-size: 12px; padding: 4px 10px; border-bottom: 1px solid #1C2B44; color: #C9D4E5; display: flex; gap: 10px; }
.log-console { background: var(--navy-950); border-radius: 10px; max-height: 260px; overflow-y: auto; padding: 6px 0; }
.log-line .lv-INFO { color: #7FD3D9; } .log-line .lv-WARN { color: #F6C75A; } .log-line .lv-ERROR { color: #FF8C8C; }
.sync-steps { list-style: none; padding: 0; margin: 12px 0; }
.sync-steps li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--muted); }
.sync-steps li.done { color: var(--good-ink); }
.sync-steps li.run { color: var(--text); font-weight: 600; }
.sync-steps li.fail { color: var(--crit-ink); font-weight: 600; }
.sync-steps .s-ic { width: 20px; height: 20px; display: grid; place-items: center; }
.report-doc { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 28px 32px; }
.report-doc .r-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--navy-800); padding-bottom: 12px; margin-bottom: 16px; }
.report-doc h2 { font-size: 20px; }
.rp-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.rp-list button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px; color: var(--text); }
.rp-list button:hover { background: var(--surface-3); }
.rp-list button.active { background: var(--teal-50); color: var(--teal-700); font-weight: 600; }
.rp-list .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 10px 10px 4px; }
.dept-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.dept-chip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.insight { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.insight:last-child { border-bottom: 0; }
.insight .i-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 34px; }
.rhi-card { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
.rhi-card .rhi-v { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 22px; text-align: center; color: var(--text-2); cursor: pointer; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--teal-500); background: var(--teal-50); }
.kpis.k6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
@media (max-width: 1280px) { .kpis.k6 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 760px) { .kpis.k6 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
