:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1114;
  --surface: #181c22;
  --surface-2: #141820;
  --border: #2a313c;
  --text: #e8eaed;
  --muted: #8b949e;
  --accent: #a855f7;
  --accent-hover: #9333ea;
  --accent-soft: rgba(168, 85, 247, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --hover-bg: #1f2937;
  --input-bg: #0d0d0d;
  --sidebar-bg: #0a0c0f;
  --sidebar-text: #e5e7eb;
  --sidebar-hover: #1f2937;
  --body-gradient: radial-gradient(ellipse 100% 60% at 50% -10%, #2e106555, var(--bg));
  --modal-overlay: rgba(8, 10, 12, 0.75);
  --radius: 16px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --panel: #181c22;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e2e6ec;
  --text: #1a1d23;
  --muted: #5b6573;
  --accent: #9333ea;
  --accent-hover: #7e22ce;
  --accent-soft: rgba(147, 51, 234, 0.10);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.10);
  --hover-bg: #eef0f3;
  --input-bg: #ffffff;
  --sidebar-bg: #111827;
  --sidebar-text: #e5e7eb;
  --sidebar-hover: #1f2937;
  --body-gradient: var(--bg);
  --modal-overlay: rgba(17, 24, 39, 0.55);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --panel: #ffffff;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--body-gradient);
  color: var(--text);
  line-height: 1.5;
}
#loginScreen[hidden],
#appShell[hidden],
#modalOverlay[hidden] {
  display: none !important;
}
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; font-weight: 650; }
.login-sub { margin: 0 0 1.5rem; color: var(--muted); font-size: 0.9rem; }
.login-remember {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.login-remember input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field input,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .field-hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }

#appShell {
  display: flex;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  height: 100vh;
  max-height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.22s ease;
  z-index: 50;
}
.sidebar .brand {
  flex-shrink: 0;
}
.sidebar .brand strong { color: var(--sidebar-text); }
.sidebar .brand .muted { color: rgba(229, 231, 235, 0.55); }
.sidebar .side-section { color: rgba(229, 231, 235, 0.6); }
.sidebar .side-section[hidden],
.sidebar .side-nav[hidden] {
  display: none !important;
}
.sidebar .side-section--platform {
  display: block;
  margin: 1rem 0 0.45rem;
  padding: 0.5rem 0.65rem 0.5rem 0.55rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-left: 3px solid transparent;
  line-height: 1.2;
}
.sidebar .side-section--platform:first-of-type {
  margin-top: 0.15rem;
}
.sidebar .side-section--instagram {
  color: #fbcfe8;
  background: linear-gradient(90deg, rgba(233, 30, 140, 0.22) 0%, rgba(233, 30, 140, 0.06) 100%);
  border-left-color: #e91e8c;
  box-shadow: inset 0 0 0 1px rgba(233, 30, 140, 0.2);
}
.sidebar .side-section--tiktok {
  color: #99f6e4;
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.2) 0%, rgba(20, 184, 166, 0.05) 100%);
  border-left-color: #14b8a6;
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.18);
}
.sidebar .side-section--threads {
  color: #f1f5f9;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.22) 0%, rgba(148, 163, 184, 0.06) 100%);
  border-left-color: #94a3b8;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}
.sidebar .side-section--youtube {
  color: #fecaca;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.22) 0%, rgba(239, 68, 68, 0.06) 100%);
  border-left-color: #ef4444;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2);
}
.sidebar .side-section--soul {
  color: #ddd6fe;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.22) 0%, rgba(124, 58, 237, 0.06) 100%);
  border-left-color: #7c3aed;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.2);
}
.sidebar .side-section--sub {
  margin: 0.65rem 0 0.35rem 0.5rem;
  padding: 0.28rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
  border-left: 2px solid transparent;
  opacity: 0.92;
}
.sidebar .side-section--sub.side-section--instagram {
  color: #f9a8d4;
  background: rgba(233, 30, 140, 0.08);
  border-left-color: rgba(233, 30, 140, 0.55);
}
.sidebar .side-section--sub.side-section--tiktok {
  color: #5eead4;
  background: rgba(20, 184, 166, 0.08);
  border-left-color: rgba(20, 184, 166, 0.55);
}
.sidebar .side-section--sub.side-section--threads {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.1);
  border-left-color: rgba(148, 163, 184, 0.55);
}
.sidebar .side-section--sub.side-section--youtube {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
  border-left-color: rgba(239, 68, 68, 0.55);
}
.sidebar .link-quiet { color: rgba(229, 231, 235, 0.55); }
.sidebar .link-quiet:hover { color: var(--accent); }
.sidebar-head {
  display: contents;
}
.sidebar-close {
  display: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.brand strong { font-size: 1.05rem; display: block; }
.brand .muted { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.app-logo {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
}
.app-logo--login {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(88, 28, 135, 0.35);
}
#loginScreen .login-card { text-align: center; }
#loginScreen .login-card form { text-align: left; }
.side-nav { flex-shrink: 0; }
.model-nav { min-height: 0; }
.model-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.2rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.model-btn { color: var(--sidebar-text); }
.model-btn:hover { background: var(--sidebar-hover); }
.model-btn.active {
  background: var(--accent-soft);
  border-color: #6b21a866;
  color: #e9d5ff;
}
.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
  margin-right: -0.2rem;
  scrollbar-gutter: stable;
}
.sidebar-scroll::-webkit-scrollbar {
  width: 6px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}
.sidebar-footer {
  flex-shrink: 0;
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.sidebar-logout {
  width: 100%;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: rgba(229, 231, 235, 0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}
.sidebar-logout:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}
.sidebar-logout svg {
  flex-shrink: 0;
}
.side-nav--footer {
  margin-top: 0.85rem;
  margin-bottom: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-hub-link {
  display: block;
  font-size: 0.85rem;
  color: rgba(229, 231, 235, 0.55);
  text-decoration: none;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
}
.sidebar-hub-link:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}
.sidebar-foot {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.link-quiet { color: var(--muted); text-decoration: none; }
.link-quiet:hover { color: var(--accent); }

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: clamp(1rem, 2vw, 1.75rem) clamp(1rem, 2.5vw, 2.5rem) 2.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: none;
  width: 100%;
}
#tree,
#summary {
  width: 100%;
  max-width: none;
}
.top h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.top h1 .app-page-profile-link {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}
.top h1 .app-page-profile-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.hint { color: var(--muted); font-size: 0.88rem; margin: 0.35rem 0 0; }
.hint:empty { display: none; }

/* Hover info tips — prefer over inline helper paragraphs in page chrome */
.ops-info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  outline: none;
}

