/* ==========================================================================
   HUMANIQ — "Cabine de Projeção" (Console Admin)
   Os bastidores da "Sala de Projeção" do site: mesma família, mais quieta.
   Um único elemento marcante: a LÂMPADA no topo (âmbar = tem GPU ligada).

   Tokens (papéis fixos)
   - Cabine  #12100E  fundo        · Painel  #1A1714  superfícies
   - Papel   #F2ECE3  texto        · Poeira  #A59B8E  texto secundário
   - Tungstênio #FFB23F  ação / máquina ligada
   - Ciano   #7FE3D4  concluído / ok      · Brasa #FF6A5C  erro / destruir
   Tipografia: Instrument Serif (só títulos de página) · Geist (tudo) · Geist Mono (só números/IDs)
   ========================================================================== */

:root {
  --bg: #12100E;
  --bg-deep: #0D0B0A;
  --panel: #1A1714;
  --panel-2: #211D19;
  --field: #0F0D0C;
  --line: rgba(255, 236, 214, 0.09);
  --line-2: rgba(255, 236, 214, 0.16);

  --ink: #F2ECE3;
  --ink-2: #C9BFB2;
  --ink-3: #A59B8E;
  --ink-4: #786F65;

  --amber: #FFB23F;
  --amber-2: #FFC566;
  --amber-ink: #1A1004;
  --amber-soft: rgba(255, 178, 63, 0.11);
  --amber-line: rgba(255, 178, 63, 0.34);

  --cool: #7FE3D4;
  --cool-soft: rgba(127, 227, 212, 0.10);
  --cool-line: rgba(127, 227, 212, 0.30);

  --danger: #FF6A5C;
  --danger-ink: #FFB1A8;
  --danger-soft: rgba(255, 106, 92, 0.11);
  --danger-line: rgba(255, 106, 92, 0.34);

  --font-display: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --r-sm: 7px;
  --r: 11px;
  --nav-w: 216px;
  --top-h: 60px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul, ol { list-style: none; }
::selection { background: rgba(255, 178, 63, 0.32); color: #fff; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono, .tabular { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* -------------------------------------------------------------- utilities */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.mt-xs { margin-top: 6px; } .mt-sm { margin-top: 12px; } .mt-md { margin-top: 20px; }
.mb-sm { margin-bottom: 12px; } .mb-md { margin-bottom: 20px; }
.text-muted { color: var(--ink-4); }
.text-secondary { color: var(--ink-3); }
.text-primary { color: var(--ink); }
.text-amber { color: var(--amber); }
.text-emerald { color: var(--cool); }
.text-danger { color: var(--danger); }
.text-xs { font-size: 0.8rem; }
.text-sm { font-size: 0.88rem; }
.font-semibold { font-weight: 600; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.container-login { width: 100%; max-width: 420px; margin: 0 auto; padding: 0 16px; }

/* =========================================================== CONSOLE SHELL
   Computador: topo + menu lateral + conteúdo. Celular: menu vira barra rolável. */
body[data-admin-page="console"] {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
}
body[data-admin-page="console"] > .topbar { grid-column: 1 / -1; grid-row: 1; }
body[data-admin-page="console"] > .console-nav-bar { grid-column: 1; grid-row: 2; }
body[data-admin-page="console"] > .main-console { grid-column: 2; grid-row: 2; min-width: 0; }
body[data-admin-page="console"] > .ops-footer { grid-column: 1 / -1; grid-row: 3; }

body[data-admin-page="login"] { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: var(--top-h);
  background: rgba(18, 16, 14, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  min-height: var(--top-h);
  max-width: none;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar-inner > .row-inline { margin-left: auto; flex-wrap: nowrap; }
.brand-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand > span:last-child {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: -0.01em;
}
.brand-mark { display: none; }
.isolated-seal { font-size: 0.8rem; color: var(--ink-4); white-space: nowrap; }
.seal-dot { display: none; }

.operator-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--ink-3); min-width: 0; }
.operator-pill strong { color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
.operator-pill > span:nth-child(2) { display: none; }

/* A LÂMPADA: o estado real da GPU de vídeo, sempre visível */
.booth-lamp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-deep);
  color: var(--ink-3);
  font-size: 0.86rem;
}
.booth-lamp .bulb {
  width: 12px; height: 12px; flex: none;
  border-radius: 50%;
  background: #3A332C;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.booth-lamp strong { color: var(--ink); font-weight: 600; white-space: nowrap; }
.booth-lamp .lamp-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.booth-lamp.is-on { border-color: var(--amber-line); background: linear-gradient(90deg, rgba(255, 178, 63, 0.16), rgba(255, 178, 63, 0.03)); color: var(--ink-2); }
.booth-lamp.is-on .bulb {
  background: radial-gradient(circle at 40% 35%, #FFF1CC 0%, var(--amber) 45%, #C26B12 100%);
  box-shadow: 0 0 0 3px rgba(255, 178, 63, 0.18), 0 0 18px 4px rgba(255, 178, 63, 0.55);
  animation: lamp-breathe 2.4s var(--ease) infinite;
}
.booth-lamp.is-on strong { color: var(--amber-2); }
@keyframes lamp-breathe {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 178, 63, 0.18), 0 0 18px 4px rgba(255, 178, 63, 0.55); }
  50% { box-shadow: 0 0 0 3px rgba(255, 178, 63, 0.10), 0 0 10px 2px rgba(255, 178, 63, 0.30); }
}

/* ------------------------------------------------------------ navegação */
.console-nav-bar {
  position: sticky;
  top: var(--top-h);
  align-self: start;
  height: calc(100vh - var(--top-h));
  border-right: 1px solid var(--line);
  background: var(--bg-deep);
}
.console-nav-bar > .container { padding: 18px 12px; max-width: none; }
.console-tabs { display: flex; flex-direction: column; gap: 2px; }
.console-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-size: 0.93rem;
  text-align: left;
  position: relative;
  transition: color 140ms var(--ease), background-color 140ms var(--ease);
}
.console-tab:hover { color: var(--ink); background: rgba(255, 236, 214, 0.04); }
.console-tab.active { color: var(--ink); background: var(--panel); }
.console-tab.active::before {
  content: '';
  position: absolute;
  left: 0; top: 9px; bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--amber);
}
.console-tab-index { display: none; }

