/* ── Tokens ───────────────────────────────────────────────────────────── */

:root,
[data-theme="dark"] {
  --background: #0a0b0f;
  --surface: #12141a;
  --surface-2: #1a1d26;
  --surface-3: #232733;
  --border: #262a35;
  --border-strong: #6e7485;
  --foreground: #e8eaed;
  --muted: #8a8f9a;
  --accent: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #facc15;
  --scrollbar-thumb: rgba(180, 190, 210, .22);
  --scrollbar-thumb-hover: rgba(180, 190, 210, .45);
}

[data-theme="light"] {
  --background: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e7eaef;
  --border: #e2e5ea;
  --border-strong: #9aa1ad;
  --foreground: #1a1d26;
  --muted: #5a6271;
  --accent: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #ca8a04;
  --scrollbar-thumb: rgba(80, 90, 110, .22);
  --scrollbar-thumb-hover: rgba(80, 90, 110, .42);
}

@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --background: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --surface-3: #e7eaef;
    --border: #e2e5ea;
    --border-strong: #9aa1ad;
    --foreground: #1a1d26;
    --muted: #5a6271;
    --accent: #2563eb;
    --green: #16a34a;
    --red: #dc2626;
    --yellow: #ca8a04;
    --scrollbar-thumb: rgba(80, 90, 110, .22);
    --scrollbar-thumb-hover: rgba(80, 90, 110, .42);
  }
}

/* ── Custom scrollbars (themed) ────────────────────────────────────────
 * Firefox: scrollbar-width / scrollbar-color (native, limited control).
 * WebKit (Chrome/Edge/Brave/Opera/Safari): ::-webkit-scrollbar pseudo-
 * elements for full styling. The thumb uses background-clip: padding-box
 * with a transparent border so it visually shrinks away from the track
 * edges — feels modern, doesn't fight with content.
 * ──────────────────────────────────────────────────────────────────── */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 120ms;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }
/* Firefox honours the scroll area but won't render arrows; no extra
 * rules needed. We keep the same thin appearance everywhere. */

/* ── Base ─────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

:root {
  /* Design tokens layered in by js/theme.js — fall back to sensible
     defaults when the user hasn't picked a preset/font/radius yet. */
  --pm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --pm-radius-card: 12px;
  --pm-radius-ctrl: 8px;
  --pm-radius-pill: 999px;
}

html, body {
  background: var(--background);
  color: var(--foreground);
  margin: 0;
  font-family: var(--pm-font);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 .5rem 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute; left: .5rem; top: .5rem; z-index: 200;
  background: var(--accent); color: white; padding: .5rem .875rem; border-radius: 6px;
  font-weight: 600; transform: translateY(-200%); transition: transform .15s;
}
.skip-link:focus { transform: translateY(0); }

hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Card / button / input — matched to stock-analysis ────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--pm-radius-card);
}
.card-hover { transition: border-color .15s, background .15s; }
.card-hover:hover { border-color: var(--border-strong); background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem; padding: .5rem .875rem; min-height: 2.25rem;
  border-radius: var(--pm-radius-ctrl); font-size: .875rem; font-weight: 500;
  border: 1px solid var(--accent); background: var(--surface);
  color: var(--foreground); cursor: pointer;
  transition: all .15s; text-decoration: none;
}
.btn:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, white); border-color: var(--accent); }
.btn-danger { color: var(--red); border-color: var(--red); background: var(--surface); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 12%, var(--surface)); }

.icon-btn {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: .25rem .5rem; border-radius: 6px; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--foreground); }

.input, select.input, textarea.input {
  width: 100%; padding: .5rem .75rem; min-height: 2.25rem;
  border-radius: var(--pm-radius-ctrl); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--foreground);
  font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 5rem; resize: vertical; font-family: inherit; }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.input.large { font-size: 1.1rem; padding: .75rem; }

.badge {
  display: inline-flex; align-items: center;
  padding: .15rem .5rem; border-radius: 6px;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase;
}
.badge-folder { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); text-transform: none; }
.badge-tag { background: var(--surface-3); color: var(--muted); text-transform: none; }
.badge-warn { background: color-mix(in srgb, var(--yellow) 18%, transparent); color: var(--yellow); text-transform: none; }

.callout {
  padding: .75rem 1rem; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--foreground); margin: .5rem 0; font-size: .875rem;
}

