/* ===================================================
   OPTIMAL Mission Control — cat control room 🐾
   Full-screen app shell: fills the window, panels
   scroll internally, falls back to page-scroll small.
   =================================================== */

/* The `hidden` attribute must always win. Author display rules (e.g.
   .drop-zone{display:flex}) otherwise beat the UA [hidden] rule, which left
   the drop zone showing ABOVE a loaded document — the "big space" on /file. */
[hidden] { display: none !important; }

:root {
  --radius: 16px;
  --radius-sm: 12px;
  --gap: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

[data-theme="midnight"] {
  --bg: #10151d; --bg-2: #141a24; --card: #1d2430; --panel: #161c26;
  --ink: #e8edf4; --dim: #8b97a8; --line: #26303f;
  --good: #34d17f; --good-bg: #12301f;
  --bad: #ff6b70; --bad-bg: #331a1d;
  --warn: #f0b64a; --warn-bg: #2c2410;
  --primary: #6f8dff; --accent: #9b7cff; --accent-2: #ff8fce;
  --glow: rgba(155,124,255,.35);
  --logbg: #0c1017; --logfg: #cdd7e6;
}
[data-theme="strawberry"] {
  --bg: #fff5f8; --bg-2: #fdf2f6; --card: #ffffff; --panel: #fbe9f0;
  --ink: #4a3b45; --dim: #9a7f8b; --line: #f3d9e3;
  --good: #2fa869; --good-bg: #e3f6ec;
  --bad: #e0507e; --bad-bg: #fde3ea;
  --warn: #d1841c; --warn-bg: #fbeed6;
  --primary: #ec7fa9; --accent: #b389f4; --accent-2: #ff9ac6;
  --glow: rgba(179,137,244,.3);
  --logbg: #fff7fa; --logfg: #6b5560;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, var(--glow), transparent 60%), var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease, color .4s ease;
  overflow: hidden;               /* app-shell owns scrolling */
}

#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }

/* ---------- app shell: fills the viewport ---------- */
.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 22px;
}

/* ---------- topbar ---------- */
.topbar {
  padding: 16px 2px 6px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 14px; }
.mascot { font-size: 38px; line-height: 1; cursor: pointer; user-select: none;
  filter: drop-shadow(0 4px 10px var(--glow)); transition: transform .15s ease; }
.mascot:hover { transform: translateY(-2px) rotate(-6deg); }
.brand-text h1 { font-family: var(--font-display); font-weight: 900; font-size: 28px;
  letter-spacing: -.02em; margin: 0; line-height: 1; }
.brand-accent { background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 4px 0 0; color: var(--dim); font-size: 13px; font-style: italic; min-height: 1.2em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.nyam { font-family: var(--font-mono); color: var(--dim); font-size: 15px; cursor: pointer;
  user-select: none; min-width: 64px; text-align: right; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 13px var(--font-body); padding: 8px 14px; border-radius: 999px; cursor: pointer;
  transition: transform .12s ease, border-color .2s ease; }
.chip:hover { transform: translateY(-1px); border-color: var(--accent); }
.chip:active { transform: scale(.97); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line);
  flex: 0 0 auto; }
.tab { text-decoration: none; color: var(--dim); font-weight: 600; font-size: 14px;
  padding: 10px 16px; border-radius: 12px 12px 0 0; position: relative; top: 1px;
  transition: color .2s ease, background .2s ease; }
.tab:hover { color: var(--ink); background: var(--card); }
.tab.active { color: var(--ink); background: var(--card); border: 1px solid var(--line); border-bottom-color: var(--card); }
.tab-soon { opacity: .45; cursor: not-allowed; }
.tab-soon:hover { background: transparent; color: var(--dim); }

/* ---------- content: flexes to fill, doesn't scroll itself ---------- */
.content {
  flex: 1 1 auto;
  min-height: 0;                  /* critical so children can scroll */
  display: flex;
  flex-direction: column;
  padding: 16px 0 8px;
  gap: 12px;
  overflow-y: auto;               /* the dashboard scrolls as a page so panels can
                                     grow (e.g. expanded email recipients) and push
                                     content below down, reachable by scrolling */
}

/* ---------- banner ---------- */
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  border-radius: var(--radius); font-family: var(--font-display); font-weight: 600;
  font-size: 20px; border: 1px solid transparent; flex: 0 0 auto; }
.banner-emoji { font-size: 28px; }
.banner-ok { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.banner-bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.banner strong { font-weight: 900; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; flex: 0 0 auto; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 12px 12px; text-align: center; transition: transform .15s ease, border-color .2s ease; }
.stat:hover { transform: translateY(-3px); border-color: var(--accent); }
.stat-num { font-family: var(--font-display); font-weight: 900; font-size: 30px; line-height: 1; }
.stat-label { color: var(--dim); font-size: 11.5px; margin-top: 6px; font-weight: 500; }
.stat-zero .stat-num { color: var(--good); }
.stat-bad .stat-num { color: var(--bad); }
.stat-warn .stat-num { color: var(--warn); }
.meta { color: var(--dim); font-size: 12.5px; margin: 0 2px; flex: 0 0 auto; }
.dot { margin: 0 8px; opacity: .5; }

/* ---------- the two-panel row: fills remaining height ---------- */
.panels {
  flex: 0 0 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 12px;
  align-items: start;             /* columns size to their own content, not the tallest */
}
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; min-height: 0; }
.panel-head { font-family: var(--font-display); font-weight: 900; font-size: 18px;
  margin: 0 0 10px; letter-spacing: -.01em; flex: 0 0 auto; }
.section-cat { font-size: 17px; }

/* LEFT panel: pipeline + log */
.pipeline-row { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; margin-bottom: 10px; }
.btn { border: none; border-radius: 14px; font: 700 13.5px var(--font-body); padding: 11px 16px;
  cursor: pointer; color: #fff; transition: transform .12s ease, filter .2s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--primary); }
.btn-accent { background: var(--accent); }
.btn-ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.log { flex: 1 1 auto; min-height: 280px; overflow-y: auto; background: var(--logbg); color: var(--logfg);
  font: 400 12.5px var(--font-mono); border-radius: var(--radius-sm); padding: 12px 14px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.log-hint { color: var(--dim); }
.pipeline-foot { display: flex; gap: 8px; margin-top: 10px; flex: 0 0 auto; }

/* pipeline run buttons: spin a rotating ⏳ on the one that's actively running,
   and keep it fully opaque so it stands out from the (dimmed) disabled buttons */
[data-run].is-running, #run-all.is-running { opacity: 1; }
[data-run].is-running::after, #run-all.is-running::after {
  content: "⏳"; display: inline-block; margin-left: 7px;
  animation: run-hourglass 1.1s ease-in-out infinite; }
@keyframes run-hourglass {
  0% { transform: rotate(0); } 55% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }

/* "Run all three" live progress strip (folders → audit → email). Each node
   lights up as the server sequence job reaches that step. */
.runall-progress { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm, 10px);
  background: var(--panel); border: 1px solid var(--line); flex: 0 0 auto; }
.runall-progress[hidden] { display: none; }
.runall-title { font-weight: 700; font-size: 13px; color: var(--ink); margin-bottom: 8px; }
.runall-track { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.runall-node { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; color: var(--dim); white-space: nowrap; transition: all .2s ease; }
.runall-node-label { font-weight: 600; }
.runall-node.is-running { border-color: var(--accent, #5b5bd6); color: var(--ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #5b5bd6) 22%, transparent); }
.runall-node.is-done { border-color: #1f9d55; color: var(--ink);
  background: color-mix(in srgb, #1f9d55 12%, var(--card)); }
.runall-node.is-failed { border-color: #b04a4a; color: var(--ink);
  background: color-mix(in srgb, #b04a4a 14%, var(--card)); }
.runall-arrow { color: var(--dim); font-size: 13px; }
.runall-spin { display: inline-block; animation: run-hourglass 1.1s ease-in-out infinite; }

/* dashboard columns: pipeline + email stacked on the LEFT, sites on the RIGHT */
.panel-col { display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.panel-left, .panel-right { background: transparent; border: none; padding: 0; gap: 12px; }
.subpanel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; min-height: 0; }
.subpanel-pipeline { flex: 0 0 auto; min-height: 260px; }   /* the pipeline log — fixed, scrolls internally */
.subpanel-sites { flex: 0 0 auto; min-height: 420px; }      /* sites list — fixed, scrolls internally */
/* Email recipients: a COMPACT box that does not stretch to fill the column.
   Collapsed by default; when expanded it grows to its content and pushes the
   pipeline below it down (the page scrolls to reach it). */
.subpanel-email { flex: 0 0 auto; }
.subpanel-email.collapsed .email-scroll { display: none; }
.subpanel-email:not(.collapsed) .email-scroll { max-height: 300px; overflow-y: auto; }

.site-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
  gap: 8px; padding-right: 4px; }
.site-card { display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm);
  padding: 12px 14px; cursor: pointer; transition: transform .15s ease, box-shadow .2s ease; flex: 0 0 auto; }
.site-card:hover { transform: translateX(2px); box-shadow: 0 8px 20px -12px var(--glow); }
.site-purr { border-left-color: var(--good); }
.site-hiss { border-left-color: var(--bad); }
.site-meh  { border-left-color: var(--warn); }
.site-face { font-size: 24px; }
.site-name { font-weight: 700; font-size: 14px; }
.site-note { color: var(--dim); font-size: 12px; margin-top: 2px; }
.site-hiss .site-note { color: var(--bad); }
.site-meh .site-note { color: var(--warn); }

.email-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }
.email-group-label { color: var(--dim); font-size: 12px; font-weight: 700; margin: 8px 0 4px; }
.email-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.email-empty { color: var(--dim); font-size: 12px; padding-left: 4px; }

/* who the scheduled weekly email goes to (Configuration) — informational */
.email-weekly-note { padding: 6px 8px; margin-bottom: 8px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line); line-height: 1.5; }
.email-weekly-note strong { color: var(--ink); }
.email-weekly-note .dim { color: var(--dim); }
/* send-email confirmation modal */
.confirm-recips { margin: 10px 0 4px; max-height: 220px; overflow-y: auto; }
.confirm-recip { font-size: 13.5px; padding: 4px 8px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line); margin: 4px 0; word-break: break-all; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* admin target selector + personal-send toggle */
.email-target-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.email-target-row select { flex: 1 1 auto; }
.email-subscribe { margin: 8px 0 2px; font-size: 13px; }
.email-subscribe em { font-style: italic; color: var(--accent); }

/* ---------- custom scrollbars ---------- */
.log::-webkit-scrollbar, .site-scroll::-webkit-scrollbar, .email-scroll::-webkit-scrollbar { width: 10px; }
.log::-webkit-scrollbar-thumb, .site-scroll::-webkit-scrollbar-thumb, .email-scroll::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 8px; }
.site-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 60px 20px; max-width: 520px; margin: auto; }
.empty-cat { font-size: 64px; margin-bottom: 10px; }
.empty h2 { font-family: var(--font-display); font-weight: 900; margin: 0 0 8px; }
.empty p { color: var(--dim); line-height: 1.6; }
.empty code { font-family: var(--font-mono); background: var(--panel); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.empty-actions { margin-top: 18px; }

/* ---------- footer ---------- */
.footer { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 8px;
  padding: 8px 2px 10px; flex: 0 0 auto; }

/* ---------- animations ---------- */
@keyframes wiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-9deg)} 75%{transform:rotate(9deg)} }
.wiggle { animation: wiggle .38s ease; }
@keyframes float-paw { 0%{transform:translateY(0) rotate(0);opacity:0} 15%{opacity:.8} 100%{transform:translateY(-120px) rotate(20deg);opacity:0} }
.floating-paw { position: fixed; font-size: 22px; pointer-events: none; animation: float-paw 2.4s ease-out forwards; z-index: 50; }

