/* Sherpa tokens, copied from fe/web/src/app/globals.css (not imported).
   Four colours: yellow #fedc03, black, white, grey #c9c9c8.
   Amber #a8780a is only for yellow-looking text on white.
   Yellow is for primary actions, the active nav item, overdue chips and the active tile's underline.
   Motion is limited to 150ms colour changes. */
:root {
  --radius: 0.65rem;
  --brand-primary: #fedc03;
  --brand-grey: #c9c9c8;
  --amber: #a8780a;
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --primary: var(--brand-primary);
  --primary-foreground: #000000;
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: var(--brand-primary);
  --sidebar: #000000;
  --sidebar-foreground: #ffffff;
  --sidebar-muted: var(--brand-grey);
  --sidebar-accent: oklch(0.21 0.006 285.885);
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Poppins', system-ui, sans-serif;
  --sidebar-w: 248px;
  --tabbar-h: 60px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.25; color: #000; font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
a { color: inherit; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.85rem; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.sidebar :focus-visible, .tabbar :focus-visible { outline-offset: -3px; }
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: #000; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius);
  padding: 0.55rem 1rem; border: 1px solid transparent; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  text-decoration: none; background: var(--secondary); color: #000;
  transition: background-color 150ms, color 150ms, border-color 150ms;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover:not(:disabled) { background: #f0cf00; }
.btn-outline { background: #fff; border-color: #000; color: #000; }
.btn-outline:hover:not(:disabled) { background: var(--muted); }
.btn-dark { background: #000; color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--sidebar-accent); }
.btn-quiet { background: transparent; border-color: var(--border); color: #000; }
.btn-quiet:hover:not(:disabled) { background: var(--muted); border-color: var(--brand-grey); }
.btn-link {
  background: none; border: 0; padding: 0.25rem 0; min-height: 0; font: inherit; cursor: pointer;
  color: #000; text-decoration: underline; text-underline-offset: 3px;
}
.btn-sm { padding: 0.3rem 0.75rem; min-height: 36px; font-size: 0.85rem; }

/* Forms */
.field { display: grid; gap: 0.3rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-size: 0.8rem; color: var(--muted-foreground); }
input[type='text'], input[type='email'], input[type='password'], input[type='tel'],
input[type='time'], input[type='search'], input[type='date'], select {
  font: inherit; width: 100%; padding: 0.55rem 0.75rem; min-height: 42px;
  border: 1px solid var(--brand-grey); border-radius: var(--radius); background: #fff; color: #000;
  transition: border-color 150ms;
}
select { appearance: auto; }

/* Layout: a black sidebar and a white main, 1280px wide at its fullest (248 + 1032). */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-foreground); padding: 1.25rem 0.9rem;
  display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh;
}
.lockup { display: flex; align-items: center; gap: 0.7rem; padding: 0 0.5rem; text-decoration: none; color: #fff; }
.badge { width: 36px; height: 36px; border-radius: 10px; flex: none; display: block; object-fit: cover; }
.lockup-text { display: grid; line-height: 1.15; min-width: 0; }
.lockup-name { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; color: #fff; }
.lockup-sub { font-size: 0.78rem; color: var(--sidebar-muted); }
.nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.nav button {
  font: inherit; font-weight: 500; text-align: left; cursor: pointer; border: 0;
  background: transparent; color: var(--sidebar-foreground); padding: 0.6rem 0.75rem;
  border-radius: var(--radius); min-height: 40px; transition: background-color 150ms, color 150ms;
}
.nav button:hover { background: var(--sidebar-accent); }
.nav button[aria-current='page'] { background: var(--primary); color: #000; font-weight: 600; }
.account { border-top: 1px solid var(--sidebar-accent); padding: 0.9rem 0.5rem 0; display: grid; gap: 0.5rem; }
.account .who { color: var(--sidebar-muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.account .btn-link { color: #fff; text-align: left; }

main { min-width: 0; width: 100%; max-width: 1032px; padding: 2.25rem 2.25rem 3.5rem; }
.page-head { margin-bottom: 1.4rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.page-head p { margin: 0.2rem 0 0; }
.back { font-weight: 600; font-size: 0.9rem; }

.card {
  background: var(--card); color: var(--card-foreground); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.card > h2 { margin-bottom: 0.6rem; }
.notice {
  border-left: 4px solid #000; background: var(--muted); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.8rem 1rem; margin-bottom: 1rem;
}
.msg { min-height: 1.4em; margin: 0.5rem 0 0; font-size: 0.9rem; }
.msg.error { font-weight: 600; border-left: 4px solid #000; padding-left: 0.6rem; }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.empty { text-align: center; padding: 2.25rem 1rem; color: var(--muted-foreground); }
.empty h3 { color: #000; margin-bottom: 0.4rem; font-size: 1.1rem; }
.empty .btn { margin-top: 0.5rem; }
.skeleton { height: 120px; border-radius: var(--radius); background: var(--muted); }

/* Pills and badges */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 999px; padding: 0.2rem 0.75rem;
  font-weight: 600; font-size: 0.85rem; background: var(--muted); color: #000; border: 1px solid var(--brand-grey);
}
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-grey); }
.pill.ok { background: #000; color: #fff; border-color: #000; }
.pill.ok::before { background: #fff; }
.pill.wait { background: #fff; border-color: #000; }
.pill.wait::before { background: #000; }
.badge-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600; border-radius: 999px; padding: 0.05rem 0.55rem;
  background: var(--muted); border: 1px solid var(--brand-grey); text-transform: uppercase; letter-spacing: 0.03em;
}
.summary { font-weight: 600; margin: 0; }

/* A 12-column grid for the page's own sections */
.g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.g12 > * { grid-column: span 12; }
.g12 > .span-3 { grid-column: span 3; }
.g12 > .span-6 { grid-column: span 6; }

/* Stat tiles: a big number, a small label, and a yellow underline when they are the active filter */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile {
  font: inherit; text-align: left; cursor: pointer; background: #fff; color: #000;
  border: 1px solid var(--border); border-bottom: 4px solid var(--border); border-radius: var(--radius);
  padding: 0.9rem 1rem 0.75rem; display: grid; gap: 0.1rem;
  transition: background-color 150ms, border-color 150ms;
}
.tile:hover { background: var(--muted); }
.tile[aria-pressed='true'] { border-bottom-color: var(--primary); }
.tile .num { font-family: var(--font-display); font-weight: 600; font-size: 2rem; line-height: 1.1; }
.tile .label { font-size: 0.82rem; color: var(--muted-foreground); }

/* A segmented control */
.seg { display: inline-flex; border: 1px solid #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; max-width: 100%; }
.seg button {
  font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; background: #fff; color: #000; border: 0;
  padding: 0.5rem 1rem; min-height: 40px; transition: background-color 150ms, color 150ms;
  border-right: 1px solid #000;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--muted); }
.seg button[aria-pressed='true'] { background: #000; color: #fff; }
.seg .count { font-weight: 500; opacity: 0.7; margin-left: 0.2rem; }

.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters input[type='search'] { flex: 1 1 240px; width: auto; min-width: 0; }
.filter-fields { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.filter-toggle { display: none; }
.select { display: grid; gap: 0.15rem; font-size: 0.78rem; font-weight: 600; color: var(--muted-foreground); }
.select select { font-weight: 400; color: #000; min-width: 9rem; }

/* Commitments */
.group { margin-bottom: 1.5rem; }
.group-title { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.6rem; font-size: 0.95rem; }
.group-title .count { color: var(--muted-foreground); font-weight: 500; font-family: var(--font-sans); }
.group-more { margin: 0.2rem 0 0; font-size: 0.88rem; }
.commit {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 0.75rem; background: #fff;
  transition: border-color 150ms;
}
.commit.focus { border-color: #000; border-width: 2px; padding: calc(1rem - 1px) calc(1.1rem - 1px); }
.c-head { display: flex; gap: 0.75rem; justify-content: space-between; align-items: flex-start; }
.c-title { font-size: 1rem; overflow-wrap: anywhere; }
.c-meta { margin: 0.25rem 0 0.1rem; font-size: 0.85rem; color: var(--muted-foreground); overflow-wrap: anywhere; }
.c-meta strong { color: #000; font-weight: 600; }
.chip {
  flex: none; display: inline-block; border-radius: 999px; padding: 0.1rem 0.65rem; font-size: 0.78rem; font-weight: 600;
  white-space: nowrap; background: var(--muted); color: var(--muted-foreground); border: 1px solid transparent;
}
.chip.due-soon { background: #fff; color: var(--amber); border-color: var(--amber); }
.chip.overdue { background: var(--primary); color: #000; }
.chip.none, .chip.later { background: var(--muted); color: var(--muted-foreground); }
.chip.snoozed { background: #fff; color: #000; border-color: var(--brand-grey); }
.said {
  margin: 0.7rem 0 0.2rem; padding: 0.55rem 0.8rem; background: var(--muted); border-left: 3px solid var(--brand-grey);
  border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.88rem;
}
.said .said-label { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); margin-bottom: 0.15rem; }
.said p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.said .said-link { display: inline-block; margin-top: 0.3rem; font-size: 0.82rem; font-weight: 600; }
.c-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }
.menu {
  margin-top: 0.6rem; padding: 0.75rem; border: 1px solid var(--brand-grey); border-radius: var(--radius); background: #fff;
  display: grid; gap: 0.6rem;
}
.menu .menu-title { font-size: 0.78rem; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.04em; }
.menu .row input[type='date'] { width: auto; flex: 1 1 9rem; min-height: 36px; padding: 0.3rem 0.6rem; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 0.1rem 0; width: 100%; }
.dir { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); }

/* Meetings today, and the Google Calendar card */
.meeting {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 0.75rem; background: #fff;
}
.meeting.past .m-title, .meeting.past .m-time { color: var(--muted-foreground); }
.m-head { display: flex; gap: 0.75rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.m-time { font-size: 0.85rem; font-weight: 600; color: var(--amber); margin: 0 0 0.1rem; }
.m-title { font-size: 1rem; overflow-wrap: anywhere; }
.m-where { margin: 0.15rem 0 0; font-size: 0.85rem; color: var(--muted-foreground); overflow-wrap: anywhere; }
.m-people { list-style: none; margin: 0.7rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.m-person { padding-top: 0.55rem; border-top: 1px solid var(--border); }
.m-who { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; font-size: 0.92rem; }
.m-who strong { overflow-wrap: anywhere; }
.m-note { font-size: 0.82rem; color: var(--muted-foreground); }
.m-owes { margin: 0.25rem 0 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.m-owes .due { color: var(--muted-foreground); }
.m-owes .due.overdue { color: #000; font-weight: 600; }
.m-pick { margin-top: 0.5rem; padding: 0.65rem; border: 1px solid var(--brand-grey); border-radius: var(--radius); display: grid; gap: 0.5rem; }
.m-pick input { width: 100%; min-height: 36px; }
.m-pick ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.m-pick li .btn { width: 100%; justify-content: flex-start; text-align: left; }
.gcal-status { font-weight: 600; overflow-wrap: anywhere; }
.gcal-status.warn { border-left: 4px solid var(--primary); padding-left: 0.6rem; }

/* The footer of Today */
.today-foot { margin-top: 1.5rem; padding-top: 0.9rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted-foreground); }

/* People */
.person-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.person-row {
  width: 100%; font: inherit; text-align: left; cursor: pointer; background: #fff; color: #000;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1.1rem; display: grid; gap: 0.15rem;
  transition: background-color 150ms, border-color 150ms;
}
.person-row:hover { background: var(--muted); border-color: var(--brand-grey); }
.person-row .p-top { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; }
.p-name { font-family: var(--font-display); font-weight: 600; }
.p-phone, .p-meta { font-size: 0.85rem; color: var(--muted-foreground); }
.p-counts { font-size: 0.9rem; font-weight: 600; }

/* Sources */
.msg-search { margin: 1.25rem 0 0.5rem; display: grid; gap: 0.3rem; }
.msg-search label, .addnum label { font-weight: 600; font-size: 0.9rem; }
.msg-search .row { flex-wrap: nowrap; }
.msg-search input { flex: 1 1 auto; min-width: 0; max-width: 32rem; }
.hit-list { list-style: none; margin: 0.5rem 0 1.25rem; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.hit-list li { border-bottom: 1px solid var(--border); }
.hit-list li:last-child { border-bottom: 0; }
.hit { display: block; width: 100%; text-align: left; font: inherit; color: #000; background: #fff; border: 0; padding: 0.7rem 1rem; cursor: pointer; transition: background-color 150ms; }
.hit:hover { background: var(--muted); }
.hit .hit-top { display: flex; gap: 0.6rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted-foreground); }
.hit .hit-top strong { color: #000; }
.hit .hit-text { overflow-wrap: anywhere; }
mark { background: var(--primary); color: #000; border-radius: 2px; padding: 0 1px; }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip-btn {
  font: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer; min-height: 36px;
  padding: 0.3rem 0.9rem; border-radius: 999px; background: #fff; color: #000; border: 1px solid #000;
  transition: background-color 150ms, color 150ms;
}
.chip-btn:hover { background: var(--muted); }
.chip-btn[aria-pressed='true'] { background: #000; color: #fff; }
/* Links & files */
.file-list { list-style: none; margin: 0 0 1rem; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-row { display: flex; gap: 0.85rem; align-items: center; padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); background: #fff; }
.file-row:last-child { border-bottom: 0; }
.f-icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: var(--radius); background: var(--muted); display: grid; place-items: center; }
.f-icon svg { width: 20px; height: 20px; fill: none; stroke: #000; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.f-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 0.1rem; }
.f-title { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.f-name { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.f-kind { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted-foreground); }
.f-url { font-size: 0.82rem; color: var(--muted-foreground); overflow-wrap: anywhere; }
.f-meta { font-size: 0.85rem; color: var(--muted-foreground); overflow-wrap: anywhere; }
.f-actions { flex: 0 0 auto; display: flex; gap: 0.9rem; align-items: center; }
.addnum { margin-bottom: 0.75rem; display: grid; gap: 0.3rem; }
.addnum .row { flex-wrap: nowrap; }
.addnum input { flex: 1 1 auto; min-width: 0; max-width: 20rem; }
.addnum .hint { font-size: 0.8rem; color: var(--muted-foreground); }
.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; }
.toolbar input { flex: 1 1 220px; width: auto; min-width: 0; }
.more { margin-top: 0.75rem; display: flex; justify-content: center; }
.list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list li { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: #fff; }
.list li:last-child { border-bottom: 0; }
.chat-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.chat-row.found { background: var(--muted); }
.chat-row .who { flex: 1 1 200px; min-width: 0; display: grid; }
.chat-row .name { font-weight: 600; overflow-wrap: anywhere; text-align: left; }
.chat-row button.name { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: #000; }
.chat-row .phone, .chat-row .history { font-size: 0.82rem; color: var(--muted-foreground); }
.chat-row .when { color: var(--muted-foreground); font-size: 0.8rem; }
.confirm { background: var(--muted); border: 1px solid var(--brand-grey); border-radius: var(--radius); padding: 0.8rem 1rem; margin-top: 0.75rem; }
.confirm p { margin-bottom: 0.6rem; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.85rem; font-weight: 600; }
/* The real checkbox is the click target: it sits over the whole track, invisible, and
   the track is drawn underneath it with pointer-events off. Keyboard focus is still shown, on the track. */
.switch input { position: absolute; z-index: 1; left: 0; top: 50%; transform: translateY(-50%); opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--brand-grey); position: relative; flex: none; transition: background-color 150ms; pointer-events: none; }
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 1px solid #000;
}
.switch input:checked + .track { background: #000; }
.switch input:checked + .track::after { left: 21px; border-color: #fff; }
.switch input:focus-visible + .track { outline: 3px solid var(--ring); outline-offset: 2px; box-shadow: 0 0 0 1px #000; }

/* A conversation */
.conv-search { margin-bottom: 0.5rem; }
.conv-search input { max-width: 28rem; }
.day { position: sticky; top: 0; z-index: 2; margin: 1.25rem 0 0.5rem; text-align: center; }
.day span { display: inline-block; background: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.8rem; font-size: 0.78rem; font-weight: 600; color: var(--muted-foreground); }
.bubble { padding: 0.4rem 0.2rem; border-radius: var(--radius); transition: background-color 150ms; }
.bubble.focus { background: var(--muted); outline: 2px solid #000; }
.bubble .b-top { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; font-size: 0.82rem; }
.bubble .b-who { font-weight: 600; }
.bubble.me .b-who { color: var(--muted-foreground); }
.bubble .b-time { color: var(--muted-foreground); }
.bubble .b-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .b-text.spoken::before { content: 'Voice note: '; color: var(--muted-foreground); }
.bubble .b-text.plain { color: var(--muted-foreground); font-style: italic; }
.tag { display: inline-block; border-radius: 999px; padding: 0 0.55rem; font-size: 0.72rem; font-weight: 600; background: #000; color: #fff; text-decoration: none; transition: background-color 150ms; }
.tag:hover { background: var(--sidebar-accent); }
.older { display: flex; justify-content: center; margin-bottom: 0.5rem; }

/* Daily briefs */
.brief { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; background: #fff; }
.brief.pinned { border-color: #000; }
.brief-head { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.2rem; }
.brief .sent { font-size: 0.82rem; color: var(--muted-foreground); }
.brief h3.sec { margin: 0.9rem 0 0.35rem; font-size: 0.85rem; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.04em; font-family: var(--font-sans); font-weight: 600; }
.brief ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.brief li { display: grid; grid-template-columns: 1.8rem 1fr; gap: 0.5rem; align-items: baseline; }
.brief li .n { font-family: var(--font-display); font-weight: 600; background: var(--muted); border-radius: 6px; text-align: center; font-size: 0.85rem; }
.brief li .t { overflow-wrap: anywhere; }
.brief .hint-line { margin: 0.9rem 0 0; font-size: 0.85rem; color: var(--muted-foreground); }

/* Connection */
.connect-grid { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: start; }
.qr { width: 240px; height: 240px; border: 1px solid var(--brand-grey); border-radius: var(--radius); padding: 0.5rem; background: #fff; }
.qr img { width: 100%; height: 100%; display: block; }
.qr-wait { display: grid; place-items: center; color: var(--muted-foreground); text-align: center; font-size: 0.9rem; }
.steps { margin: 0 0 1rem; padding-left: 1.2rem; }
.steps li { margin-bottom: 0.3rem; }
.code {
  font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; letter-spacing: 0.25em;
  background: #fff; color: #000; border: 2px solid #000; display: inline-block; padding: 0.4rem 1rem; border-radius: var(--radius);
  margin: 0.5rem 0 1rem; user-select: all;
}
.explainer .keep { margin: 0; padding: 0.7rem 0.9rem; background: var(--muted); border-left: 4px solid #000; border-radius: 0 var(--radius) var(--radius) 0; font-weight: 500; }

/* Tables */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; min-width: 820px; }
th, td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.link-box { background: var(--muted); border: 1px solid var(--brand-grey); border-radius: var(--radius); padding: 0.8rem 1rem; margin-top: 0.75rem; }
.link-box code { display: block; word-break: break-all; margin: 0.4rem 0 0.6rem; font-size: 0.85rem; }

/* More */
.more-list { list-style: none; margin: 0 0 1.25rem; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.more-list li { border-bottom: 1px solid var(--border); }
.more-list li:last-child { border-bottom: 0; }
.more-list a { display: grid; gap: 0.1rem; padding: 0.9rem 1rem; text-decoration: none; font-weight: 600; transition: background-color 150ms; }
.more-list a:hover { background: var(--muted); }
.more-list a span { font-weight: 400; font-size: 0.85rem; }

/* The undo toast */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 50;
  display: flex; gap: 1rem; align-items: center; background: #000; color: #fff; border-radius: var(--radius);
  padding: 0.7rem 1rem; max-width: min(92vw, 30rem); font-size: 0.9rem;
}
.toast button { font: inherit; font-weight: 600; background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0.2rem 0; text-decoration: underline; text-underline-offset: 3px; transition: color 150ms; }

/* Mobile tab bar: hidden on large screens */
.tabbar { display: none; }

/* Auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--muted); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem 1.75rem; }
.auth-card .lockup { padding: 0; margin-bottom: 1.25rem; color: #000; }
.auth-card .lockup-name { color: #000; }
.auth-card .lockup-sub { color: var(--muted-foreground); }
.auth-card h1 { margin-bottom: 0.4rem; }
.auth-card .btn { width: 100%; }

/* Small screens: one column, the sidebar becomes a slim top bar, and the four main places go to a tab bar */
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; height: var(--topbar-h); z-index: 10; flex-direction: row; align-items: center;
    padding: 0 1rem; gap: 0;
  }
  .sidebar .nav, .sidebar .account { display: none; }
  .lockup { padding: 0; }
  main { padding: 1.25rem 1rem calc(var(--tabbar-h) + 2rem); max-width: none; }
  h1 { font-size: 1.4rem; }

  .tabbar {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: var(--tabbar-h); background: #000; border-top: 1px solid var(--sidebar-accent);
  }
  .tabbar button {
    font: inherit; font-size: 0.7rem; font-weight: 500; background: none; border: 0; color: var(--sidebar-muted); cursor: pointer;
    display: grid; justify-items: center; align-content: center; gap: 0.15rem; padding: 0.3rem 0.2rem; min-width: 0;
    transition: color 150ms;
  }
  .tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar button[aria-current='page'] { color: var(--primary); }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .tile .num { font-size: 1.7rem; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1 1 0; padding: 0.5rem 0.4rem; font-size: 0.82rem; min-width: 0; }
  .filter-toggle { display: inline-flex; }
  .filter-fields { display: none; width: 100%; flex-direction: column; }
  .filter-fields.open { display: flex; }
  .select select { min-width: 0; width: 100%; }
  .filters input[type='search'] { flex: 1 1 140px; }
  .c-head { flex-direction: column; gap: 0.35rem; }
  .c-actions .btn { flex: 1 1 auto; }
  .connect-grid { grid-template-columns: 1fr; }
  .qr { width: min(240px, 100%); height: auto; aspect-ratio: 1; }
  .msg-search .row, .addnum .row { flex-wrap: wrap; }
  .file-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: start; }
  .f-actions { grid-column: 2; }
  .toast { bottom: calc(var(--tabbar-h) + 0.75rem); }
  .page-head { align-items: flex-start; }
  .g12 > .span-3, .g12 > .span-6 { grid-column: span 12; }
}
@media (max-width: 800px) { .day { top: var(--topbar-h); } }
