/* ============================================================================
   Suite 360 · Administração de Atualizações — design system da SPA
   Vanilla CSS, zero dependências. Tokens derivados de css/app.css do projeto,
   com a paleta escura fixada no contrato §6 (fundo #08080b, texto #f4efe6).
   Sumário: 1 tokens · 2 base · 3 shell · 4 componentes · 5 tabelas
            6 formulários · 7 overlays · 8 estados · 9 páginas · 10 responsivo
   ========================================================================== */

/* ---------------------------------------------------------------- 1. tokens */
:root {
  /* superfícies */
  --bg: #08080b;
  --bg-2: #0c0c11;
  --sidebar-bg: #0a0a0e;
  --panel: #101014;
  --panel-2: #14141a;
  --raised: #1a1a21;
  --input: #0c0c11;

  /* traços */
  --line: #22222a;
  --line-strong: #35353f;

  /* texto */
  --text: #f4efe6;
  --muted: #a9a294;
  --faint: #7e7869;

  /* acento dourado/âmbar */
  --gold: #d9c5a5;
  --gold-2: #efe6d4;
  --gold-deep: #b0915c;
  --accent: var(--gold);
  --accent-soft: color-mix(in srgb, var(--gold) 9%, transparent);
  --accent-line: color-mix(in srgb, var(--gold) 42%, var(--line));

  /* semânticos */
  --ok: #6fd4a8;
  --warn: #e0b86a;
  --bad: #e08a7c;
  --info: #8fb3e0;

  /* formas */
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 26px 70px rgba(0, 0, 0, 0.58);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar: 236px;

  /* tipografia */
  --font: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --display: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;

  /* foco e camadas */
  --focus: color-mix(in srgb, var(--gold) 72%, #fff);
  --z-shade: 60;
  --z-dialog: 70;
  --z-toast: 90;

  color-scheme: dark;
}

/* ------------------------------------------------------------------ 2. base */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--gold) 32%, transparent); }
[hidden], .hidden { display: none !important; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 650; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 100;
  padding: 10px 16px; background: var(--gold-2); color: #14140f;
  border-radius: var(--radius-xs); font-weight: 650;
}
.skip-link:focus { top: 12px; }

.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.text-gold { color: var(--gold); }
.tabular { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }
.eyebrow {
  color: var(--gold); font-size: 10px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
}