.ops-info-tip-icon {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(156, 163, 175, 0.95);
  font-size: 0.58rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.ops-info-tip:hover .ops-info-tip-icon,
.ops-info-tip:focus .ops-info-tip-icon {
  border-color: rgba(233, 30, 140, 0.45);
  color: #f9a8d4;
  background: rgba(233, 30, 140, 0.1);
}

.ops-info-tip-pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 20rem;
  padding: 0.42rem 0.58rem;
  border-radius: 8px;
  background: rgba(17, 17, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(229, 231, 235, 0.95);
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  z-index: 60;
}

.ops-info-tip:hover .ops-info-tip-pop,
.ops-info-tip:focus .ops-info-tip-pop,
.ops-info-tip:focus-within .ops-info-tip-pop {
  opacity: 1;
  visibility: visible;
}

.ops-label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

[data-theme="light"] .ops-info-tip-icon {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
  color: rgba(75, 85, 99, 0.95);
}

[data-theme="light"] .ops-info-tip:hover .ops-info-tip-icon,
[data-theme="light"] .ops-info-tip:focus .ops-info-tip-icon {
  border-color: rgba(233, 30, 140, 0.35);
  color: #be185d;
  background: rgba(233, 30, 140, 0.08);
}

[data-theme="light"] .ops-info-tip-pop {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.1);
  color: #374151;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.banner {
  font-size: 0.88rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  margin: 0.75rem 0 0;
}
.banner:empty { display: none; }
.banner-err { background: var(--danger-soft); color: var(--danger); border: 1px solid #7f1d1d55; }
.banner-ok { background: var(--success-soft); color: var(--success); border: 1px solid #14532d55; }

.summary {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.15rem;
  min-width: 108px;
}
.stat .num { font-size: 1.5rem; font-weight: 650; line-height: 1.1; }
.stat .lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.2rem; }

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.block-h {
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.block-h h2 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.block-body { padding: 0.85rem 1rem; }
.nested {
  margin-left: 0.65rem;
  border-left: 2px solid var(--border);
  padding-left: 0.85rem;
  margin-top: 0.65rem;
}
.row-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.row-line .meta { color: var(--muted); font-size: 0.8rem; }
.va-notes {
  margin: 0.25rem 0 0.5rem 0.65rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.4;
}
.row-line a.meta { color: var(--accent); text-decoration: none; }
.row-line a.meta:hover { text-decoration: underline; }
.empty { color: var(--muted); font-size: 0.88rem; padding: 0.75rem 0; margin: 0; }

.btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); background: var(--hover-bg); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #a855f7 0%, #9333ea 100%);
  border-color: #9333ea;
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #b46af8 0%, #a855f7 100%);
  border-color: #a855f7;
}
.btn-add {
  background: var(--accent-soft);
  border-color: #6b21a866;
  color: #e9d5ff;
}
.btn-add:hover { background: #581c8744; border-color: var(--accent); }
.btn-danger {
  background: var(--danger-soft);
  border-color: #7f1d1d88;
  color: var(--danger);
}
.btn-danger:hover { background: #7f1d1d44; border-color: var(--danger); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); background: var(--hover-bg); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-block { width: 100%; margin-top: 0.25rem; }
.btn.is-busy {
  opacity: 0.82;
  cursor: wait;
  pointer-events: none;
}
.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.modal-body {
  padding: 1.15rem;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.modal-body .field select {
  position: relative;
  z-index: 1;
}
.modal-body .field select:focus {
  z-index: 5;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.modal-body .banner { margin: 0 0 0.75rem; }
.modal-wide { max-width: 560px; max-height: calc(100vh - 2rem); }

.side-nav { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.side-nav--solo { margin-bottom: 0.35rem; }
.side-link {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(229, 231, 235, 0.7);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  display: block;
}
.side-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.side-link.active {
  background: var(--accent-soft);
  border-color: #6b21a866;
  color: #e9d5ff;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.badge-warmup { background: #3b82f633; color: #93c5fd; }
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-restricted { background: #fbbf2433; color: #fbbf24; }
.badge-banned { background: var(--danger-soft); color: var(--danger); }
.badge-suspected { background: #fbbf2433; color: #fbbf24; }
.badge-muted { background: #374151; color: var(--muted); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: #fbbf2433; color: #fbbf24; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.chip {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.chip-ok { border-color: #166534; background: var(--success-soft); color: var(--success); }
.chip-warn { border-color: #854d0e; background: #fbbf2433; color: #fbbf24; }
.chip-off { color: var(--muted); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.plain { margin: 0; padding-left: 1.1rem; font-size: 0.88rem; }
.plain .muted { list-style: none; margin-left: -1.1rem; color: var(--muted); }
.muted.small, .small { font-size: 0.78rem; color: var(--muted); margin-top: 0.5rem; }

.vault-handle-display {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.vault-handle-display--inline {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}
.vault-handle-former {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}
.row-actions { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.warmup-task { margin-top: 0.75rem; padding: 0.65rem; background: var(--accent-soft); border-radius: 8px; }
.field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

/* —— Analytics overview (Instagram + GetMySocial) —— */
.summary:empty { display: none; }
.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.dash-toolbar-left, .dash-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.ui-build-tag { font-size: 0.68rem; opacity: 0.55; }
.dash-deploy-warn { margin: 0 0 0.75rem; font-size: 0.82rem; }
.dash-deploy-warn code { font-size: 0.78rem; }
.dash-period { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.dash-model-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.7rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.dash-filter-label {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash-model-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}
.dash-model-pill {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.dash-model-pill:hover {
  border-color: #6b21a866;
  color: var(--text);
}
.dash-model-pill.active {
  border-color: var(--accent);
  color: #f3e8ff;
  background: linear-gradient(145deg, #6b21a8 0%, #581c87 100%);
  box-shadow: 0 0 0 1px #a855f733;
}
.dash-filter {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.dash-filter.active, .dash-filter:hover {
  border-color: var(--accent);
  color: #e9d5ff;
  background: var(--accent-soft);
}
.dash-select {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.src-pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.src-pill.src-live { color: var(--success); border-color: #166534; }
.src-pill.src-mock { color: #c4b5fd; border-color: #6b21a866; }
.dash-banner {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  background: #1e1b2e;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.65rem, 1.2vw, 1rem);
  margin-bottom: 1rem;
  width: 100%;
}
@media (max-width: 1100px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .dash-kpi-row { grid-template-columns: 1fr; }
}
.dash-kpi {
  background: linear-gradient(145deg, #1a1d28 0%, #141820 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem 0.65rem;
  min-height: 130px;
}
.dash-kpi-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.dash-kpi-src { text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.04em; }
.dash-kpi-val { font-size: 1.85rem; font-weight: 650; line-height: 1.1; }
.dash-kpi-meta { font-size: 0.75rem; margin: 0.25rem 0 0.5rem; }
.dash-kpi-meta .delta.up { color: var(--success); }
.dash-kpi-meta .delta.down { color: var(--danger); }
.dash-kpi .chart-box { width: 100%; margin-top: 0.35rem; }
.dash-kpi .chart-box .spark { width: 100%; height: 36px; display: block; }
.dash-mid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-bottom: 1rem;
  align-items: start;
  width: 100%;
}
@media (min-width: 1400px) {
  .dash-mid {
    grid-template-columns: minmax(0, 2.4fr) minmax(360px, 1fr);
  }
  .dash-chart-panel .chart-area {
    min-height: clamp(200px, 28vh, 360px);
  }
}
@media (max-width: 960px) {
  .dash-mid { grid-template-columns: 1fr; }
}
.dash-bottom {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  width: 100%;
}
@media (min-width: 1600px) {
  .dash-bottom {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 960px) {
  .dash-bottom { grid-template-columns: 1fr; }
}
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
}
.panel-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.panel-h--solo {
  justify-content: flex-start;
}
.panel-h h2 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.dash-chart-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.dash-chart-panel .panel-h {
  flex-shrink: 0;
  margin-bottom: 0.65rem;
}
.chart-area {
  position: relative;
  width: 100%;
  height: 220px;
}
.chart-area .chart-box {
  width: 100%;
  height: 100%;
}
.chart-area .chart-main-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-box {
  position: relative;
  width: 100%;
}
.chart-box .spark {
  width: 100%;
  display: block;
}
.chart-box--mini { min-height: 36px; }
.chart-area .chart-box--full {
  min-height: 0;
  height: 100%;
}
.chart-axis-x,
.chart-axis-y {
  font-size: 9px;
  fill: var(--muted);
  font-family: inherit;
}
.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.65;
}
.chart-line {
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-area-fill {
  stroke: none;
}
.dash-kpi .chart-box,
.top-spark .chart-box {
  height: 40px;
}
.chart-dot {
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.chart-hit {
  cursor: crosshair;
}
.chart-dot--active {
  opacity: 1;
}
.chart-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
  background: #1e2230;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 0.75rem;
  line-height: 1.25;
  white-space: nowrap;
}
.chart-tooltip strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}
.chart-tooltip span {
  color: #c4b5fd;
}
.chart-tooltip .chart-tt-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  color: var(--text);
}
.chart-tooltip .chart-tt-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.chart-tooltip .chart-tt-label {
  color: var(--text-muted);
  font-size: 0.72rem;
}
.chart-tooltip .chart-tt-val {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chart-box--multi { position: relative; }
.chart-legend {
  position: absolute;
  top: 0.45rem;
  right: 0.65rem;
  display: flex;
  gap: 0.7rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}
.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.chart-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}
.top-spark .chart-box { height: 28px; }
.top-spark .chart-box--mini { min-height: 28px; }
.dash-panel .chart-box--mini:not(.top-spark .chart-box) {
  margin-top: 0.35rem;
}
.top-list { display: flex; flex-direction: column; gap: 0.5rem; }
.top-row {
  display: grid;
  grid-template-columns: 2rem 1fr 100px 3rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.top-row-lead { border-color: #6b21a866; background: var(--accent-soft); }
.top-main { min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.top-link-title.ops-link-tip-wrap .ops-link-tip-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.top-link-sub.ops-link-tip-wrap .ops-link-tip-text {
  font-size: 0.72rem;
}
.top-link-meta { display: block; min-width: 0; }
.top-row { overflow: visible; }
.dash-top-panel { overflow: visible; }
.top-spark .spark { width: 100%; height: 28px; }
.top-val { text-align: right; font-weight: 600; font-size: 0.95rem; }
.donut-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 0.75rem;
}
.donut { width: 100%; height: 100%; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.donut-center strong { font-size: 1.2rem; color: var(--text); }
.donut-leg {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.35rem 0.65rem;
  font-size: 0.8rem;
  align-items: center;
}
.donut-leg .dot { width: 8px; height: 8px; border-radius: 50%; }
.live-badge {
  font-size: 0.65rem;
  background: #7f1d1d;
  color: #fecaca;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.35rem;
}
.live-now strong { font-size: 1.5rem; }
.live-links { list-style: none; padding: 0; margin: 0.5rem 0; font-size: 0.85rem; }
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 0.35rem;
}
.geo-placeholder {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #0d1018;
}
.tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
}
.summary .tech-chips { margin-top: 0.25rem; }

/* Light-theme polish — surface-white inputs/buttons for higher contrast */
[data-theme="light"] .field input,
[data-theme="light"] .field textarea,
[data-theme="light"] .field select,
[data-theme="light"] .dash-select,
[data-theme="light"] .dash-filter,
[data-theme="light"] .dash-model-pill,
[data-theme="light"] .btn {
  background: var(--surface);
}
[data-theme="light"] .login-card {
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .modal {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10), 0 16px 40px rgba(15, 23, 42, 0.10);
}
[data-theme="light"] body {
  background: var(--bg);
}
[data-theme="light"] .login-sub,
[data-theme="light"] #loginScreen .login-card { color: var(--text); }
[data-theme="light"] .login-card h1 { color: var(--text); }

/* ============================================================
   Top header bar — hamburger, page title, theme toggle
   ============================================================ */
.app-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: -0.25rem 0 0.85rem;
  position: relative;
  z-index: 60;
  overflow: visible;
}
body.ops-hide-pageheader .notif-bell-wrap {
  margin-left: auto;
}
body.ops-hide-pageheader .app-back-btn:disabled {
  display: none;
}
.app-back-btn {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, opacity 0.12s;
}
.app-back-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}
.app-back-btn:disabled {
  opacity: 0.38;
  cursor: default;
}
.hub-top-link {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.hub-top-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.login-hub {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.85rem;
}
.login-hub .link-quiet {
  color: var(--muted);
  text-decoration: none;
}
.login-hub .link-quiet:hover {
  color: var(--accent);
}
.app-topbar .top { flex: 1; min-width: 0; }
.app-topbar h1 { font-size: 1.4rem; }
.icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  transition: border-color 0.12s, background 0.12s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { display: block; }

/* Notification bell (global topbar) */
.notif-bell-wrap {
  position: relative;
  flex-shrink: 0;
}
.notif-bell {
  position: relative;
}
.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  pointer-events: none;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  left: auto;
  width: min(360px, calc(100vw - 2rem));
  max-height: 420px;
  overflow-y: auto;
  background: var(--panel, #141414);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 300;
}
.notif-dropdown[hidden] {
  display: none !important;
}
.notif-dropdown-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}
.notif-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.notif-item:hover {
  background: var(--hover-bg, rgba(255, 255, 255, 0.05));
}
.notif-item--unread {
  background: rgba(233, 30, 140, 0.06);
}
.notif-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.notif-item-body {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.notif-item-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.theme-toggle-float {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
}
.login-card { position: relative; }
.login-theme-toggle {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 34px;
  height: 34px;
  flex-basis: auto;
}
.sidebar-toggle { display: none; }

/* Scoped employees — labeled Main menu control on all pages */
body.scoped-employee .sidebar-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: auto;
  min-height: 36px;
  padding: 0.35rem 0.7rem 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
body.scoped-employee .sidebar-menu-btn:hover {
  background: var(--surface-hover, rgba(255, 255, 255, 0.06));
}
body.scoped-employee .sidebar-menu-label {
  line-height: 1;
  white-space: nowrap;
}

/* Scoped employees (editors, VAs, …) — menu button on all pages & screen sizes */
body.scoped-employee .sidebar-toggle {
  display: inline-flex;
}
@media (min-width: 801px) {
  body.scoped-employee.scoped-nav-collapsed #appShell .sidebar {
    width: 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right-width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 12, 0.55);
  backdrop-filter: blur(2px);
  z-index: 190;
}

/* ============================================================
   Mobile layout (≤ 800px)
   ============================================================ */
@media (max-width: 800px) {
  body { line-height: 1.45; }
  #appShell { display: block; height: auto; max-height: none; overflow: visible; }
  .main {
    padding: 0.85rem 0.9rem 1.5rem;
    height: auto;
    overflow: visible;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 84vw;
    max-width: 290px;
    transform: translateX(-100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.open ~ .sidebar-backdrop,
  .sidebar.open + .sidebar-backdrop {
    display: block;
  }
  body.sb-open .sidebar-backdrop { display: block; }
  body.sb-open .main {
    overflow: hidden;
    max-height: 100dvh;
  }
  .sidebar-toggle { display: inline-flex; }
  .app-topbar h1 { font-size: 1.15rem; }
  .app-topbar .hint { font-size: 0.78rem; }

  .summary { gap: 0.5rem; margin: 0.85rem 0; }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    overflow: hidden;
  }
  .modal-overlay { padding: 0.5rem; align-items: flex-start; }
  .modal-body { padding: 0.85rem; }
  .modal-footer { padding: 0.7rem 0.85rem 0.85rem; }
  .grid-2 { grid-template-columns: 1fr; gap: 0.65rem; }
  .dash-toolbar { gap: 0.45rem; }
  .dash-toolbar-left, .dash-toolbar-right { width: 100%; }
}
