/* Diab — restyled to the xAI design system.
   Near-black canvas, white outline pills, Universal Sans (Inter) at weight 400
   against Geist Mono uppercase for every label, eyebrow and counter. */

:root {
  /* ---- xAI tokens ---------------------------------------------------- */
  --canvas: #0a0a0a;
  --canvas-soft: #1a1c20;
  --canvas-card: #191919;
  --canvas-mid: #363a3f;
  --hairline: #212327;

  --ink: #ffffff;
  --ink-hover: #fafaf7;
  --body-text: #dadbdf;
  --body-mid: #7d8187;

  --accent-sunset: #ff7a17;
  --accent-sunset-soft: #ffc285;
  --accent-twilight: #c4b5fd;

  /* The brand never uses a solid white border on an outline pill. */
  --outline: rgba(255, 255, 255, 0.25);
  --outline-strong: rgba(255, 255, 255, 0.45);

  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 8px;      /* rounded.sm — card chrome */
  --pill: 9999px;     /* rounded.pill — every interactive element */

  /* ---- app slots mapped onto the tokens ------------------------------ */
  --bg: var(--canvas);
  --surface: var(--canvas-card);
  --surface-2: var(--canvas-soft);
  --line: var(--hairline);
  --text: var(--ink);
  --muted: var(--body-mid);
  --danger: var(--accent-sunset);
  --warn: var(--accent-sunset-soft);
  --tabbar: calc(62px + env(safe-area-inset-bottom));
  /* Set from visualViewport when the software keyboard is up. */
  --kb: 0px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Anything that responds to a click says so under the cursor. */
button, .card, [role='button'], label.field span { cursor: pointer; }
button:disabled, .btn[disabled] { cursor: not-allowed; }
.field input, .field textarea, .composer textarea { cursor: text; }

.btn, .tab, .icon-btn, .pill, .composer-attach, .composer-send, .composer-chip-clear {
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .12s ease, opacity .18s ease;
}

@keyframes diab-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes diab-pulse { 0%, 100% { opacity: .32; } 50% { opacity: .16; } }
@keyframes diab-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes diab-sheet-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* The list is rebuilt on every refresh, so only things that appear on a
   deliberate action animate — otherwise the whole board would flicker every
   time the data reloads. */
.sheet { animation: diab-fade .16s ease both; }
.sheet-panel { animation: diab-sheet-up .22s cubic-bezier(.2, .7, .3, 1) both; }
.toast { animation: diab-rise .2s ease both; }
/* Screen changes animate; data refreshes do not. */
.view.switching { animation: diab-rise .24s cubic-bezier(.2, .7, .3, 1) both; }
/* The thread is the tallest view in the app, and sliding it costs a full-height
   layer plus a fight with the scroll-to-bottom that follows. Fade only. */
.view.chat-view.switching { animation: diab-fade .14s ease both; }

/* First load opens into a shape rather than an empty screen. */
.skeleton-card { pointer-events: none; }
.skeleton-line, .skeleton-bar {
  background: var(--canvas-mid); border-radius: 4px;
  animation: diab-pulse 1.4s ease-in-out infinite;
}
.skeleton-line { height: 10px; width: 120px; }
.skeleton-bar { height: 13px; margin: 4px 0; }
.skeleton-bar.w-70 { width: 70%; }
.skeleton-bar.w-40 { width: 40%; margin-top: 12px; height: 10px; }
.composer-chip { animation: diab-rise .18s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* .gate and .sheet set `display`, which would otherwise beat the UA rule for the
   `hidden` attribute and leave them permanently on screen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/24px var(--font-sans);
  letter-spacing: 0;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  /* Standalone on iOS has no browser chrome to absorb a rubber-band. */
  overscroll-behavior: none;
}

/* Controls should not select, magnify, or wait 300ms for a second tap. */
button, .tab, .card, .notif, .step-toggle, .brand {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Weight 400 is the entire scale — negative tracking and size do the emphasis. */
h1, h2, h3, b, strong { font-weight: 400; }
h1, h2, h3 { margin: 0; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.error { color: var(--accent-sunset); font-size: 14px; line-height: 20px; margin: 16px 0 0; }

/* The brand's signature label: GeistMono, uppercase, positively tracked. */
.section-title, .stat-label, .pill, .badge, .time, .msg-time, .msg-task, .log-when {
  font-family: var(--font-mono);
  font-weight: 400;
}

/* ------------------------------------------------------------------ gate */

.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); z-index: 40; }
.gate-card { width: 100%; max-width: 360px; text-align: center; }
.gate-logo { border-radius: var(--radius); margin-bottom: 24px; }
.gate-card h1 { font-size: 32px; line-height: 36px; letter-spacing: -0.6px; margin-bottom: 8px; }
.gate-card > p { margin: 0 0 32px; font-size: 16px; line-height: 24px; color: var(--body-text); }

.field { display: block; text-align: left; margin-bottom: 16px; }
.field span {
  display: block; font-family: var(--font-mono); font-size: 12px; line-height: 16px;
  letter-spacing: 1.2px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase;
}
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--hairline);
  background: var(--canvas-soft); color: var(--ink); font: 400 16px/24px var(--font-sans);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--outline-strong); }