/* ------------------------------------------------------------------ 3. shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.sidebar {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 18px 12px 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--raised); border-radius: 99px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 14px; }
.brand img { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 16px; letter-spacing: -0.025em; line-height: 1.1; }
.brand-text small {
  display: block; margin-top: 3px; color: var(--muted);
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  margin: 16px 8px 4px; color: var(--faint);
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
}
.nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 38px; padding: 9px 12px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; text-align: left; text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-btn:hover { background: var(--raised); color: var(--text); }
.nav-btn[aria-current="page"] {
  background: var(--panel-2); color: var(--text);
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav-btn svg { flex: 0 0 auto; color: inherit; opacity: 0.85; }
.nav-btn .nav-count {
  margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--faint);
}

.sidebar-foot {
  margin-top: auto; padding: 14px 8px 2px;
  border-top: 1px solid var(--line);
  color: var(--faint); font-size: 11px; line-height: 1.5;
}
.sidebar-foot b { display: block; color: var(--muted); font-weight: 600; }
.sidebar-foot .mono { font-size: 11px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.topbar {
  flex: 0 0 68px; height: 68px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.crumb { min-width: 0; margin-right: auto; display: grid; gap: 2px; }
.crumb b { font-family: var(--display); font-size: 17px; letter-spacing: -0.025em; }
.crumb span { color: var(--muted); font-size: 12px; }
.top-meta { display: flex; align-items: center; gap: 14px; flex-shrink: 0; color: var(--muted); }
.clock { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.identity { display: grid; text-align: right; line-height: 1.25; }
.identity b { font-size: 12px; font-weight: 600; }
.identity span { font-size: 10px; color: var(--faint); }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--ok-soft, color-mix(in srgb, var(--ok) 8%, transparent));
  color: var(--ok); font-size: 12px; white-space: nowrap;
}
.pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent);
}
.pill[data-tone="warn"] { color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.pill[data-tone="bad"] { color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.pill[data-tone="neutral"] { color: var(--muted); background: transparent; }

.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto; padding: 0;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn--danger:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

.menu-toggle, .sidebar-close, .nav-shade { display: none; }

.content {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 22px 24px 48px;
}
.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--raised); border-radius: 99px; border: 2px solid var(--bg); }
.page { display: grid; gap: 18px; max-width: 1600px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; letter-spacing: -0.035em; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 70ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------- 4. componentes */
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel { padding: 18px 20px; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.panel-title { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.panel-desc { color: var(--faint); font-size: 12px; margin-top: 4px; max-width: 74ch; }
.panel-body { min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
  padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; gap: 6px; align-content: start; min-width: 0;
}
.stat[data-tone="warn"] { border-color: color-mix(in srgb, var(--warn) 34%, var(--line)); }
.stat[data-tone="bad"] { border-color: color-mix(in srgb, var(--bad) 34%, var(--line)); }
.stat-label { color: var(--faint); font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.stat-value { font-family: var(--display); font-size: 28px; line-height: 1.05; letter-spacing: -0.04em; }
.stat-hint { color: var(--muted); font-size: 12px; }

.split { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 16px; align-items: start; }
.split--even { grid-template-columns: 1fr 1fr; }

.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 9px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--plain::before { display: none; }
.badge--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 34%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.badge--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 34%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.badge--bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 34%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.badge--info { color: var(--info); border-color: color-mix(in srgb, var(--info) 34%, transparent); background: color-mix(in srgb, var(--info) 8%, transparent); }
.badge--gold { color: var(--gold); border-color: var(--accent-line); background: var(--accent-soft); }
.badge--neutral { color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius-xs);
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12px;
}
.chip .mono { font-size: 11px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 9px 14px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--gold-2); color: #16140f;
  font-size: 13px; font-weight: 650; white-space: nowrap;
  transition: filter 0.15s ease, background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; filter: none; transform: none; }
.btn svg { flex: 0 0 auto; }

.btn--secondary { background: var(--raised); color: var(--text); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--panel-2); filter: none; border-color: var(--gold-deep); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--raised); filter: none; }
.btn--danger {
  background: color-mix(in srgb, var(--bad) 16%, transparent);
  color: var(--bad); border-color: color-mix(in srgb, var(--bad) 46%, transparent);
}
.btn--danger:hover { background: color-mix(in srgb, var(--bad) 26%, transparent); filter: none; }
.btn--sm { min-height: 30px; padding: 5px 10px; font-size: 12px; border-radius: var(--radius-xs); }
.btn--block { width: 100%; }
.btn--icon { padding: 6px; min-height: 30px; min-width: 30px; }
.btn.is-loading { pointer-events: none; opacity: 0.7; }

.spinner {
  width: 14px; height: 14px; flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  font-size: 13px; line-height: 1.5;
}
.alert svg { flex: 0 0 auto; margin-top: 1px; }
.alert b { display: block; margin-bottom: 3px; }
.alert--warn { border-color: color-mix(in srgb, var(--warn) 38%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); color: var(--warn); }
.alert--bad { border-color: color-mix(in srgb, var(--bad) 38%, transparent); background: color-mix(in srgb, var(--bad) 7%, var(--panel)); color: var(--bad); }
.alert--ok { border-color: color-mix(in srgb, var(--ok) 38%, transparent); background: color-mix(in srgb, var(--ok) 7%, var(--panel)); color: var(--ok); }
.alert--info { border-color: color-mix(in srgb, var(--info) 34%, transparent); background: color-mix(in srgb, var(--info) 7%, var(--panel)); color: var(--info); }
.alert--gold { border-color: var(--accent-line); background: var(--accent-soft); color: var(--gold-2); }
.alert .alert-body { color: var(--text); }
.alert .alert-body b { color: inherit; }

.toolbar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.toolbar-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { min-width: 150px; }
.toolbar-search { flex: 1 1 260px; min-width: 200px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab {
  padding: 9px 14px; border: 0; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.tab .tab-count { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-left: 6px; }

.code-block {
  margin: 0; padding: 12px 14px;
  background: var(--input); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto;
}
.code-inline {
  font-family: var(--mono); font-size: 12px; padding: 2px 6px;
  background: var(--input); border: 1px solid var(--line); border-radius: 6px;
  overflow-wrap: anywhere;
}

.progress { display: grid; gap: 7px; }
.progress-track {
  height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden;
}
.progress-bar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  border-radius: 999px; transition: width 0.18s ease;
}
.progress-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.progress-meta .mono { font-size: 11px; }

/* --------------------------------------------------------------- 5. tabelas */
.table-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: auto; max-width: 100%;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table caption { text-align: left; padding: 12px 14px 0; color: var(--faint); font-size: 12px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; padding: 11px 12px;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
  color: var(--faint); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap;
}
.table td {
  padding: 11px 12px; border-bottom: 1px solid var(--line);
  vertical-align: middle; min-width: 0;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.022); }
