/* ===== Mission Control theme ===== */
:root {
  --void: #04050d;
  --deep: #0a0f24;
  --panel: rgba(14, 22, 48, .58);
  --panel-solid: #0e1630;
  --field: rgba(6, 12, 30, .72);
  --line: rgba(120, 170, 255, .16);
  --line-strong: rgba(90, 225, 255, .45);
  --ink: #e6ecff;
  --muted: #8a97c2;
  --cyan: #3ee8ff;
  --cyan-soft: rgba(62, 232, 255, .12);
  --violet: #9d7bff;
  --magenta: #ff4fa3;
  --ok: #38f5a0;
  --wip: #ffb547;
  --warn: #ff5d73;
  --glow: 0 0 0 1px rgba(62, 232, 255, .35), 0 0 22px rgba(62, 232, 255, .25);
  --radius: 16px;
  --font: "Kanit", "Leelawadee UI", "Noto Sans Thai", Tahoma, system-ui, sans-serif;
  --display: "Orbitron", "Kanit", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--void); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 300 15px/1.6 var(--font);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(80, 60, 200, .28), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(20, 150, 220, .22), transparent 60%),
    linear-gradient(180deg, var(--deep), var(--void) 70%);
  background-attachment: fixed;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.nebula {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: .5; filter: blur(60px);
  background:
    radial-gradient(35% 25% at 70% 30%, rgba(157, 123, 255, .35), transparent 70%),
    radial-gradient(30% 25% at 25% 70%, rgba(62, 232, 255, .18), transparent 70%),
    radial-gradient(20% 18% at 55% 85%, rgba(255, 79, 163, .12), transparent 70%);
  animation: drift 60s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(-4%, 3%, 0) rotate(6deg) scale(1.05); } }
header, main, section, footer { position: relative; z-index: 1; }

h1, h2 { margin: 0; font-weight: 500; }
h1 { font-size: 20px; letter-spacing: .3px; }
h2 { font-size: 17px; }
.hud, .eyebrow {
  margin: 0; font: 600 10.5px/1.4 var(--display); letter-spacing: 2.4px; color: var(--cyan);
  text-transform: uppercase; opacity: .85;
}
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(62, 232, 255, .35); }

/* ===== header ===== */
.top {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: space-between;
  padding: 14px 28px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, rgba(4, 6, 16, .92), rgba(4, 6, 16, .6));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top::after {   /* เส้นสแกนเรืองแสงใต้ header */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent);
  opacity: .7;
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo { position: relative; width: 44px; height: 44px; flex: none; }
.planet {
  position: absolute; inset: 9px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #b9f6ff, var(--cyan) 35%, #2446c8 75%, #0b1440);
  box-shadow: 0 0 18px rgba(62, 232, 255, .55);
}
.ring {
  position: absolute; left: 0; right: 0; top: 17px; height: 10px; border-radius: 50%;
  border: 2px solid rgba(157, 123, 255, .85); transform: rotate(-18deg);
  box-shadow: 0 0 10px rgba(157, 123, 255, .6);
}
.moon {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff; top: 50%; left: 50%;
  margin: -3px; box-shadow: 0 0 8px #fff; animation: orbit 6s linear infinite;
}
@keyframes orbit { from { transform: rotate(0) translateX(24px) rotate(0); } to { transform: rotate(360deg) translateX(24px) rotate(-360deg); } }

.telemetry { display: flex; gap: 10px; }
.stat {
  display: flex; flex-direction: column; align-items: center; min-width: 86px; padding: 4px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(10, 18, 40, .55);
}
.stat b { font: 700 20px/1.2 var(--display); color: var(--cyan); text-shadow: 0 0 12px rgba(62, 232, 255, .6); }
.stat.ok b { color: var(--ok); text-shadow: 0 0 12px rgba(56, 245, 160, .5); }
.stat.wip b { color: var(--wip); text-shadow: 0 0 12px rgba(255, 181, 71, .5); }
.stat span { font-size: 11.5px; color: var(--muted); }