/* ── Auth screens ─────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2rem 1rem;
  background:
    radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--accent) 16%, transparent) 0, transparent 40%),
    radial-gradient(circle at 80% 90%, color-mix(in srgb, var(--accent) 10%, transparent) 0, transparent 40%),
    var(--background);
}
.auth-card {
  width: 100%; max-width: 420px; padding: 1.75rem;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,.4);
}
.auth-title { font-size: 1.5rem; margin-top: .25rem; }
.auth-sub { margin-bottom: 1rem; }
.auth-foot { margin-top: 1.25rem; font-size: .75rem; color: var(--muted); }
.auth-switch { font-size: .8rem; margin-top: .5rem; }
.auth-hint { font-size: .75rem; margin-top: .25rem; }

.brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 600; letter-spacing: -0.01em; margin-bottom: .75rem;
}
.brand-mark { font-size: 1.25rem; }
.brand-name { font-size: 1rem; }

.strength-0 { color: var(--red); }
.strength-1 { color: var(--yellow); }
.strength-2 { color: #facc15; }
.strength-3 { color: var(--green); }
.strength-4 { color: var(--green); }

/* ── App shell ────────────────────────────────────────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 1rem; padding: .75rem 1rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-search { max-width: 420px; }
.nav-actions { display: flex; gap: .5rem; }

.app-main {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 1rem; padding: 1rem; max-width: 1400px; margin: 0 auto;
}
@media (max-width: 768px) {
  .app-main { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */

.sidebar {
  padding: .75rem; align-self: start;
  position: sticky; top: 4.5rem;
  max-height: calc(100vh - 5.5rem); overflow-y: auto;
}
.sidebar-section { margin-bottom: 1rem; }
.sidebar-title {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: .25rem .5rem; margin-bottom: .25rem;
}
.sidebar-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: .4rem .6rem; border: 0; background: transparent; color: var(--foreground);
  border-radius: 6px; cursor: pointer; font: inherit; text-align: left;
  transition: background .12s;
}
.sidebar-item:hover { background: var(--surface-2); }
.sidebar-item.is-active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.sidebar-item .count { font-size: .75rem; color: var(--muted); }
.sidebar-item.is-active .count { color: var(--accent); }

/* ── Content ──────────────────────────────────────────────────────────── */

.content { min-width: 0; }
.content-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: .25rem 0 .75rem 0; gap: 1rem;
}
.content-title { font-size: 1.25rem; }

.empty { padding: 2rem; text-align: center; }

.entry-list { display: grid; grid-template-columns: 1fr; gap: .5rem; }