/* Every interactive element is a pill with a translucent-white border.
   Auto width by default — a button only spans the container when it is the one
   thing being asked for, which is what .btn-block is for. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px;
  border-radius: var(--pill); border: 1px solid var(--outline);
  background: rgba(0, 0, 0, 0); color: var(--ink);
  font-size: 14px; line-height: 20px; font-weight: 400; cursor: pointer; white-space: nowrap;
}
.btn-block { display: flex; width: 100%; margin-top: 12px; }
.btn:active { transform: scale(0.985); }
/* The rare filled variant. */
.btn-primary { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.btn-ghost { color: var(--muted); }
.btn-danger { color: var(--accent-sunset); border-color: rgba(255, 122, 23, 0.4); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(16px + env(safe-area-inset-top)) 20px 16px;
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--hairline);
}
/* Mark and wordmark on one baseline, centred against each other. */
.brand {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: rgba(0, 0, 0, 0); padding: 0; cursor: pointer;
  font-size: 20px; line-height: 1; letter-spacing: -0.4px; color: var(--ink);
}
.brand img { display: block; border-radius: 6px; }
.brand span { display: block; }
/* The rail carries it on desktop; the top bar carries it on a phone. */
.tabs .brand { display: none; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-family: var(--font-mono); font-size: 20px; line-height: 24px; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; line-height: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; }
.icon-btn {
  background: rgba(0, 0, 0, 0); border: 1px solid var(--outline);
  border-radius: var(--pill); color: var(--ink);
  width: 40px; height: 40px; cursor: pointer; display: grid; place-items: center;
}

.view { padding: 24px 16px calc(var(--tabbar) + 32px); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(10, 10, 10, 0.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--hairline); padding-bottom: env(safe-area-inset-bottom);
}
.tabs { grid-template-columns: repeat(5, 1fr); }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; padding: 10px 2px 8px;
  color: var(--muted); font-size: 11px; line-height: 14px; font-weight: 400; cursor: pointer;
  transition: color .18s ease;
}
.tab-icon { flex: none; opacity: .85; }
.tab.active .tab-icon { opacity: 1; }
.tab.active { color: var(--ink); }
/* The white-filled pill, at counter scale. */
.badge {
  position: absolute; top: 4px; left: 50%; transform: translateX(8px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--pill);
  background: var(--ink); color: var(--canvas); font-size: 12px; line-height: 18px;
}

/* ----------------------------------------------------------------- cards */

.section-title {
  font-size: 12px; line-height: 16px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--ink); margin: 32px 2px 12px;
}
.section-title:first-child { margin-top: 0; }
/* Sections stack closely inside a sheet; the page has room to breathe, a sheet does not. */
.sheet-body .section-title, #sheet-body .section-title { margin: 22px 0 8px; }