.top-right { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.health {
  display: inline-flex; gap: 8px; align-items: center; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(10, 18, 40, .6);
  font: 400 12px/1.4 var(--mono); color: var(--muted);
}
.health i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.health.ok { color: #bfffe3; border-color: rgba(56, 245, 160, .35); }
.health.ok i { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: beacon 2.4s infinite; }
.health.bad { color: var(--warn); border-color: rgba(255, 93, 115, .45); }
.health.bad i { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
@keyframes beacon { 50% { opacity: .35; } }
.clock { font: 600 14px/1 var(--mono); color: var(--cyan); letter-spacing: 1px; text-shadow: 0 0 10px rgba(62, 232, 255, .5); }
.me { display: flex; gap: 8px; align-items: center; }

/* ===== layout & panels ===== */
.grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; padding: 22px 28px 0; }
.card {
  position: relative; padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(20, 32, 70, .62), rgba(8, 14, 34, .62));
  border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.card::before, .card::after {   /* มุมกรอบ HUD */
  content: ""; position: absolute; width: 18px; height: 18px; pointer-events: none;
  border: 2px solid var(--cyan); opacity: .8; filter: drop-shadow(0 0 4px var(--cyan));
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius); }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: var(--radius); }
.card-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 14px; }
.card-head.wrap { flex-wrap: wrap; }
.list-card { margin: 20px 28px 12px; }

/* ===== comms / chat ===== */
.chat { display: flex; flex-direction: column; min-height: 600px; }
.log {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 6px 4px 14px;
  max-height: 46vh; min-height: 200px; scrollbar-width: thin; scrollbar-color: rgba(62, 232, 255, .3) transparent;
}
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word;
  animation: materialize .35s ease-out both; }
@keyframes materialize { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } }
.msg.user {
  align-self: flex-end; border-bottom-right-radius: 4px; color: #06101f; font-weight: 400;
  background: linear-gradient(135deg, #7ff3ff, var(--cyan) 45%, #5aa9ff);
  box-shadow: 0 6px 24px rgba(62, 232, 255, .25);
}
.msg.bot {
  align-self: flex-start; border-bottom-left-radius: 4px; background: rgba(8, 14, 34, .75);
  border: 1px solid var(--line); border-left: 2px solid var(--violet);
}
.msg.bot::before { content: "AI CORE ›"; display: block; font: 600 10px/1.6 var(--display); letter-spacing: 1.8px; color: var(--violet); }
.msg.bot.err { border-left-color: var(--warn); background: rgba(60, 10, 24, .6); }
.msg.bot.err::before { content: "ALERT ›"; color: var(--warn); }
.msg b { color: var(--cyan); font-weight: 500; }
.msg .miss { color: var(--wip); font-weight: 500; }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.msg small { color: var(--muted) !important; font-family: var(--mono); font-size: 11px; }
.typing span { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }

/* voice console */
.voice {
  display: flex; align-items: center; gap: 16px; padding: 12px 14px; margin: 4px 0 12px;
  border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 8, 22, .55);
}
.mic {
  position: relative; flex: none; width: 76px; height: 76px; border-radius: 50%; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid rgba(62, 232, 255, .6); color: #e9fdff;
  background: radial-gradient(circle at 35% 30%, rgba(160, 250, 255, .55), rgba(40, 110, 220, .55) 45%, rgba(10, 20, 60, .9) 75%);
  box-shadow: 0 0 24px rgba(62, 232, 255, .35), inset 0 0 18px rgba(62, 232, 255, .3);
  transition: transform .15s, box-shadow .2s;
}
.mic::before, .mic::after {   /* วงโคจรรอบลูกบอล */
  content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1px dashed rgba(62, 232, 255, .35);
  animation: spin 14s linear infinite;
}
.mic::after { inset: -16px; border: 1px solid rgba(157, 123, 255, .18); animation-duration: 22s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.mic svg { width: 26px; height: 26px; fill: currentColor; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .6)); }
.mic span { font-size: 12px; font-weight: 500; line-height: 1.2; }
.mic:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 0 36px rgba(62, 232, 255, .55), inset 0 0 22px rgba(62, 232, 255, .4); }
.mic:disabled { opacity: .35; cursor: not-allowed; filter: grayscale(.6); }
.mic.rec {
  border-color: var(--magenta);
  background: radial-gradient(circle at 35% 30%, rgba(255, 190, 220, .7), rgba(255, 79, 163, .75) 45%, rgba(70, 10, 50, .95) 78%);
  box-shadow: 0 0 36px rgba(255, 79, 163, .7), inset 0 0 18px rgba(255, 79, 163, .5);
  animation: rec-pulse 1.4s ease-in-out infinite;
}
.mic.rec::before { border-color: rgba(255, 79, 163, .6); animation-duration: 3s; }
.mic.rec span { font-family: var(--mono); font-size: 11px; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 60px rgba(255, 79, 163, .95), inset 0 0 22px rgba(255, 79, 163, .6); } }
.mic.busy { cursor: progress; border-color: var(--violet);
  background: radial-gradient(circle at 35% 30%, rgba(210, 190, 255, .6), rgba(157, 123, 255, .6) 45%, rgba(30, 15, 70, .95) 78%); }