/* ---------- fallback: small windows scroll the page ---------- */
@media (max-width: 1000px), (max-height: 620px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; }
  .content { display: block; }
  .panels { display: grid; grid-template-columns: 1fr; height: auto; }
  .subpanel-sites, .subpanel-email, .panel-left { height: auto; }
  .site-scroll { max-height: 340px; }
  .log { min-height: 200px; max-height: 320px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand-text h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ===================================================
   Modal (site drill-down)
   =================================================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  max-width: 620px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 22px 24px; position: relative;
  resize: both; }              /* let the user drag the modal bigger/smaller */
/* roomy mode inflates padding/fonts; give the modal more room and keep it scrollable
   so the action buttons at the bottom are always reachable */
body.roomy .modal { max-height: 92vh; min-height: 200px; }
/* actions row sticks to the bottom of the modal so Save is never buried */
.modal .modal-actions, .modal .send-actions, .modal .confirm-actions {
  position: sticky; bottom: -22px; background: var(--card);
  padding: 12px 0 2px; margin-top: 8px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; z-index: 2; }
.modal-close { position: absolute; top: 12px; right: 14px; background: var(--panel);
  border: 1px solid var(--line); color: var(--ink); border-radius: 8px; width: 30px; height: 30px;
  cursor: pointer; font-size: 14px; }
.modal-close:hover { border-color: var(--accent); }
.modal-title { font-family: var(--font-display); font-weight: 900; font-size: 20px; margin: 0 0 4px; }
.modal-loading, .modal-purr { padding: 30px; text-align: center; color: var(--dim); }
.modal-toggle { margin: 10px 0 14px; }
.issue-list { display: flex; flex-direction: column; gap: 8px; }
.issue-card { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm);
  padding: 10px 14px; background: var(--panel); }
.issue-bad { border-left-color: var(--bad); }
.issue-ok { border-left-color: var(--good); }
.issue-top { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; }
.issue-status { color: var(--dim); font-weight: 500; margin-left: auto; }
.issue-who { font-size: 13px; margin-top: 3px; }
.issue-note { color: var(--bad); font-size: 12.5px; margin-top: 3px; }
.issue-exp { margin-top: 2px; }

/* ===================================================
   Alerts page
   =================================================== */
.page-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 6px; }
.alert-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alert-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 14px 0; }
.alert-block h3 { font-family: var(--font-display); font-weight: 900; font-size: 16px; margin: 0 0 10px; }
.switch-row, .switch-inline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.switch-row { margin-bottom: 12px; }
.field-row { display: flex; gap: 22px; align-items: end; flex-wrap: wrap; }
.field-row label, .fld { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--dim); }
.field-row input[type="number"], .fld input, .fld select {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 9px 11px; font: 500 14px var(--font-body); }
.switch-inline input, .switch-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.type-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.type-name { font-weight: 700; }
.type-card .type-days { background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 7px 9px; font: 500 13px var(--font-body); width: 100%; }
.site-alert { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; background: var(--panel); }
.site-alert-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.site-alert-fields { display: flex; align-items: center; gap: 12px; }
.site-alert-fields.dimmed { opacity: .4; }
.site-alert-fields input[type="number"] { width: 90px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); border-radius: 8px; padding: 7px 9px; font: 500 13px var(--font-body); }
.btn-sm { padding: 7px 11px; font-size: 12px; }
.site-types { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.stype-row { display: flex; align-items: center; gap: 14px; }
.stype-name { min-width: 60px; font-weight: 600; }
.stype-row input[type="number"] { width: 110px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); border-radius: 8px; padding: 6px 8px; font: 500 12.5px var(--font-body); }
.save-bar { display: flex; align-items: center; gap: 14px; margin: 8px 0 30px; }

/* ===================================================
   File page
   =================================================== */
.file-layout { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview-panel, .form-panel { min-height: 0; overflow-y: auto; }
/* the document viewer must always have plenty of room no matter how big the
   intake queue is. Guarantee a generous minimum, let it scroll, and let the
   user drag the bottom edge to make it even taller. */
.preview-panel { min-height: 460px; resize: vertical; overflow: auto; }
.drop-zone { border: 2px dashed var(--line); border-radius: var(--radius); min-height: 240px;
  display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer;
  transition: border-color .2s ease, background .2s ease; height: 100%; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: var(--panel); }
.drop-cat { font-size: 46px; margin-bottom: 8px; }
.drop-inner p { margin: 4px 0; }
.preview-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; height: 100%; }
.preview-wrap img { max-width: 100%; max-height: calc(100% - 42px); object-fit: contain;
  border-radius: var(--radius-sm); border: 1px solid var(--line); }
/* compact loading state (image now renders as soon as the file is saved) */
.drop-loading { font-size: 15px; font-weight: 600; color: var(--dim); }
/* the detective note pulses while classification / OCR runs in the background */
.detective-note.sniffing { color: var(--accent); animation: sniff-pulse 1s ease-in-out infinite; }
@keyframes sniff-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.preview-nav { display: flex; align-items: center; gap: 12px; }
.form-empty { padding: 30px 10px; }
.file-name { font-family: var(--font-display); font-weight: 900; font-size: 16px; margin-bottom: 4px; word-break: break-word; }
.detective-note { margin-bottom: 12px; }
.fld { margin-bottom: 12px; }
.dest-preview { background: var(--logbg); color: var(--logfg); font: 500 12.5px var(--font-mono);
  border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.warn-line { color: var(--warn); min-height: 1em; }
.file-actions { display: flex; gap: 10px; margin-top: 14px; }
.file-result { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.file-result.ok { background: var(--good-bg); color: var(--good); }
.file-result.bad { background: var(--bad-bg); color: var(--bad); }

@media (max-width: 1000px) {
  .file-layout { grid-template-columns: 1fr; }
  .page-scroll { overflow: visible; }
}

/* ===================================================
   Intake strip + toast + modal top row
   =================================================== */
.intake-strip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px; flex: 0 0 auto; }
.intake-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.intake-title { font-weight: 700; font-size: 14px; }
.intake-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.intake-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
  /* collapsed by default: cap the height so a big queue can't crowd out the
     document viewer. Scroll within the cap, and the "＋ show all" toggle
     removes the cap. Roughly two rows of chips. */
  max-height: 88px; overflow-y: auto; }
.intake-list.expanded { max-height: 320px; }   /* show many more, still scrolls */
.intake-list:empty { display: none; }
.intake-item { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font: 500 12.5px var(--font-body); cursor: pointer;
  transition: transform .12s ease, border-color .2s ease; }
.intake-item:hover { transform: translateY(-1px); border-color: var(--accent); }
/* the show-all / show-less toggle, shown only when the queue overflows */
.intake-more { background: transparent; border: 1px dashed var(--line); color: var(--dim);
  border-radius: 999px; padding: 6px 14px; font: 600 12.5px var(--font-body); cursor: pointer;
  margin-top: 8px; }
.intake-more:hover { border-color: var(--accent); color: var(--accent); }
.intake-more[hidden] { display: none; }