.card {
  background: var(--canvas-card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px; margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, transform .12s ease;
}
.card:active { transform: scale(.995); }
/* Cards inside a sheet are containers, not controls. */
.sheet .card, .log { cursor: default; }
.card.overdue { border-color: rgba(255, 122, 23, 0.35); }
.card.critical { border-color: var(--hairline); }

.card-head { display: flex; align-items: center; gap: 12px; }
.card-title { flex: 1; min-width: 0; font-size: 16px; line-height: 24px; letter-spacing: -0.2px; }
/* Archive lives on the card itself, out of the way until you go looking. */
.card-archive {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px;
  border: 0; border-radius: var(--pill); background: rgba(0, 0, 0, 0);
  color: var(--body-mid); cursor: pointer; opacity: 0;
  transition: opacity .18s ease, color .18s ease, background-color .18s ease;
}
/* Touch has no hover, so it stays quietly visible there instead. */
@media (hover: none) { .card-archive { opacity: .5; } }

/* Quiet affordance that a card opens — it only earns attention on approach. */
.card-chevron {
  flex: none; color: var(--body-mid); font-size: 18px; line-height: 1;
  transition: color .18s ease, transform .18s ease;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.card-meta:empty { display: none; }

/* Status chips take the brand's pill shape and mono label treatment. */
.pill {
  font-size: 12px; line-height: 16px; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 2px 12px; border-radius: var(--pill);
  border: 1px solid var(--outline); background: rgba(0, 0, 0, 0); color: var(--body-text);
}
.pill.high { color: var(--body-text); }
.pill.critical, .pill.overdue, .pill.rejected { color: var(--accent-sunset); border-color: rgba(255, 122, 23, 0.4); }
.pill.accepted, .pill.done { color: var(--ink); }
.pill.review { color: var(--accent-twilight); border-color: rgba(196, 181, 253, 0.35); }

.time { font-size: 12px; line-height: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.time.late { color: var(--accent-sunset); }
.time.soon { color: var(--body-text); }

/* One line of a longer thing, so a list stays scannable. */
.card-preview {
  margin-top: 10px; font-size: 14px; line-height: 20px; color: var(--body-mid);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* The week, in points. */
.points { margin: 0; padding: 0 0 0 18px; list-style: none; }
.points li {
  position: relative; font-size: 15px; line-height: 22px; color: var(--body-text);
  padding: 6px 0;
}
.points li::before {
  content: ''; position: absolute; left: -14px; top: 15px;
  width: 4px; height: 4px; border-radius: var(--pill); background: var(--body-mid);
}

/* Her read on it — set apart from the facts above it. */
.opinion {
  border-left: 1px solid var(--outline); padding: 4px 0 4px 16px;
  font-size: 15px; line-height: 24px; color: var(--body-text); white-space: pre-wrap;
}

/* Long-form copy lives in the pop-up now, so this is sheet furniture. */
.card-details {
  margin-top: 14px; font-size: 15px; line-height: 22px; color: var(--body-text);
  white-space: pre-wrap; word-break: break-word;
}
.card-details b { color: var(--ink); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; line-height: 20px; }
/* Inside a sheet an empty state is a note, not a landing pad. */
.sheet .empty { padding: 14px 0; text-align: left; }

/* ------------------------------------------------------------------ chat */

.thread { display: flex; flex-direction: column; gap: 10px; }
/* The bubble plus whatever hangs off it: reactions, and the tapback row. */
.msg-wrap { position: relative; display: flex; flex-direction: column; gap: 4px; max-width: 86%; }
.msg-wrap.jana { align-self: flex-start; align-items: flex-start; }
.msg-wrap.diab { align-self: flex-end; align-items: flex-end; }
.msg {
  max-width: 100%; padding: 12px 16px; border-radius: var(--radius); cursor: pointer;
  font-size: 16px; line-height: 24px; white-space: pre-wrap; word-break: break-word;
}
.msg.jana { background: var(--canvas-card); border: 1px solid var(--hairline); }
.msg.diab { background: var(--canvas-mid); }

.msg-reactions { display: flex; gap: 4px; }
.msg-reactions:empty { display: none; }
.react-chip {
  border: 1px solid var(--hairline); background: var(--canvas-card);
  border-radius: var(--pill); padding: 1px 8px; font-size: 13px; line-height: 20px;
}
.react-chip.mine { border-color: var(--outline); }

/* Hidden until the bubble is tapped, and floated over the thread rather than
   inserted into it — opening it must not shove every message below down. */
.react-bar {
  /* Hangs off the top edge of its own bubble, so it is obvious which message it
     belongs to rather than appearing to float between two of them. */
  display: none; position: absolute; bottom: calc(100% - 12px); z-index: 30;
  gap: 2px; padding: 4px; white-space: nowrap;
  border: 1px solid var(--outline); border-radius: var(--pill); background: var(--canvas-soft);
  animation: diab-rise .16s ease both;
}
.msg-wrap.jana .react-bar { left: 0; }
.msg-wrap.diab .react-bar { right: 0; }
.msg-wrap.reacting .react-bar { display: flex; }
.react-opt {
  border: 0; background: rgba(0, 0, 0, 0); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 6px; border-radius: var(--pill);
  transition: transform .12s ease, background-color .18s ease;
}
.react-opt:active { transform: scale(1.25); }
.msg-time { display: block; font-size: 10px; line-height: 14px; letter-spacing: .4px; color: var(--muted); margin-top: 4px; }
.msg.diab .msg-time { color: rgba(255, 255, 255, 0.45); }
.msg-task {
  display: block; font-size: 12px; line-height: 16px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--body-mid); margin-bottom: 8px;
  /* Uppercase mono with positive tracking gets heavy fast — hold the eyebrow to
     one line so a long task title never outweighs the message itself. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg.diab .msg-task { color: rgba(255, 255, 255, 0.6); }

.composer {
  position: fixed; left: 0; right: 0; bottom: var(--tabbar); z-index: 15;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; padding: 12px 16px;
  background: rgba(10, 10, 10, 0.94); backdrop-filter: blur(12px); border-top: 1px solid var(--hairline);
}
.composer-row { display: flex; gap: 12px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; max-height: 112px; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--hairline); background: var(--canvas-soft); color: var(--ink);
  font: 400 16px/24px var(--font-sans);
}
.composer textarea:focus { outline: none; border-color: var(--outline-strong); }
/* Outline pill for attach, the rare filled pill for send. */
.composer-attach {
  flex: none; width: 44px; height: 44px; border-radius: var(--pill);
  border: 1px solid var(--outline); background: rgba(0, 0, 0, 0); color: var(--ink); cursor: pointer;
}
.composer-send {
  flex: none; width: 44px; height: 44px; border-radius: var(--pill); border: 1px solid var(--ink);
  background: var(--ink); color: var(--canvas); cursor: pointer;
}
.composer-chip {
  display: flex; align-items: center; gap: 8px; align-self: flex-start; max-width: 100%;
  padding: 4px 4px 4px 12px; border: 1px solid var(--outline); border-radius: var(--pill);
}
.composer-chip-label {
  font-family: var(--font-mono); font-size: 12px; line-height: 16px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--body-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.composer-chip-clear {
  flex: none; width: 24px; height: 24px; border-radius: var(--pill);
  border: 0; background: rgba(0, 0, 0, 0); color: var(--muted); cursor: pointer; font-size: 12px;
}
.view.chat-view { padding-bottom: calc(var(--tabbar) + 96px); }
/* With the keyboard up the tab bar is behind it, so the composer takes its place. */
body.kb-open .composer { bottom: var(--kb); padding-bottom: 12px; }
body.kb-open .tabs { opacity: 0; pointer-events: none; }

/* ----------------------------------------------------------------- sheet */

.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; }
.sheet-panel {
  width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--canvas); border-radius: var(--radius) var(--radius) 0 0; border-top: 1px solid var(--hairline);
  padding: 0 20px calc(32px + env(safe-area-inset-bottom));
}
.sheet-head {
  display: flex; align-items: flex-start; gap: 16px; padding: 20px 0 16px;
  position: sticky; top: 0; z-index: 2; background: var(--canvas);
}
.sheet-head h2 { flex: 1; min-width: 0; font-size: 22px; line-height: 30px; letter-spacing: -0.4px; }
.sheet-head .icon-btn { flex: none; margin-left: 0; }
.sheet-tools { display: flex; align-items: center; gap: 6px; flex: none; }
/* An empty slot must not claim a flex line — on mobile it takes a full row and
   silently makes every sheet header 24px taller than it looks. */
.sheet-tools:empty { display: none; }
.sheet-head .icon-btn { font-size: 16px; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.row:last-child { border-bottom: 0; }
.row-label { font-size: 16px; line-height: 24px; }
.row-sub { font-size: 14px; line-height: 20px; color: var(--muted); margin-top: 4px; }
/* The label is what gives; the button keeps its shape. Without flex:none the
   row squeezes it until the text wraps into a blob. */
.row > *:first-child { min-width: 0; }
.row .btn { flex: none; width: auto; margin: 0; padding: 10px 20px; white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.stat-box { background: var(--canvas-card); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 16px; }
.stat-box .n { font-family: var(--font-mono); font-size: 32px; line-height: 36px; font-variant-numeric: tabular-nums; }
.stat-box .k {
  font-family: var(--font-mono); font-size: 12px; line-height: 16px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 8px;
}

.log { font-size: 14px; line-height: 20px; padding: 16px; cursor: default; }
.log-row { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.log-when { color: var(--muted); font-size: 12px; line-height: 20px; min-width: 84px; font-variant-numeric: tabular-nums; }
.log-what { flex: 1; color: var(--body-text); }
.log-actor { color: var(--muted); }
.log-actor.jana { color: var(--ink); }

/* --------------------------------------------------------- phone spacing */

@media (max-width: 767px) {
  .view { padding: 20px 16px calc(var(--tabbar) + 28px); }
  .section-title { margin: 26px 2px 10px; }
  .card { padding: 14px 16px; margin-bottom: 8px; }
  .quote { padding: 18px; margin-bottom: 18px; }
  .quote-text { font-size: 18px; line-height: 27px; }
  .card-meta { margin-top: 8px; }

  /* The pop-up runs to the edges of a small screen, so it needs its own rhythm. */
  .sheet-panel { padding: 0 18px calc(28px + env(safe-area-inset-bottom)); }
  .sheet-head { padding: 18px 0 12px; }
  .block { margin-top: 22px; }
  .detail-side { margin-top: 22px; }
  .week-range { font-size: 27px; line-height: 33px; }
  .week-read { padding: 18px 18px; font-size: 16px; line-height: 26px; }
  .day-label { width: 46px; }
  .notif { padding: 10px 0; gap: 12px; }
  .thread-inline .msg-wrap { max-width: 92%; }
}

/* On a phone the done pill drops to its own line rather than squeezing the
   title into three. And the properties list is dropped entirely — the status
   strip above already carries priority, due date and countdown. */
@media (max-width: 767px) {
  .sheet-head h2 { font-size: 20px; line-height: 28px; }
  .detail-side { margin-top: 24px; }
}

/* ------------------------------------------------- task pop-up internals */

/* Laid out as an object, not a form: what it is on the left, what is true about
   it on the right, the conversation underneath. One column on a phone. */
.detail { display: flex; flex-direction: column; gap: 4px; }
.detail-main, .detail-side, .detail-thread { min-width: 0; }

.detail-desc {
  margin: 4px 0 0; font-size: 16px; line-height: 25px; color: var(--body-text);
  white-space: pre-wrap; word-break: break-word;
}

/* The done control is the checkbox and nothing else. */
.done-toggle {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px;
  border-radius: var(--pill); border: 1px solid var(--outline);
  background: rgba(0, 0, 0, 0); color: var(--canvas);
  font-size: 14px; line-height: 1; cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.done-toggle.on { background: var(--ink); border-color: var(--ink); color: var(--canvas); }

/* Quiet header action — present, but not asking for attention. */
.head-icon {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: var(--pill); background: rgba(0, 0, 0, 0);
  color: var(--body-mid); cursor: pointer;
  transition: color .18s ease, background-color .18s ease;
}

/* A titled section. Every block in the pop-up is one of these, so the rhythm
   is the same everywhere instead of a stack of identical mono labels. */
.block { margin-top: 26px; }
#sheet-body > .block:first-of-type { margin-top: 6px; }
.block-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.block-head h3 {
  font-family: var(--font-mono); font-size: 12px; line-height: 16px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--body-mid);
}
.block-meta {
  margin-left: auto; font-family: var(--font-mono); font-size: 12px; line-height: 16px;
  color: var(--body-mid); font-variant-numeric: tabular-nums;
}

.progress { height: 2px; border-radius: 2px; background: var(--canvas-mid); margin-bottom: 12px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); transition: width .3s ease; }

/* A step, a link: one row shape. */
.step, .link-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.step + .step, .link-row + .link-row { border-top: 1px solid var(--hairline); }
.step-toggle { cursor: pointer; border-radius: var(--radius); }
.step-toggle:focus-visible { outline: 1px solid var(--outline-strong); outline-offset: 2px; }
.step-box {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: var(--pill); border: 1px solid var(--outline); background: rgba(0, 0, 0, 0);
  color: var(--canvas); font-size: 11px; line-height: 1;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.step-box.done { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.step-label { flex: 1; min-width: 0; }
.step-title { font-size: 15px; line-height: 22px; }
.step-title.done { text-decoration: line-through; color: var(--muted); }
.step-del {
  flex: none; width: 26px; height: 26px; border-radius: var(--pill);
  border: 0; background: rgba(0, 0, 0, 0); color: var(--body-mid); cursor: pointer;
  font-size: 11px; opacity: 0; transition: opacity .18s ease, color .18s ease;
}
.step:hover .step-del, .link-row:hover .step-del { opacity: 1; }
@media (hover: none) { .step-del { opacity: .5; } }

.link-a {
  flex: 1; min-width: 0; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 22px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-a:hover { text-decoration: underline; }

/* Facts about the task, as a plain two-column list. */
.props { margin: 0; }
.prop {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--hairline);
}
.prop:last-child { border-bottom: 0; }
.prop dt {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--body-mid);
}
.prop dd { margin: 0; font-size: 14px; line-height: 20px; color: var(--body-text); text-transform: capitalize; text-align: right; }
/* Tone, so the panel says how things stand at a glance. */
.prop dd.bad { color: var(--accent-sunset); }
.prop dd.warn { color: var(--accent-sunset-soft); }
.prop dd.good { color: var(--ink); }
.prop dd.mute { color: var(--body-mid); }
.prop-sub {
  margin-top: 3px; font-family: var(--font-mono); font-size: 12px; line-height: 16px;
  color: var(--body-mid); text-transform: none;
}
.prop-sub.bad { color: var(--accent-sunset); }
.prop-sub.warn { color: var(--accent-sunset-soft); }

/* Add-forms stay out of the way until asked for. */
.add-toggle {
  border: 0; background: rgba(0, 0, 0, 0); color: var(--body-mid);
  font-size: 14px; line-height: 20px; padding: 10px 0 2px; cursor: pointer;
  transition: color .18s ease;
}
.inline-add { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.inline-add input {
  flex: 1 1 130px; min-width: 0; padding: 9px 12px; border-radius: var(--radius);
  border: 1px solid var(--hairline); background: var(--canvas-soft); color: var(--ink);
  /* 16px is the floor: iOS zooms the page on focus for anything smaller. */
  font: 400 16px/22px var(--font-sans);
}
.inline-add input:focus { outline: none; border-color: var(--outline-strong); }
.inline-add .btn { flex: none; min-height: 40px; padding: 9px 18px; }

/* The task's own thread. */
.thread-inline { gap: 8px; }
.thread-inline .msg-wrap { max-width: 88%; }
.thread-inline .msg { font-size: 15px; line-height: 22px; }
.ask { display: flex; gap: 8px; margin-top: 12px; }
.ask input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--hairline); background: var(--canvas-soft); color: var(--ink);
  font: 400 16px/22px var(--font-sans);
}
.ask input:focus { outline: none; border-color: var(--outline-strong); }
.ask .btn { flex: none; min-height: 42px; }

/* ------------------------------------------------------- line for the day */

/* Sits above everything on the board and is the first thing read, so it gets
   room and a quieter surface than the cards it introduces. */
.quote {
  background: var(--canvas-card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px;
}
.quote-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--body-mid); margin-bottom: 12px;
}
.quote-text {
  margin: 0; font-size: 20px; line-height: 30px; letter-spacing: -0.3px;
  color: var(--ink); text-wrap: pretty;
}
.quote-source {
  margin-top: 12px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .6px;
  color: var(--body-mid);
}

/* ------------------------------------------------------------ the bell */

.bell { position: relative; }
/* The first of the trailing controls carries the push; the rest sit beside it. */
.topbar .bell { margin-left: auto; }
.bell-dot {
  position: absolute; top: 1px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--pill);
  background: var(--accent-sunset); color: var(--canvas);
  font-family: var(--font-mono); font-size: 10px; line-height: 16px; font-weight: 400;
  border: 2px solid var(--canvas);
}

/* One line you can scan by mark and subject, without reading a word of it. */
.notif-lead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--body-mid); padding: 4px 0 8px;
}
.notif-clear {
  border: 0; background: rgba(0, 0, 0, 0); color: var(--body-mid); cursor: pointer;
  font: inherit; text-transform: uppercase; padding: 2px 0;
  transition: color .18s ease;
}
.notif-list { display: flex; flex-direction: column; }
.notif-day {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--body-mid);
  padding: 18px 0 6px;
}
.notif-day:first-child { padding-top: 4px; }