.entry {
  display: grid;
  /* Four columns since the bulk-select feature added a hover-revealed
     checkbox in slot 1: select | favicon | main (flexes) | actions. */
  grid-template-columns: auto auto 1fr auto;
  align-items: center; gap: 1rem; padding: .75rem 1rem;
  cursor: pointer; min-width: 0;
}
.entry-icon { font-size: 1.5rem; width: 2.25rem; text-align: center; }
.entry-main { min-width: 0; }
.entry-title {
  font-weight: 600; display: flex; gap: .5rem; align-items: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entry-sub { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-tags { display: flex; gap: .25rem; flex-wrap: wrap; margin-top: .25rem; }
.entry-actions { display: flex; gap: .25rem; }
.star { font-size: .85em; }

/* ── Modal ────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; overflow-y: auto;
}
.modal-dialog {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--pm-radius-card);
  width: 100%; max-width: 480px; max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .55);
}
.modal-wide { max-width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem .5rem;
}
.modal-title { font-size: 1rem; }
.modal-body { padding: .5rem 1rem 1rem; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .75rem 1rem; border-top: 1px solid var(--border);
}

/* ── Forms ────────────────────────────────────────────────────────────── */

.form, .editor-fields { display: flex; flex-direction: column; gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; color: var(--muted);
}
.field-help { font-size: .75rem; color: var(--muted); }
.inline-actions { display: flex; gap: .25rem; align-items: center; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .875rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; }

.type-bar { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: .5rem; }
.type-pill {
  padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .8rem; cursor: pointer;
}
.type-pill:hover { color: var(--foreground); }
.type-pill.is-active {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: var(--accent); color: var(--accent);
}

.strength-bar {
  width: 100%; height: 4px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.strength-fill {
  height: 100%; width: 0; transition: width .15s, background .15s;
}
.strength-fill[data-score="0"] { background: var(--red); }
.strength-fill[data-score="1"] { background: var(--red); }
.strength-fill[data-score="2"] { background: var(--yellow); }
.strength-fill[data-score="3"] { background: #84cc16; }
.strength-fill[data-score="4"] { background: var(--green); }

.totp { font-size: 1.15rem; letter-spacing: .1em; padding: .15rem .35rem; background: var(--surface-2); border-radius: 6px; }

.cf-row {
  display: grid; grid-template-columns: 1fr 1fr 8rem auto; gap: .5rem;
  align-items: center; margin-bottom: .25rem;
}
@media (max-width: 600px) { .cf-row { grid-template-columns: 1fr; } }

.custom-fields { display: flex; flex-direction: column; gap: .25rem; }

/* ── Toast ────────────────────────────────────────────────────────────── */

.toast-host {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 200;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  padding: .6rem .9rem; border-radius: 8px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.4);
  pointer-events: auto;
  animation: toast-in .2s ease-out;
  max-width: 320px; font-size: .85rem;
}
.toast-error { border-color: var(--red); color: var(--red); }
.toast-leave { opacity: 0; transition: opacity .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Spinner / blocker ────────────────────────────────────────────────── */

.spinner {
  display: inline-block; width: 1.25rem; height: 1.25rem;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.blocker {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.blocker-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.25rem 1.75rem; display: flex; gap: .75rem; align-items: center;
}

/* ── Audit ────────────────────────────────────────────────────────────── */

.audit, .audit-log { display: flex; flex-direction: column; gap: .5rem; }
.audit-list { display: flex; flex-direction: column; gap: .25rem; }
.audit-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: .75rem; align-items: center;
  padding: .5rem .75rem; border-radius: 8px; background: var(--surface-2);
}
.audit-log .audit-row { grid-template-columns: 12rem 1fr; font-size: .85rem; }

/* ── Generator ────────────────────────────────────────────────────────── */

.generator { display: flex; flex-direction: column; gap: .75rem; }
.gen-opts { display: flex; flex-direction: column; gap: .5rem; }

/* ── Picker (autofill bookmarklet popup) ──────────────────────────────── */

.picker-card {
  max-width: 460px;
  padding: 1.5rem;
}
.picker-list {
  display: flex; flex-direction: column;
  gap: .35rem; margin-top: .75rem;
  max-height: 50vh; overflow-y: auto;
  padding-right: .25rem;
}
.picker-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: .75rem; align-items: center;
  padding: .6rem .75rem; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color .12s, background .12s;
}
.picker-row:hover { border-color: var(--accent); background: var(--surface-3); }
.picker-row-main { min-width: 0; }
.picker-row-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-row-main .muted { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Accessibility tweaks ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* High-contrast: respected via system preference. Increases border weight
   and removes color-mix translucency on key surfaces so focus is always
   clearly visible. */
@media (prefers-contrast: more) {
  .btn, .input, .card, .modal-dialog, .palette-card { border-width: 2px; }
  .sidebar-item.is-active { background: var(--accent); color: white; }
}

/* ── Density modes ────────────────────────────────────────────────────── */

[data-density="compact"] .entry { padding: .4rem .75rem; gap: .6rem; }
[data-density="compact"] .entry-icon { width: 1.7rem; font-size: 1.2rem; }
[data-density="compact"] .entry-tags { display: none; }
[data-density="compact"] .entry-sub { font-size: .75rem; }

/* ── Favicons ─────────────────────────────────────────────────────────── */

.entry-favicon {
  width: 28px; height: 28px; border-radius: 6px; display: block;
}
[data-density="compact"] .entry-favicon { width: 22px; height: 22px; }

/* ── Bulk selection ───────────────────────────────────────────────────── */

.entry-select {
  display: flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; cursor: pointer; opacity: 0;
  transition: opacity .12s;
}
.entry:hover .entry-select,
.entry.is-selected .entry-select,
.entry-select:focus-within { opacity: 1; }
.entry.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.entry-check {
  width: 1.1rem; height: 1.1rem; cursor: pointer;
  accent-color: var(--accent);
}
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .6rem 1rem; margin-bottom: .75rem;
  border-radius: 8px; background: var(--surface);
  border: 1px solid var(--accent);
  position: sticky; top: 4.25rem; z-index: 30;
}

/* ── Sync badge ───────────────────────────────────────────────────────── */

.sync-badge {
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  padding: .15rem .5rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.sync-badge.sync-synced { color: var(--green); }
.sync-badge.sync-syncing { color: var(--yellow); }
.sync-badge.sync-offline { color: var(--red); }
.sync-badge.sync-local { color: var(--accent); }

/* ── Language switcher ────────────────────────────────────────────────── */

.lang-switcher {
  display: flex; gap: .25rem; justify-content: center;
  margin-top: 1rem; font-size: .75rem;
}
.lang-btn {
  background: transparent; border: 0; color: var(--muted);
  cursor: pointer; padding: .25rem .5rem; border-radius: 6px;
  font: inherit;
}
.lang-btn:hover { color: var(--foreground); background: var(--surface-2); }
.lang-btn.is-active { color: var(--accent); font-weight: 600; }

/* ── Empty states ─────────────────────────────────────────────────────── */

.empty-icon { font-size: 2.5rem; margin-bottom: .25rem; opacity: .5; }

/* ── Command palette ──────────────────────────────────────────────────── */

.palette-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh; padding-left: 1rem; padding-right: 1rem;
}
.palette-card {
  width: 100%; max-width: 640px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 30px 80px -10px rgba(0,0,0,.5);
  display: flex; flex-direction: column;
  max-height: 70vh; overflow: hidden;
}
.palette-search {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
}
.palette-mark {
  font-size: .7rem; padding: .15rem .4rem; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); font-weight: 700;
}
.palette-search .input { border: 0; padding: 0; min-height: 1.75rem; }
.palette-search .input:focus { box-shadow: none; }
.palette-list {
  overflow-y: auto; padding: .25rem;
}
.palette-empty { padding: 1rem; text-align: center; }
.palette-group {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: .35rem .5rem .15rem;
}
.palette-row {
  width: 100%; display: flex; align-items: center; gap: .75rem;
  padding: .5rem .75rem; background: transparent;
  border: 0; border-radius: 8px; color: var(--foreground);
  cursor: pointer; font: inherit; text-align: left;
}
.palette-row.is-selected { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.palette-icon {
  width: 1.5rem; text-align: center; font-size: 1rem; opacity: .8;
}
.palette-text { display: flex; flex-direction: column; min-width: 0; }
.palette-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-sub { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-foot {
  display: flex; gap: .25rem; align-items: center; flex-wrap: wrap;
  padding: .5rem .75rem; border-top: 1px solid var(--border);
  font-size: .7rem;
}

/* ── Keyboard hint chips ──────────────────────────────────────────────── */

.kbd {
  display: inline-block; padding: .1rem .4rem;
  border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--surface-2); color: var(--foreground);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: .75rem; line-height: 1;
}

/* ── Help overlay ─────────────────────────────────────────────────────── */

.help-body { display: flex; flex-direction: column; gap: 1rem; }
.help-section h3 { font-size: .85rem; margin-bottom: .25rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.help-table { width: 100%; border-collapse: collapse; }
.help-table td { padding: .25rem .5rem; vertical-align: middle; }
.help-table td:first-child { white-space: nowrap; display: flex; gap: .25rem; }

/* ── User-docs modal (?-button) ───────────────────────────────────────── */

.modal-dialog.modal-wide:has(.docs-shell) { max-width: 960px; }
.docs-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  min-height: 60vh;
}
.docs-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: .25rem;
  border-right: 1px solid var(--border);
  align-self: stretch;
  overflow-y: auto;
  max-height: 70vh;
}
.docs-nav-btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem;
  background: transparent; color: var(--foreground);
  border: 0; border-radius: 6px;
  font: inherit; font-size: .85rem; text-align: left;
  cursor: pointer;
  transition: background 100ms;
}
.docs-nav-btn:hover { background: var(--surface-2); }
.docs-nav-btn.active { background: var(--accent); color: #fff; }
.docs-nav-icon { font-size: 1rem; flex-shrink: 0; }

.docs-content {
  overflow-y: auto;
  max-height: 70vh;
  padding: 0 .5rem 1rem 0;
  line-height: 1.55;
}
.docs-content .docs-section { display: flex; flex-direction: column; gap: .5rem; }
.docs-content .docs-h {
  font-size: 1.1rem; margin: 0 0 .25rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
}
.docs-content .docs-sub {
  font-size: .92rem; margin: .75rem 0 .15rem;
  color: var(--foreground); font-weight: 600;
}
.docs-content p { margin: .25rem 0; }
.docs-content .docs-list { margin: .25rem 0 .5rem; padding-left: 1.4rem; }
.docs-content .docs-list li { margin: .25rem 0; }
.docs-content code.mono {
  background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px;
  font-size: .82rem;
}
.docs-content .help-table { margin: .25rem 0; }
.docs-content .help-table td { padding: .35rem .5rem; }
.docs-faq {
  margin: .35rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.docs-faq summary {
  cursor: pointer;
  padding: .55rem .75rem;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 1.75rem;
}
.docs-faq summary::after {
  content: '▸';
  position: absolute; right: .75rem; top: 50%;
  transform: translateY(-50%);
  transition: transform 120ms;
  color: var(--muted);
}
.docs-faq[open] summary::after { transform: translateY(-50%) rotate(90deg); }
.docs-faq-body {
  padding: 0 .75rem .65rem;
  border-top: 1px solid var(--border);
}
.docs-faq-body > p:first-child { margin-top: .5rem; }

@media (max-width: 720px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-nav {
    flex-direction: row; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--border);
    max-height: none;
  }
  .docs-nav-btn { flex: 0 0 auto; font-size: .78rem; }
}

/* ── Admin panel ──────────────────────────────────────────────────────── */

.modal-dialog.modal-wide:has(.admin-shell) { max-width: 1080px; }

.admin-shell {
  display: flex; flex-direction: column;
  min-height: 60vh;
  gap: .5rem;
}
.admin-tabs {
  display: flex; gap: 2px;
  padding: .25rem;
  border-bottom: 1px solid var(--border);
}
.admin-tab-btn {
  display: flex; align-items: center; gap: .35rem;
  padding: .45rem .8rem;
  background: transparent; color: var(--foreground);
  border: 0; border-radius: 6px;
  font: inherit; font-size: .85rem;
  cursor: pointer;
  transition: background 100ms;
}
.admin-tab-btn:hover { background: var(--surface-2); }
.admin-tab-btn.active { background: var(--accent); color: #fff; }
.admin-content {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: 70vh;
  padding: .5rem .25rem;
}
.admin-tab-pane { display: flex; flex-direction: column; gap: .75rem; }

.admin-h {
  font-size: 1rem; margin: .75rem 0 .25rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--border);
}
.admin-sub { font-size: .9rem; margin: .5rem 0 .25rem; font-weight: 600; }

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .5rem;
}
.admin-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .75rem;
}
.admin-stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.admin-stat-label { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.admin-stat-hint { font-size: .7rem; margin-top: .15rem; }

.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}
.admin-table th, .admin-table td {
  padding: .4rem .55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-size: .75rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
  background: var(--surface-2);
}
.admin-table tbody tr:hover { background: var(--surface-2); }