.table tbody tr[aria-selected="true"] td { background: color-mix(in srgb, var(--gold) 7%, transparent); }
.table--dense td { padding: 8px 10px; }
.table--dense th { padding: 9px 10px; }
.table .col-check { width: 38px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; }

.table-sort {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: transparent; padding: 0;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.table-sort:hover { color: var(--text); }
.table-sort[aria-pressed="true"], .table th[aria-sort] .table-sort { color: var(--gold); }
.table-sort svg { opacity: 0.6; }

.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.key-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.key-code {
  font-family: var(--mono); font-size: 12px; letter-spacing: -0.02em;
  white-space: nowrap;
}
.copy-btn {
  width: 26px; height: 26px; flex: 0 0 auto; padding: 0;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px;
  background: transparent; color: var(--faint);
}
.copy-btn:hover { color: var(--gold); border-color: var(--accent-line); background: var(--accent-soft); }

.bulk-bar {
  position: sticky; bottom: 14px; z-index: 5;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--raised) 92%, var(--gold));
  border: 1px solid var(--accent-line); box-shadow: var(--shadow);
}
.bulk-count { font-size: 13px; font-weight: 650; }
.bulk-count .mono { font-size: 12px; }

.pagination {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 4px;
}
.pagination-info { color: var(--muted); font-size: 12px; }
.pagination-pages { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: transparent; color: var(--muted); font-size: 12px;
}
.page-btn:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.page-btn[aria-current="page"] { background: var(--panel-2); color: var(--text); border-color: var(--accent-line); }
.page-btn:disabled { opacity: 0.4; }

/* ----------------------------------------------------------- 6. formulários */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.field { display: grid; gap: 6px; min-width: 0; }
.field-label { color: var(--muted); font-size: 12px; font-weight: 550; }
.field-label .req { color: var(--bad); margin-left: 3px; }
.field-hint { color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.field-error { color: var(--bad); font-size: 12px; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"],
input[type="email"], input[type="date"], input[type="file"], select, textarea {
  width: 100%; min-width: 0; max-width: 100%;
  padding: 10px 12px;
  background: var(--input); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  outline: none;
}
textarea { line-height: 1.5; resize: vertical; min-height: 74px; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 16%, transparent);
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: color-mix(in srgb, var(--bad) 60%, var(--line));
}
input::placeholder, textarea::placeholder { color: #6f6a5f; opacity: 1; }
input[type="file"] { padding: 8px; font-size: 12px; }
input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--raised); color: var(--text); font: inherit; font-size: 12px;
}
select { appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 17px) calc(50% + 1px), calc(100% - 12px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--gold); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.input-group { display: flex; gap: 8px; align-items: center; }
.input-group input { flex: 1 1 auto; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 18px; cursor: pointer; min-height: 44px; }
.switch-text { display: grid; gap: 3px; min-width: 0; }
.switch-text b { font-size: 13.5px; font-weight: 600; }
.switch-text span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.switch-control { position: relative; display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; min-height: 44px; }
.switch-control input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track {
  width: 44px; height: 25px; padding: 3px; border-radius: 999px;
  background: #4a4a55; display: inline-flex; box-sizing: border-box; flex: 0 0 auto;
  transition: background 0.15s ease;
}
.switch-track > span { width: 19px; height: 19px; border-radius: 50%; background: #f7f3ea; transition: transform 0.15s ease; }
.switch-control input:checked + .switch-track { background: #2f7f5b; justify-content: flex-end; }
.switch-control input:checked + .switch-track > span { transform: translateX(19px); }
.switch-control input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 3px; }
.switch-state { min-width: 82px; font-size: 12.5px; font-weight: 600; }
.switch-state .on { display: none; color: var(--ok); }
.switch-state .off { color: var(--muted); }
.switch-control input:checked ~ .switch-state .on { display: inline; }
.switch-control input:checked ~ .switch-state .off { display: none; }

/* -------------------------------------------------------------- 7. overlays */
dialog.s360-dialog {
  width: min(720px, calc(100vw - 40px));
  max-height: min(88vh, 900px);
  padding: 0; margin: auto;
  border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.s360-dialog[open] { display: flex; flex-direction: column; }
dialog.s360-dialog::backdrop { background: rgba(3, 3, 5, 0.74); }
dialog.s360-dialog--sm { width: min(460px, calc(100vw - 32px)); }
dialog.s360-dialog--lg { width: min(940px, calc(100vw - 40px)); }
dialog.s360-dialog--xl { width: min(1180px, calc(100vw - 40px)); }
dialog.s360-dialog--drawer {
  width: min(680px, 100vw);
  height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; border-radius: 16px 0 0 16px;
  border-right: 0;
}
.dialog-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.dialog-head-text { min-width: 0; display: grid; gap: 4px; }
.dialog-title { font-size: 17px; }
.dialog-desc { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.dialog-body { padding: 18px 20px; overflow: auto; min-height: 0; display: grid; gap: 16px; }
.dialog-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg-2);
}
.dialog-foot .spacer { flex: 1 1 auto; }

.toasts {
  position: fixed; right: 22px; bottom: 22px; z-index: var(--z-toast);
  display: grid; gap: 10px; width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--raised); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); font-size: 13px; line-height: 1.45;
  animation: toast-in 0.16s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast[data-tone="ok"] { border-color: color-mix(in srgb, var(--ok) 42%, transparent); }