.notif {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 11px 0; border: 0; border-bottom: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0); color: var(--ink); cursor: pointer;
}
.notif:last-child { border-bottom: 0; }

/* The mark carries the meaning; colour is reserved for what has gone wrong. */
.notif-icon {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--pill); border: 1px solid var(--hairline);
  background: var(--canvas-card); color: var(--body-mid);
}
.notif-icon.bad { color: var(--accent-sunset); border-color: rgba(255, 122, 23, 0.35); }
.notif-icon.warn { color: var(--accent-sunset-soft); border-color: rgba(255, 194, 133, 0.3); }
.notif-icon.idea { color: var(--accent-twilight); border-color: rgba(196, 181, 253, 0.3); }
.notif-icon.ink { color: var(--ink); }

.notif-body { flex: 1; min-width: 0; }
.notif-subject {
  font-size: 15px; line-height: 21px; color: var(--body-mid);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Unread is the only thing set in full ink, so it reads first. */
.notif.unread .notif-subject { color: var(--ink); }
.notif-sub {
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .6px; color: var(--body-mid);
}
.notif-label { text-transform: uppercase; }
.notif-dot-sep { opacity: .5; }

/* --------------------------------------------------------- weekly page */

.week { margin-bottom: 32px; }
.week-head { padding-bottom: 4px; }
.week-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--body-mid); margin-bottom: 8px;
}
.week-range { font-size: 32px; line-height: 38px; letter-spacing: -0.6px; }