.admin-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.admin-pill.ok       { background: rgba(34, 197, 94, .15);  color: #4ade80; }
.admin-pill.warn     { background: rgba(250, 204, 21, .15); color: #facc15; }
.admin-pill.bad      { background: rgba(239, 68, 68, .15);  color: #f87171; }
.admin-pill.neutral  { background: rgba(180, 190, 210, .15); color: var(--muted); }

.admin-toolbar {
  display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.admin-toolbar .input { flex: 1 1 240px; min-width: 180px; }

.admin-row-actions { display: flex; gap: .25rem; flex-wrap: wrap; }
.admin-row-actions .btn { padding: .25rem .55rem; font-size: .78rem; }

.admin-shard-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .8rem;
  margin-bottom: .4rem;
}
.admin-shard-head {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .25rem;
}

.admin-phases {
  display: flex; flex-direction: column;
  gap: .65rem;
  margin-top: .5rem;
}
.admin-cmd {
  background: var(--surface-3, var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .5rem .65rem;
  font: 0.8rem ui-monospace, SFMono-Regular, monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  margin: .25rem 0;
}

/* Filter chips, bulk bar, detail view, audit-flash, sparkline */
.admin-filter-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .78rem;
  color: var(--muted);
}
.admin-filter-chip .input { padding: 2px 6px; font-size: .78rem; }

.admin-bulk-bar {
  display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap;
  padding: .5rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  margin: .25rem 0 .5rem;
}
.admin-bulk-bar .btn { padding: .3rem .65rem; font-size: .8rem; }

.admin-user-detail { display: flex; flex-direction: column; gap: .5rem; }
.admin-detail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.admin-detail-ts { display: flex; gap: 1.25rem; font-size: .85rem; flex-wrap: wrap; }
.admin-detail-kv {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 4px 12px; font-size: .82rem;
}
.admin-detail-kv dt { color: var(--muted); font-weight: 600; }
.admin-detail-kv dd { margin: 0; font-family: ui-monospace, SFMono-Regular, monospace; }

@keyframes admin-flash {
  0%   { background: rgba(59, 130, 246, .35); }
  100% { background: transparent; }
}
tr.admin-audit-flash { animation: admin-flash 1.5s ease-out; }

.admin-spark { color: var(--accent); display: block; }

/* Mail-templates editor — two-column layout: list left, editor right */
.admin-mail-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: .75rem;
  align-items: start;
}
.admin-mail-list {
  display: flex; flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  padding-right: .5rem;
}
.admin-mail-list-btn {
  text-align: left;
  padding: .5rem .65rem;
  background: transparent; color: var(--foreground);
  border: 0; border-radius: 6px;
  cursor: pointer;
  font: inherit; font-size: .85rem;
  display: flex; flex-direction: column; gap: 2px;
  transition: background 100ms;
}
.admin-mail-list-btn:hover { background: var(--surface-2); }
.admin-mail-list-btn.active { background: var(--accent); color: #fff; }
.admin-mail-list-btn.active .admin-pill { background: rgba(255,255,255,.18); color: #fff; }
.admin-mail-list-label { font-weight: 600; }
.admin-mail-list-meta { font-size: .72rem; }

.admin-mail-editor { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.admin-mail-html {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: .82rem;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
  min-height: 220px;
}
.admin-mail-placeholders {
  display: flex; flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: .25rem 0 .35rem;
}
.admin-mail-placeholder {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: .75rem;
  cursor: pointer;
  color: var(--accent);
  transition: background 100ms;
}
.admin-mail-placeholder:hover { background: var(--accent); color: #fff; }

@media (max-width: 720px) {
  .admin-mail-shell { grid-template-columns: 1fr; }
  .admin-mail-list { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: .5rem; }
  .admin-mail-list-btn { flex: 0 0 auto; }
}

/* ── Recovery code display ────────────────────────────────────────────── */

.recovery-code {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding: 1rem; background: var(--surface-2);
  border: 2px dashed var(--accent); border-radius: 12px;
  font-size: 1.4rem; font-weight: 700; letter-spacing: .15em;
  text-align: center; justify-content: center;
}
.recovery-group {
  display: inline-block; padding: .25rem .5rem;
  background: var(--surface); border-radius: 6px;
}

/* ── Sessions ─────────────────────────────────────────────────────────── */

.session-row.is-current {
  border-left: 3px solid var(--accent);
}

/* ── Health dashboard ─────────────────────────────────────────────────── */

.health { display: flex; flex-direction: column; gap: .75rem; }
.health-score {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.score-ring {
  width: 4.5rem; height: 4.5rem; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 1.4rem; line-height: 1;
  border: 4px solid var(--green);
}
.score-ring strong { font-size: 1.5rem; }
.score-ring span { font-size: .65rem; color: var(--muted); }
.score-excellent { border-color: var(--green); color: var(--green); }
.score-good { border-color: #84cc16; color: #84cc16; }
.score-fair { border-color: var(--yellow); color: var(--yellow); }
.score-poor { border-color: var(--red); color: var(--red); }
.health-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .5rem;
}
.health-stat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: .6rem; text-align: center;
}
.health-stat.is-issue .health-num { color: var(--yellow); }
.health-num { font-size: 1.5rem; font-weight: 700; }

/* ── Generator history ────────────────────────────────────────────────── */

.gen-history {
  display: flex; flex-direction: column; gap: .25rem;
  max-height: 14rem; overflow-y: auto;
}
.gen-history-row {
  grid-template-columns: 1fr auto auto auto;
}

/* ── Custom-icon rendering ───────────────────────────────────────────── */

.entry-icon-emoji {
  font-size: 1.5rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
}
.entry-icon-color {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 6px;
  font-weight: 700; color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
  font-size: .9rem;
}

/* Editor name row + icon picker button */
.editor-name-row {
  display: flex; gap: .5rem; align-items: stretch;
}
.icon-picker-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; min-height: 2.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--pm-radius-ctrl);
  cursor: pointer;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.icon-picker-btn:hover { background: var(--surface-3); }

.icon-picker-pop {
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--pm-radius-card);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.4);
  padding: .75rem;
  width: 280px;
}
.icon-picker-section-title {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: .25rem 0;
}
.icon-picker-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem;
  margin-bottom: .5rem;
}
.icon-picker-cell {
  background: transparent; border: 1px solid transparent; cursor: pointer;
  font-size: 1.2rem; padding: .25rem;
  border-radius: 6px;
}
.icon-picker-cell:hover { background: var(--surface-2); border-color: var(--border); }
.icon-picker-colors { grid-template-columns: repeat(7, 1fr); }
.icon-picker-color {
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer;
}
.icon-picker-color:hover { transform: scale(1.1); border-color: var(--accent); }

/* ── Hover-Preview tooltip ───────────────────────────────────────────── */

.hover-preview {
  position: fixed; z-index: 250;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--pm-radius-card);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.5);
  padding: .75rem 1rem;
  max-width: 360px;
  pointer-events: none;
  font-size: .85rem;
  line-height: 1.5;
  display: flex; flex-direction: column; gap: .15rem;
  animation: hover-preview-in .14s ease-out;
}
@keyframes hover-preview-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.hover-title { font-size: .95rem; }
.hover-notes { white-space: pre-wrap; max-height: 6rem; overflow: hidden; }
.hover-tags { display: flex; gap: .25rem; flex-wrap: wrap; margin-top: .35rem; }

