/* ============================================================
   OSINT Admin — Terminal Theme
   Fonts: JetBrains Mono + Inter (self-hosted woff2)
   Themes: [data-theme="light"] (default) | [data-theme="dark"]
   ============================================================ */


/* === SPACING SCALE — theme-invariant, always in :root, NEVER in [data-theme] === */
:root {
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* ── @font-face ──────────────────────────────────────────── */
@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:400 700; font-display:swap; src:url('/admin/static/fonts/JetBrainsMono-cyrext.woff2') format('woff2'); unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:400 700; font-display:swap; src:url('/admin/static/fonts/JetBrainsMono-cyr.woff2') format('woff2'); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:400 700; font-display:swap; src:url('/admin/static/fonts/JetBrainsMono-latinext.woff2') format('woff2'); unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:400 700; font-display:swap; src:url('/admin/static/fonts/JetBrainsMono-latin.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

@font-face { font-family:'Inter'; font-style:normal; font-weight:300 600; font-display:swap; src:url('/admin/static/fonts/Inter-cyrext.woff2') format('woff2'); unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:300 600; font-display:swap; src:url('/admin/static/fonts/Inter-cyr.woff2') format('woff2'); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:300 600; font-display:swap; src:url('/admin/static/fonts/Inter-latinext.woff2') format('woff2'); unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:300 600; font-display:swap; src:url('/admin/static/fonts/Inter-latin.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ── CSS Variables — Light (default) ─────────────────────── */
[data-theme="light"] {
  --bg:        #EEF1F8;
  --white:     #FFFFFF;
  --surface2:  #F5F7FC;
  --sidebar:   #1B2234;
  --sidebar2:  #242C42;
  --sbar3:     #2E384F;
  --border:    #D5DAEA;
  --border-d:  #2E384F;
  --accent:    #009E80;
  --accent-l:  #E6F7F4;
  --accent-b:  #B3E8DF;
  --red:       #CF2D2D;
  --red-l:     #FDF1F1;
  --amber:     #B45C00;
  --amber-l:   #FEF6EC;
  --blue:      #1E5FCF;
  --blue-l:    #EBF2FE;
  --text:      #1E2540;
  --text-2:    #4E5A7A;
  --text-3:    #8E9AB8;
  --s-text:    #C8D0E4;
  --s-dim:     #566180;
}

/* ── CSS Variables — Dark ────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #080C14;
  --white:     #0D1117;
  --surface2:  #111827;
  --sidebar:   #0D1117;
  --sidebar2:  #161D2E;
  --sbar3:     #1E2A40;
  --border:    #1E2A40;
  --border-d:  #1E2A40;
  --accent:    #00D4AA;
  --accent-l:  rgba(0,212,170,.12);
  --accent-b:  rgba(0,212,170,.25);
  --red:       #FF4560;
  --red-l:     rgba(255,69,96,.12);
  --amber:     #FFB340;
  --amber-l:   rgba(255,179,64,.12);
  --blue:      #4D9EFF;
  --blue-l:    rgba(77,158,255,.12);
  --text:      #CDD5E0;
  --text-2:    #7889A0;
  --text-3:    #5C7080;
  --s-text:    #C8D0E4;
  --s-dim:     #566180;
}

/* ── Reset + Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
abbr[title] { cursor: help; text-decoration: underline dotted var(--text-3); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

code, pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-l);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

/* ── Layout ──────────────────────────────────────────────── */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 220px; min-width: 220px;
  background: var(--sidebar);
  display: flex; flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--border-d);
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 20px 18px var(--space-md);
  border-bottom: 1px solid var(--border-d);
  display: flex; align-items: center; gap: 10px;
}
.logo-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 15px; height: 15px; color: #fff; }
.logo-text  { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; color: #fff; letter-spacing: .08em; }
.logo-sub   { font-size: 10px; color: var(--s-dim); font-family: 'JetBrains Mono', monospace; letter-spacing: .04em; margin-top: 2px; }

.s-group {
  font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--s-dim); padding: 14px 18px 5px;
  font-family: 'JetBrains Mono', monospace;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: var(--space-sm) 18px; text-decoration: none;
  font-size: 12.5px; color: var(--s-dim);
  border-left: 2px solid transparent;
  transition: all 140ms;
}
.nav-item:hover  { background: var(--sidebar2); color: var(--s-text); border-left-color: var(--sbar3); text-decoration: none; }
.nav-item.active { background: rgba(0,158,128,.1); color: var(--accent); border-left-color: var(--accent); }
.nav-item svg    { width: 14px; height: 14px; flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: var(--radius-xs);
  background: rgba(207,45,45,.2); color: #F87171;
}
.nav-badge.ok { background: rgba(0,158,128,.15); color: var(--accent); }

.sidebar-bottom {
  margin-top: auto; border-top: 1px solid var(--border-d); padding: 14px 18px;
}
.user-row  { display: flex; align-items: center; gap: 9px; }
.user-avatar {
  width: 28px; height: 28px; border-radius: var(--radius-xs);
  background: var(--sbar3); border: 1px solid var(--border-d);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--s-text);
  font-family: 'JetBrains Mono', monospace; flex-shrink: 0;
}
.user-name  { font-size: 12px; font-weight: 500; color: var(--s-text); }
.user-role  { font-size: 10px; color: var(--s-dim); font-family: 'JetBrains Mono', monospace; }
.online-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: auto; flex-shrink: 0; }

/* Theme toggle button in sidebar bottom */
.theme-toggle-btn {
  background: none; border: none; cursor: pointer;
  color: var(--s-dim); font-size: 16px; padding: 0;
  margin-left: auto; line-height: 1; opacity: .7;
}
.theme-toggle-btn:hover { opacity: 1; color: var(--s-text); }

/* Language switcher row */
.sidebar-lang-row { display: flex; align-items: center; margin-bottom: 6px; }
.lang-btn {
  background: none; border: 1px solid var(--border-d); border-radius: var(--radius-xs);
  color: var(--s-dim); font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700; padding: 2px 7px; cursor: pointer;
  letter-spacing: .05em; transition: color .15s, border-color .15s;
}
.lang-btn:hover { color: var(--s-text); border-color: var(--accent); }

/* Logout link in sidebar */
.sidebar-logout {
  width: 100%; justify-content: center;
  margin-top: 10px; font-size: 11px;
}