.modal-toprow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; flex-wrap: wrap; }
.modal-toprow .modal-toggle { margin: 0; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card); border: 1px solid var(--accent); color: var(--ink);
  padding: 12px 18px; border-radius: 12px; font: 500 13px var(--font-body); white-space: pre-line;
  box-shadow: 0 12px 30px -10px var(--glow); opacity: 0; transition: opacity .3s ease, transform .3s ease;
  z-index: 300; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================================================
   User chip + logout menu (Easy Auth)
   =================================================== */
.user-chip { position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px 5px 5px; cursor: pointer; transition: border-color .2s ease; }
.user-chip:hover { border-color: var(--accent); }
.user-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font: 700 11px var(--font-body); }
.user-hello { font: 600 13px var(--font-body); color: var(--ink); }
.user-menu { position: absolute; top: 110%; right: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px;
  min-width: 200px; box-shadow: 0 12px 30px -10px var(--glow); z-index: 250; }
.user-menu[hidden] { display: none; }
.user-menu-name { font-weight: 700; font-size: 13.5px; }
.user-menu-email { color: var(--dim); font-size: 12px; margin-bottom: 10px; word-break: break-all; }
.user-menu-logout { display: block; text-align: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: 13px; }
.user-menu-logout:hover { border-color: var(--bad); color: var(--bad); }

/* +2 years expiry row */
.expiry-row { display: flex; gap: 8px; align-items: stretch; }
.expiry-row input { flex: 1; }

/* site search on alerts */
.site-search { width: 100%; background: var(--panel); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px; padding: 10px 13px; font: 500 14px var(--font-body);
  margin-bottom: 14px; }
.site-search:focus { outline: none; border-color: var(--accent); }

/* directory picker */
.dir-picker { position: relative; margin-top: 8px; }
.dir-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 240px;
  overflow-y: auto; z-index: 60; box-shadow: 0 12px 30px -10px var(--glow); }
.dir-results:empty { display: none; }
.dir-item { padding: 9px 13px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.dir-item:hover { background: var(--panel); }
.dir-item-name { font-weight: 600; font-size: 13.5px; }
.dir-item-email { color: var(--dim); font-size: 12px; }

/* ===================================================
   Self-test / diagnostics table
   =================================================== */
.selftest-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.selftest-score { font: 900 18px var(--font-display); padding: 6px 16px; border-radius: 999px; }
.score-good { background: var(--good-bg); color: var(--good); }
.score-meh  { background: var(--warn-bg, #4a3a1a); color: var(--warn); }
.score-bad  { background: var(--bad-bg); color: var(--bad); }
.selftest-table { width: 100%; border-collapse: collapse; margin: 16px 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.selftest-table th { text-align: left; padding: 12px 16px; background: var(--panel);
  font: 700 13px var(--font-body); color: var(--dim); border-bottom: 1px solid var(--line); }
.selftest-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.selftest-table tr:last-child td { border-bottom: none; }
.row-ok { }
.row-bad { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.st-name { font-weight: 600; }
.st-detail { color: var(--dim); font-family: var(--font-mono); font-size: 12.5px; }
.pill { padding: 3px 10px; border-radius: 999px; font: 700 12px var(--font-body); white-space: nowrap; }
.pill-ok { background: var(--good-bg); color: var(--good); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.selftest-actions { margin: 8px 0 30px; }

/* ===================================================
   Profile photo, quick links, email editor, admin
   =================================================== */
.user-avatar { position: relative; width: 26px; height: 26px; border-radius: 50%;
  overflow: hidden; background: var(--accent); flex: 0 0 auto; }
.user-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-initials { position: absolute; inset: 0; display: none; align-items: center;
  justify-content: center; color: #fff; font: 700 11px var(--font-body); }
.user-photo[style*="none"] + .user-initials { display: flex; }
.user-menu-role { color: var(--accent); font-weight: 700; font-size: 12px; margin-bottom: 8px; }

.quick-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.quick-link { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: 600 12.5px var(--font-body); cursor: pointer;
  transition: transform .12s ease, border-color .2s ease; }
.quick-link:hover { transform: translateY(-1px); border-color: var(--accent); }

.panel-head .btn-sm { float: right; }
.email-list { display: flex; flex-direction: column; gap: 3px; }
.email-row { display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; padding: 4px 2px; }
.email-x { background: none; border: none; color: var(--bad); cursor: pointer; font-size: 12px; }
.email-add-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.email-add-row select { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 6px 9px; font: 500 12.5px var(--font-body); }

.admin-locked { background: var(--bad-bg); border: 1px solid var(--bad); border-radius: var(--radius);
  padding: 18px 22px; margin: 14px 0; }
.locked-cat { font-size: 32px; }
.admin-actions { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.admin-warn { background: var(--panel); border-left: 3px solid var(--warn); padding: 10px 14px;
  border-radius: var(--radius-sm); margin-bottom: 20px; }
.path-input { width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 7px 10px; font: 500 12.5px var(--font-mono); }
.admin-list { margin: 6px 0 24px 20px; font-size: 13.5px; line-height: 1.7; }

/* ===================================================
   Clickable stats, resizable panels, dashboard search
   =================================================== */
.stat-clickable { cursor: pointer; transition: transform .14s ease, border-color .2s ease; }
.stat-clickable:hover { transform: translateY(-2px); border-color: var(--accent); }
.stat-clickable::after { content: "🔍"; position: absolute; top: 8px; right: 10px;
  font-size: 11px; opacity: 0; transition: opacity .2s ease; }
.stat { position: relative; }
.stat-clickable:hover::after { opacity: .7; }


.dash-search { margin: 0 0 10px; padding: 8px 12px; font-size: 13px; }

/* achievement toast */
.achv { position: fixed; bottom: 24px; right: 24px; background: var(--card);
  border: 1px solid var(--accent); border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 16px 40px -12px var(--glow); z-index: 320; max-width: 320px;
  transform: translateX(120%); transition: transform .45s cubic-bezier(.2,.9,.3,1.3); }
.achv.show { transform: translateX(0); }
.achv-title { font: 900 14px var(--font-display); color: var(--accent); }
.achv-body { font-size: 12.5px; color: var(--ink); margin-top: 2px; }

/* ===================================================
   Real drag-to-resize grips, log page, manual email
   =================================================== */
.panel, .subpanel { position: relative; }
.resize-grip { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 1px; width: 64px; height: 12px;
  cursor: ns-resize; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .18s ease; z-index: 5; }
.resize-grip::before { content: ""; width: 46px; height: 4px; border-radius: 3px;
  background: var(--accent); }
/* keep panel content clear of the grip so buttons stay clickable */
.panel, .subpanel { padding-bottom: 16px; }
.panel:hover .resize-grip, .subpanel:hover .resize-grip { opacity: .55; }
.resize-grip:hover { opacity: 1 !important; }

.log-tools { display: flex; align-items: center; gap: 8px; }.log-select { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 7px 10px; font: 500 12.5px var(--font-body); }
.pill-cat { background: var(--panel); color: var(--dim); border: 1px solid var(--line); }

.manual-email { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: 6px 10px; font: 500 12.5px var(--font-body); flex: 1; min-width: 130px; }
.email-add-row { flex-wrap: wrap; }

/* ===================================================
   Roomy mode — let the whole page scroll instead of
   squeezing everything into one viewport height.
   Toggled from the header; remembered between visits.
   =================================================== */
/* the class goes on BOTH <html> and <body> — releasing only body isn't
   enough, because html { height:100% } still clamps the document. */
html.roomy, html.roomy body { height: auto; min-height: 100%; overflow-y: auto; }
html.roomy body { overflow-x: hidden; }
body.roomy { overflow-y: auto; height: auto; }
html.roomy .app-shell,
body.roomy .app-shell { height: auto; min-height: 100vh; overflow: visible; }
html.roomy .content, body.roomy .content { overflow: visible; height: auto; }
html.roomy .dash-layout, html.roomy .file-layout,
body.roomy .dash-layout, body.roomy .file-layout { height: auto; min-height: 0; }
html.roomy .panel, html.roomy .subpanel,
body.roomy .panel, body.roomy .subpanel { min-height: 0; max-height: none; }
/* internal scrollers become natural height so nothing is cut off */
html.roomy .site-scroll, html.roomy .email-scroll, html.roomy .log-box, html.roomy .page-scroll,
body.roomy .site-scroll, body.roomy .email-scroll, body.roomy .log-box, body.roomy .page-scroll { max-height: none; overflow: visible; }
/* give the panels a sensible floor so they don't collapse */
html.roomy .site-scroll, body.roomy .site-scroll { min-height: 220px; }

/* a touch more breathing room overall in roomy mode */
html.roomy .app-shell, body.roomy .app-shell { padding-bottom: 28px; }
.chip-on { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* roomy: panels grow with their content instead of spilling out of a
   height that was dragged while in fixed mode */
/* flex-basis:0 makes panels share the viewport by proportion, which is what
   clips content in roomy mode. Switch them to content-sized. */
html.roomy .panel, html.roomy .subpanel,
body.roomy .panel, body.roomy .subpanel {
  height: auto !important; overflow: visible;
  flex: 0 0 auto !important; }
html.roomy .site-scroll, html.roomy .email-scroll,
body.roomy .site-scroll, body.roomy .email-scroll {
  flex: 0 0 auto !important; height: auto !important; }
html.roomy .panel-right, body.roomy .panel-right { display: block; }
/* roomy still lets you drag panel borders (you asked for this) — keep the grips */
html.roomy .resize-grip, body.roomy .resize-grip { display: block; }
/* and make sure the page itself can always scroll in roomy, so a tall panel
   (e.g. the recipient editor) never pushes its Save row out of reach */
html.roomy, body.roomy { overflow-y: auto; }
html.roomy .app-shell, body.roomy .app-shell { overflow: visible; min-height: 0; }
html.roomy .stats, body.roomy .stats { flex-wrap: wrap; }

/* ===================================================
   Alerts: one sticky action bar instead of buttons
   scattered through the page
   =================================================== */
.action-bar { position: sticky; bottom: 0; margin-top: 8px;
  background: linear-gradient(to top, var(--bg) 62%, transparent);
  padding: 14px 0 10px; z-index: 40; flex: 0 0 auto; }
.action-bar-inner { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px;
  box-shadow: 0 -6px 24px -14px var(--glow); }
.action-bar-btns { display: flex; gap: 10px; align-items: center; }
.action-bar #save-status { text-align: left; }
/* page content shouldn't hide behind the bar */
.page-scroll { padding-bottom: 6px; }

/* ===================================================
   Quick-open bar across the top; slimmer pipeline so
   the right column gets the height it actually needs
   =================================================== */
.quickbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin: 4px 0 12px; flex: 0 0 auto; }
.quickbar-label { font: 700 12.5px var(--font-body); color: var(--dim); white-space: nowrap; }
.quickbar .quick-links { margin: 0; }

/* pipeline: the log box was eating the panel, so cap it and let the
   right-hand column take the height it frees up */
.log { min-height: 100px; max-height: 190px; flex: 0 1 auto; }
.pipeline-row { flex-wrap: wrap; }
.panel-left { flex: 1 1 42%; min-width: 0; }
.panel-right { flex: 1 1 58%; min-width: 0; }
/* sites gets the lion's share of the right column */
.subpanel-sites { flex: 3 1 auto; min-height: 200px; }
.subpanel-email { flex: 1 1 auto; min-height: 130px; }

/* resize grips available in BOTH modes now */
html.roomy .resize-grip, body.roomy .resize-grip { display: flex; }

/* size reset button */
.size-reset { position: fixed; bottom: 14px; right: 16px; z-index: 60;
  background: var(--card); border: 1px solid var(--line); color: var(--dim);
  border-radius: 999px; padding: 7px 13px; font: 600 11.5px var(--font-body);
  cursor: pointer; opacity: .55; transition: opacity .2s ease, border-color .2s ease; }
.size-reset:hover { opacity: 1; border-color: var(--accent); color: var(--ink); }

@media (max-width: 1100px) {
  .panels { flex-direction: column; }
  .panel-left, .panel-right { width: 100%; }
}

/* ===================================================
   Easter egg visuals
   =================================================== */
.napping { opacity: .75; }
.zzz { position: absolute; top: -6px; color: var(--dim); font-weight: 700;
  animation: floatz 2.4s ease-in-out infinite; pointer-events: none; }
@keyframes floatz { 0% { opacity: 0; transform: translateY(0); }
                    30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-22px); } }

.runner { position: fixed; font-size: 26px; z-index: 300; pointer-events: none;
  transition: left 1.1s cubic-bezier(.3,.8,.3,1), top 1.1s cubic-bezier(.3,.8,.3,1),
              transform .9s ease; }

.pokeball { position: fixed; left: -60px; top: 45vh; font-size: 40px; z-index: 320;
  pointer-events: none; animation: roll 1.5s cubic-bezier(.3,.7,.5,1) forwards; }
@keyframes roll { to { left: 48vw; transform: rotate(1080deg); } }
.pokeball.caught { animation: wobble .5s ease-in-out 3; }
@keyframes wobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-18deg); }
                    75% { transform: rotate(18deg); } }

.parader { position: fixed; left: -70px; font-size: 38px; z-index: 300; pointer-events: none;
  animation: parade 6s linear forwards; }
@keyframes parade { to { left: 108vw; } }

.party-banner { background: linear-gradient(90deg, var(--good-bg), var(--warn-bg), var(--good-bg));
  border-color: var(--good) !important; animation: shimmer 2.6s ease-in-out 3; }
@keyframes shimmer { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.16); } }

body.night-owl { filter: saturate(.9) brightness(.96); }

@media (prefers-reduced-motion: reduce) {
  .runner, .pokeball, .parader, .zzz { animation: none !important; transition: none !important; }
}

/* step-down control in the user menu */
.user-menu-step { display: block; width: 100%; text-align: center; margin-bottom: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; color: var(--ink); font: 600 12.5px var(--font-body); cursor: pointer; }
.user-menu-step:hover { border-color: var(--accent); color: var(--accent); }
.muted-role { color: var(--dim) !important; }

/* pokéball: bigger and slower so it can't be missed */
.pokeball { font-size: 56px !important; animation-duration: 1.9s !important; }
.ball-spark { position: fixed; font-size: 20px; z-index: 321; pointer-events: none;
  animation: spark .9s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }

/* ===================================================
   🌈 Psychedelic theme — the third option, unlocked by
   the barrel roll but selectable from the theme toggle
   =================================================== */
[data-theme="psychedelic"] {
  --bg: #14002b; --card: #23044a; --panel: #2d0a5c; --line: #6a2ec9;
  --ink: #ffe9ff; --dim: #c39bff;
  --good: #5cffc4; --good-bg: #06392c;
  --bad: #ff5fa2; --bad-bg: #4a0525;
  --warn: #ffd25c; --warn-bg: #46330a;
  --primary: #ff6ec7; --accent: #7cf5ff; --accent-2: #ffe14d;
  --glow: rgba(124,245,255,.45);
  --logbg: #1b0338; --logfg: #b6f7ff;
}
[data-theme="psychedelic"] body {
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(255,110,199,.28), transparent 60%),
    radial-gradient(900px 500px at 85% 100%, rgba(124,245,255,.24), transparent 60%),
    var(--bg);
  animation: psyshift 18s ease-in-out infinite;
}
@keyframes psyshift { 0%,100% { filter: hue-rotate(0deg); }
                      50% { filter: hue-rotate(40deg); } }
