/* ── yaraapi console — dark cyberpunk / command-center theme ────────────── */

:root {
  --bg:         #090d16;
  --bg-alt:     #0f172a;
  --panel:      #1e293b;
  --panel-alt:  #17212f;
  --border:     #334155;
  --border-soft: #24314599;
  --text:       #f8fafc;
  --muted:      #94a3b8;
  --muted-dim:  #64748b;

  --purple:      #a855f7;
  --purple-dim:  rgba(168, 85, 247, .14);
  --purple-line: rgba(168, 85, 247, .4);

  --cyan:        #06b6d4;
  --cyan-dim:    rgba(6, 182, 212, .14);
  --cyan-line:   rgba(6, 182, 212, .45);

  --red:         #ef4444;
  --red-dim:     rgba(239, 68, 68, .14);
  --red-line:    rgba(239, 68, 68, .45);

  --amber:       #f59e0b;
  --amber-dim:   rgba(245, 158, 11, .14);
  --amber-line:  rgba(245, 158, 11, .4);

  --green:       #22c55e;
  --green-dim:   rgba(34, 197, 94, .14);
  --green-line:  rgba(34, 197, 94, .4);

  --radius: 10px;
  --radius-sm: 6px;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(168, 85, 247, .08), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(6, 182, 212, .06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

code, .mono { font-family: var(--font-mono); font-size: .92em; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Shell layout: sidebar + topbar + content ─────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--bg-alt);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 1.1rem .9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: .65rem; padding: .4rem .3rem 1.3rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-family: var(--font-mono); color: var(--bg);
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  box-shadow: 0 0 18px rgba(6, 182, 212, .35);
}
.brand-name { font-weight: 700; letter-spacing: .02em; font-size: .95rem; }
.brand-version { color: var(--muted-dim); font-size: .7rem; font-family: var(--font-mono); }

.nav { display: flex; flex-direction: column; gap: .15rem; margin-top: .2rem; }
.nav-section-label {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  color: var(--muted-dim); padding: .9rem .7rem .25rem;
}
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border-radius: var(--radius-sm);
  color: var(--muted); font-size: .85rem; font-weight: 500;
  border: 1px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav-item.active {
  color: var(--cyan); background: var(--cyan-dim); border-color: var(--cyan-line);
}
.nav-spacer-block { flex: 1; }
.nav-foot { margin-top: auto; padding: .6rem .3rem; color: var(--muted-dim); font-size: .7rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.6rem; border-bottom: 1px solid var(--border-soft);
  background: rgba(15, 23, 42, .5); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-weight: 700; font-size: 1rem; letter-spacing: .01em; }
.topbar-right { display: flex; align-items: center; gap: .9rem; }
.user-chip {
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; color: var(--muted);
}
.tag-admin {
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .1rem .45rem; border-radius: 999px;
  color: var(--purple); background: var(--purple-dim); border: 1px solid var(--purple-line);
}
.logout-form button {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: .4rem .8rem; border-radius: var(--radius-sm); cursor: pointer; font-size: .8rem;
}
.logout-form button:hover { border-color: var(--red-line); color: var(--red); }

.content { padding: 1.6rem; max-width: 1180px; width: 100%; margin: 0 auto; }
.content-bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* ── Page heading ──────────────────────────────────────────────────────── */

.page-head { margin-bottom: 1.3rem; }
.page-head h1 { margin: 0 0 .25rem; font-size: 1.3rem; font-weight: 700; }
.page-head p { margin: 0; color: var(--muted); font-size: .85rem; }

/* ── Cards ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}
.card-title {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 .9rem;
}

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.metric-card {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; position: relative; overflow: hidden;
}
.metric-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
}
.metric-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-size: 1.7rem; font-weight: 700; font-family: var(--font-mono); margin-top: .35rem; }
.metric-value.ok { color: var(--green); }
.metric-value.warn { color: var(--amber); }
.metric-value.bad { color: var(--red); }

/* ── Badges (pill status) ──────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .22em .72em; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-clean      { color: var(--green); background: var(--green-dim); border-color: var(--green-line); }
.badge-malware    { color: var(--red);   background: var(--red-dim);   border-color: var(--red-line);   box-shadow: 0 0 14px rgba(239,68,68,.18); }
.badge-suspicious { color: var(--amber); background: var(--amber-dim); border-color: var(--amber-line); }
.badge-info       { color: var(--cyan);  background: var(--cyan-dim);  border-color: var(--cyan-line); }
.badge-neutral    { color: var(--muted); background: rgba(148,163,184,.08); border-color: var(--border); }

/* ── Result verdict header + risk factors table ───────────────────────── */
/* Shared across mail/sandbox/pdf/office results — parses the same
   risk/risk_score/summary/alert/risk_factors/ttps shape every scoring
   module returns, instead of leaving the analyst to read it out of the
   raw JSON block. */

.verdict { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .3rem; }
.verdict-score { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 800; line-height: 1; }
.verdict-score-max { font-size: .95rem; color: var(--muted-dim); font-weight: 500; }
.verdict-summary { color: var(--muted); font-size: .85rem; }

.alert-reasons { margin: .35rem 0 0; padding-left: 1.1rem; }
.alert-reasons li { margin-bottom: .15rem; }

.score-pill {
  display: inline-block; padding: .12em .6em; border-radius: 999px;
  font-family: var(--font-mono); font-weight: 700; font-size: .78rem; white-space: nowrap;
}
.score-pill.s-high   { background: var(--red-dim);   color: var(--red); }
.score-pill.s-medium { background: var(--amber-dim); color: var(--amber); }
.score-pill.s-low    { background: var(--cyan-dim);  color: var(--cyan); }

.indicator-cell { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { text-align: left; padding: .65rem .85rem; border-bottom: 1px solid var(--border-soft); }
/* A <details class="raw-json"> (with its <pre>, which doesn't wrap) inside a
   table cell would otherwise force the browser's auto table-layout to size
   that column — and the whole table — to the JSON's unwrapped width,
   distorting every other column the moment it's expanded. max-width: 0 opts
   this cell out of that sizing pass; the row's real width comes from the
   other cells, and the <pre>'s own overflow:auto still scrolls internally. */
td:has(> details.raw-json) { max-width: 0; }
thead th {
  color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  background: var(--panel-alt); font-weight: 600;
}
tbody tr { transition: background .1s; }
tbody tr:hover { background: rgba(6, 182, 212, .05); }
tbody tr:last-child td { border-bottom: none; }
table.kv th { width: 240px; color: var(--muted); font-weight: 500; background: none; text-transform: none; letter-spacing: 0; }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.form-grid { display: flex; flex-direction: column; gap: .85rem; max-width: 480px; }
.form-row { display: flex; gap: .85rem; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: .35rem; color: var(--muted); font-size: .8rem; }
label.checkbox { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }

input[type=text], input[type=password], input[type=number], input[type=url], textarea, select {
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text);
  padding: .55rem .7rem; border-radius: var(--radius-sm); font-family: inherit; font-size: .88rem;
  outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-dim);
}
textarea { resize: vertical; font-family: var(--font-mono); }