/* ── Main area ───────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  height: 50px; background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 var(--space-lg); gap: 14px; flex-shrink: 0;
}
.tb-crumb       { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-3); }
.tb-crumb strong { color: var(--text-2); font-weight: 500; }
.topbar-spacer  { flex: 1; }
.tb-chip {
  display: flex; align-items: center; gap: 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius-xs);
  background: var(--accent-l); color: var(--accent); border: 1px solid var(--accent-b);
}
.chip-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.content { flex: 1; overflow-y: auto; padding: var(--space-lg); }

/* ── Page header ─────────────────────────────────────────── */
.pg-hd   { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.pg-title { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; color: var(--text); }
h1.pg-title, h2.pg-title { margin: 0; font-size: 18px; line-height: 1.3; }
.pg-sub   { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.hd-actions { display: flex; gap: var(--space-sm); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  padding: 7px 14px; border-radius: var(--radius-xs); font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent; transition: all 130ms;
  font-family: 'Inter', sans-serif; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost   { background: var(--white); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); }
.btn-danger  { background: var(--red-l); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

/* Native button / input[type=submit normalization */
button, input[type="submit"] {
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500;
  padding: 7px 14px; border-radius: var(--radius-xs);
  cursor: pointer; border: 1px solid var(--border);
  background: var(--white); color: var(--text-2);
  transition: all 130ms; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, input[type="submit"]:hover { border-color: var(--text-3); color: var(--text); }
button[type="submit"], input[type="submit"] { background: var(--accent); color: #fff; border-color: var(--accent); }
button[type="submit"]:hover { filter: brightness(1.1); }
button.btn-danger { background: var(--red-l); color: var(--red); border-color: var(--red); }
button.btn-danger:hover { background: var(--red); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-2); margin-bottom: 6px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 7px 10px; border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--white); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 13px;
  transition: border-color 130ms; display: block;
  margin-top: var(--space-xs);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-l);
}
input[type="radio"], input[type="checkbox"] { width: auto; display: inline; }
input[type="file"] { padding: 5px var(--space-sm); cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }
.code-textarea { font-family: 'JetBrains Mono', monospace; width: 100%; }
/* Compact TOTP input — inline, same visual height as status pills */
.totp-input-sm {
  width: 7rem;
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  margin-top: 0;
  height: 26px;
  font-size: 13px;
  letter-spacing: .1em;
  vertical-align: middle;
}
select { appearance: auto; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 12px 14px; }
legend   { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 0 6px; }
small { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* Form groups */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--space-sm) var(--space-md); margin-bottom: .75rem; }
.form-row  { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.form-row-end { display: flex; align-items: flex-end; gap: .75rem; margin-top: .75rem; }
.form-row-end button[type="submit"] { margin-top: 0; flex-shrink: 0; }
.form-actions { display: flex; gap: var(--space-sm); }
.totp-input { width: 7rem !important; }

/* Error / success alert inside forms */
.form-error { color: var(--red); font-size: 12px; margin-bottom: var(--space-sm); }
.form-success { color: var(--accent); font-size: 12px; margin-bottom: var(--space-sm); }

/* ── Panel (card wrapper) ────────────────────────────────── */
.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden; margin-bottom: var(--space-md); }
.panel-head {
  padding: 12px var(--space-md); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--space-sm); background: var(--surface2);
}
.panel-title { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
h2.panel-title { margin: 0; font-size: 11px; line-height: 1.3; }
.panel-meta  { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-3); margin-left: auto; }
.panel-body  { padding: var(--space-md); }

/* ── Tables ──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
thead th {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); padding: 9px var(--space-md); text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
tbody td { padding: 10px var(--space-md); border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }
/* Key-value vertical tables: explicit value color to match primary text */
.kv-table tbody td { color: var(--text); font-weight: 500; }
th { font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 9px var(--space-md); text-align: left; border-bottom: 1px solid var(--border); background: var(--surface2); }