[data-theme="psychedelic"] .brand-title,
[data-theme="psychedelic"] .stat-num {
  background: linear-gradient(90deg, #ff6ec7, #ffe14d, #7cf5ff, #ff6ec7);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: psyflow 6s linear infinite;
}
@keyframes psyflow { to { background-position: 300% 0; } }

/* the barrel roll itself */
.barrel-rolling { animation: barrelroll 1.8s cubic-bezier(.4,.1,.3,1); }
@keyframes barrelroll {
  0%   { transform: rotate(0) scale(1); }
  35%  { transform: rotate(220deg) scale(.82); }
  70%  { transform: rotate(340deg) scale(.94); }
  100% { transform: rotate(360deg) scale(1); }
}

/* the dog appearance */
.dog-pop { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.2);
  z-index: 340; opacity: 0; pointer-events: none; text-align: center;
  transition: transform .5s cubic-bezier(.2,1.3,.4,1), opacity .35s ease; }
.dog-pop.show { transform: translate(-50%,-50%) scale(1); opacity: 1; }
.dog-pop img { max-width: min(46vw, 420px); border-radius: 20px;
  border: 4px solid var(--accent); box-shadow: 0 26px 70px -20px var(--glow); display: block; }
.dog-caption { margin-top: 12px; font: 900 20px var(--font-display); color: var(--ink);
  text-shadow: 0 2px 12px var(--glow); }

@media (prefers-reduced-motion: reduce) {
  .barrel-rolling { animation: none; }
  [data-theme="psychedelic"] body { animation: none; }
}
.user-menu-persona { width: 100%; margin-bottom: 8px; background: var(--panel);
  border: 1px solid var(--line); color: var(--ink); border-radius: 8px;
  padding: 7px 9px; font: 500 12px var(--font-body); }
.persona-banner { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn);
  border-radius: 999px; padding: 4px 12px; font: 700 11.5px var(--font-body); }

/* collapsible email panel — collapsed by default so the sites list gets room */
.panel-head.collapsible { cursor: pointer; user-select: none; display: flex;
  align-items: center; gap: 8px; }
.collapse-caret { background: none; border: none; color: var(--dim); cursor: pointer;
  font-size: 13px; padding: 0 2px; }
.subpanel-email.collapsed { flex: 0 0 auto !important; min-height: 0; }
.subpanel-email.collapsed .resize-grip { display: none; }
/* the pipeline log is resizable in its own right */
.log { position: relative; }
.footer-version { opacity: .6; font-family: var(--font-mono); font-size: 11px; }
.footer-study { font-weight: 600; }

/* ---------- activity log filters + recipient picker ---------- */
.log-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 8px 0 12px; }
.log-fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
.log-fld .log-select { min-width: 130px; }
.log-email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.log-dir { position: relative; }
.log-recip-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.recip-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.recip-x { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 12px; padding: 0; }
.recip-x:hover { color: var(--bad); }

