:root {
  --paper: #f6f0e8;
  --paper-2: #fbf8f3;
  --card: #fffdf9;
  --ink: #171412;
  --ink-2: #3d3732;
  --muted: #5e5852;
  --red: #c81018;
  --red-dark: #a90e14;
  --red-on-dark: #ff8589;
  --line: rgba(23, 20, 18, .14);
  --line-strong: rgba(23, 20, 18, .24);
  --sand: #ebe4da;
  --taken: #e8e1d7;
  --amber-bg: #f7e1b9;
  --amber-fg: #5a3a06;
  --amber-dot: #ffb547;
  --focus: #1769ff;
  --radius: 24px;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--red); }
a:hover { color: var(--red-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.serif { font-family: var(--serif); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 48px 24px; color: var(--muted); text-align: center; }
.muted { color: var(--muted); }
.accent { color: var(--red); }
.eyebrow { color: var(--red); font-size: 13px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }

/* ---------- Buttons & form controls ---------- */
.btn {
  min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 22px;
  border: 0; border-radius: 14px;
  background: var(--red); color: #fff;
  font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--red-dark); color: #fff; }
.btn:disabled { background: var(--sand); color: var(--muted); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn.secondary:hover { background: var(--paper-2); }
.btn.light { background: #fff; color: var(--ink); }
.btn.ghost-dark { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn.ghost-dark:hover { background: rgba(255,255,255,.08); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.link-btn { min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--red-dark); font-weight: 700; font-size: 14px; }
.link-btn.muted { color: var(--muted); text-decoration: underline; font-weight: 600; }
.link-btn.on-dark { color: rgba(255,255,255,.75); text-decoration: underline; font-weight: 600; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--sand); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--card); font-size: 16px; font-weight: 500;
}
.input.big { min-height: 56px; font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.input.code { letter-spacing: .4em; text-align: center; font-size: 26px; }
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.4; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; line-height: 1.4; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--red); flex-shrink: 0; }
.form-error { color: var(--red-dark); font-size: 14px; font-weight: 600; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 28px 16px; border-right: 1px solid var(--line);
}
.brand { padding: 4px 12px 28px; font-size: 21px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: 12px; color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none;
}
.nav-link:hover { background: var(--sand); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--ink); color: #fff; }
.nav-link .grow { flex: 1; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sidebar .spacer { flex: 1; }
.account-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--paper-2);
  color: var(--ink); text-decoration: none;
}
.account-card:hover { color: var(--ink); border-color: var(--line-strong); }
.avatar { width: 36px; height: 36px; border-radius: 99px; background: var(--red); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; text-decoration: none; }
.who { display: flex; align-items: center; gap: 10px; }
.who strong { display: block; font-size: 14px; }
.who .meta span, .account-card > span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; padding: 40px 48px 56px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.page-title { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5vw, 60px); line-height: 1; letter-spacing: -.03em; }
.page-sub { max-width: 640px; color: var(--muted); font-size: 17px; }

.mobile-top, .tabbar { display: none; }