/* ── Did-you-mean ────────────────────────────────────────────────────── */

.didyoumean {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-top: 1rem;
  padding: .5rem .75rem;
  border-radius: var(--pm-radius-ctrl);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border));
}

/* ── Mobile swipe gestures ───────────────────────────────────────────── */

.entry {
  position: relative;
  transition: transform .12s, background .12s;
  touch-action: pan-y;     /* allow vertical scroll, swallow horizontal */
}
.entry.swipe-right { background: color-mix(in srgb, var(--green) 14%, var(--surface)); }
.entry.swipe-left  { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }

/* ── Bottom-sheet modal on small viewports ───────────────────────────── */

@media (max-width: 600px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-dialog {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    animation: bottom-sheet-up .18s ease-out;
  }
  @keyframes bottom-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}

/* ── Onboarding tour overlay ─────────────────────────────────────────── */

.tour-overlay {
  position: fixed; inset: 0;
  z-index: 350;
  pointer-events: none;
}
.tour-panel {
  position: fixed;
  background: rgba(0,0,0,.55);
  pointer-events: auto;
}
.tour-ring {
  position: fixed;
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.0), 0 0 24px color-mix(in srgb, var(--accent) 60%, transparent);
  pointer-events: none;
}
.tour-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--pm-radius-card);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.5);
  padding: 1rem;
  width: 320px; max-width: calc(100vw - 16px);
  pointer-events: auto;
}
.tour-card h3 { margin-bottom: .5rem; font-size: 1rem; }
.tour-card p { margin-bottom: .75rem; }
.tour-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: .5rem;
}