.toast[data-tone="warn"] { border-color: color-mix(in srgb, var(--warn) 42%, transparent); }
.toast[data-tone="bad"] { border-color: color-mix(in srgb, var(--bad) 46%, transparent); }
.toast[data-tone="gold"] { border-color: var(--accent-line); }
.toast-body { min-width: 0; display: grid; gap: 3px; }
.toast-title { font-weight: 650; font-size: 13px; }
.toast[data-tone="ok"] .toast-title { color: var(--ok); }
.toast[data-tone="warn"] .toast-title { color: var(--warn); }
.toast[data-tone="bad"] .toast-title { color: var(--bad); }
.toast[data-tone="gold"] .toast-title { color: var(--gold); }
.toast-msg { color: var(--muted); overflow-wrap: anywhere; }
.toast-close { margin-left: auto; border: 0; background: transparent; color: var(--faint); font-size: 16px; line-height: 1; padding: 2px 4px; }
.toast-close:hover { color: var(--text); }

/* --------------------------------------------------------------- 8. estados */
.empty-state, .error-state, .loading-state {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 44px 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--panel); color: var(--muted);
}
.state-mark {
  display: grid; place-items: center; width: 54px; height: 54px;
  border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--panel-2); color: var(--gold);
}
.state-title { font-family: var(--display); font-size: 17px; color: var(--text); }
.state-msg { font-size: 13px; max-width: 62ch; line-height: 1.55; }
.error-state { border-style: solid; border-color: color-mix(in srgb, var(--bad) 34%, var(--line)); }
.error-state .state-mark { color: var(--bad); }

.skeleton { display: grid; gap: 10px; }
.sk-line, .sk-block {
  display: block; border-radius: 7px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--raised) 37%, var(--panel-2) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
}
.sk-line { height: 11px; }
.sk-block { height: 74px; border-radius: var(--radius-sm); }
.sk-card { height: 96px; border-radius: var(--radius); }
@keyframes sk { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sk-line--sm { width: 40%; }
.sk-line--md { width: 68%; }

/* --------------------------------------------------------------- 9. páginas */
/* login */
.login-screen {
  min-height: 100%; display: grid; place-items: center; padding: 32px 20px;
  background:
    radial-gradient(1000px 460px at 50% -12%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 68%),
    var(--bg);
  overflow-y: auto;
}
.login-card {
  width: min(430px, 100%); padding: 26px 26px 22px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  display: grid; gap: 18px;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand img { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); }
.login-brand h1 { font-size: 19px; }
.login-brand small { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.login-foot { color: var(--faint); font-size: 11.5px; line-height: 1.5; text-align: center; }

/* painel */
.expiring-list { display: grid; gap: 8px; }
.expiring-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--warn) 26%, var(--line));
  border-radius: var(--radius-xs); background: color-mix(in srgb, var(--warn) 5%, var(--panel));
  font-size: 12.5px;
}
.mini-list { display: grid; gap: 2px; }
.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row .mini-main { min-width: 0; display: grid; gap: 2px; }
.mini-row .mini-main b { font-size: 13px; font-weight: 600; }
.mini-row .mini-main span { color: var(--faint); font-size: 11.5px; }