/* ── Status pills / badges ───────────────────────────────── */
.pill, .status-active, .status-inactive, .status-pending, .status-badge {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: 2px var(--space-sm); border-radius: var(--radius-xs);
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; border: 1px solid;
}
.status-active, .pill-ok    { background: var(--accent-l); color: var(--accent); border-color: var(--accent-b); }
.status-inactive, .pill-err { background: var(--red-l);    color: var(--red);    border-color: #FABFBF; }
.status-pending { background: var(--amber-l); color: var(--amber); border-color: #F9C97C; }
.pending-invite-row td { opacity: 0.85; font-style: italic; }
.pill-warn  { background: var(--amber-l); color: var(--amber); border-color: #F9C97C; }
.pill-idle  { background: var(--surface2); color: var(--text-3); border-color: var(--border); }
.dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* offline_db scan status classes */
.status-badge { font-size: 10px; }
.status-queued { background: var(--amber-l); color: var(--amber); border-color: #F9C97C; }
.status-passed  { background: var(--accent-l); color: var(--accent); border-color: var(--accent-b); }
.status-rejected, .status-error_final { background: var(--red-l); color: var(--red); border-color: #FABFBF; }

/* T-361: offline_db health badges */
.health-ok { background: var(--accent-l); color: var(--accent); border-color: var(--accent-b); }
.health-missing_object, .health-import_failed, .health-empty, .health-too_large {
  background: var(--red-l); color: var(--red); border-color: #FABFBF;
}
.health-importing { background: var(--amber-l); color: var(--amber); border-color: #F9C97C; }
.health-check_failed, .health-unknown { background: var(--surface2); color: var(--text-3); border-color: var(--border); }
.text-xs { font-size: 10px; }

/* ── T-365: source-status table (AML transparency) ───────── */
.status-table-acc { margin-top: var(--space-md); }
.src-status-section { margin-top: var(--space-md); }
.src-status-hd { font-size: 12px; color: var(--text-2); margin: 0 0 var(--space-xs); font-weight: 600; }
.src-status-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.src-status-table th, .src-status-table td {
  text-align: left; padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.src-status-table th { color: var(--text-3); font-weight: 600; font-size: 10px; text-transform: uppercase; }
.src-status-name { font-family: var(--font-mono, monospace); }
.src-status-count { text-align: right; font-variant-numeric: tabular-nums; }
.src-status-badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs);
  font-size: 11px; border: 1px solid transparent; white-space: nowrap;
}
.src-status-badge--found { background: var(--accent-l); color: var(--accent); border-color: var(--accent-b); }
.src-status-badge--clean { background: var(--surface2); color: var(--text-3); border-color: var(--border); }
.src-status-badge--unreachable { background: var(--red-l); color: var(--red); border-color: #FABFBF; font-weight: 600; }
.src-status-badge--skipped { background: var(--surface2); color: var(--text-4, #aaa); border-color: var(--border); opacity: 0.7; }
.tooltip-anchor { position: relative; cursor: help; font-size: 0.85em; color: var(--text-4, #888); vertical-align: middle; }
.tooltip-anchor .tooltip-text { display: none; position: absolute; left: 50%; top: 1.6em; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; white-space: nowrap; font-size: 0.82rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-1); z-index: 200; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.tooltip-anchor:hover .tooltip-text, .tooltip-anchor:focus .tooltip-text { display: block; }

/* ── Alert boxes ─────────────────────────────────────────── */
[role="alert"].alert-success { background: var(--accent-l); color: var(--accent); border: 1px solid var(--accent-b); padding: var(--space-sm) 12px; border-radius: var(--radius-xs); font-size: 12px; margin-bottom: .75rem; }
[role="alert"].alert-error   { background: var(--red-l);    color: var(--red);    border: 1px solid #FABFBF; padding: var(--space-sm) 12px; border-radius: var(--radius-xs); font-size: 12px; margin-bottom: .75rem; }
[role="alert"]               { padding: var(--space-sm) 12px; border-radius: var(--radius-xs); font-size: 12px; margin-bottom: .75rem; }

/* ── Stat cards ──────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xs);
  border-top: 3px solid var(--accent); padding: var(--space-md);
}
.stat.red   { border-top-color: var(--red); }
.stat.amber { border-top-color: var(--amber); }
.stat.blue  { border-top-color: var(--blue); }
.stat:hover { box-shadow: 0 2px 8px rgba(30,37,64,.08); }
.s-lbl { font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: 10px; }
.s-val { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.s-foot { font-size: 11px; color: var(--text-3); margin-top: 6px; display: flex; align-items: center; gap: 5px; }

/* ── Grid ────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }

/* ── Activity feed ───────────────────────────────────────── */
.feed-item { display: flex; align-items: center; gap: 10px; padding: 10px var(--space-md); border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
a.feed-item, a.feed-item:visited { text-decoration: none; color: inherit; }
a.feed-item:hover { background: var(--surface2); }
a.feed-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.feed-ico  { width: 28px; height: 28px; border-radius: var(--radius-xs); flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; }
.feed-ico svg { width: 13px; height: 13px; }
.feed-ico.g { background: var(--accent-l); color: var(--accent); }
.feed-ico.b { background: var(--blue-l);   color: var(--blue);   }
.feed-ico.a { background: var(--amber-l);  color: var(--amber);  }
.feed-ico.r { background: var(--red-l);    color: var(--red);    }
.feed-text  { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.feed-text strong { color: var(--text); font-weight: 500; }
.feed-time  { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-3); margin-top: 2px; }
.feed-ts    { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-3); display: block; margin-top: 1px; }
.feed-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px; color: var(--text-3); font-size: 12px; }
.feed-empty svg { opacity: 0.3; }

/* ── Progress bars ───────────────────────────────────────── */
.prog-row  { display: flex; align-items: center; gap: 12px; padding: 9px var(--space-md); border-bottom: 1px solid var(--border); }
.prog-row:last-child { border-bottom: none; }
.prog-lbl  { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-2); width: 120px; flex-shrink: 0; }
.prog-bg   { flex: 1; height: 3px; background: var(--border); border-radius: var(--radius-xs); overflow: hidden; }
.prog-fill { height: 100%; border-radius: var(--radius-xs); background: var(--accent); }
.prog-fill.w { background: var(--amber); }
.prog-fill.e { background: var(--red); }
.prog-val  { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-3); width: 30px; text-align: right; }
.prog-val.w { color: var(--amber); }
.prog-val.e { color: var(--red); }

/* prog-fill width utilities — CSP-safe (no inline styles) (T-306) */
.prog-w-0{width:0%} .prog-w-5{width:5%} .prog-w-10{width:10%}
.prog-w-15{width:15%} .prog-w-20{width:20%} .prog-w-25{width:25%}
.prog-w-30{width:30%} .prog-w-35{width:35%} .prog-w-40{width:40%}
.prog-w-45{width:45%} .prog-w-50{width:50%} .prog-w-55{width:55%}
.prog-w-60{width:60%} .prog-w-65{width:65%} .prog-w-70{width:70%}
.prog-w-75{width:75%} .prog-w-80{width:80%} .prog-w-85{width:85%}
.prog-w-90{width:90%} .prog-w-95{width:95%} .prog-w-100{width:100%}

/* Theme toggle override when placed in topbar (T-306) */
.topbar .theme-toggle-btn { width: auto; text-align: initial; margin-left: 0; margin-top: 0; padding: 6px 8px; }

/* ── Inline action links ─────────────────────────────────── */
.a-btn { font-size: 11px; color: var(--accent); background: none; border: none; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; padding: 2px 0; }
.a-btn:hover { text-decoration: underline; }
.a-btn.danger { color: var(--red); }

/* ── Utility ─────────────────────────────────────────────── */
.text-mono   { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text); }
.text-small  { font-size: 12px; }
.text-dim    { color: var(--text-3); }
.text-error  { color: var(--red); }
.text-success{ color: var(--accent); }
.text-amber  { color: var(--amber); }
.up   { color: var(--accent);  font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.dn   { color: var(--red);     font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.warn { color: var(--amber);   font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.d-none { display: none; }

/* ── Login page layout ───────────────────────────────────── */
body.login-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg);
}

.login-card {
  width: 100%; max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: var(--space-xl) var(--space-xl) 28px;
}
.login-card h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 22px;
  display: flex; align-items: center; gap: 10px;
}
.login-logo-mark {
  width: 28px; height: 28px;
  background: var(--accent); border-radius: var(--radius-xs);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.login-logo-mark svg { width: 15px; height: 15px; color: #fff; }

.login-card .login-error {
  background: var(--red-l); color: var(--red);
  border: 1px solid #FABFBF;
  border-left: 3px solid var(--red);
  padding: var(--space-sm) 12px; border-radius: var(--radius-xs);
  font-size: 12px; margin-bottom: var(--space-md);
}
.login-card label { margin-bottom: 12px; }
.login-card input[type="email"],
.login-card input[type="password"],
.login-card input[type="text"] {
  margin-top: var(--space-xs);
}
.login-card input.input-error { border-color: var(--red); }
.login-card input.input-error:focus { box-shadow: 0 0 0 3px var(--red-l); }
.login-card button[type="submit"] { width: 100%; justify-content: center; margin-top: var(--space-sm); }
.totp-hint { font-size: .8rem; color: var(--muted, #777); margin: 4px 0 0; }

/* Login page centering wrapper */
.login-center {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; width: 100%;
  background: var(--bg);
}

/* TOTP section */
.totp-section { margin-top: var(--space-xs); }
.totp-timer { height: 2px; background: var(--border); border-radius: var(--radius-xs); margin-bottom: 12px; overflow: hidden; }
.totp-timer-fill { height: 100%; background: var(--accent); transition: width 1s linear; }

/* ── Separator ───────────────────────────────────────────── */
.sep { border: none; border-top: 1px dashed var(--border); margin: var(--space-lg) 0; }

/* ── Section headers on pages ────────────────────────────── */
h1 { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
h2 { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; margin-top: 20px; }
p  { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }

/* Section block */
section { margin-bottom: var(--space-lg); }

/* ── TOTP input width ────────────────────────────────────── */
input[name="totp_code"] { width: 7rem; }
/* F-008: inline style="width:4rem" replaced with class (CSP violation) */
.input-trust-score { width: 4rem; }

/* ── Dashboard stat cards (T-264) ───────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 14px var(--space-md); border-top: 3px solid var(--border); }
.stat-card.green { border-top-color: var(--accent); }
.stat-card.blue  { border-top-color: var(--blue); }
.stat-card.amber { border-top-color: var(--amber); }
.stat-card.red   { border-top-color: var(--red); }
.stat-card-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--space-sm); }
.stat-card-value { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-card-sub   { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.stat-bar        { height: 3px; background: var(--border); border-radius: var(--radius-xs); margin-top: 10px; }
.stat-bar-fill   { height: 100%; background: var(--accent); border-radius: var(--radius-xs); }
.stat-bar-fill.warn { background: #E5860A; }
.stat-bar-fill.crit { background: var(--red); }
@media (max-width: 900px) { .stat-row { grid-template-columns: 1fr 1fr; } }

/* ── System status panel ─────────────────────────────────── */
.sys-status-row  { display: flex; flex-wrap: wrap; gap: 12px; padding: 14px var(--space-md); }
.sys-status-item { display: flex; flex-direction: column; gap: 3px; min-width: 70px; }
.sys-status-label{ font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.sys-status-val  { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text); }
.sys-status-val.ok   { color: var(--accent); }
.sys-status-val.warn { color: var(--amber); }
.sys-status-val.err  { color: var(--red); }
.sys-badges { display: flex; gap: 8px; padding: 0 var(--space-md) 14px; }
.sys-badge  { font-size: 11px; color: var(--text-3); }
.sys-badge.ok   { color: var(--accent); }
.sys-badge.warn { color: var(--amber); }
.sys-badge.err  { color: var(--red); }

/* ── T-266: URL truncation + file input ─────────────────── */
.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-cell code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-upload-group { display: flex; align-items: center; gap: var(--space-sm); flex: 1; min-width: 16rem; }
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0,0,0,0); }
.file-upload-label { display: inline-flex; align-items: center; padding: 0 0.75rem; height: 2rem; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-xs); font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text); cursor: pointer; white-space: nowrap; }
.file-upload-label:hover { border-color: var(--accent); color: var(--accent); }
.file-name-display { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted   { color: var(--text-3); }

/* ── F-008 inline-style replacement utilities ─────────────── */
.mb-0    { margin-bottom: 0 !important; }
.mb-05   { margin-bottom: var(--space-sm); }
.mb-075  { margin-bottom: 0.75rem; }
.mb-1    { margin-bottom: var(--space-md); }
.mt-075  { margin-top: 0.75rem; }
.ml-05   { margin-left: var(--space-sm); }
.text-red    { color: var(--red); }
.text-accent { color: var(--accent); }
.d-inline    { display: inline; }
.actions-col { white-space: nowrap; }
.mono-sm     { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
/* ── Telegram link result row ────────────────────────────── */
.tg-link-row   { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.tg-link-anchor { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--accent); word-break: break-all; }
.tg-link-anchor:hover { text-decoration: underline; }
.btn-copy { padding: 4px 6px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-xs); color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; flex-shrink: 0; }
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }
.panel-pad   { padding: var(--space-sm) 0; }
.totp-input    { width: 7rem; }
.totp-input-sm { width: 5.5rem; }
.totp-input-sm.input-error { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-l); }
.totp-label    { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.totp-err-msg  { display: block; font-size: 0.75rem; color: var(--red, #ef4444); min-height: 0; margin-top: 2px; }
.totp-err-msg:empty { display: none; }
.form-label-sm  { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; margin-bottom: 0; }
.inline-form    { display: inline-flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; }
.inline-form-nowrap { flex-wrap: nowrap; }

/* ── Grid helpers used by partials ──────────────────────── */
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--space-sm) var(--space-md); margin-bottom: 0.75rem; }
.grid-auto-wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: var(--space-sm) var(--space-md); margin-bottom: 0.75rem; }
.flex-row  { display: flex; align-items: center; gap: var(--space-sm); }
.flex-row-gap { display: flex; gap: var(--space-sm); }

/* ── T-269: Modal overlay (invite form) ──────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-lg) 28px;
  width: 100%; max-width: 480px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.modal-title { margin-top: 0; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none;
  font-size: 18px; line-height: 1;
  color: var(--text-3); cursor: pointer;
  padding: 2px 6px;
  font-family: 'JetBrains Mono', monospace;
}
.modal-close:hover { color: var(--text); }
.modal-submit[disabled] { opacity: .6; cursor: not-allowed; }
.modal-names-hint { font-size: 11px; color: var(--text-3); margin-bottom: 12px; }

/* ── Invite modal: wide two-column layout ────────── */
.modal-card--wide { max-width: 1000px; }
.invite-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.invite-col-table-title { font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin: 0 0 0.5rem 0; }
@media (max-width: 680px) {
  .modal-card--wide { max-width: 480px; }
  .invite-grid { grid-template-columns: 1fr; }
  .invite-col-table { display: none; }
}

/* ── T-269: User name sub-line in users table ────────────── */
.user-subtext { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── T-269: Width utilities ──────────────────────────────── */
.w-auto { width: auto; }

/* ── CSP F-047: utility replacing inline style="margin:0" on logout form ─ */
.m-0 { margin: 0; }

/* ── CSP inline-style migrations ── */
.mt-half { margin-top: 0.5rem; }
.mt-xs   { margin-top: var(--space-xs); }
.ms-1rem { margin-left: 1rem; }
.pg-sub-compact { margin: 0 0 0.5rem; }
.pre-json { font-size: 0.8rem; }
.w-160 { width: 160px; }

/* ── TOTP setup — replacing inline styles (CSP F-047) ───── */
.qr-container { text-align: center; margin: var(--space-md) 0; }
.totp-details { margin-bottom: var(--space-md); }
.totp-manual-uri { word-break: break-all; font-size: 0.8rem; padding: var(--space-sm); }

/* ── Column mapping sample hints (T-282) ─────────────── */
.hint { color: var(--text-3); font-size: 0.85em; display: block; margin-bottom: 0.2rem; /* layout-specific */ }
.hint-list { color: var(--text-3); font-size: 0.85em; margin: 0.1rem 0 0.2rem 0.9rem; /* layout-specific */ padding: 0; list-style: disc; }
.hint-list li { line-height: 1.4; }

/* ── Offline DB table + row actions (8-col layout) ───────
   Root cause of the old horizontal scroll + button chaos: 10 columns with
   inline TOTP forms forced .table-scroll table { min-width: max-content } to
   blow past the viewport, and .actions-flex { flex-wrap } scattered 5 buttons.
   Now: Active/Health/Trust folded into one display cell; every action lives in
   a ⋯ dropdown; one TOTP per row. The table fits 100% — no scroll, no wrap. */
.offline-db-table { width: 100%; table-layout: auto; }
.offline-db-table td, .offline-db-table th { padding-left: var(--space-sm); padding-right: var(--space-sm); }
/* Override the global .table-scroll table { min-width: max-content } (preview
   modal still needs it) so THIS table shrinks to the content area instead. */
.table-scroll .offline-db-table { min-width: 0; }
/* The ⋯ panel is position:absolute — the wrapper must not clip it. With the
   table no longer overflowing, this wrapper never needs to scroll. */
.offline-db-scroll { overflow: visible; }
.cell-status { white-space: nowrap; }
.cell-status .pill { margin-right: var(--space-xs); }
.cell-actions { white-space: nowrap; text-align: right; }
.health-cell { max-width: 8rem; }
.actions-flex { display: inline-flex; gap: var(--space-xs); align-items: center; }
.trust-inline { display: inline-flex; gap: var(--space-xs); align-items: center; }

/* Row ⋯ overflow menu (native <details>, matches .role-compare-summary idiom) */
.row-menu { display: inline-block; position: relative; margin-left: var(--space-xs); }
.row-menu-trigger {
  list-style: none; cursor: pointer; user-select: none;
  padding: 2px 8px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 700; line-height: 1;
}
.row-menu-trigger::-webkit-details-marker { display: none; }
.row-menu-trigger::marker { content: ""; }
.row-menu-trigger:hover,
.row-menu[open] .row-menu-trigger { background: var(--surface2); color: var(--text); }
/* position: fixed so the panel escapes .panel { overflow: hidden } and the
   scrolling .content — JS sets top/left from the ⋯ trigger rect on open. */
.row-menu-panel {
  position: fixed; z-index: 1000;
  min-width: 190px; padding: var(--space-xs);
  display: flex; flex-direction: column; gap: 1px; text-align: left;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(20, 28, 56, .14);
}
.row-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text);
}
.row-menu-item:hover { background: var(--surface2); }
.row-menu-item.danger { color: var(--red); }
.row-menu-item.danger:hover { background: var(--red-l); }
.row-menu-totp {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 6px 10px 8px; margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.row-menu-totp .totp-input-sm { margin-top: 4px; width: 100%; }
.row-menu-trust { display: flex; flex-direction: column; gap: 4px; padding: 4px 10px; }
.row-menu-trust .input-trust-score { width: 4.5rem; }
.row-menu-trust .row-menu-item { padding: 6px 8px; }

/* Description sub-line under the DB name in the table */
.offline-db-desc {
  font-size: 12px; color: var(--text-3); margin-top: 2px;
  line-height: 1.35; white-space: normal; max-width: 340px;
}

/* ── Upload accordion (collapsible form: name → multiline desc → upload) ── */
.upload-accordion > .upload-accordion-summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: var(--space-sm);
}
.upload-accordion-summary::-webkit-details-marker { display: none; }
.upload-accordion-summary::marker { content: ""; }
.upload-accordion-summary:hover .panel-title { color: var(--text); }
.upload-accordion-chevron { margin-left: auto; color: var(--text-3); transition: transform .15s ease; }
.upload-accordion[open] .upload-accordion-chevron { transform: rotate(180deg); }
.upload-form-stack { display: flex; flex-direction: column; gap: var(--space-md); }
.upload-form-stack .field { display: flex; flex-direction: column; gap: 4px; }
.upload-form-stack .field-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.upload-form-stack .input-text,
.upload-form-stack textarea { width: 100%; box-sizing: border-box; }
.upload-form-stack textarea { min-height: 72px; }
.upload-form-footer { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; }
.upload-form-footer .file-upload-group { flex: 1; }

/* ── T-352: Role comparison table in invite modal ────── */
.role-compare-wrap { overflow-x: auto; margin-top: 0.5rem; }
.role-compare-summary { font-size: 0.75rem; color: var(--text-3); cursor: pointer; user-select: none; list-style: none; }
.role-compare-summary::-webkit-details-marker { display: none; }
.role-compare-table { font-size: 0.75rem; color: var(--text-3); width: 100%; border-collapse: collapse; margin-top: 0.35rem; table-layout: fixed; }
.role-compare-table th { font-weight: 600; color: var(--text-2); padding: 2px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.role-compare-table td { padding: 2px 6px; border-bottom: 1px solid var(--border); word-break: break-word; }
.role-compare-table th:first-child,
.role-compare-table td:first-child { width: 33%; }
.role-compare-fn { font-size: 0.7rem; color: var(--text-3); margin-top: 0.25rem; }

/* ── T-289: Offline DB preview modal + copy ID ───────── */
.text-mono { font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 0.85em; white-space: nowrap; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  padding: 0 3px; font-size: 0.9em; color: var(--text-3);
  vertical-align: middle; line-height: 1;
}
.btn-icon:hover { color: var(--accent); }
/* T-289: modal preview table — constrain height inside .modal-body (scoped to avoid vertical
   scrollbar on the main page table, which .content already scrolls). */
.modal-body .table-scroll { max-height: 55vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: max-content; }

/* ── T-289: Preview modal inner layout ───────────────── */
.modal-content {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 90vw; max-width: 900px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  position: relative;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-body {
  padding: var(--space-md) 18px;
  overflow-y: auto;
  flex: 1;
}

/* ── T-294: .totp-hint ───────────────────────────────────── */
.totp-hint {
  margin-top: var(--space-xs);  /* aligns 3px → 4px to design scale (small{} at line 290 covers display/font/color) */
}

/* ── htmx:confirm dialog — centered, site-styled ─────── */
.confirm-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: var(--space-lg) 28px;
  min-width: 320px;
  max-width: 420px;
  width: 100%;
  /* margin:auto centers <dialog> with showModal() in all browsers */
  margin: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.confirm-dialog__message {
  margin: 0 0 var(--space-md) 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}
.confirm-dialog__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Accessibility ──────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── HTMX global loading indicator ─────────────────────── */
#htmx-global-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border, #ccc);
  border-top-color: var(--accent, #0ea5e9);
  border-radius: 50%;
  animation: htmx-spin 0.6s linear infinite;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  position: fixed;
  top: var(--space-sm, 0.5rem);
  right: var(--space-sm, 0.5rem);
  z-index: 9999;
}

.htmx-request #htmx-global-spinner,
#htmx-global-spinner.htmx-request {
  opacity: 1;
}

@keyframes htmx-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  #htmx-global-spinner {
    animation: none;
    border-top-color: var(--accent, #0ea5e9);
  }
}

/* ── Lookup fullscreen spinner overlay ──────────────────────── */
.lookup-spinner-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.lookup-spinner-overlay.htmx-request {
  display: flex;
}
.lookup-spinner-ring {
  width: 56px;
  height: 56px;
  border: 5px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent, #0ea5e9);
  border-radius: 50%;
  animation: htmx-spin 0.7s linear infinite;
}
.lookup-spinner-text {
  color: #fff;
  font-size: 0.9375rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.03em;
}
@media (prefers-reduced-motion: reduce) {
  .lookup-spinner-ring { animation: none; border-top-color: var(--accent, #0ea5e9); }
}

/* ── Lookup results ─────────────────────────────────────────── */
.lookup-results { margin-top: var(--space-md, 1rem); }

.results-summary {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 0.5rem);
  margin-bottom: var(--space-md, 1rem);
}

.lookup-results {
  position: relative;
}

.search-id-chip {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  background: var(--surface-alt, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 0.25rem);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim, #94a3b8);
  cursor: copy;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  z-index: 1;
}
.search-id-chip:hover {
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
}
.search-id-chip.copied {
  background: var(--success-bg, #dcfce7);
  border-color: var(--success, #22c55e);
  color: var(--success, #22c55e);
}

.source-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md, 1rem);
  margin-bottom: var(--space-md, 1rem);
}

.source-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 0.5rem);
  padding: var(--space-md, 1rem);
  background: var(--surface, #fff);
}

.source-card--found { border-left: 3px solid var(--accent, #0ea5e9); }
.source-card--degraded { border-left: 3px solid var(--warn, #f59e0b); }
.source-card--not_found { opacity: 0.6; }

.source-card-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm, 0.5rem);
}

.source-card-id {
  font-weight: 600;
  font-size: 0.875rem;
}

.card-data {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem var(--space-sm, 0.5rem);
  font-size: 0.8125rem;
  margin: 0;
}

.card-data dt { color: var(--text-muted, #64748b); white-space: nowrap; }
.card-data dd { margin: 0; word-break: break-word; }
.card-note { font-size: 0.8125rem; color: var(--text-muted, #64748b); margin: 0; }
.card-summary { font-size: 0.8125rem; color: var(--text-2, #64748b); margin: 0 0 var(--space-sm, 0.5rem); font-weight: 500; }

/* T-355: services_list (holehe, ignorant, maigret) */
.card-services-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.card-services-list li { display: flex; align-items: center; gap: 0.25rem; background: var(--surface-2, #f1f5f9); border-radius: var(--radius-xs, 4px); padding: 0.125rem 0.5rem; font-size: 0.75rem; }
.svc-name { font-weight: 500; }
.svc-domain { color: var(--text-muted, #94a3b8); font-size: 0.6875rem; }
.svc-link { color: var(--accent, #0ea5e9); text-decoration: none; }

/* T-355: breach_list (hibp) */
.card-breach-list { width: 100%; border-collapse: collapse; font-size: 0.75rem; margin-top: var(--space-xs, 0.25rem); }
.card-breach-list th { background: var(--surface-2, #f1f5f9); text-align: left; padding: 0.25rem 0.5rem; font-weight: 600; color: var(--text-2, #475569); border-bottom: 1px solid var(--border, #e2e8f0); }
.card-breach-list td { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--border, #e2e8f0); vertical-align: top; }
.card-breach-list tr:last-child td { border-bottom: none; }
.data-classes { color: var(--text-muted, #64748b); max-width: 220px; }

/* T-355: kv_table (hunter_io, phone_checker) */
.card-kv-table { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; font-size: 0.8125rem; margin: 0; }
.card-kv-table dt { color: var(--text-muted, #64748b); white-space: nowrap; font-size: 0.75rem; }
.card-kv-table dd { margin: 0; font-weight: 500; }
.card-kv-table dt.kv-highlight, .card-kv-table dt.kv-highlight + dd { color: var(--text, #0f172a); font-weight: 600; }

/* T-355: match_table (offline_db) */
.card-match-table-wrap { overflow-x: auto; margin-top: var(--space-xs, 0.25rem); }
.card-match-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; white-space: nowrap; }
.card-match-table th { background: var(--surface-2, #f1f5f9); text-align: left; padding: 0.25rem 0.5rem; font-weight: 600; color: var(--text-2, #475569); border-bottom: 2px solid var(--border, #e2e8f0); }
.card-match-table td { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--border, #e2e8f0); }
.card-match-table tr:last-child td { border-bottom: none; }

/* ── SSE card fade-in (T-356) ───────────────────────────────── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-appear {
  animation: card-in 0.18s ease-out both;
}

.info-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-info, #eff6ff);
  border: 1px solid var(--border-info, #bfdbfe);
  border-radius: var(--radius-xs, 4px);
  font-size: 13px;
  color: var(--text-2, #374151);
  margin-bottom: var(--space-md, 1rem);
}
.info-block svg { flex-shrink: 0; color: var(--blue, #3b82f6); margin-top: 1px; }
.info-block a { color: var(--blue, #3b82f6); }

.create-case-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md, 1rem);
  padding: var(--space-md, 1rem) 0;
  border-top: 1px solid var(--border, #e2e8f0);
}

.create-case-bar form {
  display: flex;
  align-items: center;
  gap: var(--space-md, 1rem);
}

.disambig-prompt {
  padding: var(--space-lg, 1.5rem) 0 var(--space-md, 1rem);
}

.disambig-msg {
  margin: 0 0 var(--space-md, 1rem);
  color: var(--text-secondary, #64748b);
  font-size: 0.9375rem;
}

.disambig-btns {
  display: flex;
  gap: var(--space-sm, 0.5rem);
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 0.25rem);
  cursor: pointer;
}

/* T-321 fix: hide empty access-panel row border */
.access-panel-row td:empty { padding: 0; border: none; }

/* invite_success.html toast — replaces inline styles (CSP nonce policy) */
.invite-warn-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  max-width: 500px;
  padding: 1rem;
  background: var(--color-warning-bg, #fef3c7);
  border: 1px solid var(--color-warning-border, #f59e0b);
  border-radius: 8px;
}
.invite-warn-toast__msg  { margin: 0 0 0.5rem; }
.invite-warn-toast__link { word-break: break-all; font-size: 0.8rem; }

/* T-357: lookup card action buttons (delete + drilldown) */
.card-actions { margin-left: auto; display: flex; gap: 0.25rem; align-items: center; }
.card-delete-btn, .card-drilldown-btn {
  background: none; border: none; cursor: pointer;
  padding: 0.2rem 0.4rem; border-radius: 4px;
  font-size: 0.85rem; line-height: 1; opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}
.card-delete-btn:hover { opacity: 1; background: var(--color-danger-bg, #fee2e2); }
.card-drilldown-btn:hover { opacity: 1; background: var(--color-info-bg, #dbeafe); }

/* T-375: aggregated sections view */
.result-section { margin-bottom: 1.5rem; }
.section-title { font-size: 0.9rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted, #6b7280); margin-bottom: 0.5rem; border-bottom: 1px solid var(--border, #e5e7eb); padding-bottom: 0.25rem; }
.result-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.result-table th { text-align: left; padding: 0.4rem 0.75rem; background: var(--surface-2, #f9fafb); font-weight: 500; border-bottom: 1px solid var(--border, #e5e7eb); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted, #6b7280); }
.result-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border-light, #f3f4f6); vertical-align: middle; }
.result-table tr:last-child td { border-bottom: none; }
.result-table tr:hover td { background: var(--surface-hover, #f9fafb); }
.field-label { font-weight: 500; color: var(--text-secondary, #374151); white-space: nowrap; }
.field-value { font-family: var(--font-mono, "JetBrains Mono", monospace); word-break: break-all; }
.field-trust { text-align: center; width: 3rem; }
.field-action { text-align: right; white-space: nowrap; width: 6rem; }
.trust-badge { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; font-size: 0.75rem; font-weight: 700; }
.trust-none { background: var(--surface-2, #f3f4f6); color: var(--text-muted, #9ca3af); }
.trust-1, .trust-2, .trust-3 { background: #fee2e2; color: #dc2626; }
.trust-4, .trust-5 { background: #fef3c7; color: #d97706; }
.trust-6, .trust-7 { background: #fef9c3; color: #ca8a04; }
.trust-8, .trust-9, .trust-10 { background: #dcfce7; color: #16a34a; }
.btn-drilldown { font-size: 0.75rem; padding: 0.2rem 0.5rem; }

/* T-368: vis-network graph */
.graph-panel { padding: 0; overflow: hidden; }
.vis-container { height: 420px; width: 100%; background: var(--surface-2, #f9fafb); }
.graph-status { padding: 0.4rem 0.75rem; font-size: 0.8rem; color: var(--text-muted, #6b7280); background: var(--surface-2, #f9fafb); border-bottom: 1px solid var(--border, #e5e7eb); }

/* ════════════════════════════════════════════════════════════
   Sources page redesign — clean forms + API-key card
   (replaces sprawling .grid-auto layout; aligns with offline-db)
   ════════════════════════════════════════════════════════════ */

/* Create/Edit source form — tidy fixed grid instead of auto-fill sprawl */
.source-form-panel { margin-bottom: var(--space-md); }
.source-form { padding: var(--space-md); }
.source-form .source-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md); margin-bottom: var(--space-md);
}
.source-form .source-grid > label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
}
.source-form .source-grid > label input { width: 100%; }
.source-form .source-grid > label small { font-weight: 400; color: var(--text-3); margin-top: 2px; }
.source-form [data-totp-grace-hide] { margin-bottom: var(--space-sm); }
.source-form .totp-label {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 0;
}
@media (max-width: 1100px) { .source-form .source-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 680px)  { .source-form .source-grid { grid-template-columns: 1fr; } }

/* Generic small badge (was undefined — used by version cell + api-key card) */
.badge {
  display: inline-flex; align-items: center; padding: 1px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); color: var(--text-2); background: var(--surface2);
}
.badge-success { background: var(--accent-l); color: var(--accent); border-color: var(--accent-b); }
.badge-warn    { background: var(--amber-l);  color: var(--amber);  border-color: #F9C97C; }

/* API key card */
.api-key-card { margin-top: var(--space-md); }
.api-key-card .panel-head { display: flex; align-items: center; gap: var(--space-sm); }
.masked-key { font-family: 'JetBrains Mono', monospace; background: var(--surface2); padding: 2px 6px; border-radius: var(--radius-xs); }
.api-key-form { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); flex-wrap: wrap; }
.api-key-input { flex: 1; min-width: 16rem; }
.api-key-actions { display: flex; gap: var(--space-sm); }
.btn-danger-ghost { background: none; color: var(--red); border: 1px solid var(--red); }
.btn-danger-ghost:hover { background: var(--red-l); }
.alert { padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12px; margin: var(--space-sm) 0; }
.alert-success { background: var(--accent-l); color: var(--accent); }
.alert-error   { background: var(--red-l);    color: var(--red); }

/* a11y visually-hidden (was undefined) */
.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; }
.text-sm { font-size: 12px; }

/* Sources ⋯ menu: labelled trust-score control (offline-db keeps its own labelled button) */
.row-menu-trust-block { display: flex; flex-direction: column; gap: 4px; padding: 6px 10px; }
.row-menu-trust-label { font-size: 12px; color: var(--text-2); }
.row-menu-trust-block .row-menu-trust { padding: 0; }
.row-menu-trust-block .input-trust-score { width: 4.75rem; }
.row-menu-trust-block select.input-trust-score { padding: 5px 6px; }

/* Submit buttons in the row ⋯ menu (trust "Save") were inheriting the global teal
   button[type=submit] style (white text); .row-menu-item:hover then swaps the bg to a
   light surface but keeps white text → the label vanished on hover. Force the same plain
   menu-item look as the other items, with a visible hover. */
button.row-menu-item { background: none; color: var(--text); border: none; }
button.row-menu-item:hover { background: var(--surface2); color: var(--text); filter: none; }
button.row-menu-item.danger { color: var(--red); }
button.row-menu-item.danger:hover { background: var(--red-l); color: var(--red); }

/* ════════════════════════════════════════════════════════════
   work/lookup results — ONE aligned table (replaces per-section
   tables whose column widths jumped + borders overlapped).
   Uses real design tokens (the old .result-table used undefined
   --text-muted/--surface-2/--border-light → hardcoded fallbacks).
   ════════════════════════════════════════════════════════════ */
.lookup-table {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  font-size: 13px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden;
  margin-top: var(--space-sm);
}
.lk-col-field  { width: 22%; }
.lk-col-value  { width: 46%; }
.lk-col-trust  { width: 12%; }
.lk-col-action { width: 20%; }
.lookup-table thead th {
  text-align: left; padding: 8px 14px;
  background: var(--surface2); color: var(--text-3);
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
.lookup-table thead th.lk-th-center { text-align: center; }
.lookup-table tbody td {
  padding: 9px 14px; border-top: 1px solid var(--border);
  vertical-align: top; overflow-wrap: anywhere; line-height: 1.45;
}
.lookup-table tbody tr:hover td { background: var(--surface2); }
.lk-section-row th {
  text-align: left; padding: 7px 14px;
  background: var(--surface2); color: var(--text-2);
  font-size: 12px; font-weight: 700; border-top: 1px solid var(--border);
}
.lk-section-row:hover th { background: var(--surface2); }
.lk-field  { color: var(--text-2); font-weight: 500; }
.lk-value  { color: var(--text); }
.lk-trust  { text-align: center; }
.lk-action { text-align: right; }
.lk-action .btn-drilldown { white-space: nowrap; }
/* Trust number badge — real tokens (old .trust-badge was a token-less circle) */
.trust-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem; padding: 0 5px;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 700;
  background: var(--accent-l); color: var(--accent); border: 1px solid var(--accent-b);
}
.trust-none { color: var(--text-3); }

/* work/lookup bottom note (view-only role) — was flush to the table edge.
   Give it the same separation as .create-case-bar. */
.lookup-note { margin-top: var(--space-md); padding-top: var(--space-md);
  border-top: 1px solid var(--border); color: var(--text-3); }

/* ── work/lookup page refactor — clean search form + disambiguate ── */
.lookup-form { display: flex; flex-direction: column; gap: var(--space-sm); align-items: flex-start; }
.lookup-form .field { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 560px; }
.lookup-form .field-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.lookup-form .input-text { width: 100%; }
.radio-group { display: flex; flex-direction: column; gap: 8px; margin: var(--space-sm) 0 var(--space-md); }
.radio-group .radio-label { gap: 8px; }
/* search_id chip — real tokens (was --surface-alt/--text-dim/--primary fallbacks) */
.search-id-chip { background: var(--surface2); border-color: var(--border); color: var(--text-3); }
.search-id-chip:hover { border-color: var(--accent); color: var(--accent); }
.search-id-chip.copied { background: var(--accent-l); border-color: var(--accent-b); color: var(--accent); }

/* ═══════════════════════════════════════════════════════
   T-396 Stage 1 — Report redesign
   ═══════════════════════════════════════════════════════ */

/* Dossier container */
.dossier { display: flex; flex-direction: column; gap: var(--space-md); }

/* Block title input — styled as panel-title text; editable on focus */
.dossier-title-input {
  flex: 1; min-width: 0;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .06em;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 2px 6px; margin: 0; line-height: 1.5;
}
.dossier-title-input:focus { background: var(--bg); border-color: var(--accent); outline: none; }
.dossier-title-input::placeholder { font-style: italic; color: var(--text-3); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* Section-level actions (delete/rename) — fade in on panel hover */
.section-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; margin-left: auto; flex-shrink: 0; }
.panel:hover .section-actions { opacity: 1; }

/* detail-list — the main key:value grid for report sections */
.detail-list {
  display: grid; grid-template-columns: 200px 1fr; gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  margin: var(--space-sm) 0;
}
.dl-row { display: contents; }
.dl-key { background: var(--white); padding: 9px var(--space-md); color: var(--text-3); font-size: 13px; }
.dl-val {
  background: var(--white); padding: 9px var(--space-md);
  color: var(--text); display: flex; align-items: center; gap: 8px;
  justify-content: space-between;
}
.dl-val .v { font-family: 'JetBrains Mono', monospace; font-size: 13.5px; }
.dl-val.col { flex-direction: column; align-items: flex-start; gap: 4px; }
.dl-row:hover .dl-key,
.dl-row:hover .dl-val { background: var(--surface2); }

/* Per-row edit/delete actions — fade in on row hover */
.row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; flex-shrink: 0; }
.dl-row:hover .row-actions { opacity: 1; }
.row-act {
  color: var(--text-3); cursor: pointer; font-size: 13px;
  background: none; border: none; padding: 2px 6px;
  border-radius: var(--radius-sm); line-height: 1;
}
.row-act:hover { background: var(--bg); }
.row-act.edit:hover    { color: var(--accent); }
.row-act.del:hover     { color: var(--red); }
.row-act.restore:hover { color: var(--green, #16a34a); }

/* Field-level hidden / overridden states (T-396 Stage 3) */
.dl-row-hidden .dl-key { color: var(--text-3); font-style: italic; }
.dl-row-hidden .dl-val { color: var(--text-3); }
.dl-val .v.muted       { font-style: italic; color: var(--text-3); }
.dl-val .v.overridden  { color: var(--accent); }
.dl-row-editing        { display: contents; }
.dl-row-editing .dl-key { background: var(--white); padding: 9px var(--space-md); color: var(--text-3); font-size: 13px; }
.dl-row-editing .dl-val { background: var(--surface2); padding: 9px var(--space-md); display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.dl-row-editing textarea { width: 100%; resize: vertical; }

/* Status pill */
.status-pill {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-2);
}

/* Risk score display */
.score { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.score .num { font-size: 16px; }
.score .den { color: var(--text-3); }
.score.bad  .num { color: var(--red); }
.score.mid  .num { color: var(--amber); }
.score.good .num { color: var(--accent); }

/* Risk bar — width set via JS from data-pct; color by adjacent .score modifier */
.risk-bar { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; width: 140px; margin-top: 4px; }
.risk-bar > i { display: block; height: 100%; background: var(--amber); }
.score.bad  + .risk-bar > i { background: var(--red); }
.score.good + .risk-bar > i { background: var(--accent); }

/* Free-text analyst textarea */
.free-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text);
  font-family: 'Inter', system-ui, sans-serif; font-size: 14px;
  padding: 10px; resize: vertical; min-height: 70px; display: block;
}
.free-input:focus { outline: none; border-color: var(--accent); }

/* Autosave ok indicator */
.save-ok { color: var(--accent); font-size: 12px; margin-left: 6px; }

/* Per-block comment thread */
.comment-list { list-style: none; padding: 0; margin: 0; }
.comments { margin-top: var(--space-md); border-top: 1px dashed var(--border); padding-top: var(--space-md); }
.comments h4 {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3); margin: 0 0 var(--space-sm);
}
.comment-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-of-type { border-bottom: none; }
.comment-meta { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.comment-author { color: var(--accent); }
.comment-body { font-size: 13px; color: var(--text); }
.comment-form { display: flex; flex-direction: column; gap: var(--space-sm); margin-top: var(--space-sm); }
.comment-form textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text); padding: 8px; font-size: 13px; resize: vertical;
  font-family: 'Inter', system-ui, sans-serif;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form .comment-submit { align-self: flex-end; }

/* Add field / section CTAs */
.add-field { margin-top: var(--space-sm); }
.add-field-form { display: flex; gap: var(--space-sm); flex-wrap: wrap; align-items: center; margin-top: var(--space-xs); }
.add-field-form.hidden { display: none; }
.add-field-form input { flex: 1; min-width: 120px; }
.add-section { display: flex; justify-content: center; margin-top: var(--space-md); }

/* Photo placeholders — identification block */
.photos { display: flex; gap: var(--space-sm); margin-bottom: var(--space-md); }
.photos .ph { width: 96px; height: 120px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface2); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 28px; }

/* dossier-add form — hidden until toggle */
.dossier-add { margin-top: var(--space-md); }
.dossier-add.hidden { display: none; }
.dossier-add.open { display: block; }

/* ── History drawer ── */
.drawer-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 40;
}
.drawer-back.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 440px; max-width: 92vw;
  background: var(--white); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .2s; z-index: 50;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md); border-bottom: 1px solid var(--border);
}
.drawer-head .t {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  text-transform: uppercase; letter-spacing: .06em;
}
.drawer-filters {
  display: flex; gap: var(--space-sm); padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.drawer-chip {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  cursor: pointer; transition: border-color .12s, color .12s; user-select: none;
}
.drawer-chip.off { border-color: var(--border); color: var(--text-3); }
.drawer-body { overflow: auto; padding: var(--space-sm) 0; flex: 1; }
.ev { display: flex; flex-direction: column; gap: 2px; padding: 10px var(--space-md); border-bottom: 1px solid var(--border); }
.ev .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ev .who { color: var(--accent); font-size: 13px; }
.ev .ts  { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.ev .act { font-size: 13px; color: var(--text); }
.ev .diff { color: var(--text-3); font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.ev .diff b { color: var(--text); font-weight: 500; }
.ev .tag {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase;
  letter-spacing: .05em; padding: 1px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); color: var(--text-3);
}
.ev-empty { padding: var(--space-lg); text-align: center; color: var(--text-3); font-size: 13px; }
.drawer-chip.active { background: var(--accent); color: var(--white); border-color: var(--accent); }