/* -------------------------------------------------------------- conteúdo */
.main-console { padding: 30px 0 64px; }
.main-console > .container { max-width: 1180px; }

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.section-header > div:first-child { max-width: 72ch; }
.eyebrow { display: none; }
.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.section-subtitle { margin-top: 8px; font-size: 0.93rem; line-height: 1.55; color: var(--ink-3); max-width: 70ch; }
.section-subtitle strong { color: var(--ink-2); font-weight: 600; }

/* --------------------------------------------------------------- painéis */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.panel-pad { padding: 22px; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.panel-subtitle { margin-top: 3px; font-size: 0.86rem; color: var(--ink-3); max-width: 80ch; }
.panel-body { padding: 20px; }

/* ---------------------------------------------------- indicadores (KPIs)
   Uma faixa única com divisórias, não seis cartões iguais. */
.kpi-grid, .kpi-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px 18px;
  min-width: 0;
  border-left: 1px solid var(--line);
}
.kpi-card:first-child { border-left: 0; }
.kpi-label { font-size: 0.84rem; color: var(--ink-3); }
.kpi-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.kpi-meta { font-size: 0.8rem; color: var(--ink-4); line-height: 1.4; }
.kpi-card.highlight-amber .kpi-value { color: var(--amber-2); }
.kpi-card.highlight-emerald .kpi-value { color: var(--cool); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

/* ---------------------------------------------------------------- botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 0.86rem; }
.btn-xs { min-height: 30px; padding: 4px 10px; font-size: 0.82rem; }
.btn-full { width: 100%; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--amber-2); border-color: var(--amber-2); }
.btn-secondary { background: var(--panel-2); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { border-color: rgba(255, 236, 214, 0.28); background: #28231E; }
.btn-ghost { color: var(--ink-3); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); background: rgba(255, 236, 214, 0.05); }
.btn-emerald { background: var(--cool-soft); border-color: var(--cool-line); color: var(--cool); font-weight: 600; }
.btn-emerald:hover:not(:disabled) { background: rgba(127, 227, 212, 0.18); }
.btn-amber-outline { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); font-weight: 600; }
.btn-amber-outline:hover:not(:disabled) { background: rgba(255, 178, 63, 0.2); }
.btn-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: rgba(255, 106, 92, 0.2); }

/* ------------------------------------------------------- selos de estado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.badge.mono { font-size: 0.76rem; }
.badge-emerald { color: var(--cool); border-color: var(--cool-line); background: var(--cool-soft); }
.badge-amber { color: var(--amber); border-color: var(--amber-line); background: var(--amber-soft); }
.badge-danger { color: var(--danger-ink); border-color: var(--danger-line); background: var(--danger-soft); }
.badge-cyan { color: var(--ink-2); border-color: var(--line-2); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-4); display: inline-block; flex: none; }
.status-dot.online { background: var(--cool); }
.status-dot.amber { background: var(--amber); }
.status-dot.danger { background: var(--danger); }

/* --------------------------------------------------------- formulários */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group-compact { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.86rem; font-weight: 500; color: var(--ink-2); }
.form-hint { font-size: 0.8rem; color: var(--ink-4); }
.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--field);
  color: var(--ink);
  font-size: 0.92rem;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 178, 63, 0.14); }
.select { width: auto; min-width: 150px; padding-right: 34px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.form-group .select, .form-group-compact .select, .filter-bar .select { width: 100%; }
.input-mono { font-family: var(--font-mono); font-size: 0.88rem; }
.textarea { min-height: 88px; resize: vertical; }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.checkbox-row { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.checkbox-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--amber); }
.panel-header form.row-inline { flex: 1 1 420px; }
.panel-header form.row-inline .input { flex: 1 1 220px; width: auto; }

