:root {
  --bg: #f4f1ea;
  --surface: #fffdf9;
  --surface-2: #faf6ee;
  --ink: #1f1c18;
  --ink-2: #4a433b;
  --muted: #71685e;
  --line: #e6dfd3;
  --line-strong: #d3c9b9;
  --accent: #8f3d1f;
  --accent-soft: #f6e7df;
  --ok: #1f6b45;
  --ok-bg: #e4f3ea;
  --warn: #8a5a10;
  --warn-bg: #f8efd8;
  --info: #1d4e89;
  --info-bg: #e6eff9;
  --danger: #a3261b;
  --danger-bg: #fde8e4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 45, 25, 0.05), 0 6px 20px rgba(60, 45, 25, 0.05);
  /* chart roles */
  --s-auto: #2a78d6;
  --s-approved: #eb6834;
  --s-asked: #1baf7a;
  --s-drafted: #eda100;
  --s-skipped: #b9b5ab;
  --s-failed: #d03b3b;
  --grid: #e9e3d8;
  --side: 240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
code { font-family: Consolas, "SF Mono", monospace; font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.muted, .hint, .sub, .meta, .empty, .kicker { color: var(--muted); }
.hint { font-size: 13px; display: block; font-weight: 400; }
.kicker { font-size: 12.5px; letter-spacing: 0.02em; margin-bottom: 4px; }
.kicker a { color: inherit; }
.nowrap { white-space: nowrap; }
.dot { margin: 0 4px; color: var(--line-strong); }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; z-index: 60;
  display: flex; flex-direction: column; gap: 20px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; font-weight: 700; font-size: 15px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; flex: none; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14.5px;
}
.nav a:hover { background: #f0eadf; color: var(--ink); }
.nav a.on { background: var(--ink); color: #fff; }
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge { margin-left: auto; min-width: 20px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; line-height: 20px; text-align: center; font-weight: 650; }
.nav a.on .badge { background: #fff; color: var(--ink); }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 4px 8px 0; font-size: 13px; }
.who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiet-link { color: var(--muted); }
.mode-pill { display: inline-flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; }
.mode-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.mode-pill.draft i { background: #b3a999; }

.content { width: 100%; max-width: 2000px; margin: 0; padding: 22px 24px 48px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.sub { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-actions, .button-row, .model-row {
  display: flex;
  gap: 8px 10px;
  align-items: center;
  flex-wrap: wrap;
}
.head-actions form, .button-row form, .model-row form { display: flex; margin: 0; }
.button-row > .hint, .head-actions > .hint {
  display: inline;
  flex: 1 1 14rem;
  min-width: 12rem;
}
.head-stats { display: flex; gap: 18px; color: var(--muted); }
.head-stats strong { color: var(--ink); font-size: 18px; margin-right: 4px; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-title { font-size: 17px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.section { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.grid-2.flush { gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 18px; }
.empty { padding: 18px 4px; }
.empty-state { align-items: flex-start; padding: 32px; gap: 10px; }
.empty-state p { color: var(--muted); max-width: 62ch; }

.banner { padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.banner.ok { background: var(--ok-bg); border-color: #c5e3d1; color: #174f33; }
.banner.danger { background: var(--danger-bg); border-color: #f0c2b8; color: #7a1d14; }
.banner.warn { background: var(--warn-bg); border-color: #ead7a6; color: #5f3e09; }
.flashes { display: grid; gap: 8px; }

/* ---- controls ---- */
button, .button {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--ink); border-radius: 9px;
  background: var(--ink); color: #fff;
  padding: 9px 16px; min-height: 40px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
button:hover, .button:hover { background: #3a342c; }
button:active, .button:active { transform: translateY(1px); }
button.quiet, .button.quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
button.quiet:hover, .button.quiet:hover { background: #f1ebdf; }
button.small, .button.small { min-height: 32px; padding: 5px 11px; font-size: 13.5px; }
.danger-text { color: var(--danger) !important; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.stack > button, .stack > .button, .card > button, .card > .button,
.form-grid > button, .span-2 > button, .source > button, .source > .button {
  width: max-content;
  max-width: 100%;
  justify-self: start;
}
button.busy { cursor: wait; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 400; padding: 9px 12px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 18px; height: 18px; margin: 0; flex: none; padding: 0; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: 1 / -1; }

.options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 400; }
.option:hover { border-color: var(--ink-2); }
.option:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fffaf6; }
.option input { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.option-body { display: grid; gap: 4px; }
.option-body span { color: var(--muted); font-size: 13.5px; }

/* ---- tags & chips ---- */
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.tag.sent { color: var(--ok); background: var(--ok-bg); }
.tag.drafted { color: var(--warn); background: var(--warn-bg); }
.tag.waiting { color: #fff; background: var(--accent); }
.tag.skipped, .tag.read { color: var(--muted); background: #eeeae2; }
.tag.handled { color: var(--ok); background: var(--ok-bg); }
.tag.pending { color: var(--info); background: var(--info-bg); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--ink-2); }
.chip.tiny { padding: 1px 8px; font-size: 12px; }
.chip.gmail::before, .chip.outlook::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #d9483b; }
.chip.outlook::before { background: #1570c9; }

/* ---- inbox ---- */
.status-strip { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); flex-wrap: wrap; }
.status-item { padding: 12px 18px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; border-right: 1px solid var(--line); min-width: 0; }
.status-item:last-child { border-right: 0; }
.status-item.grow { flex: 1 1 320px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.inline-details { flex-basis: 100%; }
.status-item .schedule { flex-basis: 100%; }
.status-item .inline-details + .schedule { margin-top: -4px; }
.inline-details summary { cursor: pointer; color: var(--accent); font-size: 13.5px; width: fit-content; }
.lines { margin: 8px 0 0; padding-left: 18px; max-height: 12rem; overflow: auto; color: var(--ink-2); font-size: 13.5px; }

.tabs-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; background: var(--surface); }
.tab span { font-size: 12px; color: var(--muted); font-weight: 600; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.on span { color: #d8d0c4; }

.inbox-desk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 280px); gap: 16px; align-items: start; min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, clamp(240px, 32%, 360px)) minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
.story-rail {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
}
.story-rail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.story-rail-head h2 { font-size: 16px; }
.story-rail-list { overflow: auto; }
.story-rail-list .empty { padding: 18px 16px; }
.story-card {
  display: grid; gap: 3px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none; min-width: 0;
}
.story-card:hover { background: var(--surface-2); }
.story-card.on { background: #fbf3ec; }
.story-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; min-width: 0; }
.story-card-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.story-card .tag { flex: none; }
.story-card-who { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-card-blurb { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.story-card-foot { font-size: 12px; color: var(--muted); }
.matter-jump { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.matter-scrim {
  position: fixed; inset: 0 0 0 var(--side); background: rgba(31, 28, 24, 0.28); z-index: 40;
}
.matter-drawer {
  position: fixed; top: 0; left: var(--side); bottom: 0; width: min(400px, calc(94vw - var(--side)));
  z-index: 50; background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: 12px 0 40px rgba(31, 28, 24, 0.12);
  display: flex; flex-direction: column;
  gap: 12px; padding: 22px 22px 28px; overflow: auto;
  animation: drawer-in 0.18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(-16px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.matter-drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.matter-drawer-head h2 { font-size: 20px; overflow-wrap: anywhere; }
.matter-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 6px; }
.matter-letters { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.matter-letters a {
  display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none; min-width: 0;
}
.matter-letters a:hover { color: var(--accent); }
.matter-letters strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matter-letters span { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matter-actions { padding-top: 8px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: hidden; overflow-y: auto; max-height: calc(100vh - 32px); position: sticky; top: 16px; min-width: 0; }
.row { display: grid; gap: 3px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; border-left: 3px solid transparent; min-width: 0; overflow: hidden; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.on { background: #fbf3ec; border-left-color: var(--accent); }
.row-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; min-width: 0; }
.row-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row.unread .row-who::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--info); margin-right: 7px; vertical-align: 2px; }
.row-date { color: var(--muted); font-size: 12.5px; flex: none; }
.row-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row.unread .row-subject { font-weight: 600; }
.row-snippet { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1em; min-width: 0; }
.row-foot { display: flex; gap: 6px; align-items: center; margin-top: 3px; min-width: 0; }
.row-foot .tag { flex: 1 1 auto; min-width: 0; }
.row-foot .chip { flex: none; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 10px 12px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.pager .button[aria-disabled] { opacity: 0.4; pointer-events: none; }
.pager-status { font-size: 13px; color: var(--muted); font-weight: 600; min-width: 3.5em; text-align: center; }

.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 16px; align-items: start; }
.cal-board {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; min-width: 0;
}
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cal-toolbar h2 { font-size: 18px; }
.cal-weekdays, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-weekdays span {
  padding: 8px 6px; font-size: 12px; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); text-align: center;
}
.cal-week + .cal-week { border-top: 1px solid var(--line); }
.cal-cell {
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  min-height: 108px; padding: 8px 7px 10px; color: inherit; text-decoration: none;
  border-right: 1px solid var(--line); background: var(--surface);
}
.cal-week .cal-cell:last-child { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { color: var(--muted); background: #f7f3eb; }
.cal-cell.out .cal-num { color: var(--muted); }
.cal-cell.today .cal-num {
  background: var(--ink); color: #fff; border-radius: 999px;
}
.cal-cell.on { background: var(--accent-soft); }
.cal-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13.5px; align-self: flex-start;
}
.cal-pill {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; line-height: 1.35; padding: 2px 6px; border-radius: 5px;
  background: var(--info-bg); color: var(--ink); border-left: 3px solid #1570c9;
}
.cal-pill.gmail { background: #fde8e4; border-left-color: #d9483b; }
.cal-pill.outlook { background: var(--info-bg); border-left-color: #1570c9; }
.cal-pill b { font-weight: 650; margin-right: 4px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.cal-more { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 6px; }
.cal-side { display: grid; gap: 16px; min-width: 0; }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-day-head .card-title { margin: 0; }
.cal-agenda { display: grid; gap: 2px; max-height: 460px; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.cal-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 4px 8px; padding: 6px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.cal-item:last-child { padding-bottom: 0; border-bottom: 0; }
.cal-item-when { font-size: 12px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-dot { width: 8px; height: 8px; border-radius: 999px; background: #1570c9; flex-shrink: 0; }
.cal-dot.gmail { background: #d9483b; }
.cal-dot.outlook { background: #1570c9; }
.cal-item-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-item-title a { color: inherit; text-decoration: none; }
.cal-item-title a:hover { text-decoration: underline; }
.cal-item-sub { grid-column: 3; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; min-width: 0; }

.reader { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.reader-head { padding: 20px 24px 16px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.reader-title { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.reader-title h2 { font-size: 20px; overflow-wrap: anywhere; }
.reader-title .tag { flex: none; margin-top: 3px; }
.ai-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.ai-note b { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 2px; }
.ai-note.ask { background: #fdf3ec; border-color: #f0d6c6; }
.story { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 8px; display: grid; gap: 8px; }
.story-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.story-head b { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tag.waiting_on_me { color: #fff; background: var(--accent); }
.tag.waiting_on_them { color: var(--info); background: var(--info-bg); }
.tag.in_progress { color: var(--warn); background: var(--warn-bg); }
.story-line { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.story-line li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 8px 8px 14px; border-left: 2px solid var(--line-strong); position: relative; }
.story-line li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); position: absolute; left: -5px; top: 12px; }
.story-line li.on { background: #fff; border-radius: 0 8px 8px 0; }
.story-line li.on::before { background: var(--accent); }
.story-line li.out { color: var(--muted); }
.story-who { font-weight: 600; font-size: 13.5px; color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
a.story-who:hover { text-decoration: underline; }
.story-date { font-size: 12px; color: var(--muted); }
.story-summary { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chip.tiny.story { background: #efe8dc; color: var(--ink-2); }
.mail-frame { display: block; width: 100%; height: 420px; border: 0; background: #fff; }
.reply-box { padding: 18px 24px 22px; border-top: 1px solid var(--line); display: grid; gap: 12px; background: #f6faf7; }
.reply-box.waiting { background: #fdf6f1; }
.reply-box.drafted { background: #fdf9ee; }
.reply-box form { display: grid; gap: 12px; }
.reply-box.start { background: #fff; padding-top: 14px; padding-bottom: 16px; gap: 6px; }
.reply-box form.rewrite-row, .rewrite-row { display: flex; gap: 8px; align-items: center; }
.rewrite-row input[type=text] { flex: 1; min-width: 0; }
.rewrite-row button { flex: none; }
.attach-box { display: grid; gap: 6px; }
.attach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.attach-list li { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.attach-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.attach-pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.attach-pick input[type=file] { flex: 1 1 200px; min-width: 0; font-size: 13px; }
.attach-pick select { flex: 1 1 180px; min-width: 0; }
.invoice-lines td:first-child { width: 60%; }
.invoice-lines input { width: 100%; min-width: 64px; }
.invoice-lines td:nth-child(2) input { max-width: 80px; }
.invoice-lines td:nth-child(3) input { max-width: 130px; }
.invoice-lines input.needs { border-color: #d08a3c; background: #fdf6ec; }
.table .num, .invoice-lines .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-sums { display: grid; grid-template-columns: auto auto; justify-content: end; column-gap: 28px; row-gap: 4px; font-variant-numeric: tabular-nums; }
.invoice-sums > :nth-child(even) { text-align: right; }
.invoice-sums strong { font-size: 16px; padding-top: 4px; }
.plain-list { margin: 6px 0 0; padding-left: 18px; }
.pre { white-space: pre-line; }
.doc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.role-form select, .small-select { min-height: 32px; padding: 4px 8px; font-size: 13px; width: auto; }
.chip.role-invoice_template, .chip.role-contract_template { background: #f3e9dc; color: #7a4a17; }
.chip.role-price_list { background: #e5f0e8; color: #2f5d3a; }
.contract-fields td:nth-child(2) { width: 45%; }
.contract-fields input { width: 100%; }
.contract-fields input.needs { border-color: #d08a3c; background: #fdf6ec; }
.template-list li { display: grid; gap: 4px; margin-bottom: 12px; }
.doc-picks { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; max-height: 220px; overflow: auto; margin: 0; }
.doc-picks legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.search-row { display: flex; gap: 8px; margin: 12px 0; max-width: 520px; }
.search-row input { flex: 1; min-width: 0; }
.chip.type-client { background: #e3edf9; color: #234a78; }
.chip.type-student { background: #ece5f7; color: #4d3577; }
.chip.type-supplier { background: #f3e9dc; color: #7a4a17; }
.chip.type-partner { background: #e2f1ef; color: #1f5a52; }
.chip.type-friend, .chip.type-family { background: #fbe7ea; color: #82303d; }
.chip.type-institution { background: #ececec; color: #444; }
.small-text { font-size: 12px; }
.letter-list li { margin-bottom: 10px; }
.write-desk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: stretch; margin-top: 12px; }
.write-chat, .write-draft { display: flex; flex-direction: column; min-height: 600px; }
.write-chat { gap: 12px; }
.chat-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; max-height: 62vh; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.chat-msg { display: flex; flex-direction: column; max-width: 88%; }
.chat-msg.you { align-self: flex-end; align-items: flex-end; }
.chat-msg .bubble { white-space: pre-line; overflow-wrap: anywhere; padding: 9px 12px; border-radius: 12px; background: #f4efe6; font-size: 14.5px; }
.chat-msg.you .bubble { background: #2b2620; color: #fff; }
.chat-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chat-hint { color: var(--muted); font-size: 14px; display: grid; gap: 6px; }
.chat-hint p { margin: 0; }
.chat-input { display: flex; gap: 8px; align-items: stretch; margin-top: auto; }
.chat-input textarea { flex: 1; min-width: 0; resize: none; min-height: 44px; }
.chat-input button { align-self: stretch; }
.made-link { align-self: flex-start; }
.attach-box { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.attach-title { font-size: 13px; font-weight: 600; color: var(--muted); }
.attach-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attach-add select { width: auto; flex: 1 1 220px; min-height: 32px; padding: 4px 8px; font-size: 13.5px; }
.upload-button { cursor: pointer; margin: 0; }
.draft-made { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; background: #fffaf0; border: 1px dashed var(--line-strong); border-radius: 8px; padding: 6px 10px; }
.draft-form { display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; }
.draft-top { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 12px; align-items: end; }
.draft-top input, .draft-top select { height: 42px; box-sizing: border-box; }
.draft-body { flex: 1 1 auto; display: flex; flex-direction: column; }
.draft-body textarea { flex: 1 1 auto; min-height: 240px; resize: vertical; }
.draft-actions { margin-top: auto; }
@media (max-width: 860px) {
  .write-desk { grid-template-columns: 1fr; }
  .write-chat, .write-draft { min-height: 0; }
  .chat-log { max-height: 50vh; }
  .draft-top { grid-template-columns: 1fr; }
}
.lang-switch { display: flex; gap: 4px; margin-top: 10px; }
.lang-switch button { min-height: 26px; padding: 2px 9px; font-size: 12.5px; }
.lang-switch button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab-side { margin-left: auto; font-size: 13px; color: var(--muted); align-self: center; white-space: nowrap; }
.reply-head { display: grid; gap: 2px; }
.reply-text { white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; max-height: 26rem; overflow: auto; }
.reply-text.tall { max-height: none; }
.sources { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---- approvals ---- */
.approval-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.approval-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 22px; }
.approval-side, .approval-main { display: grid; gap: 12px; align-content: start; }
.original summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.original .reply-text { margin-top: 8px; max-height: 18rem; font-size: 14px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 6px 12px 6px 0; font-variant-numeric: tabular-nums; }
/* Stays a table cell (display:flex on a td breaks the row lines); the buttons and forms inside sit in a line. */
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions > form, .table td.actions > .button, .table td.actions > a, .table td.actions > span { display: inline-flex; vertical-align: middle; margin: 0 0 0 8px; }
.table td.actions > :first-child { margin-left: 0; }

/* ---- dashboard ---- */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow); display: grid; gap: 4px; align-content: start; min-width: 0; }
.tile.attention { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.tile-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 30px; line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tiles.small .tile-value { font-size: 24px; }
.tile-note, .delta { font-size: 12.5px; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.foot-note { color: var(--muted); font-size: 13.5px; }
.status-bad { color: var(--danger); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 13.5px; border-right: 1px solid var(--line-strong); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--ink); color: #fff; }

.viz { gap: 6px; }
.viz h3.spaced { margin-top: 18px; }
.viz-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.trend { width: 100%; height: auto; display: block; overflow: visible; }
.trend .grid { stroke: var(--grid); stroke-width: 1; }
.trend .baseline { stroke: var(--line-strong); stroke-width: 1; }
.trend .axis { fill: var(--muted); font-size: 11.5px; font-family: inherit; font-variant-numeric: tabular-nums; }
.trend .hit { fill: transparent; }
.trend .bar:hover .hit { fill: rgba(60, 45, 25, 0.05); }
.s-auto_sent { fill: var(--s-auto); background: var(--s-auto); }
.s-approved_sent { fill: var(--s-approved); background: var(--s-approved); }
.s-asked { fill: var(--s-asked); background: var(--s-asked); }
.s-drafted { fill: var(--s-drafted); background: var(--s-drafted); }
.s-skipped { fill: var(--s-skipped); background: var(--s-skipped); }
.s-failed { fill: var(--s-failed); background: var(--s-failed); }
.table-view { margin-top: 8px; }
.table-view summary { cursor: pointer; color: var(--accent); font-size: 13.5px; font-weight: 600; width: fit-content; }
.table-view .table-wrap { margin-top: 10px; max-height: 320px; overflow: auto; }

.hbars { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 9px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr) 36px; gap: 10px; align-items: center; font-size: 13.5px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar-track { height: 12px; display: block; }
.hbar-track i { display: block; height: 100%; min-width: 3px; background: var(--s-auto); border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; align-items: end; height: 120px; margin-top: 12px; border-bottom: 1px solid var(--line-strong); }
.hour { height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.hour:hover { background: rgba(60, 45, 25, 0.05); }
.hour i { display: block; width: 100%; max-width: 20px; min-height: 0; background: var(--s-auto); border-radius: 4px 4px 0 0; }
.hours-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; line-height: 1.4; padding: 6px 10px; border-radius: 7px; max-width: 280px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }

/* ---- knowledge ---- */
.prose { display: grid; gap: 6px; }
.prose h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 10px; }
.prose h4:first-child { margin-top: 0; }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 3px; }
.prose.small { font-size: 14px; color: var(--ink-2); }
.source { gap: 10px; }
.source > button, .source > .button { margin-top: auto; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 11px; padding: 16px; text-align: center; background: var(--surface-2); cursor: pointer; font-weight: 500; color: var(--ink-2); position: relative; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.search-box { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.hit { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); }
.hit-title { font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.doc-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.doc-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.doc h3 a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.doc h3 a:hover { text-decoration: underline; }
.chip.src-upload { background: var(--info-bg); border-color: #cfe0f3; }
.chip.src-email { background: var(--ok-bg); border-color: #c5e3d1; }
.chip.src-sharepoint { background: #e3f1f0; border-color: #bfdedb; }
.chip.src-note { background: var(--warn-bg); border-color: #ead7a6; }

.kb-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kb-steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.kb-steps li.done { border-color: #c5e3d1; background: #f6fbf7; }
.kb-steps b { font-size: 15px; }
.kb-steps span { color: var(--muted); font-size: 13.5px; }
.kb-steps a { font-size: 13.5px; font-weight: 600; width: fit-content; }
.kb-graph { width: 100%; height: 520px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kb-graph svg { width: 100%; height: 100%; display: block; cursor: grab; }
.kb-graph svg:active { cursor: grabbing; }
.kb-graph-hint { margin: 8px 2px 0; }
.kb-edge { fill: none; stroke: #d4cbb8; stroke-width: 1.5; stroke-linecap: round; opacity: 0.9; }
.kb-edge.related { stroke-dasharray: 5 5; stroke-width: 1.1; opacity: 0.55; }
.kb-edge.dim { opacity: 0.12; }
.kb-node { cursor: pointer; }
.kb-node.dim { opacity: 0.18; }
.kb-node circle { stroke-width: 2; }
.kb-you circle { fill: var(--ink); stroke: var(--ink); }
.kb-hub circle { fill: #fff; stroke-width: 2.5; }
.kb-leaf circle { stroke: #fff; }
.kb-label { font-family: inherit; font-size: 11px; fill: var(--ink-2); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.kb-you .kb-label { fill: #fff; font-size: 12px; font-weight: 700; stroke: var(--ink); stroke-width: 3px; }
.kb-hub .kb-label { fill: var(--ink); font-size: 11px; font-weight: 700; }
.kb-hub.kind-fact, .kb-leaf.kind-fact, .kb-node.kind-fact circle, .sw.kind-fact { stroke: #1d4e89; fill: #1d4e89; background: #1d4e89; }
.kb-hub.kind-person, .kb-leaf.kind-person, .kb-node.kind-person circle, .sw.kind-person { stroke: #0b7c83; fill: #0b7c83; background: #0b7c83; }
.kb-hub.kind-topic, .kb-leaf.kind-topic, .kb-node.kind-topic circle, .sw.kind-topic { stroke: #2a78d6; fill: #2a78d6; background: #2a78d6; }
.kb-hub.kind-experience, .kb-leaf.kind-experience, .kb-node.kind-experience circle, .sw.kind-experience { stroke: #8a5a10; fill: #8a5a10; background: #8a5a10; }
.kb-hub.kind-preference, .kb-leaf.kind-preference, .kb-node.kind-preference circle, .sw.kind-preference { stroke: #6b4a9a; fill: #6b4a9a; background: #6b4a9a; }
.kb-hub.kind-rule, .kb-leaf.kind-rule, .kb-node.kind-rule circle, .sw.kind-rule { stroke: #8f3d1f; fill: #8f3d1f; background: #8f3d1f; }
.kb-hub.kind-decision, .kb-leaf.kind-decision, .kb-node.kind-decision circle, .sw.kind-decision { stroke: #1f6b45; fill: #1f6b45; background: #1f6b45; }
.kb-hub.kind-fact circle, .kb-hub.kind-person circle, .kb-hub.kind-topic circle, .kb-hub.kind-experience circle, .kb-hub.kind-preference circle, .kb-hub.kind-rule circle, .kb-hub.kind-decision circle, .kb-node.kb-hub circle { fill: #fff; }
.kb-legend { margin-top: 10px; }
.kb-kind .card-title { display: flex; align-items: center; gap: 8px; }
.kb-add { max-width: 420px; }
.kb-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kb-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; background: var(--surface-2); }
.kb-card.locked { background: #f3f7fb; }
.kb-card p { overflow-wrap: anywhere; }
.kb-views { margin: 4px 0 16px; }
.kb-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kb-tile { text-decoration: none; color: inherit; display: grid; gap: 8px; align-content: start; }
.kb-tile h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.kb-tile h3 span { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 600; }
.kb-tile ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); font-size: 13.5px; }
.kb-tile:hover { border-color: var(--line-strong); }
.kb-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.kb-event { display: grid; grid-template-columns: 12px 1fr; gap: 12px; align-items: start; }
.kb-event p { margin: 0; }
.kb-event.superseded, .kb-event.ended { opacity: 0.78; }
.kb-card.past { opacity: 0.7; }
.kb-past-head { margin: 16px 0 8px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
details.card > summary { cursor: pointer; display: grid; gap: 4px; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

/* ---- connections ---- */
.conn-head { display: flex; gap: 12px; align-items: center; }
.conn-head > div { display: grid; gap: 2px; }
.logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex: none; }
.logo.gmail { background: #d9483b; }
.logo.outlook { background: #1570c9; }
.logo.whatsapp { background: #1fa855; }
.logo.sharepoint { background: #0b7c83; }
.logo.files { background: #7a6a55; }
.logo.ai { background: #3a342c; }
.logo.store { background: #5b5fa8; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.state i { width: 8px; height: 8px; border-radius: 50%; background: #c5bcae; }
.state.on { color: var(--ok); }
.state.on i { background: var(--ok); }
.account-line { font-weight: 600; overflow-wrap: anywhere; }
.copy-line { display: block; margin: 4px 0; }
.setup { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; gap: 10px; align-content: start; }
.checks { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: step; font-size: 14px; color: var(--ink-2); }
.checks li { position: relative; padding-left: 32px; counter-increment: step; }
.checks li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); background: #fff; }
.checks li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.checks b { display: block; color: var(--ink); }

/* ---- sign in ---- */
.auth-shell { width: min(1080px, calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 440px); gap: 56px; align-items: center; min-height: 100vh; padding: 40px 0; }
.auth-copy { display: grid; gap: 18px; }
.auth-copy .brand { padding: 0; }
.auth-copy h1 { font-size: 38px; line-height: 1.15; letter-spacing: -0.02em; }
.points { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); font-size: 16.5px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card .stack button { width: 100%; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.tabs a { text-align: center; text-decoration: none; color: var(--ink-2); border-radius: 8px; padding: 7px 12px; font-weight: 600; }
.tabs a.on { background: var(--ink); color: #fff; }

/* ---- privacy policy ---- */
.legal { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 72px; display: grid; gap: 14px; }
.legal .brand { padding: 0; }
.legal h1 { font-size: 32px; margin-top: 8px; }
.legal h2 { font-size: 18px; margin-top: 14px; }
.legal ul { margin: 0; padding-left: 22px; display: grid; gap: 6px; }

/* ---- settings tabs & compact controls ---- */
.settings-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; max-width: 100%; }
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs .tab { flex: none; white-space: nowrap; }
.settings-panel { display: flex; flex-direction: column; gap: 16px; }
.settings-panel[hidden] { display: none; }
.model-select { flex: 1 1 280px; min-width: 0; }
.ping-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin-top: 6px; }
.ping-item { display: flex; align-items: flex-start; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ping-item .check { flex: 0 1 auto; }
.ping-info { display: inline-block; }
.ping-info summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1.5; user-select: none; padding: 0 4px; }
.ping-info summary::-webkit-details-marker { display: none; }
.ping-info[open] { flex-basis: 100%; }
.ping-info[open] summary { color: var(--accent); }
.ping-info p { margin-top: 4px; }

/* ---- small screens ---- */
@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1240px) {
  .inbox-desk { grid-template-columns: 1fr; }
  .story-rail { position: static; max-height: min(42vh, 380px); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .brand span:last-child, .side-foot .who, .side-foot .quiet-link { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav a span { display: none; }
  .nav a.on span { display: inline; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .matter-scrim { inset: 0; }
  .matter-drawer { left: 0; width: min(420px, 94vw); }
  .content { padding: 16px 14px 48px; }
  .split, .grid-2, .grid-2.wide-left, .approval-grid, .doc-list, .auth-shell, .form-grid, .kb-steps, .kb-cards, .kb-tiles, .cal-layout, .ping-grid, .inbox-desk { grid-template-columns: 1fr; }
  .cal-cell { min-height: 84px; }
  .list { position: static; max-height: 46vh; }
  .auth-shell { gap: 28px; min-height: auto; }
  .auth-copy h1 { font-size: 30px; }
  .status-item { border-right: 0; border-bottom: 1px solid var(--line); flex-basis: 100%; }
  .status-item:last-child { border-bottom: 0; }
}
@media (max-width: 560px) {
  .cal-cell { min-height: 56px; padding: 4px; }
  .cal-pill b { display: none; }
  .cal-item { grid-template-columns: auto minmax(0, 1fr); }
  .cal-item-when { grid-column: 1 / -1; }
  .cal-item-sub { grid-column: 2; }
  .tiles, .grid-4, .options { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 24px; }
  .reader-head, .reply-box { padding-left: 16px; padding-right: 16px; }
  .approval-head, .reader-title, .doc-head { flex-direction: column; }
  .hbars li { grid-template-columns: minmax(0, 1fr) 70px 30px; }
}
