/* ==========================================================================
   DEMO SẢN PHẨM — HỆ THỐNG GIÁM SÁT TRẬT TỰ ĐÔ THỊ BẰNG UAV
   Phong cách cổng quản lý điều hành công vụ: header đỏ đô + vàng nghi thức,
   nội dung dashboard hành chính gọn gàng. Be Vietnam Pro.
   ========================================================================== */

:root {
  --gov:      #7c1d12;   /* đỏ đô công vụ */
  --gov-2:    #5e120a;
  --gov-hi:   #a02616;
  --gold:     #d9a43b;
  --gold-soft:#f3e3c2;

  --bg:       #eef0f4;
  --card:     #ffffff;
  --ink:      #1c2430;
  --ink-2:    #3d4654;
  --mute:     #67717f;
  --line:     #dde1e8;
  --line-soft:#e9ecf1;

  --ok:       #2e7d32;
  --ok-bg:    #e6f2e7;
  --warn:     #b26a00;
  --warn-bg:  #fdf1dd;
  --danger:   #c62828;
  --danger-bg:#fdeaea;
  --info:     #1256a0;
  --info-bg:  #e7effa;

  --f: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
  --radius: 8px;
  --shadow: 0 1px 3px rgba(28,36,48,.08), 0 4px 16px rgba(28,36,48,.06);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
a { color: inherit; }
button { font-family: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gov-hi);
  outline-offset: 2px;
}

.num { font-variant-numeric: tabular-nums; }

/* =========================================================
   TRANG ĐĂNG NHẬP
   ========================================================= */
.login-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(124,29,18,.10), transparent 60%),
    var(--bg);
}
.gov-topline { height: 6px; background: linear-gradient(90deg, var(--gov), var(--gov-hi)); border-bottom: 2px solid var(--gold); }

.login-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 48px) 16px;
}
.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: clamp(26px, 5vw, 40px) clamp(22px, 5vw, 40px) 28px;
  text-align: center;
}
.login-card .emblem { width: 84px; height: 84px; margin-inline: auto; }
.login-org {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 14px 0 4px;
}
.login-title {
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--gov);
  line-height: 1.4;
  margin-bottom: 4px;
}
.login-sub { font-size: .8rem; color: var(--mute); margin: 0 0 22px; }

.login-form { text-align: left; }
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field .control { position: relative; }
.field input {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: #f4f5f7;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 40px 11px 13px;
  cursor: not-allowed;
}
.field input:focus { outline: 2px solid rgba(124,29,18,.35); outline-offset: 0; }
.field .lock {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--mute);
  pointer-events: none;
}
.login-note {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: .78rem;
  color: var(--info);
  background: var(--info-bg);
  border: 1px solid #c9dcf2;
  border-radius: 6px;
  padding: 9px 12px;
  margin: 4px 0 18px;
}
.login-note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

.btn-login {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: var(--gov);
  color: #fff;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 13px;
  cursor: pointer;
  transition: background .2s var(--ease), transform .15s var(--ease);
}
.btn-login:hover { background: var(--gov-hi); }
.btn-login:active { transform: scale(.985); }

.login-foot {
  text-align: center;
  font-size: .74rem;
  color: var(--mute);
  padding: 18px 16px 26px;
}
.login-back { font-size: .78rem; margin-top: 14px; }
.login-back a { color: var(--info); }

/* =========================================================
   DASHBOARD — KHUNG
   ========================================================= */
.gov-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(90deg, var(--gov-2), var(--gov) 45%, var(--gov-hi));
  border-bottom: 2px solid var(--gold);
  color: #fff;
}
.gov-header .inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
}
.gov-header .emblem { width: 42px; height: 42px; flex: none; }
.gov-name { min-width: 0; }
.gov-name .t1 {
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  opacity: .9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gov-name .t2 {
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gov-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.gov-user .who {
  text-align: right;
  line-height: 1.3;
}
.gov-user .who .u { font-size: .82rem; font-weight: 700; }
.gov-user .who .r { font-size: .68rem; color: var(--gold-soft); opacity: .9; }
.btn-logout {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.btn-logout:hover { background: rgba(255,255,255,.22); }
.btn-logout svg { width: 14px; height: 14px; }

.layout {
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
  max-width: 1500px;
  margin-inline: auto;
  min-height: calc(100vh - 62px);
}

/* Sidebar */
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  position: sticky;
  top: 62px;
  align-self: start;
  height: calc(100vh - 62px);
  overflow-y: auto;
}
.side-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mute);
  padding: 0 10px;
  margin: 14px 0 6px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar nav a svg { width: 17px; height: 17px; flex: none; color: var(--mute); }
.sidebar nav a:hover { background: var(--line-soft); color: var(--ink); }
.sidebar nav a.active { background: #f7ebe9; color: var(--gov); }
.sidebar nav a.active svg { color: var(--gov); }
.side-sys {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding: 12px 10px 0;
  font-size: .74rem;
  color: var(--mute);
}
.side-sys .row { display: flex; justify-content: space-between; margin-bottom: 5px; }
.side-sys .ok { color: var(--ok); font-weight: 700; }

/* Main */
.main { padding: 20px clamp(14px, 2.5vw, 28px) 60px; min-width: 0; }
.crumb {
  font-size: .76rem;
  color: var(--mute);
  margin-bottom: 14px;
}
.crumb b { color: var(--ink-2); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  scroll-margin-top: 78px;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .01em;
  display: flex; align-items: center; gap: 9px;
}
.panel-head h2 svg { width: 17px; height: 17px; color: var(--gov); }
.panel-head .meta { font-size: .76rem; color: var(--mute); }
.panel-head .spacer { margin-left: auto; }
.panel-body { padding: 16px 18px; }

/* Thẻ số liệu */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.scard {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gov);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.scard .v { font-size: 1.7rem; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.scard .v small { font-size: .58em; font-weight: 600; color: var(--mute); letter-spacing: 0; }
.scard .k { font-size: .78rem; color: var(--mute); margin-top: 2px; }
.scard.c-blue  { border-left-color: var(--info); }
.scard.c-amber { border-left-color: var(--warn); }
.scard.c-green { border-left-color: var(--ok); }
.scard.c-red   { border-left-color: var(--danger); }
.scard .sub { display: flex; gap: 10px; margin-top: 8px; font-size: .72rem; color: var(--ink-2); flex-wrap: wrap; }
.scard .sub i { font-style: normal; display: inline-flex; align-items: center; gap: 5px; }
.scard .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--ok); }
.dot-fly { background: var(--info); }
.dot-chg { background: var(--warn); }

/* Bản đồ */
.map-frame { position: relative; background: #dfe3ea; }
.map-frame iframe { display: block; width: 100%; border: 0; }
.map-caption {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: .76rem;
  color: var(--mute);
}
.map-caption b { color: var(--ink-2); }
.badge-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  color: var(--ok);
}
.badge-live::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46,125,50,.45); } 100% { box-shadow: 0 0 0 8px rgba(46,125,50,0); } }

/* Bộ lọc cảnh báo */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 99px;
  font-size: .76rem;
  font-weight: 600;
  padding: 5px 13px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--gov); color: var(--gov); }