/* releases */
.release-list { display: grid; gap: 14px; }
.release-card { padding: 16px 18px; display: grid; gap: 12px; }
.release-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.release-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.release-title h3 { font-size: 19px; letter-spacing: -0.03em; }
.release-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--faint); font-size: 12px; }
.release-notes {
  margin: 0; padding: 11px 13px; background: var(--input);
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  color: var(--muted); font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 190px; overflow: auto;
}
.artifact-list { display: grid; gap: 8px; }
.artifact {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: var(--panel-2);
}
.artifact-main { min-width: 0; display: grid; gap: 3px; }
.artifact-main b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.artifact-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--faint); font-size: 11.5px; }
.artifact-actions { display: flex; align-items: center; gap: 8px; }

/* chaves — resultado da geração */
.key-result-list {
  display: grid; gap: 6px; max-height: 320px; overflow: auto;
  padding: 10px; background: var(--input);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.key-result-item {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 6px 8px; border-radius: var(--radius-xs); background: var(--panel-2);
}
.key-result-item .key-code { font-size: 12.5px; }

/* auditoria */
.log-detail summary {
  cursor: pointer; color: var(--gold); font-size: 12px; list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.log-detail summary::-webkit-details-marker { display: none; }
.log-detail[open] summary { margin-bottom: 8px; }
.log-json {
  margin: 0; padding: 10px 12px; max-height: 280px; overflow: auto;
  background: var(--input); border: 1px solid var(--line); border-radius: var(--radius-xs);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted);
}
.actor { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.actor::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  display: inline-block; background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

/* detalhe da chave */
.drawer-summary {
  display: grid; gap: 10px; padding: 14px 16px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.activation-list { display: grid; gap: 10px; }
.activation {
  display: grid; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
}
.activation-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.history-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.history-item {
  display: grid; gap: 3px; padding: 9px 11px;
  border-left: 2px solid var(--line-strong); background: var(--panel-2);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}
.history-item b { font-size: 12.5px; }
.history-item span { color: var(--faint); font-size: 11.5px; }

/* ------------------------------------------------------------ 10. responsivo */
@media (max-width: 1400px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .split, .split--even { grid-template-columns: 1fr; }
  .form-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skeleton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  :root { --sidebar: 236px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    display: none; position: fixed; inset: 0 auto 0 0; z-index: var(--z-shade);
    width: min(280px, 88vw); box-shadow: var(--shadow);
  }
  .app.is-menu-open .sidebar { display: flex; }
  .nav-shade:not([hidden]) {
    display: block; position: fixed; inset: 0; width: 100%; height: 100%;
    border: 0; padding: 0; background: rgba(3, 3, 5, 0.68); z-index: calc(var(--z-shade) - 1);
  }
  .menu-toggle, .sidebar-close { display: inline-grid; }
  .sidebar-close { position: absolute; top: 14px; right: 12px; }
  .brand { padding-right: 40px; }
  .stat-grid, .stat-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  dialog.s360-dialog--drawer { width: min(560px, 100vw); }
}
@media (max-width: 720px) {
  .topbar { padding: 0 14px; height: 62px; flex-basis: 62px; gap: 10px; }
  .content { padding: 16px 14px 40px; }
  .stat-grid, .stat-grid--3, .skeleton-grid { grid-template-columns: 1fr; }
  .top-meta .clock, .identity { display: none; }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv dt { margin-top: 6px; }
  .page-head h2 { font-size: 20px; }
}
@media (min-width: 1700px) { .content { padding-inline: 34px; } }

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

/* ------------------------------------------------- 11. utilitários de composição
   Usados no lugar de style inline, que a CSP restritiva da SPA não autoriza. */
.gap-2 { gap: 2px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.mt-10 { margin-top: 10px; }
.min-w-0 { min-width: 0; }
.fs-sm { font-size: 11.5px; }
.cell-ua { max-width: 420px; }
.select-auto { width: auto; }
.offscreen { position: fixed; top: -1000px; left: -1000px; opacity: 0; pointer-events: none; }