/* ----------------------------------------------------------- avisos */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--ink-2);
  font-size: 0.9rem;
}
.alert-error { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger-ink); }
.alert-success { border-color: var(--cool-line); background: var(--cool-soft); color: var(--cool); }
.alert-amber { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber-2); }
#globalToast { position: sticky; top: calc(var(--top-h) + 10px); z-index: 50; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8); }

.perimeter-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--amber-line);
  background: var(--amber-soft);
  font-size: 0.88rem;
  color: var(--ink-2);
}

/* ------------------------------------------------------------- tabelas
   Rolam de lado no celular; a 1ª coluna (ID) fica presa. */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.data-table th {
  position: sticky;
  top: 0;
  padding: 11px 14px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-4);
  background: var(--panel);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table td.mono, .data-table td .mono { color: var(--ink-2); }
.data-table tbody tr:hover td { background: rgba(255, 236, 214, 0.025); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.empty-state { white-space: normal; }
.empty-state { padding: 34px 18px; text-align: center; color: var(--ink-4); font-size: 0.92rem; }

/* ----------------------------------------------- modelos e chaves (cards) */
.routing-card, .secret-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.routing-card { display: flex; flex-direction: column; justify-content: space-between; }
.routing-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.routing-code { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; color: var(--amber-2); }
.routing-card-body { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.routing-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 13px 18px; border-top: 1px solid var(--line); }
.secret-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.secret-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.secret-key-title { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.secret-hint-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 11px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-3); overflow-wrap: anywhere; }
.secret-input-row { display: flex; gap: 8px; align-items: center; }

/* --------------------------------------------------------------- modais */
.modal-backdrop { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 7, 6, 0.82); backdrop-filter: blur(4px); }
.modal-card { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-title { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; line-height: 1.1; color: var(--ink); }
.modal-body { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }

.ops-footer { padding: 18px 0; border-top: 1px solid var(--line); font-size: 0.84rem; color: var(--ink-4); }

/* ----------------------------------------------------------------- login */
.auth-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 0; }
.auth-stage .panel-pad { padding: 28px; }
.auth-stage .section-title { font-size: 2.3rem; }
body[data-admin-page="login"] .perimeter-box { display: none; }

/* ============================================================ RESPONSIVO */
@media (max-width: 1280px) {
  .operator-pill, .isolated-seal { display: none; }
}

@media (max-width: 1180px) {
  .kpi-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid-6 .kpi-card:nth-child(3n + 1) { border-left: 0; }
  .kpi-grid-6 .kpi-card:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .booth-lamp .lamp-detail { max-width: 28ch; }
}

@media (max-width: 960px) {
  :root { --top-h: 56px; }
  body[data-admin-page="console"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; }
  body[data-admin-page="console"] > .topbar { grid-row: 1; }
  body[data-admin-page="console"] > .console-nav-bar { grid-column: 1; grid-row: 2; }
  body[data-admin-page="console"] > .main-console { grid-column: 1; grid-row: 3; }
  body[data-admin-page="console"] > .ops-footer { grid-row: 4; }

  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
  .isolated-seal, .operator-pill { display: none; }
  .booth-lamp { order: 3; flex: 1 1 100%; }
  .booth-lamp .lamp-detail { max-width: none; flex: 1; }

  .console-nav-bar { position: sticky; top: var(--top-h); z-index: 55; height: auto; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(13, 11, 10, 0.96); backdrop-filter: blur(8px); }
  .console-nav-bar > .container { padding: 8px 12px; }
  .console-tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .console-tabs::-webkit-scrollbar { display: none; }
  .console-tab { width: auto; white-space: nowrap; padding: 8px 13px; border-radius: 999px; font-size: 0.9rem; }
  .console-tab.active { background: var(--amber-soft); color: var(--amber-2); }
  .console-tab.active::before { display: none; }

  .grid-2, .grid-3, .secret-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-console { padding-top: 22px; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .kpi-grid, .kpi-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid-6 .kpi-card, .kpi-grid .kpi-card { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .kpi-grid-6 .kpi-card:nth-child(odd), .kpi-grid .kpi-card:nth-child(odd) { border-left: 0; }
  .kpi-grid-6 .kpi-card:nth-child(-n + 2), .kpi-grid .kpi-card:nth-child(-n + 2) { border-top: 0; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 1.35rem; }
  .panel-header, .panel-body, .panel-pad { padding-left: 16px; padding-right: 16px; }
  .section-header > .row-inline, .section-header > div:last-child:not(:first-child) { width: 100%; }
  .section-header .select { flex: 1; }
  .secret-input-row { flex-direction: column; align-items: stretch; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .data-table { font-size: 0.86rem; }
  .data-table th:first-child, .data-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
  .modal-footer .btn { flex: 1; }
  .brand > span:last-child { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