/* Her read leads the page — it is the part actually worth reading. */
.week-read {
  margin: 24px 0 0; padding: 22px 24px;
  border: 1px solid var(--hairline); border-left: 2px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0; background: var(--canvas-card);
  font-size: 17px; line-height: 28px; color: var(--ink); white-space: pre-wrap;
}
.week-read cite {
  display: block; margin-top: 14px; font-style: normal;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--body-mid);
}

/* The receipts: what actually closed, by day, straight from the tasks. */
.day-row { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.day-row:last-child { border-bottom: 0; }
.day-label { flex: none; width: 52px; display: flex; flex-direction: column; gap: 2px; }
.day-name {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--body-mid);
}
.day-num { font-size: 20px; line-height: 22px; letter-spacing: -0.4px; color: var(--ink); }
.day-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.day-item {
  text-align: left; border: 0; background: rgba(0, 0, 0, 0); cursor: pointer; padding: 3px 0;
  font-size: 15px; line-height: 22px; color: var(--body-text);
  transition: color .18s ease;
}

/* ----------------------------------------------------------------- toast */

/* Hairline borders carry every elevation cue — the brand uses no shadows. */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + 16px); z-index: 60;
  background: var(--canvas-card); border: 1px solid var(--hairline);
  padding: 12px 24px; border-radius: var(--radius); font-size: 14px; line-height: 20px; max-width: 88vw;
}
.toast.bad { border-color: rgba(255, 122, 23, 0.4); color: var(--accent-sunset); }