fieldset { border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 1rem; margin: 0; }
legend { color: var(--muted); padding: 0 .5rem; font-size: .8rem; }

/* Mode selector (tabs) + the panel matching the checked tab — replaces
   stacking every input source (fichero/URL/texto/guardado) always visible
   at once regardless of which was actually picked. Pure CSS (:has()), no
   JS: the tabs are just radios styled as a segmented control; :has() on
   the form shows only the one panel whose data-mode matches the checked
   radio's value. Add a new mode by adding one more :has() line below and
   a matching value="…"/data-mode="…" pair in the markup. */
.mode-tabs {
  display: flex; flex-wrap: wrap; gap: .2rem;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 1.1rem;
}
.mode-tab { position: relative; }
.mode-tab input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.mode-tab span {
  display: inline-block; padding: .55rem .9rem; margin-bottom: -1px;
  font-size: .82rem; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.mode-tab:hover span { color: var(--text); background: var(--panel-alt); }
.mode-tab input:checked ~ span { color: var(--cyan); border-color: var(--cyan); }
.mode-tab input:focus-visible ~ span { outline: 2px solid var(--cyan-line); outline-offset: -2px; }

.mode-panel { display: none; }
form:has(input[name="mode"][value="file"]:checked)   .mode-panel[data-mode="file"],
form:has(input[name="mode"][value="url"]:checked)    .mode-panel[data-mode="url"],
form:has(input[name="mode"][value="stored"]:checked) .mode-panel[data-mode="stored"],
form:has(input[name="mode"][value="text"]:checked)   .mode-panel[data-mode="text"],
form:has(input[name="mode"][value="hash"]:checked)   .mode-panel[data-mode="hash"],
form:has(input[name="mode"][value="search"]:checked) .mode-panel[data-mode="search"] {
  display: block;
}

/* Page-level section tabs — same :has() trick as .mode-tabs above, but for
   whole unrelated blocks that used to be stacked one under another on a
   page (e.g. Office's "Analizar" + "Desbloquear" forms, or Mail's "Casos
   guardados" sitting above the upload form) instead of one form's own
   input-source panels. `.view-tabs-wrap` is the scoping ancestor — reuses
   the .mode-tab/.mode-tabs look for the tab bar itself, only the
   panel-visibility rule is new. Add a new page by adding one more value to
   the list below (values are just UI hooks, no backend meaning, so they're
   reused freely across pages — :has() always scopes to its own ancestor). */
.view-panel { display: none; }
.view-tabs-wrap:has(input[name="view"][value="analyze"]:checked)     .view-panel[data-view="analyze"],
.view-tabs-wrap:has(input[name="view"][value="unlock"]:checked)      .view-panel[data-view="unlock"],
.view-tabs-wrap:has(input[name="view"][value="cases"]:checked)       .view-panel[data-view="cases"],
.view-tabs-wrap:has(input[name="view"][value="rules"]:checked)       .view-panel[data-view="rules"],
.view-tabs-wrap:has(input[name="view"][value="active"]:checked)      .view-panel[data-view="active"],
.view-tabs-wrap:has(input[name="view"][value="suggestions"]:checked) .view-panel[data-view="suggestions"],
.view-tabs-wrap:has(input[name="view"][value="manual"]:checked)      .view-panel[data-view="manual"],
.view-tabs-wrap:has(input[name="view"][value="search"]:checked)      .view-panel[data-view="search"],
.view-tabs-wrap:has(input[name="view"][value="correlations"]:checked) .view-panel[data-view="correlations"],
.view-tabs-wrap:has(input[name="view"][value="maintenance"]:checked) .view-panel[data-view="maintenance"],
.view-tabs-wrap:has(input[name="view"][value="list"]:checked)        .view-panel[data-view="list"],
.view-tabs-wrap:has(input[name="view"][value="create"]:checked)      .view-panel[data-view="create"],
.view-tabs-wrap:has(input[name="view"][value="js"]:checked)          .view-panel[data-view="js"],
.view-tabs-wrap:has(input[name="view"][value="base64"]:checked)      .view-panel[data-view="base64"] {
  display: block;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

button, .btn {
  display: inline-block;
  background: var(--cyan); color: #04222a; border: none; font-weight: 700; font-size: .85rem;
  padding: .58rem 1.1rem; border-radius: var(--radius-sm); cursor: pointer;
  transition: filter .12s, transform .05s, box-shadow .12s; align-self: flex-start;
  box-shadow: 0 0 0 rgba(6, 182, 212, 0);
}
button:hover, .btn:hover { filter: brightness(1.12); box-shadow: 0 0 16px rgba(6, 182, 212, .35); }
button:active, .btn:active { transform: translateY(1px); box-shadow: none; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.secondary:hover { border-color: var(--cyan-line); color: var(--cyan); box-shadow: 0 0 14px rgba(6, 182, 212, .18); }
button.danger { background: var(--red); color: #2a0808; }
button.danger:hover { box-shadow: 0 0 16px rgba(239, 68, 68, .4); }
/* label.ghost: the same look also used for a <label> acting as a button
   trigger (modal openers, confirm-before-destroy toggles below) — without
   this, a trigger label falls back to plain flex/muted text instead of
   looking clickable. */
button.ghost, label.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: .35rem .7rem; font-size: .76rem; box-shadow: none; display: inline-block; cursor: pointer; }
button.ghost:hover, label.ghost:hover { color: var(--text); border-color: var(--muted); box-shadow: none; }

/* Feedback while a form (typically a file upload) is submitting — see
   static/js/copy.js::initFormLoadingFeedback(). Without this, a slow
   multi-file upload with no visible change looks like it silently failed. */
button.btn-loading, button.btn-loading:hover {
  cursor: wait; filter: none; box-shadow: none;
  animation: btn-loading-pulse 1.1s ease-in-out infinite;
}
@keyframes btn-loading-pulse { 0%, 100% { opacity: .6; } 50% { opacity: .95; } }

.inline-form { display: inline-block; margin: 0 .3rem 0 0; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Dropzone (base look is pure CSS; the "you picked this file" text
   below needs the tiny JS in copy.js::initDropzoneFeedback — a native
   <input type=file> gives no other way to surface what was selected) ── */

.dropzone {
  position: relative;
  border: 2px dashed var(--cyan-line);
  border-radius: var(--radius);
  background: var(--panel-alt);
  padding: 2.4rem 1.5rem;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--cyan); background: var(--cyan-dim); }
.dropzone input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.dropzone-icon {
  width: 46px; height: 46px; margin: 0 auto .8rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--cyan-dim); border: 1px solid var(--cyan-line);
  color: var(--cyan); font-size: 1.3rem; font-weight: 700;
}
.dropzone-title { font-weight: 700; margin-bottom: .25rem; }
.dropzone-hint { color: var(--muted); font-size: .78rem; }
.dropzone-filename {
  margin-top: .9rem; padding: .4rem .8rem; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: .78rem; font-weight: 700;
  color: var(--green); background: var(--green-dim); border: 1px solid var(--green-line);
  display: inline-block; word-break: break-all;
}
.dropzone.has-file { border-style: solid; border-color: var(--green-line); background: var(--green-dim); }

/* Collapsible "upload" card — once there's a result, the form that produced
   it is no longer what the analyst needs to see; open by default only when
   there's nothing to show yet (see templates: {{ 'open' if not result }}). */
details.form-toggle > summary {
  cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--text);
  padding: .3rem 0; margin-bottom: .9rem; list-style: none;
}
details.form-toggle > summary::-webkit-details-marker { display: none; }
details.form-toggle > summary::before { content: "▸ "; color: var(--cyan); }
details.form-toggle[open] > summary::before { content: "▾ "; }

/* ── Alerts / messages ─────────────────────────────────────────────────── */

.alert {
  padding: .75rem 1rem; border-radius: var(--radius-sm); border: 1px solid; font-size: .85rem;
  margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
}
.alert-error   { color: var(--red);   background: var(--red-dim);   border-color: var(--red-line); }
.alert-warn    { color: var(--amber); background: var(--amber-dim); border-color: var(--amber-line); }
.alert-ok      { color: var(--green); background: var(--green-dim); border-color: var(--green-line); }
.alert-info    { color: var(--cyan);  background: var(--cyan-dim);  border-color: var(--cyan-line); }

/* ── Result / raw JSON panel ──────────────────────────────────────────── */

details.raw-json { margin-top: .8rem; }
details.raw-json summary {
  cursor: pointer; color: var(--muted); font-size: .8rem; padding: .3rem 0;
  user-select: none;
}
details.raw-json summary:hover { color: var(--cyan); }
details.raw-json[open] summary { margin-bottom: .4rem; }
.copy-btn {
  margin-left: .6rem; padding: .15rem .55rem; font-size: .68rem; font-weight: 600;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: none; vertical-align: middle;
}
.copy-btn:hover { color: var(--cyan); border-color: var(--cyan-line); box-shadow: none; }

.risk-bar {
  display: flex; width: 100%; height: 22px; border-radius: 999px; overflow: hidden;
  background: var(--bg-alt); border: 1px solid var(--border-soft);
}
.risk-bar-segment { height: 100%; transition: width .2s; }
.risk-bar-segment.critical { background: var(--red); }
.risk-bar-segment.high     { background: var(--amber); }
.risk-bar-segment.medium   { background: var(--cyan); }
.risk-bar-segment.low      { background: var(--green); }
.risk-bar-legend { display: flex; gap: 1.1rem; margin-top: .55rem; font-size: .74rem; color: var(--muted); flex-wrap: wrap; }
.risk-bar-legend span::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: .4rem; vertical-align: middle;
}
.risk-bar-legend .critical::before { background: var(--red); }
.risk-bar-legend .high::before     { background: var(--amber); }
.risk-bar-legend .medium::before   { background: var(--cyan); }
.risk-bar-legend .low::before      { background: var(--green); }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font-family: var(--font-mono); font-size: .74rem; padding: .2rem .55rem;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; color: var(--text);
}
.finding-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.finding-list li {
  padding: .55rem .75rem; border-radius: var(--radius-sm); border: 1px solid var(--border-soft);
  background: var(--panel-alt); font-size: .84rem;
}