/* ---------- Cards & grids ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.span-2 { grid-column: span 2; }
.card { padding: 24px 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-title { font-size: 15px; font-weight: 700; }
.card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.dark .muted { color: rgba(255,255,255,.72); }
.card-serif { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.watch { background: var(--amber-bg); color: var(--amber-fg); }
.chip.solid { background: var(--ink); color: #fff; }
.chip.outline { border: 1px solid var(--line-strong); padding: 3px 10px; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--amber-dot); flex-shrink: 0; }
.dot.live { box-shadow: 0 0 0 4px rgba(255,181,71,.25); }

.empty { padding: 20px; border: 1px dashed var(--line-strong); border-radius: 16px; color: var(--muted); font-size: 15px; }
.error-box { padding: 16px 18px; border-radius: 14px; background: #fbe3e1; color: #6b0a0e; font-size: 15px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.skeleton { background: linear-gradient(90deg, var(--sand), var(--paper-2), var(--sand)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 12px; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Today ---------- */
.ask-bar { width: 360px; max-width: 100%; min-height: 48px; padding: 0 6px 0 16px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--card); color: var(--muted); }
.ask-bar input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15px; color: var(--ink); outline: none; }
.upnext { min-height: 304px; padding: 32px; justify-content: space-between; gap: 22px; }
.upnext .eyebrow { color: var(--red-on-dark); }
.upnext h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4vw, 48px); line-height: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: rgba(255,255,255,.1); font-size: 13px; font-weight: 600; white-space: nowrap; }
.spot-flow { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.spot-flow .label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.66); }
.spot-big { font-family: var(--serif); font-size: 44px; line-height: 1.05; }
.pref-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 7px; border-radius: 12px; border: 1px solid rgba(255,255,255,.28); font-size: 16px; font-weight: 700; }
.pref-chip .rank { width: 22px; height: 22px; border-radius: 99px; background: rgba(255,255,255,.18); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.pref-chip:first-child .rank { background: var(--red); }
.row-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-actions .grow { flex: 1; }

.goal-num { font-family: var(--serif); font-size: 88px; line-height: .9; letter-spacing: -.03em; }
.bar { position: relative; height: 10px; border-radius: 99px; background: var(--sand); }
.bar .fill { height: 100%; border-radius: 99px; background: var(--ink); max-width: 100%; }
.bar .pace { position: absolute; top: -5px; width: 2px; height: 20px; background: var(--red); }
.bar.big { height: 16px; }
.bar.big .pace { top: -8px; height: 32px; }
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.stat strong { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }

table.classes { width: 100%; border-collapse: collapse; font-size: 14px; }
table.classes th { padding: 10px 8px 10px 0; text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
table.classes td { padding: 12px 8px 12px 0; border-bottom: 1px solid rgba(23,20,18,.08); vertical-align: middle; }
table.classes tr:last-child td { border-bottom: 0; }
table.classes .strong { font-weight: 700; }
table.classes .sub { color: var(--muted); }
table.classes td:last-child { text-align: right; }

.feed-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid rgba(23,20,18,.08); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px; background: var(--sand); display: flex; align-items: center; justify-content: center; }
.feed-text { font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.feed-time { font-size: 12px; color: var(--muted); }

/* ---------- Spot watch ---------- */
.class-chips { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.class-chip {
  flex: 1 0 220px; min-height: 72px; padding: 14px 18px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left; text-decoration: none; color: var(--ink);
}
.class-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.class-chip[aria-current="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.class-chip .t { font-size: 15px; font-weight: 700; }
.class-chip .s { font-size: 13px; opacity: .8; }
.class-chip .in { white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; opacity: .85; }
.class-chip .in b { font-size: 18px; opacity: 1; }

.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.map-scroll { overflow-x: auto; }
.map { position: relative; min-width: 520px; }
.map-group { display: flex; flex-direction: column; gap: 8px; }
.map-group + .map-group { margin-top: 18px; }
.map-group h3 { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.map-row { display: flex; gap: 8px; flex-wrap: wrap; }
.spot {
  position: relative; min-width: 52px; height: 46px; padding: 0 6px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card);
  font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.map.positioned .spot { position: absolute; min-width: 0; padding: 0; font-size: clamp(10px, 1.1vw, 13px); }
.spot.taken { background: var(--taken); border-color: var(--taken); color: var(--muted); }
.spot.mine { background: var(--ink); border-color: var(--ink); color: #fff; }
.spot.picked { background: var(--red); border-color: var(--red); color: #fff; }
.spot:not(:disabled):hover { border-color: var(--ink); }
.spot .rank { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 99px; background: #fff; color: var(--red); border: 1.5px solid var(--red); font-size: 11px; display: flex; align-items: center; justify-content: center; }

.watch-panel { position: sticky; top: 24px; padding: 24px; border-radius: var(--radius); background: var(--ink); color: #fff; display: flex; flex-direction: column; gap: 16px; }
.watch-panel h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; }
.watch-panel .sub { font-size: 13px; color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 8px; }
.queue { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.queue li { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 12px; border-radius: 14px; background: rgba(255,255,255,.08); }
.queue .rank { width: 26px; height: 26px; flex-shrink: 0; border-radius: 99px; background: var(--red); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.queue .name { flex: 1; min-width: 0; }
.queue .name b { display: block; font-size: 16px; }
.queue .name span { font-size: 12px; color: rgba(255,255,255,.7); }
.queue .icon-btn { color: rgba(255,255,255,.72); width: 36px; height: 36px; }
.queue .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.queue .icon-btn:disabled { opacity: .3; }
.empty.dark { border-color: rgba(255,255,255,.3); color: rgba(255,255,255,.75); }
.shortcut-row { display: flex; flex-wrap: wrap; gap: 8px; }
.shortcut { min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-size: 13px; font-weight: 600; }
.shortcut:hover { background: rgba(255,255,255,.08); }
.panel-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.66); }
.note { padding: 12px 14px; border-radius: 12px; background: var(--amber-bg); color: #4a3005; font-size: 13px; font-weight: 600; }
.watch-panel .btn:disabled { background: rgba(255,255,255,.14); color: rgba(255,255,255,.75); }

/* ---------- Rules ---------- */
.rules-layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; align-items: start; }
.rule-card { padding: 20px 22px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); display: flex; align-items: center; gap: 20px; }
.rule-card.editing { border: 2px solid var(--red); padding: 19px 21px; }
.rule-card.paused { opacity: .72; }
.rule-time { width: 96px; flex-shrink: 0; display: flex; flex-direction: column; }
.rule-time b { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; }
.rule-time span { font-size: 13px; color: var(--muted); }
.rule-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rule-body strong { font-size: 16px; }
.rule-body span { font-size: 14px; color: var(--ink-2); }
.switch { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; font-size: 13px; font-weight: 600; padding: 0 4px; }
.switch .track { width: 44px; height: 26px; padding: 3px; border-radius: 99px; background: #c9c0b4; display: flex; justify-content: flex-start; transition: background .15s; }
.switch .track::after { content: ""; width: 20px; height: 20px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch[aria-checked="true"] .track { background: var(--ink); justify-content: flex-end; }
.editor { position: sticky; top: 24px; padding: 24px 26px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper-2); display: flex; flex-direction: column; gap: 16px; }
.editor h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.day-pills { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-pill { min-height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); font-size: 14px; font-weight: 700; }
.day-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.override-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.override-row .input { min-height: 42px; }
.preview { padding: 14px 16px; border-radius: 14px; background: var(--sand); display: flex; flex-direction: column; gap: 4px; }
.preview span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.preview q { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.2; }
.run { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(23,20,18,.08); font-size: 14px; }
.run:last-child { border-bottom: 0; }

/* ---------- Progress ---------- */
.big-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }
.big-stats b { display: block; font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; }
.big-stats span { font-size: 13px; color: var(--muted); }
.bar-labels { position: relative; height: 18px; font-size: 13px; color: var(--muted); }
.bar-labels span { position: absolute; white-space: nowrap; }
.bar-labels .pace-label { transform: translateX(-50%); color: var(--red-dark); font-weight: 700; }
.months { height: 190px; display: flex; align-items: flex-end; gap: 8px; }
.month { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.month .v { font-size: 12px; font-weight: 700; }
.month .b { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--ink); min-height: 2px; }
.month.current .b { background: var(--red); }
.month.current .v { color: var(--red-dark); }
.month .l { font-size: 12px; color: var(--muted); }
.segmented { display: flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--sand); }
.segmented button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 13px; font-weight: 500; }
.segmented button[aria-pressed="true"] { background: var(--card); font-weight: 700; box-shadow: 0 1px 3px rgba(23,20,18,.18); }
.recap-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.recap-list li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.12); }
.recap-list li:last-child { border-bottom: 0; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: min(80%, 560px); padding: 11px 14px; border-radius: 18px; font-size: 15px; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; border-bottom-right-radius: 5px; background: #1769e0; color: #fff; }
.bubble.assistant { align-self: flex-start; border-bottom-left-radius: 5px; background: #ebe8e4; }
.bubble.typing { color: var(--muted); }
.composer { padding: 12px; border-top: 1px solid var(--line); background: var(--paper-2); display: flex; flex-direction: column; gap: 10px; }
.composer form { display: flex; gap: 8px; }
.composer .input { border-radius: 99px; padding: 0 18px; }
.composer .send { width: 48px; height: 48px; flex-shrink: 0; padding: 0; border-radius: 99px; }
.suggestions { display: flex; gap: 8px; overflow-x: auto; }
.suggestion { flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--card); font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---------- AI apps / MCP ---------- */
.mcp-hero {
  padding: clamp(24px, 4vw, 40px); border-radius: var(--radius); background: var(--ink); color: #fff;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: 32px; align-items: end;
}
.mcp-hero h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4vw, 46px); line-height: 1; margin: 8px 0 12px; }
.mcp-hero p:not(.eyebrow) { color: rgba(255,255,255,.72); max-width: 560px; }
.mcp-hero .eyebrow { color: var(--red-on-dark); }
.endpoint-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.endpoint-row code { flex: 1; min-width: 0; padding: 13px 15px; overflow-x: auto; border: 1px solid rgba(255,255,255,.24); border-radius: 12px; background: rgba(255,255,255,.08); color: #fff; font: 600 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.mcp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.setup-card { position: relative; padding-top: 30px; }
.setup-card .card-serif { margin-top: 5px; }
.app-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.app-mark.chatgpt { background: var(--ink); color: #fff; }
.app-mark.claude { background: #d97757; color: #fff8ef; font-family: Georgia, serif; }
.setup-steps { margin: 4px 0; padding: 0; list-style: none; counter-reset: setup; display: grid; gap: 14px; }
.setup-steps li { counter-increment: setup; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 11px; align-items: start; font-size: 14px; }
.setup-steps li::before { content: counter(setup); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 99px; background: var(--sand); font-size: 12px; font-weight: 800; }
.setup-steps li > span { min-width: 0; }
.setup-steps code { overflow-wrap: anywhere; font-size: 12px; }
.text-link { align-self: flex-start; font-size: 14px; font-weight: 700; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tool-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; gap: 8px; }
.tool-grid article strong { font-size: 15px; }
.tool-grid article p { color: var(--muted); font-size: 13px; }
.tool-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--sand); color: var(--red); }
.mcp-warning { padding: 14px 16px; border-radius: 14px; background: var(--amber-bg); color: #4a3005; font-size: 14px; }

/* ---------- Login / connect ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); }
.auth-hero { padding: 56px clamp(24px, 6vw, 96px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; border-right: 1px solid var(--line); }
.auth-hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(56px, 7vw, 104px); line-height: .9; letter-spacing: -.045em; max-width: 640px; }
.auth-hero h1 em { display: block; color: var(--red); font-style: normal; }
.auth-points { margin: 0; padding: 20px 0 0; list-style: none; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); max-width: 460px; }
.auth-points li { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 600; }
.auth-points .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--red); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-panel { padding: 56px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; gap: 24px; background: var(--paper-2); }
.auth-panel h2 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1; }
.auth-panel form { display: flex; flex-direction: column; gap: 14px; }
.fine { font-size: 13px; color: var(--muted); line-height: 1.5; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; align-items: start; }
.steps li::before { counter-increment: step; content: counter(step); width: 36px; height: 36px; border-radius: 99px; background: var(--ink); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.steps .body { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.connect { max-width: 720px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); max-width: min(560px, calc(100vw - 32px)); padding: 14px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; white-space: pre-line; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8d0c11; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .watch-layout, .rules-layout { grid-template-columns: minmax(0, 1fr); }
  .watch-panel, .editor { position: static; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 > .span-2 { grid-column: 1 / -1; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) 16px 10px; position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .mobile-top .brand { padding: 0; font-size: 18px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 6px 6px max(10px, env(safe-area-inset-bottom)); background: var(--paper-2); border-top: 1px solid var(--line); }
  .tab { flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; position: relative; }
  .tab[aria-current="page"] { color: var(--red); font-weight: 700; }
  .tab .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10px; }
  .main { padding: 20px 16px 104px; gap: 18px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 20px; }
  .upnext { padding: 22px; min-height: 0; }
  .spot-big { font-size: 34px; }
  .goal-num { font-size: 64px; }
  .ask-bar { width: 100%; }
  .page-head > .actions { width: 100%; }
  table.classes thead { display: none; }
  table.classes tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid rgba(23,20,18,.08); }
  table.classes tr:last-child { border-bottom: 0; }
  table.classes td { padding: 0; border: 0; }
  table.classes td.c-when { grid-column: 1; }
  table.classes td.c-class { grid-column: 1; }
  table.classes td.c-studio { display: none; }
  table.classes td.c-spot { grid-column: 2; grid-row: 1; text-align: right; }
  table.classes td.c-status { grid-column: 1; }
  table.classes td.c-act { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
  .rule-card { flex-wrap: wrap; gap: 12px 16px; }
  .rule-body { flex-basis: calc(100% - 120px); }
  .big-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run { grid-template-columns: minmax(0, 1fr) auto; }
  .run .msg { grid-column: 1 / -1; grid-row: 2; }
  .chat { height: calc(100vh - 250px); }
  .mcp-hero, .mcp-grid { grid-template-columns: minmax(0, 1fr); }
  .endpoint-row { align-items: stretch; flex-direction: column; }
  .endpoint-row .btn { width: 100%; }
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { border-right: 0; padding: 40px 20px 8px; gap: 24px; }
  .auth-hero .auth-points { display: none; }
  .auth-panel { padding: 24px 20px 48px; background: transparent; justify-content: flex-start; }
}

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