.hint {
  background: var(--canvas-card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px; font-size: 14px; line-height: 20px;
  color: var(--body-text); margin-bottom: 16px;
}
.hint b { color: var(--ink); }


/* ================================================================= desktop
   The phone layout is bottom-tabs and full-bleed. On a large screen both are
   wrong, so at >=768px the tab bar becomes a left rail, the content centres in
   the brand's ~1200px container, and the bottom sheet becomes a dialog.
   No markup changes: .tabs is a grid item here rather than a fixed bar. */

@media (min-width: 768px) {
  :root {
    /* The bar is gone at this width, so every calc() that reserved room for it
       collapses to zero in one place. */
    --tabbar: 0px;
  }

  body { padding-top: 0; }

  #app {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "nav topbar"
      "nav view";
    min-height: 100vh;
  }

  /* ---- left rail ---- */
  .tabs {
    grid-area: nav;
    position: sticky; top: 0; align-self: start;
    height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
    padding: 24px 16px;
    background: var(--canvas);
    backdrop-filter: none;
    border-top: 0; border-right: 1px solid var(--hairline);
  }
  .tabs .brand { display: flex; padding: 10px 16px 28px; }
  .topbar .brand { display: none; }
  /* No counters in the rail — a number beside every section is a to-do list of
     its own, and this app deliberately shows none. */
  .tabs .badge { display: none; }
  /* The rail reads as a list: mark, then label, on one line. */
  .tab {
    display: flex; flex-direction: row; align-items: center; gap: 10px;
    justify-content: flex-start; text-align: left;
    padding: 10px 14px; font-size: 14px; line-height: 20px;
    border: 1px solid transparent; border-radius: var(--pill);
  }
  .tab-icon { width: 17px; height: 17px; }
  /* The active item takes the brand's outline pill. */
  .tab.active { border-color: var(--outline); color: var(--ink); }
  .badge {
    position: static; transform: none; margin-left: auto;
  }

  /* ---- top bar ---- */
  .topbar {
    grid-area: topbar;
    padding: 16px 32px;
    border-bottom: 1px solid var(--hairline);
  }

  /* ---- content ---- */
  .view {
    grid-area: view;
    width: 100%; max-width: 1200px; justify-self: center;
    padding: 32px;
  }
  .chat-view { max-width: 800px; }
  .review-view { max-width: 780px; }

  /* The blurred bar spans the column; the input strip centres on the thread. */
  .composer {
    left: 232px; right: 0;
    padding-left: max(32px, calc((100% - 800px) / 2));
    padding-right: max(32px, calc((100% - 800px) / 2));
  }
  .view.chat-view { padding-bottom: 104px; }

  /* ---- sheet becomes a dialog ---- */
  .sheet { align-items: center; justify-content: center; padding: 40px; }
  .sheet-panel {
    /* 480px was too cramped for a task with steps, links and a thread in it. */
    max-width: 860px; max-height: 88vh; max-height: 88dvh;
    border: 1px solid var(--hairline); border-radius: var(--radius);
    padding: 0 28px 28px;
  }

  .gate-card { max-width: 400px; }

  /* Content left, facts right, conversation beneath — the side rail spans both. */
  .detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 244px;
    grid-template-areas: 'main side' 'thread side';
    column-gap: 32px;
  }
  .detail-main { grid-area: main; }
  .detail-side { grid-area: side; border-left: 1px solid var(--hairline); padding-left: 24px; }
  .detail-thread { grid-area: thread; }
  .detail-side .block:first-child { margin-top: 0; }
}