pre.result {
  background: var(--bg-alt); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1rem; overflow: auto; max-height: 560px; font-family: var(--font-mono); font-size: .8rem;
  color: #cbd5e1;
}

.mail-preview-frame {
  width: 100%; height: 480px; border: 1px solid var(--border-soft); border-radius: var(--radius);
  background: #fff; /* most email HTML assumes a white page background with dark text */
}

/* ── Login page ────────────────────────────────────────────────────────── */

.login-box {
  width: 340px; padding: 2.2rem;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  box-shadow: 0 0 60px rgba(168, 85, 247, .08);
}
.login-brand { display: flex; align-items: center; gap: .7rem; justify-content: center; margin-bottom: 1.6rem; }
.login-brand .brand-mark { width: 42px; height: 42px; font-size: 1.1rem; }
.login-brand-text { text-align: left; }
.login-brand-text strong { display: block; font-size: 1.05rem; }
.login-brand-text span { color: var(--muted-dim); font-size: .72rem; font-family: var(--font-mono); }
.login-box form { display: flex; flex-direction: column; gap: .9rem; }
.login-box button { align-self: stretch; text-align: center; }

/* ── Modal (pure CSS checkbox toggle, no JS) ──────────────────────────── */

.modal-toggle { display: none; }
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(2, 6, 16, .7);
  align-items: center; justify-content: center; z-index: 50; backdrop-filter: blur(2px);
}
.modal-toggle:checked ~ .modal-backdrop { display: flex; }
.modal-box {
  width: 420px; max-width: calc(100vw - 2rem);
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; font-size: 1rem; }
.modal-close { color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-open-btn { display: inline-block; }

/* Keyboard focus ring for label-as-button triggers (modal open/close, confirm
   toggles) — tabIndex is added by copy.js::initLabelTriggers(), this just
   makes that focus visible. */
label.ghost:focus-visible, .modal-open-btn:focus-visible, .modal-close:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px;
}

/* ── Confirm-before-destroy (pure CSS checkbox toggle, same trick as the
   modal above) — a destructive action shows a plain button first; checking
   the hidden toggle swaps it for the real "yes, do it" button + a way to
   back out, so a misclick can't fire a delete/purge/revoke directly. ──── */

.confirm-toggle { display: none; }
.confirm-actions { display: none; align-items: center; gap: .4rem; }
.confirm-toggle:checked ~ .confirm-label { display: none; }
.confirm-toggle:checked ~ .confirm-actions { display: inline-flex; }

/* ── Misc utility ──────────────────────────────────────────────────────── */

.muted { color: var(--muted); }
.mt-1 { margin-top: 1rem; }
.section-title { font-size: .95rem; font-weight: 700; margin: 1.8rem 0 .8rem; }