.chip.on { background: var(--gov); border-color: var(--gov); color: #fff; }

/* Danh sách cảnh báo */
.alert-list { display: flex; flex-direction: column; }
.alert-row {
  display: grid;
  grid-template-columns: 44px minmax(180px, 1.5fr) 130px minmax(150px, 1fr) 150px 120px;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .15s var(--ease);
  text-align: left;
  background: none;
  border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  font-size: .85rem;
  color: var(--ink);
}
.alert-row:hover { background: #faf7f4; }
.alert-row:last-child { border-bottom: 0; }
.a-ic {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.a-ic svg { width: 20px; height: 20px; }
.t-ct .a-ic { background: var(--danger-bg); color: var(--danger); }
.t-cd .a-ic { background: var(--ok-bg); color: var(--ok); }
.t-nu .a-ic { background: var(--info-bg); color: var(--info); }
.a-main .ttl { font-weight: 700; font-size: .88rem; }
.a-main .addr { font-size: .77rem; color: var(--mute); }
.a-id { font-size: .72rem; color: var(--mute); }

.prio-badge {
  display: inline-flex; flex-direction: column; gap: 2px;
}
.prio-badge .p {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700;
  letter-spacing: .04em;
  border-radius: 4px;
  padding: 2px 8px;
  width: max-content;
}
.p-urgent { background: var(--danger-bg); color: var(--danger); }
.p-high   { background: var(--warn-bg); color: var(--warn); }
.p-normal { background: var(--line-soft); color: var(--ink-2); }
.countdown { font-size: .72rem; color: var(--mute); }
.countdown b { color: var(--danger); font-weight: 700; }
.countdown.calm b { color: var(--warn); }
.countdown.done { color: var(--ok); }

.a-org { font-size: .78rem; color: var(--ink-2); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; font-weight: 700;
  border-radius: 99px;
  padding: 3px 11px;
  width: max-content;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-new  { background: var(--danger-bg); color: var(--danger); }
.st-prog { background: var(--warn-bg); color: var(--warn); }
.st-done { background: var(--ok-bg); color: var(--ok); }

.a-open {
  font-size: .76rem; font-weight: 600; color: var(--info);
  justify-self: end;
  white-space: nowrap;
}
.alert-empty { padding: 26px 18px; text-align: center; color: var(--mute); font-size: .85rem; }

/* Đội drone */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(206px, 1fr));
  gap: 12px;
}
.uav {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 15px;
}
.uav .top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.uav .top svg { width: 22px; height: 22px; color: var(--gov); flex: none; }
.uav .name { font-weight: 800; font-size: .9rem; }
.uav .st { margin-left: auto; font-size: .68rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.uav .st.ready { background: var(--ok-bg); color: var(--ok); }
.uav .st.fly   { background: var(--info-bg); color: var(--info); }
.uav .st.charge{ background: var(--warn-bg); color: var(--warn); }
.uav .row { display: flex; justify-content: space-between; font-size: .77rem; color: var(--mute); margin-top: 3px; }
.uav .row b { color: var(--ink-2); font-weight: 600; }
.batt { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.batt .bar { flex: 1; height: 7px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.batt .bar i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.batt .bar i.low { background: var(--warn); }
.batt .val { font-size: .74rem; font-weight: 700; color: var(--ink-2); min-width: 34px; text-align: right; }

.dock-strip {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.dock {
  display: flex; gap: 11px; align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: .8rem;
  color: var(--ink-2);
}
.dock svg { width: 26px; height: 26px; color: var(--gov); flex: none; }
.dock b { display: block; font-size: .84rem; color: var(--ink); }

/* ===== Thẻ UAV đồng bộ ngôn ngữ với trạm dock ===== */
.uav3 {
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; overflow: hidden;
  display: flex; flex-direction: column;
}
.u3-head { display: flex; align-items: center; gap: 8px; padding: 10px 11px; }
.u-ready .u3-head  { background: #eef7ee; color: #1d5a21; }
.u-fly .u3-head    { background: #eef3fb; color: #1d4787; }
.u-charge .u3-head { background: #fdf3e3; color: #8a5200; }
.u-maint .u3-head  { background: #f2f3f5; color: #454b56; }
.u3-ring {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px dashed currentColor; display: grid; place-items: center;
}
.u3-ring svg { width: 21px; height: 21px; }
.u3-id { flex: 1; min-width: 0; }
.u3-id b { display: block; font-size: .92rem; letter-spacing: .02em; white-space: nowrap; }
.u3-id span { display: block; font-size: .66rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u3-head .st { margin-left: auto; white-space: nowrap; }
.u3-head .st { flex: none; }
.u3-batt { display: flex; align-items: center; gap: 9px; padding: 11px 13px 3px; color: var(--ink-2); }
.u3-batt svg { width: 22px; height: 22px; flex: none; }
.u3-batt .bar { flex: 1; height: 7px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.u3-batt .bar i { display: block; height: 100%; border-radius: 99px; background: #2e7d32; }
.u3-batt .bar i.low { background: #b26a00; }
.u3-batt > b { font-size: .82rem; color: var(--ink); min-width: 38px; text-align: right; }
.u3-tiles { display: grid; gap: 6px; padding: 9px 11px 12px; }
.u3t {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-soft, #f6f7f9); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 7px 10px;
}
.u3t > svg { width: 18px; height: 18px; flex: none; color: var(--gov); }
.u3t b { display: block; font-size: .76rem; color: var(--ink); line-height: 1.3; }
.u3t small { display: block; font-size: .6rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--mute); }

/* ===== Mô hình 3D thiết bị bay ===== */
.drone3d { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.d3d-view iframe {
  width: 100%; height: 420px; border: 1px solid var(--line);
  border-radius: 10px; background: #0c111c; display: block;
}
.d3d-credit { font-size: .7rem; color: var(--mute); margin: 7px 2px 0; }
.d3d-credit a { color: var(--info); text-decoration: none; }
.d3d-specs h3 { font-size: .9rem; margin-bottom: 12px; color: var(--gov); }
.d3d-specs dl { margin: 0; }
.d3d-specs dl > div {
  display: grid; grid-template-columns: 110px 1fr; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: .84rem;
}
.d3d-specs dt { font-weight: 700; color: var(--ink-2); }
.d3d-specs dd { margin: 0; color: var(--ink); }
@media (max-width: 860px) {
  .drone3d { grid-template-columns: 1fr; }
  .d3d-view iframe { height: 300px; }
}

/* ===== Trạm dock: 3 trạm xếp dọc, sơ đồ chỗ đỗ + icon thời tiết ===== */
.dock-strip { grid-template-columns: 1fr; }
.dock3 {
  display: flex; align-items: stretch; gap: 18px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; padding: 14px 16px;
}
.d3-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.d3-name { display: flex; align-items: center; gap: 10px; }
.d3-name > svg { width: 30px; height: 30px; color: var(--gov); flex: none; }
.d3-name b { display: block; font-size: .92rem; color: var(--ink); }
.d3-name span { display: block; font-size: .75rem; color: var(--ink-2); }
.d3-name > div { flex: 1; min-width: 0; }
.dock-occ {
  flex: none; font-size: .76rem; font-weight: 700; color: var(--gov);
  border: 1px solid currentColor; border-radius: 99px; padding: 2px 9px;
}
.wx { display: flex; flex-wrap: wrap; gap: 8px; }
.wxi {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 86px; padding: 8px 10px;
  background: var(--bg-soft, #f6f7f9); border: 1px solid var(--line-soft);
  border-radius: 8px; text-align: center;
}
.wxi svg { width: 20px; height: 20px; color: var(--gov); margin-bottom: 2px; }
.wxi b { font-size: .78rem; color: var(--ink); line-height: 1.2; }
.wxi small { font-size: .62rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--mute); }
.wxi.ok { background: #eef7ee; border-color: #bcd9bd; }
.wxi.ok svg, .wxi.ok b { color: #1d5a21; }
.wxi.bad { background: #fdecea; border-color: #e7b3ac; }
.wxi.bad svg, .wxi.bad b { color: #a1170a; }

/* Chỗ đỗ vẽ dạng sân đáp */
.d3-pads { flex: none; display: flex; gap: 12px; align-items: center; }
.padv {
  position: relative; width: 148px; min-height: 128px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-align: center; padding: 12px 8px;
  border-radius: 12px; overflow: hidden;
}
.padv::before {
  content: ""; position: absolute; inset: 7px;
  border: 1.5px dashed currentColor; border-radius: 9px; opacity: .35;
  pointer-events: none;
}
.padv .pv-ico { width: 34px; height: 34px; }
.padv b { font-size: .88rem; }
.padv small { display: block; font-size: .66rem; font-weight: 600; line-height: 1.3; }
.pv-batt {
  width: 72%; height: 6px; border-radius: 99px;
  background: rgba(0, 0, 0, .12); overflow: hidden; margin: 2px 0 1px;
}
.pv-batt i { display: block; height: 100%; border-radius: 99px; background: #2e7d32; }
.pv-batt i.low { background: #b26a00; }
.pv-h {
  font-size: 1.9rem; font-weight: 800; line-height: 1;
  border: 2.5px solid currentColor; border-radius: 50%;
  width: 46px; height: 46px; display: grid; place-items: center;
  opacity: .55;
}
.pad-ready  { background: #eef7ee; border: 1.5px solid #2e7d32; color: #1d5a21; }
.pad-charge { background: #fdf3e3; border: 1.5px solid #b26a00; color: #8a5200; }
.pad-maint  { background: #f2f3f5; border: 1.5px solid #5f6673; color: #454b56; }
.pad-away   { background: #eef3fb; border: 1.5px dashed #2456a6; color: #1d4787; }
.pad-empty  { background: #fafafa; border: 1.5px dashed var(--line); color: var(--mute); }

@media (max-width: 1100px) {
  .padv { width: 122px; }
}
@media (max-width: 760px) {
  .dock3 { flex-direction: column; gap: 12px; }
  .d3-pads { width: 100%; flex-wrap: wrap; }
  .padv { flex: 1 1 30%; width: auto; min-height: 112px; }
  .wxi { flex: 1; min-width: 72px; }
}

/* Lịch bay */
.sched { width: 100%; border-collapse: collapse; font-size: .84rem; }
.sched th, .sched td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.sched th {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mute);
}
.sched tbody tr:last-child td { border-bottom: 0; }
.sched .done-txt { color: var(--ok); font-weight: 600; }
.sched .now-txt { color: var(--info); font-weight: 700; }
.sched .wait-txt { color: var(--mute); }
.week-note { font-size: .78rem; color: var(--mute); padding: 10px 18px 14px; }
.week-note b { color: var(--ink-2); }

/* Modal chi tiết */
.modal-back[hidden] { display: none; }
.modal-back {
  position: fixed; inset: 0;
  background: rgba(20, 26, 36, .55);
  display: grid; place-items: center;
  padding: 18px;
  z-index: 100;
}
.modal {
  background: var(--card);
  border-radius: 10px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 18px 60px rgba(0,0,0,.3);
}
.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { font-size: 1.02rem; font-weight: 800; }
.modal-head .sub { font-size: .78rem; color: var(--mute); margin-top: 2px; }
.modal-close {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 6px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--mute);
  flex: none;
}
.modal-close:hover { color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 16px 20px 20px; }
.ba-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.ba-cell { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ba-cell svg { display: block; width: 100%; height: auto; }
.ba-cell .cap {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 7px 11px;
  border-top: 1px solid var(--line-soft);
  color: var(--mute);
}
.detail-rows { font-size: .85rem; }
.detail-rows .dr {
  display: grid; grid-template-columns: 170px 1fr;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.detail-rows .dr:last-child { border-bottom: 0; }
.detail-rows dt { color: var(--mute); font-size: .78rem; }
.detail-rows dd { margin: 0; color: var(--ink); }
.modal-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
}
.btn-sm {
  border-radius: 6px;
  font-size: .8rem; font-weight: 700;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  transition: all .15s var(--ease);
}
.btn-sm:hover { border-color: var(--gov); color: var(--gov); }
.btn-sm.primary { background: var(--gov); border-color: var(--gov); color: #fff; }
.btn-sm.primary:hover { background: var(--gov-hi); }

/* Footer dashboard */
.dash-foot {
  text-align: center;
  font-size: .72rem;
  color: var(--mute);
  padding: 6px 16px 26px;
}

/* Toast demo */
.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  font-size: .82rem;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  z-index: 120;
  max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stat-cards { grid-template-columns: repeat(3, 1fr); }
  .alert-row { grid-template-columns: 44px minmax(160px, 1.6fr) 120px 140px; }
  .alert-row .a-org, .alert-row .a-open { display: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
  }
  .sidebar nav { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sidebar nav a { white-space: nowrap; font-size: .8rem; }
  .side-label, .side-sys { display: none; }
  .gov-name .t1 { display: none; }
  .gov-name .t2 { white-space: normal; font-size: .78rem; }
}
@media (max-width: 640px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .gov-user .who { display: none; }
  .alert-row {
    grid-template-columns: 44px 1fr;
    grid-template-areas: "ic main" "ic prio" "ic status";
    row-gap: 6px;
    align-items: start;
  }
  .alert-row .a-ic { grid-area: ic; }
  .alert-row .a-main { grid-area: main; }
  .alert-row .prio-badge { grid-area: prio; }
  .alert-row .status { grid-area: status; }
  .ba-grid { grid-template-columns: 1fr; }
  .detail-rows .dr { grid-template-columns: 1fr; gap: 1px; }
  .map-frame iframe { height: 380px; }
}

/* =========================================================
   PHÂN HỆ QUẢN LÝ (drones / tasks / incidents)
   ========================================================= */

/* Bảng dữ liệu chuẩn */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 860px; }
table.data th, table.data td { padding: 10px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
table.data thead th {
  font-size: .67rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mute); background: #fafbfc; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
table.data tbody tr { transition: background .15s var(--ease); }
table.data tbody tr:hover { background: #faf7f4; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td .sub2 { display: block; font-size: .72rem; color: var(--mute); }
table.data td b { font-weight: 700; }
.row-click { cursor: pointer; }
.table-foot {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  padding: 10px 18px; border-top: 1px solid var(--line-soft);
  font-size: .76rem; color: var(--mute);
}
.table-foot b { color: var(--ink-2); }

/* Nút thao tác nhỏ trong bảng */
.btn-xs {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 5px;
  font-size: .72rem; font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s var(--ease);
}
.btn-xs:hover { border-color: var(--gov); color: var(--gov); }
.btn-xs.primary { background: var(--gov); border-color: var(--gov); color: #fff; }
.btn-xs.primary:hover { background: var(--gov-hi); }
.btn-xs.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-xs:disabled { opacity: .4; cursor: not-allowed; }
.btn-xs:disabled:hover { border-color: var(--line); color: var(--ink-2); }
.act-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Badge trạng thái bổ sung */
.st-wait   { background: var(--line-soft); color: var(--ink-2); }
.st-run    { background: var(--info-bg); color: var(--info); }
.st-cancel { background: #f3f4f6; color: #9aa1ab; text-decoration: line-through; }
.st-maint  { background: #efe7fa; color: #6b3fa0; }
.st-fly    { background: var(--info-bg); color: var(--info); }
.st-ready  { background: var(--ok-bg); color: var(--ok); }
.st-charge { background: var(--warn-bg); color: var(--warn); }

/* Badge loại nhiệm vụ / nguồn */
.tt {
  display: inline-block;
  font-size: .7rem; font-weight: 700;
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}
.tt-150 { background: #e9edf6; color: #33508a; }
.tt-50  { background: #fdf1dd; color: var(--warn); }
.tt-re  { background: var(--ok-bg); color: var(--ok); }
.src { font-size: .74rem; color: var(--mute); white-space: nowrap; }
.src b { color: var(--info); font-weight: 600; }

/* Tiến trình quy trình phiếu (6 bước) */
.stage { display: inline-flex; align-items: center; gap: 4px; }
.stage i {
  width: 9px; height: 9px; border-radius: 50%;
  background: #d7dbe2; display: inline-block;
}
.stage i.on { background: var(--ok); }
.stage i.cur { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.stage-lbl { display: block; font-size: .72rem; color: var(--ink-2); font-weight: 600; margin-top: 3px; }

/* Nhật ký trạng thái trong modal */
.log-list { margin: 0; padding: 0; list-style: none; }
.log-list li {
  display: grid; grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 6px 0 6px 14px;
  border-left: 2px solid var(--line);
  position: relative;
  font-size: .82rem;
}
.log-list li::before {
  content: ""; position: absolute; left: -5px; top: 12px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
}
.log-list li.pending { color: var(--mute); }
.log-list li.pending::before { background: #d7dbe2; }
.log-list .lt { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.log-list li.pending .lt { color: var(--mute); font-weight: 500; }

/* Form tạo nhiệm vụ */
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f-field label { display: block; font-size: .76rem; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.f-field select, .f-field input {
  width: 100%;
  font-family: inherit;
  font-size: .88rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
}
.f-field select:focus, .f-field input:focus { outline: 2px solid rgba(124,29,18,.3); }
.f-hint { grid-column: 1 / -1; font-size: .76rem; color: var(--mute); margin: 0; }

/* Thông số kỹ thuật drone trong modal */
.spec-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.spec {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 9px 12px;
  background: #fafbfc;
}
.spec .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--mute); }
.spec .v2 { font-size: .88rem; font-weight: 700; color: var(--ink); }
.maint-warn {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--warn-bg);
  border: 1px solid #f0d9ae;
  border-radius: 6px;
  padding: 10px 13px;
  font-size: .8rem; color: #7a5200;
  margin-bottom: 14px;
}
.maint-warn svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

h4.m-sub {
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gov); margin: 18px 0 8px;
}
table.mini { width: 100%; border-collapse: collapse; font-size: .8rem; }
table.mini th, table.mini td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); }
table.mini th { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
table.mini tr:last-child td { border-bottom: 0; }

@media (max-width: 640px) {
  .f-grid { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: 1fr 1fr; }
  table.data { min-width: 720px; }
}

/* =========================================================
   ĐIỀU HÀNH BAY — lịch trình + sự kiện
   ========================================================= */

/* Kế hoạch bay theo dòng thời gian trong ngày */
.fp-list { display: flex; flex-direction: column; }
.fp-item {
  display: grid;
  grid-template-columns: 108px 86px minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .15s var(--ease);
}
.fp-item:hover { background: #faf7f4; }
.fp-item:last-child { border-bottom: 0; }
.fp-time { line-height: 1.35; }
.fp-time .t { font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.fp-time .t2 { font-size: .74rem; color: var(--mute); font-variant-numeric: tabular-nums; }
.alt-badge {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 76px; height: 52px;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1.1;
}
.alt-badge b { font-size: 1.05rem; }
.alt-badge span { font-size: .6rem; font-weight: 700; letter-spacing: .06em; }
.alt-150 { background: #e9edf6; color: #33508a; }
.alt-50  { background: #fdf1dd; color: #8a5a00; }
.alt-re  { background: var(--ok-bg); color: var(--ok); }
.fp-main { min-width: 0; }
.fp-main .area { font-weight: 700; font-size: .9rem; }
.fp-main .meta1 { font-size: .78rem; color: var(--ink-2); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.fp-main .tech { font-size: .73rem; color: var(--mute); margin-top: 2px; }
.mode-chip {
  display: inline-block;
  font-size: .68rem; font-weight: 700;
  border-radius: 4px; padding: 1px 7px;
}
.md-dk { background: #eef1f5; color: #4a5568; }
.md-rr { background: #f3ebfa; color: #6b3fa0; }
.md-tt { background: #e5f2f8; color: #0d6786; }
.md-cb { background: var(--danger-bg); color: var(--danger); }
.md-tc { background: var(--gold-soft); color: #7a5200; }
.fp-side { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }

/* Bảng tuần */
.week-grid { width: 100%; border-collapse: collapse; font-size: .8rem; min-width: 640px; }
.week-grid th, .week-grid td { border: 1px solid var(--line-soft); padding: 8px 10px; text-align: center; }
.week-grid th { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); background: #fafbfc; }
.week-grid td .n1 { font-weight: 800; font-size: .95rem; }
.week-grid td .n2 { display: block; font-size: .68rem; color: var(--mute); }
.week-grid td.today { background: #f7ebe9; outline: 2px solid var(--gov); outline-offset: -2px; }

/* Feed sự kiện bay */
.feed { margin: 0; padding: 0; list-style: none; max-height: 520px; overflow-y: auto; }
.feed li {
  display: grid;
  grid-template-columns: 58px 12px minmax(0, 1fr);
  gap: 0 12px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .83rem;
  align-items: start;
}
.feed li:last-child { border-bottom: 0; }
.feed .ft { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: .8rem; padding-top: 1px; }
.feed .fdot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.feed .lv-info .fdot { background: #9fb2c8; }
.feed .lv-warn .fdot { background: var(--warn); }
.feed .lv-urgent .fdot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.feed .fbody b { font-weight: 700; }
.feed .ftag {
  display: inline-block;
  font-size: .68rem; font-weight: 700;
  background: var(--line-soft); color: var(--ink-2);
  border-radius: 4px; padding: 0 6px; margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.feed .lv-urgent .fbody { color: var(--danger); }
.feed .lv-warn .fbody { color: #7a5200; }

@media (max-width: 760px) {
  .fp-item { grid-template-columns: 86px 1fr; }
  .fp-time { grid-column: 1; }
  .alt-badge { width: 70px; height: 46px; }
  .fp-main { grid-column: 1 / -1; }
  .fp-side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
}

/* Gợi ý vuốt ngang cho bảng rộng — chỉ hiện ở màn hình hẹp */
.m-hint { display: none; }
@media (max-width: 900px) {
  .m-hint { display: inline; color: var(--gov); font-weight: 600; }
}

/* =========================================================
   LẬP ĐƯỜNG BAY (planner)
   ========================================================= */
.planner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}
.map-box { position: relative; height: 620px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 1; }
.map-toolbar {
  position: absolute; top: 12px; right: 12px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.map-toolbar .btn-xs { box-shadow: var(--shadow); padding: 8px 14px; font-size: .78rem; }
.map-hintbar {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  background: rgba(28,36,48,.85);
  color: #fff;
  font-size: .76rem;
  padding: 7px 13px;
  border-radius: 6px;
  max-width: min(420px, calc(100% - 90px));
}
.vx-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gov-hi);
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  cursor: grab;
}
.wpn-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gov);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
  font-family: var(--f);
}
.wpn-icon.start { background: var(--ok); }
.wpn-icon.end { background: var(--info); }

.side-card { margin-bottom: 16px; }
.p-form { display: grid; gap: 12px; }
.p-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.alt-quick { display: flex; gap: 8px; }
.alt-quick button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 6px;
  padding: 9px 6px;
  font-size: .8rem; font-weight: 700;
  cursor: pointer;
  color: var(--ink-2);
  line-height: 1.25;
  transition: all .15s var(--ease);
}
.alt-quick button small { display: block; font-weight: 500; font-size: .66rem; color: var(--mute); }
.alt-quick button.on { background: var(--gov); border-color: var(--gov); color: #fff; }
.alt-quick button.on small { color: var(--gold-soft); }
.rng { display: flex; align-items: center; gap: 10px; }
.rng input[type=range] { flex: 1; accent-color: var(--gov); min-width: 0; }
.rng .rv { font-size: .8rem; font-weight: 700; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.cam-note {
  font-size: .74rem; color: var(--mute);
  background: #fafbfc;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 8px 11px;
}

.mi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-soft); border-radius: 6px; overflow: hidden; }
.mi {
  background: var(--card);
  padding: 10px 13px;
}
.mi .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--mute); }
.mi .v { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mi .v small { font-size: .68em; font-weight: 600; color: var(--mute); }
.mi.hl .v { color: var(--gov); }
.batt-warn { color: var(--danger) !important; }

.send-row { display: grid; gap: 10px; }
.btn-send {
  width: 100%;
  border: 0; border-radius: 6px;
  background: var(--gov);
  color: #fff;
  font-size: .88rem; font-weight: 700;
  letter-spacing: .05em;
  padding: 12px;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.btn-send:hover { background: var(--gov-hi); }
.btn-send:disabled { opacity: .45; cursor: not-allowed; }
.btn-kmz {
  width: 100%;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--card);
  color: var(--ink-2);
  font-size: .82rem; font-weight: 700;
  padding: 10px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.btn-kmz:hover { border-color: var(--gov); color: var(--gov); }

@media (max-width: 1100px) {
  .planner-grid { grid-template-columns: 1fr; }
  .map-box { height: 480px; }
}
@media (max-width: 640px) {
  .map-box { height: 400px; }
  .mi-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Thư viện quỹ đạo · nguồn tạo · xem lại quỹ đạo
   ========================================================= */
.src-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 700;
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}
.src-badge svg { width: 12px; height: 12px; }
.src-user { background: var(--info-bg); color: var(--info); }
.src-ai { background: #f3ebfa; color: #6b3fa0; }

.mission-list { display: flex; flex-direction: column; }
.mission-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .15s var(--ease);
}
.mission-row:hover { background: #faf7f4; }
.mission-row:last-child { border-bottom: 0; }
.mission-row .m-name { font-weight: 700; font-size: .88rem; }
.mission-row .m-meta { font-size: .75rem; color: var(--mute); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.track-map {
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
  background: #dfe3ea;
}

/* phát lại quỹ đạo trong modal */
.trk-play { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -4px 0 14px; }
.trk-play input[type=range] { flex: 1 1 180px; accent-color: var(--gov); }
.trk-spd { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.trk-spd button { font: inherit; font-size: .72rem; font-weight: 700; background: var(--card); color: var(--mute); border: 0; padding: 4px 8px; cursor: pointer; }
.trk-spd button + button { border-left: 1px solid var(--line); }
.trk-spd button.on { background: var(--gov); color: #fff; }
.trk-read { flex-basis: 100%; font-size: .78rem; color: var(--mute); }
.trk-drone { width: 34px; height: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.trk-drone svg { width: 34px; height: 34px; }

@media (max-width: 640px) {
  .mission-row { grid-template-columns: 74px 1fr; }
  .mission-row .act-group { grid-column: 1 / -1; }
  .track-map { height: 230px; }
}

/* =========================================================
   Thiết lập toàn địa bàn + chia vùng nhiều drone
   ========================================================= */
.area-info {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  font-size: .82rem; color: var(--ink-2);
  align-items: center;
}
.area-info b { font-weight: 800; }
.area-warn { color: var(--danger); font-weight: 700; }
.area-suggest {
  margin: 10px 0 0;
  font-size: .84rem;
  background: var(--info-bg);
  border: 1px solid #c9dcf2;
  color: var(--info);
  border-radius: 6px;
  padding: 8px 13px;
}
.area-controls {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.area-controls .f-field { margin: 0; display: flex; align-items: center; gap: 8px; }
.area-controls .f-field label { margin: 0; }
.area-controls select { width: auto; padding: 8px 11px; }
.swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 6px;
}
.part-label {
  background: #fff;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  font-family: var(--f);
  font-size: .68rem;
  font-weight: 800;
  padding: 2px 7px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.part-warning {
  margin-top: 12px;
  font-size: .84rem;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid #f0c4c4;
  border-radius: 6px;
  padding: 9px 13px;
}

/* Thanh đang sửa + hàng đường bay nâng cấp */
.edit-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 18px;
  background: var(--gold-soft);
  border-bottom: 1px solid #e6d2a3;
  font-size: .85rem;
}
.edit-bar .eb-label {
  font-size: .68rem; font-weight: 800; letter-spacing: .12em;
  color: #7a5200;
}
.route-warn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 800;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}
.badge-area {
  display: inline-block;
  font-size: .66rem; font-weight: 800; letter-spacing: .08em;
  background: #33508a; color: #fff;
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}
.mission-row.is-area { background: #f6f8fb; border-left: 4px solid #33508a; }
.mission-row.is-area:hover { background: #eef2f8; }
.m-edited { font-size: .72rem; color: var(--warn); font-weight: 600; }

/* ===== Dòng thời gian ảnh trực giao: chuyển mốc & so sánh song song ===== */
.ortho-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); }
.ortho-tab {
  font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.ortho-tab:hover { border-color: var(--gov); color: var(--gov); }
.ortho-tab.active { background: var(--gov); border-color: var(--gov); color: #fff; }
.ortho-grid { display: grid; grid-template-columns: 1fr; gap: 3px; }
.ortho-grid.both { grid-template-columns: 1fr 1fr; }
.ortho-pane { position: relative; margin: 0; min-width: 0; }
.ortho-pane figcaption {
  position: absolute; top: 10px; left: 10px; z-index: 2; pointer-events: none;
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: rgba(28, 36, 48, .78); border-radius: 5px; padding: 4px 9px;
}
.ortho-pane[data-pane="new"] figcaption { background: rgba(124, 29, 18, .88); }
@media (max-width: 860px) {
  .ortho-grid.both { grid-template-columns: 1fr; }
  .ortho-pane iframe { height: 340px; }
}

/* ảnh trước/sau thật + mô phỏng AI */
.ba-cell img.ba-img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; background: #dfe3ea; }

/* so sánh ảnh trực giao đồng bộ */
.ortho-map { height: 520px; width: 100%; background: #1d2430; }
.ortho-pane figcaption { z-index: 500; }
.ortho-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 18px; border-top: 1px solid var(--line-soft); font-size: .8rem; }
.ortho-tools .ot-sw { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink); }
.ortho-tools .ot-sw input { accent-color: var(--gov); width: 15px; height: 15px; }
.ortho-tools .ot-info { color: var(--mute); margin-left: auto; font-variant-numeric: tabular-nums; }
.ortho-cross { pointer-events: none; }
.ortho-cross i, .ortho-cross b { position: absolute; background: #ff2d2d; box-shadow: 0 0 0 1px rgba(255,255,255,.85); }
.ortho-cross i { left: 16px; top: 0; width: 2px; height: 34px; }
.ortho-cross b { top: 16px; left: 0; height: 2px; width: 34px; }
@media (max-width: 760px) { .ortho-map { height: 340px; } .ortho-tools .ot-info { margin-left: 0; } }

/* vòng QA 13/10: danh sách phiếu Tổng quan — địa chỉ xuống dòng riêng; mã không bị ngắt */
.a-main .addr { display: block; margin-top: 2px; }
.nowrap, table.sched td.num, #incBody td:first-child b { white-space: nowrap; }
@media (max-width: 1200px) { .m-hint { display: inline; color: var(--gov); font-weight: 600; } }
/* bảng nhiều cột (Việc bất thường, Quản lý drone): đủ rộng để chữ không bị bóp từng từ — màn hẹp thì cuộn ngang */
#incTable, #droneTable { min-width: 1180px; }
#incTable td:nth-child(3) { min-width: 210px; }

/* =========================================================
   QUỸ ĐẠO SỐ — bản sao số địa bàn (twin.html)
   ========================================================= */
.tw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tw-speed { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; font-size: .74rem; }
.tw-speed span { padding: 0 8px 0 12px; color: var(--mute); font-weight: 600; }
.tw-speed button { border: 0; border-left: 1px solid var(--line); background: var(--card); padding: 5px 11px; font: inherit; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.tw-speed button.on { background: var(--gov); color: #fff; }
.tw-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.tw-map-wrap { position: relative; min-height: 560px; border-right: 1px solid var(--line-soft); }
.tw-map { position: absolute; inset: 0; background: #1d2530; }
.tw-side { max-height: 640px; overflow-y: auto; padding: 10px; background: #fafbfc; }
.tw-side-head { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); padding: 2px 4px 8px; }
.tw-dr { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: box-shadow .15s var(--ease), border-color .15s; }
.tw-dr:hover { box-shadow: var(--shadow); }
.tw-dr.on { box-shadow: 0 0 0 2px var(--c), var(--shadow); }
.tw-dr .batt { margin-top: 6px; }
.tw-dr-top { display: flex; align-items: center; gap: 7px; font-size: .86rem; }
.tw-dr-top .p { margin-left: auto; }
.tw-model { font-size: .7rem; color: var(--mute); }
.tw-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--c); flex: none; }
.tw-line { font-size: .76rem; margin-top: 5px; line-height: 1.4; }
.tw-line.mute, td.mute { color: var(--mute); }
.tw-prog { height: 6px; border-radius: 99px; background: var(--line-soft); margin-top: 6px; overflow: hidden; }
.tw-prog i { display: block; height: 100%; border-radius: 99px; transition: width .3s linear; }
.tw-next { font-size: .72rem; margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); color: var(--ink-2); }

/* biểu tượng trên bản đồ */
.tw-drone { position: relative; width: 44px; height: 44px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.tw-drone svg { width: 44px; height: 44px; transition: transform .25s linear; }
.tw-drone b { position: absolute; right: -6px; bottom: -4px; background: var(--c); color: #fff; font-size: .62rem; font-weight: 800; border-radius: 99px; padding: 1px 5px; border: 1.5px solid #fff; }
.tw-drone:not(.fly) { transform: scale(.72); opacity: .92; }
.tw-drone.fly::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 2px solid var(--c); animation: twPing 1.8s ease-out infinite; }
.tw-drone.sel::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 0 0 2px var(--c); }
@keyframes twPing { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.tw-dock { width: 26px; height: 26px; border-radius: 6px; background: #263238; color: var(--gold); border: 2px solid var(--gold); display: grid; place-items: center; font-weight: 800; font-size: .8rem; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.tw-inc { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .72rem; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); background: var(--mute); }
.tw-inc.tw-urgent { background: var(--danger); }
.tw-inc.tw-high { background: var(--warn); }
.tw-plan-tag { display: inline-block; white-space: nowrap; transform: translate(-50%, -150%); background: rgba(255,255,255,.92); color: var(--c); border: 1px solid var(--c); border-radius: 4px; font-size: .64rem; font-weight: 700; padding: 1px 5px; }

/* bảng đo xa của drone đang chọn */
.tw-tele { position: absolute; left: 12px; bottom: 44px; z-index: 500; width: 340px; max-width: calc(100% - 24px); background: rgba(22,28,36,.9); color: #e8ecf1; border-radius: var(--radius); padding: 10px 12px; font-size: .74rem; backdrop-filter: blur(4px); }
.tw-tele-head { display: flex; align-items: center; gap: 7px; font-size: .8rem; margin-bottom: 7px; }
.tw-tele-head b { color: #fff; white-space: nowrap; }
.tw-tele-head .ph { flex: 1; min-width: 0; color: #c9d1db; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-tele-head .tw-x { white-space: nowrap; }
.tw-x { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 4px; font: inherit; font-size: .68rem; padding: 3px 7px; cursor: pointer; }
.tw-x + .tw-x { margin-left: 4px; }
.tw-x[aria-pressed="true"] { background: var(--gold); color: #1c2430; font-weight: 700; }
.tw-tele dl { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; margin: 0; }
.tw-tele dt { color: #9aa5b3; font-size: .64rem; text-transform: uppercase; letter-spacing: .06em; }
.tw-tele dd { margin: 0; font-weight: 700; color: #fff; }
.tw-legend { position: absolute; left: 12px; bottom: 10px; z-index: 500; display: flex; flex-wrap: wrap; gap: 4px 12px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 4px 10px; font-size: .68rem; color: var(--ink-2); }
.tw-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tw-legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--info); }
.tw-legend .lg-dash { border-top-style: dashed; border-top-width: 2px; }
.tw-legend .lg-plan { border-top: 2px dotted var(--mute); }
.tw-legend .lg-dock { width: 14px; height: 14px; border: 1.5px solid var(--gold); background: #263238; color: var(--gold); border-radius: 3px; font-style: normal; font-size: .55rem; font-weight: 800; display: grid; place-items: center; }

/* hàng đợi + nhật ký */
.tw-bottom { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
#twQueue { min-width: 980px; }
#twQueue tr.tw-run td { background: #f3f7fd; }
#twQueue tr.tw-hi td { background: #fff7e6; }
.tw-acts { white-space: nowrap; }
.tw-acts .btn-xs + .btn-xs { margin-left: 6px; }
.tw-events { list-style: none; margin: 0; padding: 6px 0; max-height: 430px; overflow-y: auto; }
.tw-events li { display: grid; grid-template-columns: 44px 1fr 8px; gap: 8px; padding: 7px 16px; font-size: .76rem; border-bottom: 1px solid var(--line-soft); align-items: start; }
.tw-events li i { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--info); }
.tw-events li.ev-warn i { background: var(--warn); }
.tw-events li.ev-urgent i { background: var(--danger); }
.tw-events li span:first-child { color: var(--mute); }

@media (max-width: 1100px) {
  .tw-grid { grid-template-columns: minmax(0, 1fr); }
  .tw-map-wrap { min-height: 460px; border-right: 0; }
  .tw-side { max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
  .tw-side-head { grid-column: 1 / -1; }
  .tw-dr { margin-bottom: 0; }
  .tw-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tw-map-wrap { min-height: 380px; }
  .tw-tele { width: auto; right: 12px; bottom: 54px; }
  .tw-legend { font-size: .62rem; }
}

/* Quỹ đạo số — thẻ trạm dock trên bản đồ: ô đỗ + pin (vàng = đang sạc, xanh = sẵn sàng) */
.tw-dk { position: absolute; width: 196px; background: rgba(255,255,255,.96); border: 1.5px solid #263238; border-radius: 8px; box-shadow: 0 3px 10px rgba(0,0,0,.35); padding: 6px; font-size: .7rem; color: var(--ink); cursor: default; }
.tw-dk-nw { right: 18px; bottom: 6px; }
.tw-dk-e  { left: 20px; top: 50%; transform: translateY(-50%); }
.tw-dk-w  { right: 20px; top: 50%; transform: translateY(-50%); }
.tw-dk-h { display: flex; align-items: baseline; gap: 6px; padding: 0 2px 5px; }
.tw-dk-h b { font-size: .74rem; }
.tw-dk-h span { margin-left: auto; color: var(--mute); font-size: .64rem; }
.tw-pad { display: grid; grid-template-columns: 18px auto 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; border-radius: 6px; padding: 4px 6px; margin-top: 4px; cursor: pointer; }
.tw-pad .tw-q { grid-row: 1 / 3; width: 18px; height: 18px; color: var(--c); }
.tw-pad > b { font-size: .72rem; }
.tw-pad-st { grid-column: 2 / 4; font-size: .64rem; font-weight: 600; }
.tw-pad.ready  { background: #eef7ee; border: 1.5px solid #2e7d32; color: #1d5a21; }
.tw-pad.charge { background: #fdf3e3; border: 1.5px solid #c98a00; color: #7a4a00; }
.tw-pad.maint  { background: #f2f3f5; border: 1.5px solid #5f6673; color: #454b56; }
.tw-pad.away   { background: #eef3fb; border: 1.5px dashed #2456a6; color: #1d4787; grid-template-rows: auto auto; }
.tw-bat { position: relative; justify-self: end; width: 46px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; padding: 1px; }
.tw-bat::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2.5px; height: 5px; border-radius: 0 1px 1px 0; background: currentColor; }
.tw-bat i { display: block; height: 100%; border-radius: 1.5px; background: #2e7d32; }
.tw-pad.charge .tw-bat i { background: repeating-linear-gradient(-45deg, #f2b705 0 5px, #e09b00 5px 10px); background-size: 14px 14px; animation: twCharge 1s linear infinite; }
.tw-bat em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: .62rem; line-height: 1; color: #5a3600; }
@keyframes twCharge { from { background-position: 0 0; } to { background-position: 14px 0; } }
/* cột bên: pin đang sạc nhấp nháy vàng */
.batt.charging .bar i { background: repeating-linear-gradient(-45deg, #f2b705 0 5px, #e09b00 5px 10px); background-size: 14px 14px; animation: twCharge 1s linear infinite; }
.batt.charging .val { color: #8a5200; }
@media (max-width: 640px) { .tw-dk { width: 160px; } .tw-bat { width: 36px; } }
.tw-fly { display: none; }
.tw-far .tw-dk { width: auto; display: flex; gap: 3px; padding: 3px; border-radius: 6px; white-space: nowrap; }
.tw-far .tw-dk-h, .tw-far .tw-pad .tw-q, .tw-far .tw-pad-st { display: none; }
.tw-far .tw-pad { display: inline-flex; gap: 4px; margin: 0; padding: 2px 6px 2px 5px; }
.tw-far .tw-pad > b { font-size: .64rem; }
.tw-far .tw-bat { width: 26px; height: 11px; }
.tw-far .tw-bat::after { top: 2px; height: 4px; }
.tw-far .tw-bat em { font-size: .5rem; }
.tw-far .tw-fly { display: inline; font-size: .62rem; }
.tw-far .tw-dk-nw { right: auto; bottom: auto; left: 20px; top: 50%; transform: translateY(-50%); }
/* vòng QA 13/10 (2): bản đồ Leaflet tự tạo lớp xếp chồng riêng → không vẽ đè thanh tiêu đề dính khi cuộn */
.ortho-map, .tw-map-wrap, .track-map, .map-frame { isolation: isolate; }
/* bảng quỹ đạo đủ rộng: nhật ký xuống dưới */
.tw-bottom { grid-template-columns: minmax(0, 1fr); gap: 0; }
.tw-events { max-height: 300px; }
.tw-warn { margin: 0 0 12px; padding: 9px 12px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-size: .82rem; line-height: 1.45; }
#map.leaflet-container, .leaflet-container { isolation: isolate; }

/* =========================================================
   QUẢN LÝ THƯ MỤC ẢNH (files.html)
   ========================================================= */
.fm-search input { width: 300px; max-width: 100%; border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font: inherit; font-size: .8rem; }
.fm-search input:focus { outline: 2px solid var(--gov-hi); outline-offset: 1px; }
.fm-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 560px; }
.fm-tree { border-right: 1px solid var(--line-soft); background: #fafbfc; padding: 10px 6px; max-height: 760px; overflow: auto; }
.fm-tree ul { list-style: none; margin: 0; padding: 0; }
.fm-node { display: flex; align-items: center; padding-left: calc(var(--d) * 14px); border-radius: 6px; }
.fm-node.on { background: #f7ebe9; }
.fm-node.on .fm-go { color: var(--gov); font-weight: 700; }
.fm-tw { width: 22px; height: 26px; flex: none; border: 0; background: none; padding: 0; color: var(--mute); cursor: pointer; display: grid; place-items: center; }
.fm-tw svg { width: 13px; height: 13px; transition: transform .15s var(--ease); }
.fm-tw.open svg { transform: rotate(90deg); }
.fm-go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; border: 0; background: none; font: inherit; font-size: .8rem; color: var(--ink-2); padding: 5px 6px; cursor: pointer; text-align: left; border-radius: 6px; }
.fm-go:hover { background: rgba(0,0,0,.04); }
.fm-go svg { width: 16px; height: 16px; flex: none; color: var(--gold); }
.fm-go span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-go small { font-size: .66rem; color: var(--mute); }
.fm-main { min-width: 0; padding: 12px 16px 16px; }
.fm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.fm-crumbs { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-size: .8rem; }
.fm-crumbs li + li::before { content: "›"; color: var(--mute); margin: 0 6px; }
.fm-crumbs button { border: 0; background: none; font: inherit; color: var(--info); cursor: pointer; padding: 2px 0; }
.fm-crumbs button[aria-current] { color: var(--ink); font-weight: 700; cursor: default; }
.fm-path { margin-left: auto; font: 600 .76rem/1.4 ui-monospace, Menlo, Consolas, monospace; background: #263238; color: #f3e3c2; border-radius: 6px; padding: 4px 10px; cursor: copy; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.fm-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.fm-card:hover { box-shadow: var(--shadow); border-color: var(--gold); }
.fm-card svg { width: 30px; height: 30px; color: var(--gold); }
.fm-card b { font-size: .92rem; }
.fm-card span { font-size: .74rem; color: var(--mute); }
.fm-card.flight span:nth-of-type(1) { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fm-src { display: inline-block; font-size: .64rem !important; font-weight: 700; border-radius: 99px; padding: 2px 8px; margin-top: 2px; }
.fm-src.real { background: var(--ok-bg); color: var(--ok) !important; }
.fm-src.demo { background: var(--line-soft); color: var(--ink-2) !important; }
.fm-src.up { background: var(--info-bg); color: var(--info) !important; }
.fm-flight { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 42%); gap: 14px; margin-bottom: 12px; }
.fm-info-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; }
.fm-info-h svg { width: 20px; height: 20px; color: var(--gold); }
.fm-dl { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0 0 10px; font-size: .8rem; }
.fm-dl > div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.fm-dl dt { color: var(--mute); }
.fm-dl dd { margin: 0; color: var(--ink); }
.fm-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.fm-acts a.btn-xs { text-decoration: none; display: inline-flex; align-items: center; }
.btn-xs.danger { border-color: var(--danger); color: var(--danger); }
.btn-xs.danger:hover { background: var(--danger-bg); }
.fm-map { min-height: 260px; border-radius: var(--radius); overflow: hidden; isolation: isolate; background: #1d2530; }
.fm-note { font-size: .74rem; color: var(--mute); margin: 6px 0; }
.fm-empty { color: var(--mute); font-size: .84rem; padding: 18px 4px; }
.fm-drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: .78rem; color: var(--mute); margin-bottom: 12px; text-align: center; transition: all .15s; }
.fm-drop.over { border-color: var(--gov); background: #fbf2f0; color: var(--gov); }
.fm-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fm-ph { display: flex; flex-direction: column; text-align: left; font: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 0; overflow: hidden; cursor: zoom-in; }
.fm-ph:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.fm-th { display: block; aspect-ratio: 16 / 10; background: #dfe3ea; }
.fm-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fm-ph-n { font-size: .64rem; font-weight: 600; color: var(--ink-2); padding: 5px 7px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-ph-m { font-size: .64rem; color: var(--mute); padding: 0 7px 6px; }
.fm-more { grid-column: 1 / -1; border: 1px dashed var(--line); background: none; border-radius: 6px; padding: 10px; font: inherit; font-size: .8rem; color: var(--info); cursor: pointer; }
/* xem ảnh lớn */
.fm-lb { position: fixed; inset: 0; z-index: 1400; background: rgba(10,14,20,.88); display: grid; place-items: center; padding: 16px; }
.fm-lb-in { display: grid; grid-template-columns: minmax(0, 1fr) 320px; width: min(1280px, 100%); max-height: calc(100vh - 32px); background: #11161d; border-radius: 10px; overflow: hidden; }
.fm-lb-img { position: relative; display: grid; place-items: center; min-height: 300px; background: #000; }
.fm-lb-img img { max-width: 100%; max-height: calc(100vh - 32px); object-fit: contain; display: block; }
.fm-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 60px; border: 0; border-radius: 8px; background: rgba(255,255,255,.14); color: #fff; font-size: 2rem; cursor: pointer; }
.fm-lb-nav:disabled { opacity: .25; cursor: default; }
.fm-lb-nav.prev { left: 10px; } .fm-lb-nav.next { right: 10px; }
.fm-lb-side { background: #fff; padding: 14px 16px; overflow: auto; }
.fm-lb-side .fm-dl > div { grid-template-columns: 100px 1fr; }
.fm-lb-side .fm-dl dd { word-break: break-all; }
.fm-lb-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fm-lb-x { border: 0; background: var(--line-soft); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; font-size: 1rem; }
@media (max-width: 1000px) {
  .fm-grid { grid-template-columns: minmax(0, 1fr); }
  .fm-tree { border-right: 0; border-bottom: 1px solid var(--line-soft); max-height: 260px; }
  .fm-flight { grid-template-columns: minmax(0, 1fr); }
  .fm-lb-in { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .fm-lb-img img { max-height: 55vh; }
}
@media (max-width: 640px) {
  .fm-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fm-dl > div { grid-template-columns: 110px 1fr; }
  .fm-path { margin-left: 0; }
  .fm-search input { width: 100%; }
}
a.btn-xs { text-decoration: none; display: inline-flex; align-items: center; }
.fm-lb-img { background: #000 center / contain no-repeat; } .fm-lb-img img { position: relative; }
/* nút Tạo phiếu thủ công trên màn so sánh song song */
.ortho-tools .ot-ticket { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: .8rem; }
.ortho-tools .ot-ticket svg { width: 16px; height: 16px; }
.ortho-tools .ot-ticket:disabled { opacity: .6; cursor: progress; }
.f-field textarea { width: 100%; font: inherit; font-size: .88rem; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; resize: vertical; }

/* ===== Đăng nhập: tài khoản trình diễn theo cấp ===== */
.login-err { color: var(--danger); background: var(--danger-bg); border-radius: 6px; padding: 8px 12px; font-size: .84rem; margin: 0 0 10px; }
.demo-acc { margin-top: 18px; }
.demo-acc-h { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin-bottom: 8px; }
.demo-acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acc-card { text-align: left; font: inherit; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--gov)); border-radius: 8px; padding: 9px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: box-shadow .15s, border-color .15s; }
.acc-card:hover { box-shadow: var(--shadow); border-color: var(--c); }
.acc-card b { font-size: .86rem; color: var(--c); }
.acc-card span { font-size: .76rem; font-weight: 600; color: var(--ink); }
.acc-card small { font-size: .68rem; color: var(--mute); line-height: 1.35; }
.acc-card .acc-cred { margin-top: 5px; font-size: .7rem; font-weight: 600; color: var(--mute); }
.acc-card .acc-cred code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); background: rgba(0,0,0,.05); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
.acc-card .acc-cred em { font-style: normal; color: var(--ok, #2e7d32); }
.login-form .control { position: relative; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font: inherit; font-size: .72rem; font-weight: 600; color: var(--mute); background: none; border: 0; padding: 4px 6px; cursor: pointer; }
.login-form #pass { padding-right: 52px; }
.lv-admin { --c: #9a2a18; } .lv-ttch { --c: #1f3864; } .lv-tram { --c: #1565c0; } .lv-qsv { --c: #2e7d32; }
@media (max-width: 520px) { .demo-acc-grid { grid-template-columns: 1fr; } }

/* ---------- Phân quyền: dải cấp tài khoản + chế độ chỉ xem ---------- */
.role-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 5px 16px; font-size: .76rem; background: color-mix(in srgb, var(--c) 9%, #fff); border-bottom: 1px solid color-mix(in srgb, var(--c) 30%, #fff); color: var(--ink); }
.role-bar b { color: #fff; background: var(--c); padding: 1px 8px; border-radius: 10px; font-size: .72rem; }
.role-bar span { font-weight: 700; color: var(--c); }
.role-bar em { font-style: normal; color: var(--ink-2); }
body.ro .ctl, body.ro [data-ctl] { display: none !important; }
.scard.c-teal { border-left-color: #00897b; }

/* ---------- Cảm biến môi trường trên trạm dock ---------- */
.sensors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfe; min-width: 0; }
.sn svg { width: 17px; height: 17px; color: var(--gov); }
.sn b { font-size: .95rem; color: var(--ink); line-height: 1.15; }
.sn b small { font-size: .68rem; font-weight: 600; color: var(--mute); }
.sn span { font-size: .64rem; color: var(--mute); line-height: 1.3; }
.sn.warn { background: #fff8e6; border-color: #ecd398; } .sn.warn svg, .sn.warn b { color: #8a5a00; }
.sn.bad { background: #fdecea; border-color: #e7b3ac; } .sn.bad svg, .sn.bad b { color: #a1170a; }
.sn.aq-1 { background: #eef7ee; border-color: #bcd9bd; } .sn.aq-1 b, .sn.aq-1 svg { color: #1d5a21; }
.sn.aq-2 { background: #fffbe0; border-color: #e8db8a; } .sn.aq-2 b, .sn.aq-2 svg { color: #7a6200; }
.sn.aq-3 { background: #fff1e3; border-color: #f0c08e; } .sn.aq-3 b, .sn.aq-3 svg { color: #a24e00; }
.sn.aq-4, .sn.aq-5, .sn.aq-6 { background: #fdecea; border-color: #e7b3ac; } .sn.aq-4 b, .sn.aq-5 b, .sn.aq-6 b, .sn.aq-4 svg, .sn.aq-5 svg, .sn.aq-6 svg { color: #a1170a; }
.sn-foot { grid-column: 1 / -1; margin: 0; font-size: .7rem; color: var(--ink-2); }
@media (max-width: 720px) { .sensors { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .stat-cards:has(> :nth-child(6)) { grid-template-columns: repeat(6, 1fr); } }

/* ---------- Cấu hình AI ---------- */
.cf-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; }
.cf-tab { font: inherit; font-size: .82rem; font-weight: 700; padding: 7px 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 20px; cursor: pointer; }
.cf-tab small { font-weight: 600; color: var(--mute); margin-left: 2px; }
.cf-tab.on { background: var(--gov); border-color: var(--gov); color: #fff; }
.cf-tab.on small { color: #f3d9a4; }
.cf-tabs-note { font-size: .74rem; color: var(--mute); margin-left: 6px; }
.cf-now { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.cf-now-p b { font-size: .82rem; }
.cf-perm { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; font-size: .8rem; }
.cf-perm li.ok { color: #1d5a21; } .cf-perm li.no { color: var(--mute); }
.cf-ags { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.cf-ag { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--card); display: flex; flex-direction: column; gap: 8px; text-align: left; }
.cf-ag.using { border-color: var(--gov); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gov) 25%, transparent); }
.cf-ag-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-ag-h b { font-size: .95rem; color: var(--ink); margin-right: 4px; }
.cf-tag { font-size: .66rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: #eef1f6; color: var(--ink-2); }
.cf-tag.mine { background: #e3f0fb; color: #0d4f8b; } .cf-tag.def { background: #fdf3dc; color: #7a5300; }
.cf-desc { margin: 0; font-size: .8rem; color: var(--ink-2); }
.cf-models { display: grid; gap: 3px; }
.cf-m { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 8px; font-size: .78rem; align-items: baseline; }
.cf-m span { color: var(--mute); font-weight: 700; font-size: .7rem; letter-spacing: .04em; }
.cf-m b { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-m code, .cf-table code { font-size: .7rem; color: var(--mute); }
.cf-style { margin: 0; font-size: .76rem; font-style: italic; color: var(--ink-2); border-left: 3px solid var(--line); padding-left: 8px; }
.cf-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.cf-using { font-size: .76rem; font-weight: 700; color: var(--gov); }
.cf-new { font: inherit; cursor: pointer; align-items: center; justify-content: center; border-style: dashed; color: var(--gov); font-weight: 700; min-height: 150px; }
.cf-new span { font-size: 1.6rem; line-height: 1; }
.cf-new:hover { background: #f7f9fc; }
.cf-sub { border-top: 1px solid var(--line); }
.cf-chk { display: flex; gap: 6px; align-items: center; font-size: .8rem; font-weight: 500; }
.cf-test { font-size: .8rem; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line); margin: 6px 0 0; }
.cf-test.ok { background: #eef7ee; border-color: #bcd9bd; } .cf-test.bad { background: #fdecea; border-color: #e7b3ac; } .cf-test.run { color: var(--mute); }
.cf-test audio { margin-top: 6px; height: 32px; max-width: 100%; }
.f-field textarea { font: inherit; font-size: .85rem; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; width: 100%; box-sizing: border-box; }
@media (max-width: 760px) { .cf-now { grid-template-columns: 1fr; } }
.cf-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.cf-slot { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--card); }
.cf-slot-h b { display: block; font-size: .9rem; color: var(--ink); }
.cf-slot-h span { font-size: .74rem; color: var(--mute); }
.cf-slot select { font: inherit; font-size: .84rem; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.cf-slot-f { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cf-slot-f code { font-size: .7rem; color: var(--mute); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cf-slot-save { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.cf-chk { flex-direction: row !important; }
.f-field .cf-chk input[type=checkbox] { width: auto; margin: 0; flex: none; }