/* Two-up card grid once there is genuinely room for it. The section headings
   span the full width, so the flat DOM needs no wrapper elements. */
/* Two-up card grid once there is genuinely room for it. The section headings
   span the full width, so the flat DOM needs no wrapper elements. */
@media (min-width: 1100px) {
  .board-view, .ideas-view, .archive-view {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    align-content: start;
  }
  .board-view > .section-title, .ideas-view > .section-title, .archive-view > .section-title,
  .board-view > .quote, .board-view > .hint, .ideas-view > .hint,
  .board-view > .empty, .ideas-view > .empty, .archive-view > .empty { grid-column: 1 / -1; }
  .board-view > .card, .ideas-view > .card, .archive-view > .card { margin-bottom: 0; }
}

/* A third column only when a card still has room to read at that width. */
@media (min-width: 1600px) {
  .board-view, .ideas-view, .archive-view { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Pointer devices get feedback. The brand documents an ink-hover token but
   filters hover out of its component specs; a desktop app that acknowledges
   nothing under the cursor reads as broken, so it is used here — and only
   where a pointer actually exists. */
@media (hover: hover) and (pointer: fine) {
  .tab:hover { color: var(--ink-hover); }
  .btn:hover { border-color: var(--outline-strong); }
  .btn-primary:hover { background: var(--ink-hover); }
  .btn-ghost:hover, .btn-danger:hover { color: var(--ink-hover); }
  .icon-btn:hover { border-color: var(--outline-strong); }
  .card:hover { border-color: rgba(255, 255, 255, 0.14); }
  .step-del:hover { color: var(--accent-sunset); }
  .add-toggle:hover { color: var(--ink); }
  .head-icon:hover { color: var(--ink); background: var(--canvas-card); }
  .notif:hover .notif-subject { color: var(--ink); }
  .notif:hover .notif-icon { border-color: var(--outline); }
  .notif-clear:hover { color: var(--ink); }
  .notif:hover .card-chevron { color: var(--ink); transform: translateX(2px); }
  .day-item:hover { color: var(--ink); text-decoration: underline; }
  .step-toggle:hover .step-box { border-color: var(--outline-strong); }
  .step-toggle:hover .step-title { color: var(--ink); }
  .card:hover .card-chevron { color: var(--ink); transform: translateX(2px); }
  .card:hover .card-archive { opacity: .7; }
  .card-archive:hover { opacity: 1 !important; color: var(--ink); background: var(--canvas-mid); }
  .card.overdue:hover { border-color: rgba(255, 122, 23, 0.5); }
  .composer-send:hover { background: var(--ink-hover); }
  .composer-attach:hover { border-color: var(--outline-strong); }
  .composer-chip-clear:hover { color: var(--ink-hover); }
  .react-opt:hover { background: var(--canvas-mid); transform: scale(1.15); }
  .react-opt:hover { background: var(--canvas-mid); transform: scale(1.15); }
}