.mic.busy::before { border-style: solid; border-color: transparent; border-top-color: var(--violet); animation-duration: .9s; }
.mic.busy span { font-size: 10px; }
.wave-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
#wave { width: 100%; height: 46px; display: block; }
.kbd-hint { color: var(--muted); font-size: 12px; }

.ask textarea {
  width: 100%; resize: vertical; padding: 12px 14px; border-radius: 12px; min-height: 84px;
  background: var(--field); border: 1px solid var(--line); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.ask textarea::placeholder { color: #5f6b93; }
.ask-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.auto { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.auto input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 34px; height: 18px; border-radius: 999px; background: rgba(120, 140, 200, .25); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #cfd8ff; transition: transform .2s; }
.auto input:checked + .switch { background: rgba(62, 232, 255, .55); box-shadow: 0 0 10px rgba(62, 232, 255, .5); }
.auto input:checked + .switch::after { transform: translateX(16px); background: #fff; }
.auto input:focus-visible + .switch { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ===== buttons ===== */
button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 9px 18px; transition: all .18s; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary {
  font-weight: 500; color: #041020; letter-spacing: .3px;
  background: linear-gradient(135deg, #8ff6ff, var(--cyan) 40%, #7a8cff);
  box-shadow: 0 0 0 1px rgba(143, 246, 255, .6), 0 6px 24px rgba(62, 232, 255, .35);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  border-radius: 2px;
}
.primary:hover:not(:disabled) { filter: brightness(1.12); box-shadow: 0 0 0 1px #bffaff, 0 8px 34px rgba(62, 232, 255, .6); }
.primary.launch { padding: 10px 26px; }
.ghost { background: rgba(10, 18, 40, .5); border-color: var(--line); color: var(--ink); }
.ghost:hover:not(:disabled) { border-color: var(--line-strong); background: var(--cyan-soft); box-shadow: 0 0 14px rgba(62, 232, 255, .2); }
.small { padding: 5px 12px; font-size: 13px; }

/* ===== form ===== */
.entry { display: flex; flex-direction: column; gap: 14px; }
.entry label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.entry :is(input, select, textarea), .filters :is(input, select), .startno input, .me select {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 15px;
  background: var(--field); color: var(--ink); transition: border-color .2s, box-shadow .2s, background .6s;
}
.me select { padding: 5px 10px; font-size: 14px; }
.entry textarea { resize: vertical; }
:is(.ask textarea, .entry input, .entry select, .entry textarea, .filters input, .filters select, .startno input, .me select):focus {
  outline: none; border-color: var(--cyan); box-shadow: var(--glow);
}
input[type="date"], input[type="time"], input[type="month"] { font-family: var(--mono); font-size: 14px; }
::-webkit-calendar-picker-indicator { filter: invert(.8) sepia(1) hue-rotate(150deg) saturate(4); cursor: pointer; }
select option { background: var(--panel-solid); color: var(--ink); }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 13px; color: var(--muted); margin-bottom: 7px; padding: 0; }
legend small { font-size: 11.5px; opacity: .75; margin-left: 4px; }
.seg, .chips { display: flex; flex-wrap: wrap; gap: 7px; border-radius: 12px; }
.seg button, .chips button {
  padding: 5px 13px; border-radius: 999px; font-size: 14px; color: #c3cdf0;
  background: rgba(10, 18, 40, .6); border: 1px solid var(--line);
}
.seg button:hover, .chips button:hover { border-color: var(--line-strong); color: var(--ink); }
.seg button[aria-pressed="true"], .chips button[aria-pressed="true"] {
  color: #eaffff; font-weight: 500; border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(62, 232, 255, .28), rgba(157, 123, 255, .22));
  box-shadow: 0 0 14px rgba(62, 232, 255, .35), inset 0 0 8px rgba(62, 232, 255, .2);
}
.chips button[aria-pressed="true"]::before { content: "✦ "; color: var(--cyan); }

/* Bot เติมช่อง: แสงสแกนผ่าน */
.filled {
  border-color: var(--violet) !important;
  box-shadow: 0 0 0 1px rgba(157, 123, 255, .6), 0 0 22px rgba(157, 123, 255, .45) !important;
  background-image: linear-gradient(100deg, transparent 20%, rgba(157, 123, 255, .28) 45%, transparent 70%) !important;
  background-size: 250% 100% !important; animation: scan 1.1s ease-out;
}
@keyframes scan { from { background-position: 120% 0; } to { background-position: -40% 0; } }
.missing { border-color: var(--wip) !important; box-shadow: 0 0 0 1px rgba(255, 181, 71, .6), 0 0 16px rgba(255, 181, 71, .3) !important; }
.seg.missing, .chips.missing { outline: 1px dashed var(--wip); outline-offset: 5px; box-shadow: none !important; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 6px; }
.badge { padding: 3px 12px; border-radius: 999px; font-size: 12px; color: var(--wip);
  border: 1px solid rgba(255, 181, 71, .45); background: rgba(255, 181, 71, .1); animation: beacon 2s infinite; }

/* ===== mission log ===== */
.filters, .export { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters :is(input, select) { padding: 7px 10px; font-size: 14px; }
.startno { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.startno input { width: 74px; padding: 6px 8px; font-family: var(--mono); }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 8, 22, .45); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; vertical-align: top; }
th {
  font: 600 10.5px/1.4 var(--display); letter-spacing: 1.5px; color: var(--cyan);
  background: rgba(62, 232, 255, .06); border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
td { border-bottom: 1px solid rgba(120, 170, 255, .08); }
td:first-child { font-family: var(--mono); color: var(--muted); }
td:nth-child(4), td:nth-child(5), td:nth-child(8) { white-space: nowrap; }
td.detail { min-width: 300px; color: #dbe3ff; }
td.nowrap { white-space: nowrap; font-family: var(--mono); font-size: 13px; }
tbody tr { cursor: pointer; transition: background .15s; }
tbody tr:hover { background: linear-gradient(90deg, rgba(62, 232, 255, .1), transparent 80%); }
tbody tr:hover td:first-child { color: var(--cyan); }
tr.editing { background: linear-gradient(90deg, rgba(157, 123, 255, .2), transparent) !important; }
.staff-chip { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 500;
  box-shadow: 0 0 10px rgba(0, 0, 0, .35); }
td.st { white-space: nowrap; color: var(--ok); }
td.st::before { content: "●"; margin-right: 6px; text-shadow: 0 0 8px currentColor; }
td.st-wip { color: var(--wip); }
.del { border: 0; background: none; color: var(--muted); padding: 2px 8px; }
.del:hover { color: var(--warn); text-shadow: 0 0 8px var(--warn); }
.empty { text-align: center; color: var(--muted); padding: 34px; margin: 0; }

/* ===== user menu ===== */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 999px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 600; color: #041020; background: linear-gradient(135deg, #8ff6ff, var(--violet));
  box-shadow: 0 0 12px rgba(62, 232, 255, .5);
}
.user-name { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-name .hud { font-size: 8.5px; }
.user-name b { font-weight: 500; font-size: 14px; }
.user-name b .adm { font: 600 9px/1 var(--display); letter-spacing: 1px; color: var(--wip); margin-left: 6px;
  border: 1px solid rgba(255, 181, 71, .5); border-radius: 4px; padding: 2px 4px; vertical-align: 2px; }
.caret { color: var(--muted); font-size: 11px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; z-index: 20;
  display: flex; flex-direction: column; border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(8, 14, 34, .96); box-shadow: var(--glow), 0 20px 40px rgba(0, 0, 0, .5);
  animation: materialize .18s ease-out;
}
.menu[hidden] { display: none; }
.menu button { text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 12px; color: var(--ink); }
.menu button:hover { background: var(--cyan-soft); }
.menu .danger:hover { background: rgba(255, 93, 115, .15); color: var(--warn); }

/* ===== dialogs ===== */
dialog.dialog { width: min(440px, calc(100% - 32px)); color: var(--ink); padding: 22px 24px; margin: auto;
  background: linear-gradient(160deg, rgba(20, 32, 70, .96), rgba(8, 14, 34, .97)); }
dialog.dialog.wide { width: min(760px, calc(100% - 32px)); }
dialog.dialog { overflow-x: hidden; }
.add-row .auto { white-space: nowrap; }
dialog::backdrop { background: rgba(2, 4, 12, .7); backdrop-filter: blur(4px); }
dialog[open] { animation: materialize .22s ease-out; }
dialog form#pwForm { display: flex; flex-direction: column; gap: 12px; }
dialog form#pwForm h2 { margin-bottom: 4px; }
dialog label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
dialog input:not([type=checkbox]) { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 15px;
  background: var(--field); color: var(--ink); }
dialog input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow); }
.err { min-height: 20px; margin: 0; color: var(--warn); font-size: 14px; }
table.crew td { vertical-align: middle; }
.crew .you { color: var(--cyan); font-size: 12px; margin-left: 6px; }
.crew .role-admin { color: var(--wip); }
.crew .no-pw { color: var(--warn); }
.crew .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.crew .actions button { padding: 4px 10px; font-size: 12.5px; }
.crew .actions .danger:hover { border-color: var(--warn); color: var(--warn); background: rgba(255, 93, 115, .1); }
.add-user { margin-top: 16px; }
.add-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.add-row input:not([type=checkbox]) { flex: 1; min-width: 160px; }
.admin-note { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

/* ===== nav tabs ===== */
.tabs { position: relative; z-index: 4; display: flex; gap: 6px; padding: 14px 28px 0; }
.tab {
  display: inline-flex; gap: 8px; align-items: center; padding: 8px 18px; border-radius: 12px 12px 0 0;
  color: var(--muted); text-decoration: none; border: 1px solid transparent; border-bottom: 0;
  font-weight: 400; transition: color .15s, background .15s;
}
.tab:hover { color: var(--ink); background: rgba(62, 232, 255, .06); }
.tab[aria-selected="true"] {
  color: var(--ink); background: linear-gradient(180deg, rgba(62, 232, 255, .14), transparent);
  border-color: var(--line-strong); box-shadow: inset 0 2px 0 var(--cyan);
}
.view[hidden] { display: none !important; }
.view > .grid { padding-top: 12px; }
.page-card { margin: 12px 28px 12px; }
.muted { color: var(--muted); margin: 0; font-size: 13px; }
code { font-family: var(--mono); font-size: 12.5px; color: var(--cyan); background: rgba(62, 232, 255, .08);
  padding: 1px 5px; border-radius: 5px; }
mark { background: rgba(255, 181, 71, .35); color: var(--ink); border-radius: 3px; padding: 0 2px; }

/* ===== filter bar (search / dashboard) ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filter-bar.compact { margin: 0; }
.filter-bar label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.filter-bar :is(input, select) {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px;
  background: var(--field); color: var(--ink);
}
.filter-bar :is(input, select):focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow); }
.filter-bar .grow { flex: 1 1 260px; }
.range-seg button { font-size: 13px; }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }

/* ===== dashboard ===== */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(6, 12, 30, .55); }
.kpi span { display: block; font-size: 13px; color: var(--muted); }
.kpi b { font: 700 30px/1.25 var(--display); color: var(--ink); }
.kpi.ok b { color: var(--ok); }
.kpi.wip b { color: var(--wip); }
.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.chart { margin: 0; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(6, 12, 30, .55); min-width: 0; }
.chart.wide { grid-column: 1 / -1; }
.chart figcaption { font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar { display: grid; grid-template-columns: minmax(70px, 38%) 1fr auto; gap: 10px; align-items: center;
  padding: 3px 4px; border-radius: 6px; cursor: default; }
.hbar:hover { background: rgba(62, 232, 255, .07); }
.hbar .k { font-size: 13px; color: #c7d1f2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 10px; }
.hbar .bar { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--cyan); opacity: .85; }
.hbar:hover .bar { opacity: 1; box-shadow: 0 0 10px rgba(62, 232, 255, .5); }
.hbar .v { font: 400 12.5px/1 var(--mono); color: var(--ink); min-width: 34px; text-align: right; }
.more { margin: 6px 4px 0; font-size: 12px; color: var(--muted); }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 18px;
  border-bottom: 1px solid rgba(120, 170, 255, .25); }
.cols.short { height: 140px; }
.col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; position: relative; cursor: default; }
.col .cbar { width: min(70%, 34px); border-radius: 4px 4px 0 0; background: var(--cyan); opacity: .85; }
.col:hover .cbar { opacity: 1; box-shadow: 0 0 12px rgba(62, 232, 255, .55); }
.col .cv { font: 400 11.5px/1 var(--mono); color: var(--ink); margin-bottom: 4px; min-height: 12px; }
.col .ck { position: absolute; top: 100%; margin-top: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.chart .cols { margin-bottom: 24px; }
.tip { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; padding: 7px 11px; font-size: 13px;
  border-radius: 9px; background: rgba(8, 14, 34, .96); border: 1px solid var(--line-strong); box-shadow: var(--glow); }
.pending { margin-top: 18px; }
.pending h3 { margin: 2px 0 10px; font-size: 16px; font-weight: 500; }
td.late { color: var(--wip); font-weight: 500; }
.done-btn { white-space: nowrap; }
.done-btn:hover:not(:disabled) { border-color: var(--ok) !important; color: var(--ok); background: rgba(56, 245, 160, .1) !important; }
#sTable tbody tr, #pTable tbody tr { cursor: pointer; }

/* ===== admin tabs & settings ===== */
.admin-tabs { margin-bottom: 16px; }
.sub-hud { margin: 20px 0 8px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.set-grid small { font-size: 11.5px; opacity: .8; }
dialog textarea { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 14px;
  background: var(--field); color: var(--ink); resize: vertical; font-family: var(--font); }
dialog textarea:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow); }
textarea.full { width: 100%; }
.pair-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.pair { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; }
.pair input { font-family: var(--mono); font-size: 13px !important; padding: 7px 9px !important; }
.pair span { color: var(--muted); }
.color-rows { display: flex; flex-direction: column; gap: 8px; }
.color-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.color-row .staff-chip { min-width: 110px; text-align: center; }
.color-row label { flex-direction: row; align-items: center; gap: 6px; }
.color-row input[type=color] { width: 38px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.info-grid div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(6, 12, 30, .5); }
.info-grid span { display: block; font-size: 12px; color: var(--muted); }
.info-grid b { font-weight: 500; font-size: 14px; }
.backups { margin-top: 10px; max-height: 220px; overflow-y: auto; }
.backups td { font-family: var(--mono); font-size: 13px; }
.btn-link { display: inline-block; padding: 3px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.btn-link:hover { border-color: var(--line-strong); background: var(--cyan-soft); }

@media (max-width: 1100px) { .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .tabs { padding: 10px 16px 0; overflow-x: auto; }
  .tab { padding: 8px 12px; }
  .page-card { margin: 10px 16px; }
  .kpis, .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts, .set-grid { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr auto; }
  .pair span { display: none; }
}

.foot { text-align: center; padding: 8px 0 26px; opacity: .6; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 10; max-width: calc(100% - 32px);
  padding: 11px 20px; border-radius: 12px; color: var(--ink);
  background: rgba(10, 18, 40, .92); border: 1px solid var(--line-strong); box-shadow: var(--glow);
  backdrop-filter: blur(10px); animation: materialize .25s ease-out;
}

@media (max-width: 1100px) { .telemetry { order: 3; width: 100%; justify-content: center; } }
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; padding: 14px 16px 0; gap: 14px; }
  .list-card { margin: 14px 16px 12px; }
  .top { padding: 12px 16px; gap: 12px; position: relative; }
  .stat { min-width: 0; flex: 1; }
  .chat { min-height: 0; }
  .row3, .row2 { grid-template-columns: 1fr 1fr; }
  .row3 label:first-child { grid-column: 1 / -1; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