/* ---------- drill-down: filter + document preview ---------- */
.issue-filter { display: flex; gap: 8px; margin: 4px 0 10px; }
.issue-filter .log-select { flex: 1 1 auto; }
.issue-click { cursor: pointer; transition: transform .12s ease, box-shadow .2s ease; }
.issue-click:hover { transform: translateX(2px); box-shadow: 0 8px 20px -12px var(--glow); }
.doc-preview { display: flex; justify-content: center; margin: 12px 0; max-height: 420px; overflow: auto; }
.doc-preview img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ---------- send-email choice modal ---------- */
.send-choice { margin: 6px 0 4px; }
.send-opt { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 10px 0 4px; cursor: pointer; }
.send-opt input { accent-color: var(--accent); }
.send-usual { margin: 2px 0 6px 24px; }
.send-custom { margin: 4px 0 4px 24px; }
.send-custom .dir-picker { position: relative; }
/* the "➕ Add typed address" row in a directory result list */
.dir-item.dir-add { background: var(--good-bg); }
.dir-item.dir-add .dir-item-name { color: var(--good); font-weight: 700; }

/* ---------- file page: auto-advance + process progress ---------- */
.auto-advance { font-size: 12.5px; gap: 6px; }
.process-progress { font-weight: 700; font-size: 12.5px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }

/* ---------- one-time coaching hint (reuses .achv slot, no confetti) ---------- */
.achv.achv-hint { border-color: var(--accent); }

/* ---------- footer tour button + spotlight tour ---------- */
.tour-launch { background: none; border: none; color: var(--dim); cursor: pointer;
  font: inherit; font-size: 12px; padding: 0; text-decoration: underline dotted; }
.tour-launch:hover { color: var(--accent); }
.tour-catch { position: fixed; inset: 0; z-index: 9998; display: none; background: transparent; }
.tour-spot { position: fixed; z-index: 9999; display: none; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(10, 12, 20, 0.62); outline: 2px solid var(--accent);
  pointer-events: none; transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease; }
.tour-pop { position: fixed; z-index: 10000; display: none; max-width: 340px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 50px -20px rgba(0,0,0,.6); padding: 16px 18px; }
.tour-title { font-family: var(--font-display); font-weight: 900; font-size: 16px; margin-bottom: 6px; }
.tour-body { font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.tour-count { font-size: 12px; color: var(--dim); }
.tour-btns { display: flex; gap: 6px; }

/* ---------- legend modal ---------- */
.legend-btn { margin-left: 8px; vertical-align: middle; }
.legend-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.legend-row { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.legend-ic { font-size: 22px; flex: 0 0 28px; text-align: left; }
.legend-hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- intake mailboxes ---------- */
.intake-mailboxes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; }
.mb-label { color: var(--dim); font-weight: 600; }
.mb-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px; font-size: 12.5px; }
.mb-editor { display: inline-flex; align-items: center; gap: 6px; }
.mb-editor .site-search { min-width: 260px; }

/* ---------- admin: user preferences default bar ---------- */
.userprefs-default { display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 10px 0; }
.userprefs-default label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
#userprefs-table .up-theme { min-width: 120px; }

/* ---------- legend icons in site/drill-down cards ---------- */
.issue-ic { font-size: 15px; }
.issue-iconbar { font-size: 20px; letter-spacing: 5px; margin: 2px 0 10px; }
.intake-help { font-size: 12.5px; color: var(--dim); margin: 10px 0 0; line-height: 1.5; }
.intake-help strong { color: var(--ink); }
.intake-help .ways { display: inline; }

/* ---------- drill-down multi-select toolbar ---------- */
.issue-tools { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.issue-tools .switch-inline { font-size: 12.5px; }
.issue-check { margin-right: 2px; accent-color: var(--accent); cursor: pointer; }

/* ---------- tour multi-highlight (several targets at once) ---------- */
.tour-multi { position: fixed; inset: 0; z-index: 9999; pointer-events: none; display: none; }
.tour-multi-svg { position: fixed; inset: 0; pointer-events: none; }
.tour-multi-svg .tour-hl { fill: none; stroke: var(--accent); stroke-width: 3; }
.tour-badge { position: fixed; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.4); }

/* ---------- practice-doc picker ---------- */
.practice-box { display: inline-flex; align-items: center; gap: 6px; }
.practice-box #gen-site { min-width: 130px; padding: 5px 8px; }

/* ---------- admin: add-user (seed) box ---------- */
.userprefs-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0; }
.unit { color: var(--dim); font-size: 12px; margin-left: 4px; }

/* ---------- per-document open-folder button in the site modal ---------- */
.doc-folder { background: none; border: none; cursor: pointer; font-size: 14px; padding: 0 2px; margin-left: 6px; opacity: .65; }
.doc-folder:hover { opacity: 1; }

/* activity-log "Who" profile avatar (#12) */
.who-cell { display: inline-flex; align-items: center; gap: 7px; }
.who-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  object-fit: cover; flex: 0 0 auto;
  background: var(--card);
}
.who-name { line-height: 1.2; }