/* ── Changelog ───────────────────────────────────────────────────────── */

.changelog-version { margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.changelog-version:last-child { border-bottom: 0; }
.changelog-version.is-unseen { background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 8px; padding: .5rem .75rem; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.changelog-list { list-style: none; padding-left: 0; margin: 0; }
.changelog-item {
  display: flex; gap: .5rem; align-items: baseline;
  padding: .25rem 0;
  font-size: .9rem;
}
.changelog-tag {
  display: inline-block; padding: .1rem .45rem; border-radius: 999px;
  font-size: .65rem; text-transform: uppercase; font-weight: 700;
  background: var(--surface-2); color: var(--muted); flex-shrink: 0;
}
.changelog-tag-new       .changelog-tag { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.changelog-tag-fix       .changelog-tag { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.changelog-tag-security  .changelog-tag { background: color-mix(in srgb, var(--yellow) 18%, transparent); color: var(--yellow); }
.changelog-tag-breaking  .changelog-tag { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }

/* ── Favorites-Bar ───────────────────────────────────────────────────── */

.favorites-bar {
  display: flex; gap: .5rem;
  overflow-x: auto;
  padding: .25rem .25rem .5rem;
  margin-bottom: .5rem;
  scrollbar-width: thin;
}
.fav-chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--pm-radius-pill);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .12s, transform .12s;
  font: inherit; color: var(--foreground);
}
.fav-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.fav-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fav-chip-icon { width: 20px; height: 20px; border-radius: 4px; display: block; flex-shrink: 0; }
.fav-chip-label { font-size: .85rem; max-width: 8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-chip-actions { display: flex; gap: .15rem; }
.fav-chip-btn {
  background: transparent; border: 0; cursor: pointer;
  padding: .15rem .35rem; border-radius: 4px;
  font-size: .85rem;
}
.fav-chip-btn:hover { background: var(--surface-2); }

/* ── Toast action button ─────────────────────────────────────────────── */

.toast { display: flex; align-items: center; gap: .75rem; }
.toast-msg { flex: 1; }
.toast-action {
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); cursor: pointer;
  padding: .2rem .55rem; border-radius: var(--pm-radius-ctrl);
  font: inherit; font-weight: 600;
}
.toast-action:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ── Account picker popover ──────────────────────────────────────────── */

.account-picker {
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--pm-radius-card);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.4);
  min-width: 220px;
  padding: .25rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.account-picker-row {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: .5rem .75rem;
  background: transparent; border: 0; cursor: pointer;
  border-radius: var(--pm-radius-ctrl);
  font: inherit; color: var(--foreground); text-align: left;
}
.account-picker-row:hover { background: var(--surface-2); }
.account-picker-row strong { font-size: .9rem; }

/* ── Multi-account editor block ──────────────────────────────────────── */

.multiacc-block {
  border: 1px solid var(--border);
  border-radius: var(--pm-radius-card);
  padding: .5rem;
  background: var(--surface-2);
}
.multiacc-tabs { margin-bottom: .5rem; }

/* ── Smart-paste banner (entry editor) ──────────────────────────────── */

.paste-strip {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .75rem; margin: .25rem 0 .5rem;
  border-radius: var(--pm-radius-ctrl);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
}
.paste-icon { font-size: 1.25rem; flex-shrink: 0; }
.paste-text { flex: 1; min-width: 0; }
.paste-text .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Drag & drop visuals ────────────────────────────────────────────── */

body.pm-dragging { cursor: grabbing; }
body.pm-dragging .entry { cursor: grabbing; }
.sidebar-item.is-drop-target {
  background: color-mix(in srgb, var(--accent) 22%, transparent) !important;
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* ── Inline-rename input in sidebar ─────────────────────────────────── */

.sidebar-rename-input {
  width: 100%;
  padding: .25rem .5rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--foreground);
  font: inherit;
  outline: none;
}

/* ── Rotation badges + policy grid ──────────────────────────────────── */

.badge-rotation {
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  transition: transform .12s;
}
.badge-rotation:hover { transform: translateY(-1px); }
.badge-rotation-soon {
  background: color-mix(in srgb, var(--yellow) 18%, transparent);
  color: var(--yellow);
  border-color: color-mix(in srgb, var(--yellow) 40%, transparent);
}
.badge-rotation-overdue {
  background: color-mix(in srgb, var(--red) 18%, transparent);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
}

.rotation-policy-grid {
  display: flex; flex-direction: column;
  gap: .25rem;
  max-height: 60vh; overflow-y: auto;
}
.rotation-policy-row {
  display: grid;
  grid-template-columns: 1fr 6rem auto;
  gap: .5rem;
  align-items: center;
  padding: .25rem 0;
}
.rotation-policy-tag {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--accent);
}