/* Admin table of contents + collapsible sections (#6, #14) */
.admin-toc {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 12px 14px; margin: 0 0 18px;
  background: var(--card); border-radius: 10px;
  border: 1px solid var(--line);
}
.admin-toc a {
  font-size: 13px; text-decoration: none;
  color: var(--accent, #5b5bd6); white-space: nowrap;
}
.admin-toc a:hover { text-decoration: underline; }
.collapsible-head { cursor: pointer; user-select: none; }
.sec-caret { display: inline-block; width: 1em; font-size: .8em; opacity: .6; margin-right: 4px; }
.section-body[hidden] { display: none; }

/* Colour picker in email editor toolbars (#11, #12) */
.et-colour {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; cursor: pointer; vertical-align: middle;
}
.et-colour input[type="color"] {
  width: 26px; height: 24px; padding: 0; border: 1px solid var(--line);
  border-radius: 5px; background: none; cursor: pointer;
}

/* Existing approved-acronyms display (#8) */
.alias-table { border-collapse: collapse; margin-top: 4px; }
.alias-table th { text-align: left; padding: 4px 12px 4px 0; vertical-align: top;
  font-weight: 600; white-space: nowrap; color: var(--ink); }
.alias-table td { padding: 4px 0; }
.alias-chip { display: inline-block; padding: 2px 8px; margin: 2px;
  background: var(--card); border-radius: 12px; font-size: 12px; }

/* Friendly type name display (#10) */
.st-token-tag { display: inline-block; padding: 1px 7px; margin-left: 6px;
  background: var(--card); border-radius: 10px; font-size: 11px;
  font-family: ui-monospace, monospace; opacity: .75; }
.st-token code { font-size: 11px; }
.st-token { margin-top: 2px; }

/* Friendly multi-select dropdown for log filters (#3, #4) */
.ms-dd { position: relative; display: inline-block; }
.ms-dd-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  min-width: 130px; justify-content: space-between; text-align: left;
}
.ms-dd-caret { font-size: .7em; opacity: .6; }
.ms-dd-menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0;
  min-width: 180px; max-height: 260px; overflow-y: auto;
  background: var(--panel, #fff); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.ms-dd-opt {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border-radius: 6px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.ms-dd-opt:hover { background: var(--card); }
.ms-dd-opt input { margin: 0; }

/* Top save bar for alerts (#15) */
.alerts-top-save {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 14px 0 22px; padding: 14px 16px;
  background: var(--card); border-radius: 10px;
  border: 1px solid var(--line);
}

/* Send-email modal: inline chip-input (type among the chips) (#16, #13) */
.send-field { margin-bottom: 14px; }
.chip-input {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 52px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); cursor: text;
}
.chip-input.readonly { cursor: default; background: transparent; border-style: dashed; }
.chip-input-field {
  flex: 1 1 160px; min-width: 160px;
  border: none; outline: none; background: transparent;
  font: inherit; color: inherit; padding: 6px 2px; min-height: 24px;
}
.chip-input .dir-results {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--panel, #fff); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
  max-height: 240px; overflow-y: auto;
}
.chip-input .dir-results:empty { display: none; }
/* clearer remove-recipient ✕ */
.recip-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 10px; border-radius: 14px;
  background: var(--accent-soft, #e6e6fb); font-size: 13px;
}
.recip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.18); color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer; padding: 0;
}
.recip-x:hover { background: var(--bad, #c0392b); }

/* Per-schedule step checkboxes in weekly auto-send */
.wk-steps { display: inline-flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.wk-step { font-size: 13px; white-space: nowrap; }

/* Whose multi-select people sublist + SharePoint source badge (#1, #2) */
.ms-dd-special { font-weight: 600; }
.who-people {
  margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line);
  max-height: 180px; overflow-y: auto;
}
.who-people .ms-dd-opt { font-weight: normal; padding-left: 18px; }
.src-badge {
  display: inline-block; margin-left: 8px; padding: 1px 6px;
  font-size: 11px; border-radius: 10px;
  background: var(--card); color: var(--dim);
  vertical-align: middle;
}

/* Filer: documents that arrived by email but aren't filed yet */
.intake-pending { margin: 8px 0 4px; padding: 8px 10px;
  background: var(--card); border-radius: 10px;
  border: 1px dashed var(--line); }
.pending-head { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.pending-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  border-radius: 6px; font-size: 13px; }
.pending-item.ready { cursor: pointer; }
.pending-item.ready:hover { background: var(--panel, #fff); }
.pending-name { font-weight: 500; }
.pending-tag { margin-left: auto; font-size: 11px; color: var(--accent, #5b5bd6); }
.pending-item.waiting { opacity: .7; }
.intake-item.flash { animation: intake-flash 1.2s ease; }
@keyframes intake-flash {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 3px var(--accent, #5b5bd6); }
}

/* Sortable log column headers */
.log-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.log-sortable:hover { color: var(--accent, #5b5bd6); }
.sort-caret { font-size: .7em; opacity: .5; margin-left: 3px; }
.log-sortable.sort-active .sort-caret { opacity: 1; }

/* Removable ✕ on approved-acronym chips (#5) */
.alias-chip.removable { display: inline-flex; align-items: center; gap: 5px; padding-right: 5px; }
.alias-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.16); color: #fff; font-size: 10px; line-height: 1;
  cursor: pointer; padding: 0;
}
.alias-x:hover { background: var(--bad, #c0392b); }

/* Colour-coded admin TOC + section headers (#6) */
.toc-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 14px;
  background: color-mix(in srgb, var(--sec-colour, #5b5bd6) 18%, var(--card));
  color: var(--ink) !important; text-decoration: none;
  font-size: 13px; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--sec-colour, #5b5bd6) 40%, transparent);
}
.toc-link:hover { background: color-mix(in srgb, var(--sec-colour, #5b5bd6) 32%, var(--card)); text-decoration: none; }
.toc-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.section-head.collapsible-head {
  border-left: 4px solid var(--sec-colour, transparent);
  padding-left: 10px;
}

/* Homepage email editor: roomier, de-cluttered save row (#3, #4) */
.email-field { margin-bottom: 14px; }
.email-weekly-freq { margin-bottom: 10px; }
.email-save-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.email-save-row .email-subscribe { margin: 0; }
.email-save-actions { display: inline-flex; align-items: center; gap: 10px; }
.chip-empty { color: var(--dim); font-size: 13px; font-style: italic; }
/* roomy: the email editor grows with its content and never clips the Save row.
   The scroll region and subpanel expand so the bottom actions stay reachable. */
html.roomy .subpanel-email, body.roomy .subpanel-email { overflow: visible !important; height: auto !important; max-height: none !important; }
html.roomy .subpanel-email .email-scroll, body.roomy .subpanel-email .email-scroll { max-height: none !important; overflow: visible !important; }
html.roomy .email-save-row, body.roomy .email-save-row { position: static; }

/* Log entry edit button (developer) */
.log-edit-btn {
  border: none; background: none; cursor: pointer; opacity: .4;
  font-size: 12px; padding: 0 4px; vertical-align: middle;
}
.log-edit-btn:hover { opacity: 1; }
tr[data-synced="1"] .log-edit-btn { opacity: .55; }

/* The email-text editor boxes stack (toolbar → editor → save), unlike the
   inline .userprefs-default config rows which flow horizontally. */
#emailtpl-box, #logtpl-box {
  display: block;          /* override the flex layout that squished the editor */
}
#emailtpl-box label, #logtpl-box label { display: block; }
#et-editor, #lt-editor { width: 100%; box-sizing: border-box; }

/* Preview couldn't-render fallback */
.preview-fallback {
  padding: 24px; text-align: center; color: var(--dim);
  font-size: 14px; line-height: 1.5; max-width: 32ch; margin: 0 auto;
}

/* Arrived-by-email popup (source/sender multi-select filter) */
.arrivals-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 10px 0 14px; }
.arrivals-filter .af-senders { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.ms-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.arrivals-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.arr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.arr-ic { flex: none; }
.arr-name { font-weight: 600; }
.arr-meta { margin-left: auto; }
.arr-tag { flex: none; }
.arr-row .arr-file { flex: none; margin-left: auto; }

/* Config-location table */
.cl-table code { font-family: "JetBrains Mono", monospace; font-size: 12px; word-break: break-all; }

/* Approved-acronym selectors render BLUE in strawberry (pink) mode, so the
   selectable chips stand out against the pink theme. */
[data-theme="strawberry"] .alias-chip {
  background: #e6efff;
  color: #1d4ed8;
  border: 1px solid #93b4f5;
}
[data-theme="strawberry"] .alias-chip.removable {
  background: #dbe8ff;
  color: #1e40af;
  border-color: #6f9bf0;
}
[data-theme="strawberry"] .alias-chip.removable .recip-x,
[data-theme="strawberry"] .alias-chip.removable button { color: #1e40af; }
[data-theme="strawberry"] #alias-type,
[data-theme="strawberry"] #alias-acronyms:focus {
  border-color: #6f9bf0;
  outline-color: #2563eb;
}

/* config-locations: highlight items that live on the sensitive config site */
.cl-onconfig { color: #1d4ed8; font-weight: 600; }
[data-theme="strawberry"] .cl-onconfig { color: #1e40af; }

/* ---- Acronym selectors: same pattern as the recipient (email) chips ---- */
.alias-chip {
  background: var(--accent-soft, #e6e6fb);
  border: none; border-radius: 14px; padding: 3px 8px 3px 10px;
}
.alias-chip.removable .alias-x,
.alias-chip.removable .recip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.18); color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer; padding: 0;
}
.alias-chip.removable .alias-x:hover,
.alias-chip.removable .recip-x:hover { background: var(--bad, #c0392b); }

/* MIDNIGHT: the chip pattern was unreadable (light fallback + light ink).
   Give both the recipient chips and acronym chips a proper dark-blue version. */
[data-theme="midnight"] .recip-chip,
[data-theme="midnight"] .alias-chip {
  background: #263252; color: #cdd7ff; border-color: #34406b;
}
[data-theme="midnight"] .recip-chip .recip-x,
[data-theme="midnight"] .alias-chip .alias-x,
[data-theme="midnight"] .alias-chip .recip-x {
  background: rgba(255,255,255,.16); color: #e8edf4;
}

/* config-locations polish: existence dot + section links */
.cl-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); margin-right: 7px; vertical-align: baseline; }
.cl-dot.on { background: var(--good, #2ecc71); }
.cl-where { color: var(--primary); text-decoration: none; font-weight: 600; }
.cl-where:hover { text-decoration: underline; }
.cl-table td { padding-bottom: 10px; }

/* ---- Text inputs & textareas: readable in EVERY theme (midnight had white
   boxes / invisible text in admin), and drag-resizable with scrolling. ---- */
textarea,
input[type="text"], input[type="search"], input[type="email"], input[type="number"] {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
}
textarea {
  resize: vertical;            /* drag the corner to make it taller */
  overflow: auto;              /* always scrollable so nothing is cut off */
  min-height: 90px;
}
textarea:focus, input[type="text"]:focus, input[type="search"]:focus,
input[type="email"]:focus, input[type="number"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

/* pipeline output stays resizable + scrollable, roomy or not */
.log { resize: vertical; min-height: 120px; }

/* intake list: emoji + filename on one aligned line (was offset for most rows) */
.intake-item { display: flex; align-items: center; gap: 7px; text-align: left; }

/* run-all modal: the three steps strip */
.runall-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 4px 0 6px; font-weight: 600; }
.runall-step { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 9px; font-size: 12.5px; }
.runall-arrow { color: var(--dim); }

/* admin TOC: clearly a table of contents, with all-expand/collapse */
.toc-bar { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; width: 100%; margin-bottom: 6px; }
.toc-title { font-weight: 800; font-size: 13.5px; }
.toc-bar-actions { display: flex; gap: 6px; }

/* ============================================================
   #1 Access-request block on the welcome screen
   ============================================================ */
.access-request {
  margin-top: 22px; padding: 18px 20px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line);
  max-width: 460px; margin-left: auto; margin-right: auto; text-align: center;
}
.access-request h3 { margin: 0 0 6px; font-size: 16px; }
.access-request p { margin: 0 0 12px; color: var(--dim); font-size: 13.5px; }
.access-request .btn { text-decoration: none; display: inline-block; }

/* ============================================================
   MORE POP ✨ — richer buttons, cards, banners (all themes)
   ============================================================ */
.btn-primary, .btn-accent {
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  background-image: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0));
}
.btn:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.banner { box-shadow: 0 2px 12px rgba(0,0,0,.10); }
.banner-ok { background-image: linear-gradient(135deg, rgba(46,204,113,.16), transparent); }
.banner-bad { background-image: linear-gradient(135deg, rgba(192,57,43,.14), transparent); }
.stat-card, .userprefs-default, .site-card {
  transition: transform .12s ease, box-shadow .2s ease;
}
.stat-card:hover, .site-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.section-head {
  position: relative; padding-left: 2px;
}
.section-head::after {
  content: ""; display: block; height: 3px; width: 44px; margin-top: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
}

/* preview 'rendering…' placeholder (#3) */
#preview-fallback {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; color: var(--dim); font-size: 14px;
  background: var(--card); border-radius: 10px;
}

/* #4 SharePoint deep-links in the config-locations panel */
.cl-splink { color: var(--primary); text-decoration: none; font-weight: 600; }
.cl-splink:hover { text-decoration: underline; }
.cl-splink::before { content: "🔗 "; }

/* ============================================================
   Detached-job notifications (toasts)
   ============================================================ */
#toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 220px; max-width: 340px; padding: 12px 16px; border-radius: 12px;
  font-weight: 600; font-size: 14px; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  opacity: 0; transform: translateY(10px); transition: opacity .3s ease, transform .3s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok  { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.toast-bad { background: linear-gradient(135deg, #e74c3c, #c0392b); }

/* ============================================================
   Intake: inline filter bar + uploader label
   ============================================================ */
.intake-filterbar { margin: 6px 0 10px; }
.intake-filter-input {
  width: 100%; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 14px;
}
.intake-filter-input:focus { outline: 2px solid var(--primary); }
.intake-by { color: var(--dim); font-size: 12px; font-weight: 400; }

/* ============================================================
   Scrolling + resize: work with 'roomy' OFF too, expanders always usable
   ============================================================ */
/* When roomy is off the app can clip content — allow the main content to scroll */
body:not(.roomy) .page-scroll,
body:not(.roomy) main,
body:not(.roomy) .content { overflow-y: auto; }
/* every textarea / log / preview stays user-resizable AND scrollable regardless
   of roomy state (previously some were locked when roomy was off) */
.roomy textarea, body:not(.roomy) textarea,
.roomy .log, body:not(.roomy) .log,
textarea, .log, .resizable {
  resize: vertical !important;
  overflow: auto !important;
}
/* give resizable panes a visible drag affordance in both states */
textarea, .log, .resizable { min-height: 90px; }
.log { min-height: 120px; }

/* relocate hint + copy button in the config-locations panel */
.cl-relocate { margin-top: 3px; font-size: 12px; }
.cl-relocate code { background: var(--panel); padding: 1px 5px; border-radius: 5px; }
.cl-copy { background: none; border: none; cursor: pointer; font-size: 12px; padding: 0 4px; }
.cl-copy:hover { opacity: .7; }

/* ============================================================
   Pipeline log: make the DIV genuinely drag-resizable (divs need
   overflow!=visible + an explicit min/max, unlike textareas)
   ============================================================ */
.log {
  resize: vertical !important;
  overflow: auto !important;
  min-height: 140px;
  max-height: none;      /* no cap — drag the pipeline as tall as you like */
  height: 260px;         /* a sensible default drag start */
  display: block;
}
/* the pipeline subpanel must not clip or fix the log's height */
.subpanel-pipeline { overflow: visible; height: auto; }
.subpanel-pipeline .log { flex: none; }
/* roomy mode must NOT flatten the log's own resize/scroll — keep it draggable */
html.roomy .subpanel-pipeline .log, body.roomy .subpanel-pipeline .log {
  overflow: auto !important; max-height: none !important; resize: vertical !important;
  height: 260px; }

/* settings panel: group header rows */
.st-group-row td { background: var(--panel); padding-top: 12px; font-size: 13px; color: var(--primary); }

/* ============================================================
   Intake filter bar — one clean, aligned row of labelled fields
   ============================================================ */
.intake-filterbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  width: 100%; margin: 6px 0 14px; padding-bottom: 16px; border-bottom: 2px dashed var(--line); }
/* each labelled field is a small vertical stack: label on top, control below */
.if-field { display: inline-flex; flex-direction: column; gap: 3px; position: relative; }
.if-lab { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; padding-left: 2px; }
/* the name search — a normal-sized single-line input, NOT a big square */
.intake-filter-name { width: 200px; height: 36px; box-sizing: border-box; padding: 8px 11px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; }
.intake-filter-name:focus { outline: 2px solid var(--primary); }
.intake-filter-date { height: 36px; box-sizing: border-box; padding: 6px 8px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; }
.intake-filter-date:focus { outline: 2px solid var(--primary); }
/* the checkbox-dropdown buttons (uploader / how it arrived) */
.if-drop-btn { height: 36px; box-sizing: border-box; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; cursor: pointer; white-space: nowrap; }
.if-drop-btn:hover:not(:disabled) { border-color: var(--accent); }
.if-drop-btn:disabled { opacity: .5; cursor: not-allowed; }
.if-drop-menu { position: absolute; top: 100%; left: 0; margin-top: 4px; z-index: 50;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px; min-width: 200px; max-height: 260px; overflow-y: auto; }
.if-check { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px;
  font-size: 13px; cursor: pointer; }
.if-check:hover { background: var(--panel); }
/* reset button lines up with the bottom of the fields */
.if-reset { height: 36px; box-sizing: border-box; align-self: flex-end; white-space: nowrap; }

/* intake row metadata + preview badge */
.intake-when { color: var(--dim); font-size: 11px; }
.intake-method { color: var(--primary); font-size: 11px; }
.intake-meta { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: 6px; }
.method-badge { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.method-chip { display: inline-block; padding: 3px 10px; border-radius: 10px;
  background: var(--panel); color: var(--primary); font-size: 12px; font-weight: 600; }
.form-panel .method-badge { margin: 2px 0 10px; }

/* ============================================================
   Logos — welcome top strip + app header
   ============================================================ */
/* welcome page: co-branded strip, CCI left / OPTIMAL right */
.brand-strip { position: absolute; top: 0; left: 0; right: 0; display: flex;
  justify-content: space-between; align-items: center; padding: 18px 26px; z-index: 5; }
.brand-logo { height: 46px; width: auto; opacity: .96; }
.brand-logo.brand-left { max-width: 200px; }
.brand-logo.brand-right { max-width: 200px; }

/* app header: small logos flanking the brand text */
.header-logo { height: 34px; width: auto; }
.header-logo-cci { margin-right: 4px; }
.header-logo-optimal { margin-left: 10px; }
/* on a dark header, give a light logo room to breathe; a chip keeps a dark
   logo visible too */
.topbar .header-logo { background: rgba(255,255,255,.9); border-radius: 8px; padding: 3px 6px; }

@media (max-width: 620px) {
  .header-logo-optimal { display: none; }   /* keep the header uncluttered on phones */
  .brand-logo { height: 34px; }
}

/* ============================================================
   Personnel editor
   ============================================================ */
.pe-wrap { max-width: 900px; }
.pe-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pe-intro { margin: 4px 0 16px; max-width: 640px; }
.pe-haslock { color: var(--primary); font-weight: 600; font-size: 13px; }
.pe-locked { padding: 16px 18px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--line); font-size: 14px; }
.pe-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pe-toolbar .pe-spacer { flex: 1; }
.pe-dirty { color: #b8500a; font-weight: 600; }
.pe-site { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 14px; background: var(--card); }
.pe-site.pe-inactive { opacity: .62; background: var(--panel); }
.pe-site-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pe-site-name { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 15px; font-weight: 600; background: var(--card); color: var(--ink); }
.pe-site-id { font-size: 12px; color: var(--dim); white-space: nowrap; }
.pe-toggle { font-size: 13px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pe-people { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.pe-people th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--dim); padding: 4px 8px; border-bottom: 1px solid var(--line); }
.pe-people td { padding: 4px 8px; }
.pe-people input[type=text], .pe-p-name, .pe-p-role { width: 100%; padding: 6px 8px;
  border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; }
/*Fix dark mode on personnel bug */
.pe-people input[type=text]:disabled, .pe-p-name:disabled, .pe-p-role:disabled,
.pe-people input[type=text][readonly], .pe-p-name[readonly],
.pe-p-extra:disabled, .pe-site-name:disabled, .pe-site-idnum:disabled {
  background: var(--panel); color: var(--ink); -webkit-text-fill-color: var(--ink);
  opacity: 1; cursor: default; }
/* View-only mode disables these inputs. Browsers render disabled/readonly
   fields with their OWN washed-out colours (light bg + grey text), which is
   unreadable in dark mode. Force our themed colours so view-only stays legible. */
.pe-people input[type=text]:disabled, .pe-p-name:disabled, .pe-p-role:disabled,
.pe-people input[type=text][readonly], .pe-p-name[readonly],
.pe-p-extra:disabled, .pe-site-name:disabled, .pe-site-idnum:disabled {
  background: var(--panel); color: var(--ink); -webkit-text-fill-color: var(--ink);
  opacity: 1; cursor: default; }
.pe-p-del { background: none; border: none; cursor: pointer; color: #b04a4a; font-size: 14px; }
.pe-p-del:hover { opacity: .7; }
.pe-idle-modal { max-width: 420px; text-align: center; }
.pe-flash { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: 12px 22px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 500; font-size: 14px; }
.pe-flash.bad { background: #b04a4a; }

/* non-blocking "save in progress" banner — bottom-right, does NOT cover the page
   so the user can keep working while the save completes */
.pe-save-progress { position: fixed; bottom: 24px; right: 24px; z-index: 500;
  background: var(--card, #fff); color: var(--ink, #222); border: 1px solid var(--border, #e6e9ee);
  border-left: 4px solid var(--primary, #1f3a5f); padding: 12px 18px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 13px; max-width: 320px;
  display: flex; align-items: center; gap: 8px; }
.pe-save-progress[hidden] { display: none; }
.pe-sp-spin { display: inline-block; animation: pe-sp-rot 1.4s linear infinite; }
@keyframes pe-sp-rot { to { transform: rotate(360deg); } }

/* personnel loading state — shown until the roster paints */
.pe-loading { display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 40px 18px; margin: 10px 0; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--line); color: var(--dim); font-size: 14px; }
.pe-loading[hidden] { display: none; }

/* "Update docs" popup: folders/audit runner + its live log */
.pe-update-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.pe-update-log { max-height: 220px; overflow-y: auto; background: var(--logbg); color: var(--logfg);
  border-radius: 8px; padding: 10px 12px; margin: 8px 0; line-height: 1.5;
  font: 400 12px var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.pe-update-log[hidden] { display: none; }
[data-pe-run].is-running { opacity: 1; }
[data-pe-run].is-running::after { content: "⏳"; display: inline-block; margin-left: 7px;
  animation: run-hourglass 1.1s ease-in-out infinite; }

/* ============================================================
   Email explanatory-block HTML editors (admin)
   ============================================================ */
.et-htmlblock { margin: 10px 0 16px; }
.et-lab { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.et-html { width: 100%; min-height: 60px; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.5;
  resize: vertical; }             /* drag the corner to resize */
.et-html:focus { outline: 2px solid var(--primary); }
.et-prev-lab { margin: 4px 0 2px; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.et-prev { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px;
  background: #fff; color: #222; font-size: 13px; min-height: 20px; }

/* personnel editor v2: search, collapse, per-site, roles, inactive colour */
.pe-search { padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; min-width: 220px; }
.pe-collapse { background: none; border: none; cursor: pointer; font-size: 14px; color: var(--dim); padding: 0 4px; }
.pe-count { white-space: nowrap; }
.pe-add-bottom { margin: 10px 0 30px; }
.pe-prow-inactive input, .pe-prow-inactive select { opacity: .55; }
.pe-save-site { white-space: nowrap; }
.pe-p-role { padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; }
.pe-roles-modal { max-width: 520px; }
.pe-role-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.pe-role-full { flex: 1; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; }
.pe-role-abbr { padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; }
.pe-role-del { background: none; border: none; cursor: pointer; color: #b04a4a; font-size: 14px; }
.pe-viewing { color: #b8500a; font-weight: 600; font-size: 13px; }
/* View-only inputs: this rule used to set only a hardcoded light background
   (#f6f7f9). In dark mode that left LIGHT text (var(--ink)) on a LIGHT box —
   the "personnel editor is illegible in dark mode" bug. Because it comes after
   the themed :disabled/[readonly] rule above, it won on `background`, so it must
   set the themed colours itself. */
body.pe-readonly .pe-people input, body.pe-readonly .pe-people select {
  background: var(--panel); color: var(--ink); -webkit-text-fill-color: var(--ink);
  opacity: 1; }

/* personnel editor: summary, filters, per-site unsaved badge, confirm modal */
.pe-summary { margin: 4px 0 8px; }
.pe-sum-toggle { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; color: var(--ink); }
.pe-sum-toggle:hover { border-color: var(--accent); }
.pe-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 10px 14px; margin-bottom: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.pe-filters select { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); }
.pe-site-unsaved { color: #b8500a; font-weight: 600; font-size: 12px; margin-left: 8px; }
.pe-confirm-modal { max-width: 400px; }

/* ============================================================
   Pipeline log resize — definitive fix (uses #log for specificity)
   There are several legacy .log rules; #log outranks them all so the
   drag-to-resize works in BOTH normal and roomy mode.
   ============================================================ */
#log {
  resize: vertical !important;
  overflow: auto !important;
  height: 300px;
  min-height: 140px;
  max-height: none !important;   /* no cap — drag as tall as you want */
  display: block !important;
  flex: none !important;         /* don't let flex collapse the drag height */
}
html.roomy #log, body.roomy #log {
  resize: vertical !important;
  overflow: auto !important;     /* roomy elsewhere sets visible, which kills the grip */
  max-height: none !important;
  height: 300px;
  flex: none !important;
}

/* personnel custom columns */
.pe-colbadge { font-size: 11px; }
.pe-col-del { background: none; border: none; cursor: pointer; color: #b04a4a; font-size: 11px; }
.pe-p-extra { width: 100%; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; }
.pe-add-col { margin-left: 6px; }

/* personnel saving progress overlay */
.pe-saving { position: fixed; inset: 0; background: rgba(20,25,40,.28); z-index: 600;
  display: flex; align-items: center; justify-content: center; }
.pe-saving-box { background: var(--card); border-radius: 14px; padding: 22px 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); min-width: 280px; text-align: center; }
.pe-saving-bar { height: 6px; border-radius: 4px; background: var(--panel); overflow: hidden; margin-bottom: 12px; }
.pe-saving-fill { height: 100%; width: 40%; border-radius: 4px; background: var(--primary);
  animation: pe-indeterminate 1.1s ease-in-out infinite; }
@keyframes pe-indeterminate {
  0% { margin-left: -40%; } 100% { margin-left: 100%; }
}
.pe-saving-msg { font-size: 14px; color: var(--ink); }

/* personnel audit-status chips + pills */
.pe-chip { display: inline-block; padding: 2px 8px; border-radius: 11px; font-size: 11px;
  font-weight: 600; margin: 1px 2px; white-space: nowrap; }
.pe-chip.ok   { background: #d6f5df; color: #1c7a3e; }
.pe-chip.warn { background: #fff2cc; color: #8a6d00; }
.pe-chip.bad  { background: #ffd9d9; color: #9e2626; }
.pe-chip.unk  { background: var(--panel); color: var(--muted, #888); }
.pe-status-pill { border: none; cursor: pointer; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; }
.pe-status-pill.ok   { background: #d6f5df; color: #1c7a3e; }
.pe-status-pill.warn { background: #fff2cc; color: #8a6d00; }
.pe-status-pill.bad  { background: #ffd9d9; color: #9e2626; }
.pe-status-pill.unk  { background: var(--panel); color: var(--muted, #888); }
.pe-status-chips { margin-top: 4px; }
.pe-status-cell { max-width: 340px; }
.pe-sitechips { padding: 6px 10px; margin-bottom: 6px; background: var(--panel);
  border-radius: 8px; font-size: 12px; }
.pe-asof { margin-left: 12px; }

/* personnel role cards (mini dashboard in the drill-down) */
.pe-rolecards { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.pe-rolecard { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; min-width: 120px; text-align: left; cursor: pointer; transition: box-shadow .12s; }
.pe-rolecard:hover { box-shadow: 0 3px 12px rgba(0,0,0,.12); }
.pe-rc-role { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.pe-rc-total { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1; }
.pe-rc-split { font-size: 11px; margin-top: 3px; }
.pe-rc-active { color: #1c7a3e; }
.pe-rc-inactive { color: var(--muted, #888); }

/* personnel site folder link */
.pe-site-link { font-size: 12px; margin-left: 8px; color: var(--primary, #2b6cb0);
  text-decoration: none; white-space: nowrap; }
.pe-site-link:hover { text-decoration: underline; }

/* personnel audit-running banner */
.pe-auditbar { background: #fff8e6; border: 1px solid #f0d98c; color: #8a6d00;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }

/* dashboard: by-doc-type breakdown */
.typebreak { margin: 4px 0 10px; }
.typebreak-toggle { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--ink); }
.typebreak-toggle:hover { border-color: var(--accent, #5b5bd6); }
.typebreak-body { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.typebreak-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.typebreak-cat { font-size: 12px; font-weight: 700; min-width: 96px; }
.typebreak-warn { color: #8a6d00; }
.typebreak-bad { color: #9e2626; }
.typebreak-chip { display: inline-block; padding: 3px 10px; border-radius: 11px; font-size: 12px;
  background: var(--panel); color: var(--ink); cursor: pointer; border: 1px solid var(--line); }
.typebreak-chip:hover { border-color: var(--accent, #5b5bd6); }
.typebreak-chip b { margin-left: 3px; }

/* personnel field types */
.pe-coltype { font-size: 11px; opacity: .7; }
.pe-p-extra.pe-invalid { border-color: #d9534f; background: #fff3f3; }
.pe-cols-bar { margin: 4px 0 8px; }
.pe-type-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pe-type-choice { flex: 1; min-width: 110px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; font-size: 14px; }
.pe-type-choice:hover { border-color: var(--accent, #5b5bd6); background: var(--panel); }
.pe-gcol-type { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); }

/* personnel: site-level documents row */
.pe-sitelevel { display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 8px 10px; margin-bottom: 8px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; }
.pe-sitelevel-label { font-weight: 600; font-size: 13px; }
.pe-sitelevel .pe-status-chips { flex-basis: 100%; margin-top: 6px; }

/* personnel: "Site [X] — Name" header with a big editable ID */
.pe-site-idbox { display: inline-flex; align-items: baseline; gap: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 2px 8px; }
.pe-site-idlabel { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); }
.pe-site-idnum { width: 3ch; border: none; background: transparent; color: var(--ink);
  font-size: 22px; font-weight: 800; text-align: center; padding: 0; }
.pe-site-idnum::-webkit-outer-spin-button, .pe-site-idnum::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pe-site-idnum { -moz-appearance: textfield; }
.pe-site-dash { color: var(--dim); font-weight: 700; margin: 0 2px; }

/* personnel: filter "on" badge */
.pe-filter-badge { display: inline-block; margin-left: 4px; font-size: 10px; font-weight: 700;
  background: var(--accent, #5b5bd6); color: #fff; border-radius: 8px; padding: 1px 6px;
  text-transform: uppercase; letter-spacing: .03em; }

/* personnel: always-visible action footer (sticky at viewport bottom) */
.pe-footer { position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 16px; margin-top: 10px; border-radius: 0 0 12px 12px;
  box-shadow: 0 -2px 10px rgba(0,0,0,.08); }
#pe-sites { padding-bottom: 8px; }

/* log: manual entry modal fields */
.manual-fld { display: block; margin: 12px 0; font-weight: 600; font-size: 13px; }
.manual-fld input, .manual-fld textarea { display: block; width: 100%; margin-top: 4px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: var(--panel); color: var(--ink); box-sizing: border-box; }
.manual-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }

/* personnel: restore-from-backup list */
.pe-restore-list { max-height: 340px; overflow-y: auto; margin: 10px 0;
  border: 1px solid var(--line); border-radius: 8px; }
.pe-restore-row { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.pe-restore-row:last-child { border-bottom: none; }
.pe-restore-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

/* log: shared ChipPicker sizing in the email toolbar row */
.log-chip-input { min-width: 260px; flex: 1 1 260px; }