.panic-list {
  margin: .5rem 0;
  padding-left: 1.25rem;
  font-size: .85rem;
}
.panic-list li { margin-bottom: .15rem; }

/* ── Assistant suggestion chips ──────────────────────────────────────── */

.suggestions-strip,
.note-facts {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .35rem; margin: .5rem 0;
  padding: .25rem .5rem; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
}
.suggestions-mark {
  font-size: 1rem;
  margin-right: .15rem;
}
.suggestions-chip {
  min-height: 1.75rem; padding: .15rem .5rem;
  font-size: .8rem;
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border-strong));
  background: var(--surface);
  color: var(--accent);
}
.suggestions-chip:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

/* ── Natural-search toggle ───────────────────────────────────────────── */

.nav-search-wrap {
  display: flex; align-items: center; gap: .25rem;
  max-width: 520px; flex: 1;
}
.nav-search-mode {
  font-size: 1rem; opacity: .55;
  border: 1px solid var(--border); border-radius: 6px;
  padding: .35rem .5rem;
}
.nav-search-mode.is-active {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.assistant-insights section h3 { margin-bottom: .35rem; font-size: .95rem; }

/* ── LLM chat ────────────────────────────────────────────────────────── */

.llm-chat {
  display: flex; flex-direction: column;
  gap: .5rem;
  min-height: 50vh;
}
.llm-chat-messages {
  flex: 1;
  display: flex; flex-direction: column; gap: .5rem;
  overflow-y: auto;
  max-height: 50vh;
  padding: .5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.llm-msg {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .5rem .75rem;
  border-radius: 8px;
  max-width: 85%;
  white-space: pre-wrap;
  word-break: break-word;
}
.llm-msg-role {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.llm-msg-user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
}
.llm-msg-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
}
.llm-chat-options {
  display: flex; gap: 1rem; flex-wrap: wrap;
  font-size: .8rem;
}
.llm-chat-input {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .5rem;
  align-items: end;
}
.llm-chat-input textarea { resize: vertical; }

.llm-models { display: flex; flex-direction: column; gap: .5rem; }

/* ── Settings: tabs + panel + design controls ───────────────────────── */

.settings-shell {
  display: grid;
  grid-template-columns: minmax(160px, 200px) 1fr;
  gap: 1rem;
  min-height: 60vh;
}
@media (max-width: 720px) {
  .settings-shell { grid-template-columns: 1fr; }
}

.settings-tabs {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .25rem;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--pm-radius-ctrl);
}
@media (max-width: 720px) {
  .settings-tabs { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
}

.settings-tab {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font: inherit; text-align: left;
  border-radius: var(--pm-radius-ctrl);
  transition: background .12s, color .12s;
}
.settings-tab:hover { color: var(--foreground); background: var(--surface-3); }
.settings-tab.is-active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.settings-tab-icon { font-size: 1rem; width: 1.2rem; text-align: center; }

.settings-panel {
  padding: 0 .25rem;
  overflow-y: auto;
  max-height: 70vh;
}

.settings-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.settings-block:last-child { border-bottom: 0; }
.settings-block h3 { font-size: .9rem; margin-bottom: .35rem; }
.settings-block p { margin-bottom: .5rem; }

/* ── Theme preset gallery ─────────────────────────────────────────────── */

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .5rem;
  margin-top: .25rem;
}
.preset-swatch {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  height: 4.5rem; padding: .5rem;
  border: 2px solid transparent;
  border-radius: var(--pm-radius-ctrl);
  cursor: pointer;
  font: inherit; color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  transition: border-color .12s, transform .12s;
}
.preset-swatch:hover { transform: translateY(-1px); }
.preset-swatch.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.preset-dot {
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4);
}
.preset-label { font-size: .8rem; font-weight: 600; }

/* ── Custom CSS textarea ─────────────────────────────────────────────── */

.custom-css { margin-top: 1rem; }
.custom-css summary { cursor: pointer; font-weight: 600; }
.custom-css textarea { margin-top: .5rem; min-height: 8rem; }

/* ── Domain reputation badge ─────────────────────────────────────────── */

.domain-rep { margin-top: .25rem; font-size: .75rem; }
.domain-rep-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .7rem;
  text-transform: none;
  letter-spacing: 0;
}
.domain-rep-established { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.domain-rep-recent      { background: var(--surface-2); color: var(--muted); }
.domain-rep-new         { background: color-mix(in srgb, var(--yellow) 18%, transparent); color: var(--yellow); }
.domain-rep-unknown     { background: var(--surface-2); color: var(--muted); }
.domain-rep-unreachable { background: color-mix(in srgb, var(--yellow) 20%, transparent); color: var(--yellow); }
.domain-rep-dead        { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }

/* ── Phishing lookalike warning ──────────────────────────────────────── */

.phishing-warn {
  border-color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 10%, var(--surface));
}
.phishing-warn.phishing-high {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
}
.phishing-warn p { margin: .25rem 0; }
.phishing-inline {
  color: var(--red);
  font-weight: 600;
}

/* ── Travel selection list (checkboxes) ──────────────────────────────── */

.travel-pick { display: flex; flex-direction: column; gap: .35rem; }

/* ── Screenshot / app-switcher guard ─────────────────────────────────── */

.screenshot-guard {
  position: fixed; inset: 0; z-index: 999;
  background: var(--background);
  display: none;
  align-items: center; justify-content: center;
  /* The OS captures whatever's painted at the moment the app suspends.
     A solid color + lock glyph beats trying to blur the previous frame
     (which can be racy on iOS). */
}
.screenshot-guard.is-active { display: flex; }
.screenshot-guard-inner {
  font-size: 4rem; opacity: .3;
}

/* ── Print ─────────────────────────────────────────────────────────────── */

@media print {
  .nav, .sidebar, .modal-overlay, .toast-host, .palette-overlay { display: none !important; }
  body { background: white !important; color: black !important; }
}
