/* Twin, the control room. An Apple-style app in the language of the Jarvis guide:
   - Type: a serif for large titles (Georgia, as the guide's titles) and the system sans for everything you read.
   - Colour: cream text on near-black, the guide's deep green as the one accent, amber for what needs you, red for danger.
   - Layout: grouped rounded panels on black, quiet separators, generous space, one clear action per task.
   The galaxy (Jarvis) has its own section further down. */

:root {
  --bg: #000;
  --sidebar: #0b0c0a;
  --surface: #151613;
  --surface-2: #1d1e1a;
  --surface-3: #282923;
  --separator: rgb(242 240 232 / 0.09);
  --text: #f2f0e8;
  --muted: #a6a79c;
  --faint: #76776d;
  --accent: #74c595;
  --accent-strong: #2f7d52;
  --accent-soft: rgb(116 197 149 / 0.14);
  --warn: #e4ae55;
  --warn-soft: rgb(228 174 85 / 0.13);
  --danger: #ee6f63;
  --danger-soft: rgb(238 111 99 / 0.13);
  --ok: var(--accent);
  --ok-soft: var(--accent-soft);
  /* older names some screens still use */
  --border: var(--separator);
  --subtle: var(--surface-2);
  --accent-text: #fff;
  --warn-edge: var(--warn);
  --danger-edge: var(--danger);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px rgb(0 0 0 / 0.55);
  --sidebar-width: 248px;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Vazirmatn", system-ui, sans-serif;
  --display: Georgia, "Iowan Old Style", "New York", "Times New Roman", "Vazirmatn", serif;
  --mono: "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, dl, dd, ul, ol { margin: 0; }
h1 { font-family: var(--display); font-size: clamp(1.7rem, 3vw, 2.15rem); font-weight: 400; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 1.06rem; font-weight: 600; line-height: 1.3; }
/* Georgia has no Persian letters, and any letter spacing breaks Persian joins: Persian titles use the sans, unspaced */
:root[dir="rtl"] { --display: "Vazirmatn", "Segoe UI", Tahoma, sans-serif; }
:root[dir="rtl"] h1, :root[dir="rtl"] .today-greeting { letter-spacing: 0; font-weight: 600; }

/* planner rows: an Apple-style circle to tick a task off, and a quiet × to take it away */
.plan-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; min-height: 58px; padding: 10px 0; border-block-end: 1px solid var(--separator); }
.plan-row:last-child { border-block-end: 0; }
.plan-tick { width: 24px; height: 24px; padding: 0; border: 1.5px solid var(--faint); border-radius: 50%; background: transparent; cursor: pointer; }
.plan-tick:hover { border-color: var(--accent); background: var(--accent-soft); }
.plan-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plan-title { font-weight: 500; overflow-wrap: anywhere; }
.plan-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.84rem; color: var(--muted); }
.plan-meta .when { color: var(--accent); font-weight: 600; }
.plan-remove { width: 30px; height: 30px; color: var(--faint); background: transparent; border: 0; border-radius: 50%; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.plan-remove:hover { color: var(--text); background: var(--surface-2); }
.plan-reason { font-size: 0.84rem; color: var(--warn); }
.plan-origin { font-size: 0.8rem; color: var(--faint); overflow-wrap: anywhere; }

/* the conversation with Jarvis: beside the galaxy, and in the Ask sheet */
.jv-convo {
  position: absolute;
  inset-block: 88px 200px;
  inset-inline-start: clamp(12px, 2.5vw, 28px);
  width: min(380px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  color: var(--jv-text);
  background: var(--jv-glass);
  border: 1px solid var(--jv-line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.55);
  backdrop-filter: blur(16px);
}
.jv-convo[hidden] { display: none; }
.cv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cv-title { font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--jv-soft); }
:root[dir="rtl"] .cv-title { letter-spacing: 0; }
.jv-pill.small { min-height: 26px; padding: 2px 10px; font-size: 0.74rem; }
.jv-convo .cv-list { flex: 1; min-height: 0; overflow-y: auto; }
.cv-list { display: flex; flex-direction: column; gap: 16px; padding-inline-end: 4px; }
.cv-turn { display: flex; flex-direction: column; gap: 6px; }
.cv-you { align-self: flex-end; max-width: 88%; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cv-you p { margin: 0; padding: 8px 12px; font-size: 0.92rem; line-height: 1.45; border-radius: 14px 14px 4px 14px; background: rgb(127 160 255 / 0.18); overflow-wrap: anywhere; }
:root[dir="rtl"] .cv-you p { border-radius: 14px 14px 14px 4px; }
.cv-time { font-size: 0.68rem; color: var(--jv-soft); font-variant-numeric: tabular-nums; }
.cv-jarvis { display: flex; flex-direction: column; gap: 6px; max-width: 94%; }
.cv-answer { margin: 0; font-size: 0.95rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.cv-working { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 0.86rem; color: #ffd38a; }
.cv-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: cv-pulse 1.2s ease-in-out infinite; }
@keyframes cv-pulse { 50% { opacity: 0.25; transform: scale(0.7); } }
@media (prefers-reduced-motion: reduce) { .cv-dot { animation: none; } }
.cv-steps { margin: 0; padding-inline-start: 18px; font-size: 0.8rem; line-height: 1.5; color: var(--jv-soft); }
.cv-steps li.now { color: var(--jv-text); }
.cv-looked summary { cursor: pointer; font-size: 0.76rem; color: var(--jv-soft); }
.cv-looked[open] summary { margin-block-end: 4px; }
.cv-did { margin: 0; padding-inline-start: 18px; font-size: 0.8rem; color: #b6ffdf; }
.cv-did li.bad { color: #ffb4a8; }
.cv-earlier { align-self: center; padding: 4px 12px; font: inherit; font-size: 0.78rem; color: var(--jv-soft); background: none; border: 1px solid var(--jv-line); border-radius: 999px; cursor: pointer; }
.cv-empty { margin: 0; font-size: 0.86rem; color: var(--jv-soft); }
.jv-convo .source-chip { color: var(--jv-text); background: rgb(255 255 255 / 0.06); border: 1px solid var(--jv-line); }
@media (max-width: 1099px) {
  .jv-convo { inset-block: 76px 210px; inset-inline: 12px; width: auto; z-index: 2; }
}

.cv-learned { margin: 0; padding-inline-start: 18px; font-size: 0.8rem; color: #9fd7ff; }
.cv-learned li.bad { color: #ffb4a8; text-decoration: line-through; }
.cv-questions { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid rgb(255 211 138 / 0.35); border-radius: 12px; background: rgb(255 211 138 / 0.06); }
.cv-q-title { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: #ffd38a; }
:root[dir="rtl"] .cv-q-title { letter-spacing: 0; }
.cv-q p { margin: 0 0 6px; font-size: 0.9rem; }
.cv-q-bar { display: flex; gap: 6px; align-items: center; }
.cv-q-bar input { flex: 1; min-width: 0; min-height: 30px; padding: 4px 10px; color: inherit; background: rgb(255 255 255 / 0.06); border: 1px solid var(--jv-line); border-radius: 999px; font: inherit; font-size: 0.86rem; }
.ask-convo .cv-learned { color: var(--accent); }

/* what's happening: beside the galaxy, on the right */
.jv-happening {
  position: absolute;
  inset-block: 88px 200px;
  inset-inline-end: clamp(12px, 2.5vw, 28px);
  width: min(400px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  color: var(--jv-text);
  background: var(--jv-glass);
  border: 1px solid var(--jv-line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.55);
  backdrop-filter: blur(16px);
  z-index: 3;
}
.jv-happening[hidden] { display: none; }
.hp-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.hp-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--jv-line); border-radius: 12px; background: rgb(255 255 255 / 0.03); }
.hp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.hp-said { margin: 0; padding-inline-start: 16px; font-size: 0.86rem; color: var(--jv-soft); }
.hp-said li { overflow-wrap: anywhere; }
.hp-text { width: 100%; min-height: 64px; padding: 8px 10px; color: var(--jv-text); background: rgb(255 255 255 / 0.06); border: 1px solid var(--jv-line); border-radius: 10px; font: inherit; font-size: 0.9rem; resize: vertical; }
.hp-bar { display: flex; gap: 8px; }
.jv-pill.hp-send { color: #000; background: #dce9ff; border-color: #dce9ff; }
.hp-error { margin: 0; font-size: 0.8rem; color: #ffb4a8; }
.hp-sent { margin: 0; font-size: 0.82rem; color: #b6ffdf; }
.hp-deals-title { margin-block-start: 6px; }
.hp-deal p { margin: 0; font-size: 0.88rem; }
.hp-deal-open { all: unset; display: flex; flex-direction: column; gap: 6px; cursor: pointer; border-radius: 8px; }
.hp-deal-open:focus-visible { outline: 2px solid #dce9ff; outline-offset: 3px; }
.hp-what { font-size: 0.88rem; }
.hp-verdicts { flex-wrap: wrap; gap: 6px; }
.jv-pill.small.hp-judge { padding-inline: 10px; }
.st-shots { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.st-shots li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.st-shots li.done span:first-child { opacity: 0.7; }
.st-pick { position: relative; cursor: pointer; }
.st-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.st-video { width: 100%; max-height: 420px; border-radius: 10px; background: #000; }
.st-details summary { cursor: pointer; font-size: 0.82rem; color: var(--jv-soft); }
.hp-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 2px 8px; }
.hp-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px; color: var(--jv-soft); background: transparent; border: 1px solid var(--jv-line); border-radius: 999px; font: inherit; font-size: 0.78rem; cursor: pointer; }
.hp-tab.on { color: #000; background: #dce9ff; border-color: #dce9ff; }
.hp-tab:focus-visible { outline: 2px solid #dce9ff; outline-offset: 2px; }
.hp-count { font-variant-numeric: tabular-nums; opacity: 0.75; }
.hp-dot, .jv-pill.has-dot::after { width: 8px; height: 8px; border-radius: 50%; background: #ff6b5e; box-shadow: 0 0 0 2px rgb(0 0 0 / 0.5); }
.hp-dot { position: absolute; inset-block-start: -3px; inset-inline-end: -3px; }
.jv-pill.has-dot { position: relative; }
.jv-pill.has-dot::after { content: ""; position: absolute; inset-block-start: -2px; inset-inline-end: -2px; }
.hp-note { margin: 0; font-size: 0.8rem; color: var(--jv-soft); }
.hp-guide { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border-radius: 8px; background: rgb(220 233 255 / 0.07); }
.hp-guide p { margin: 0; font-size: 0.85rem; }
.hp-study .hp-kind { align-self: flex-start; }
.hp-deal.confirmed { border-color: rgb(182 255 223 / 0.45); }
.hp-thread { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; border-radius: 10px; background: rgb(0 0 0 / 0.25); }
.hp-msg { display: flex; flex-direction: column; gap: 1px; max-width: 88%; padding: 5px 9px; border-radius: 10px; font-size: 0.84rem; background: rgb(255 255 255 / 0.06); overflow-wrap: anywhere; }
.hp-msg.mine { align-self: flex-end; background: rgb(220 233 255 / 0.14); }
.hp-msg.found { outline: 1px solid #dce9ff; }
.hp-msg-time { font-size: 0.7rem; opacity: 0.6; }
.hp-kind { font-size: 0.75rem; letter-spacing: 0.02em; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--jv-line); opacity: 0.85; white-space: nowrap; }
.hp-deal-pay_later .hp-kind, .hp-deal-owe .hp-kind { border-color: currentColor; opacity: 1; font-weight: 600; }
@media (max-width: 1099px) {
  .jv-happening { inset-block: 76px 210px; inset-inline: 12px; width: auto; z-index: 4; }
}

/* in the Ask sheet: the same conversation, on the app's own colours */
.ask-convo { max-height: 46vh; overflow-y: auto; --jv-soft: var(--muted); --jv-text: var(--text); --jv-line: var(--separator); }
.ask-convo .cv-you p { background: var(--accent-soft); }
.ask-convo .cv-working { color: var(--warn); }
.ask-convo .cv-did { color: var(--accent); }

/* Lazarus: the recovery key, shown once on request */
.vault-key { display: flex; flex-direction: column; gap: 10px; }
.vault-key code { display: block; padding: 12px 14px; font: 600 0.95rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.04em; word-break: break-all; color: var(--text); background: var(--surface-2); border-radius: 10px; user-select: all; }
.bad-text { color: var(--danger); }

/* the shop: sales waiting for a confirm, the sales list, receipts */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.file-btn { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat.good dd { color: var(--accent); }
.stat.bad dd { color: var(--danger); }
.shop-proposed { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-block-start: 1px solid var(--line); }
.shop-proposed:first-of-type { border-block-start: 0; padding-block-start: 4px; }
.shop-proposed-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.shop-said { display: block; padding: 8px 12px; color: var(--muted); font-size: 0.9rem; background: var(--surface-2); border-radius: 10px; quotes: none; }
.shop-fields { display: grid; grid-template-columns: 2fr 0.8fr 1.4fr; gap: 8px; }
.shop-receipt { font-size: 0.84rem; color: var(--accent); }
.shop-receipt.bad { color: var(--danger); }
.shop-card h3 { margin-block: 26px 4px; font-size: 0.95rem; }
.shop-card > div:first-of-type > h3:first-child { margin-block-start: 6px; }
.shop-history { display: flex; flex-direction: column; }
.shop-sale { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 11px 36px 11px 0; border-block-start: 1px solid var(--line); }
.shop-sale:first-child { border-block-start: 0; }
.shop-sale-main { display: flex; justify-content: space-between; gap: 12px; }
.shop-sale-main .num { font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.shop-sale .plan-remove { position: absolute; inset-inline-end: 0; inset-block-start: 9px; }
[dir="rtl"] .shop-sale { padding: 11px 0 11px 36px; }
@media (max-width: 640px) { .shop-fields { grid-template-columns: 1fr 1fr; } .shop-fields input:first-child { grid-column: 1 / -1; } }

/* a job Claude is doing: its state, last steps and any question for the owner */
.task { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.task-head { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; font-weight: 600; }
.task-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.task-dot.live { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.task-dot.bad { background: var(--danger); }
.task-steps { margin: 0; padding-inline-start: 18px; font-size: 0.84rem; color: var(--muted); }
.task-steps li + li { margin-block-start: 3px; }
.task-step.said { color: var(--text); }
.task-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-block-start: 8px; }
.task-figure { margin: 0; }
.task-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: rgb(127 127 127 / 0.15); }
.task-figure figcaption { font-size: 0.78rem; color: var(--muted); margin-block-start: 3px; text-transform: capitalize; }
.jv-receipts .task { width: min(560px, 100%); color: #eef4ff; background: rgb(8 11 20 / 0.72); border: 1px solid rgb(150 180 255 / 0.22); backdrop-filter: blur(10px); }

/* where an answer came from: one button per note */
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sources-label { font-size: 0.78rem; color: var(--faint); }
.source-chip { max-width: 16rem; padding: 3px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; font-size: 0.8rem; color: var(--text); background: var(--surface-2); border: 0; border-radius: 999px; cursor: pointer; }
.source-chip:hover { background: var(--surface-3); }
.jv-receipts { flex-direction: column; align-items: center; gap: 8px; }
.jv-receipts .sources { justify-content: center; }
.jv-receipts .source-chip { color: #eef4ff; background: rgb(8 11 20 / 0.72); border: 1px solid rgb(150 180 255 / 0.22); backdrop-filter: blur(10px); }
h3 { font-size: 0.95rem; font-weight: 600; }
.muted { color: var(--muted); font-size: 0.9rem; }
.small { font-size: 0.84rem; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
::selection { color: #fff; background: var(--accent-strong); }

button, input, select, textarea { font: inherit; color: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 50;
  padding: 10px 16px;
  color: #fff;
  background: var(--accent-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip:focus { top: 12px; }
main:focus { outline: none; }

/* ------------------------------------------------------------------ the window: a quiet sidebar and the page */

.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 10px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
  background: var(--sidebar);
  border-inline-end: 1px solid var(--separator);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 18px; }
.brand-name { font-family: var(--display); font-size: 1.3rem; line-height: 1.1; }
.brand .muted { font-size: 0.74rem; line-height: 1.35; margin-block-start: 2px; }

/* the app icon: a small dark tile with Jarvis's light in it */
.logo {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 9%, var(--accent) 16%, rgb(116 197 149 / 0.25) 34%, transparent 52%),
    linear-gradient(160deg, #20221d, #0b0c0a);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.07) inset;
}

.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }

.nav-group {
  margin: 18px 12px 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--faint);
}

.nav-group:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: start;
  cursor: pointer;
}

.nav-item svg { flex: none; }
.nav-item .label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nav-item:hover:not([aria-current="page"]) { color: var(--text); background: var(--surface-2); }
.nav-item[aria-current="page"] { color: var(--text); background: var(--surface-3); font-weight: 600; }
.nav-item[aria-current="page"] svg { color: var(--accent); }

.count {
  min-width: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  color: #fff;
  background: var(--accent-strong);
}

.side-foot { padding: 12px 12px 4px; border-block-start: 1px solid var(--separator); }
.side-foot .muted { font-size: 0.78rem; line-height: 1.4; }

.shell { min-width: 0; display: flex; flex-direction: column; }

/* the page header: a large serif title with the guide's short green rule under it */
.bar {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 34px clamp(18px, 3.5vw, 40px) 4px;
}

.bar-title { flex: 1; min-width: 0; }
.bar-title h1::after { content: ""; display: block; width: 36px; height: 2px; margin-block: 14px 10px; background: var(--accent); border-radius: 2px; }
.bar-title .muted { font-size: 0.95rem; max-width: 60ch; }
.bar-tools { display: flex; align-items: center; gap: 8px; padding-top: 4px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: var(--muted);
  background: var(--surface-2);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.menu-btn { display: none; }

/* segmented control (Apple style): a track with the chosen segment raised */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-2); border-radius: 9px; }

.seg button {
  min-height: 30px;
  padding: 3px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 0.86rem;
  cursor: pointer;
}

.seg button:hover:not([aria-pressed="true"]) { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--text); background: var(--surface-3); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.4); }

.scrim { display: none; }

.page { width: 100%; max-width: 1000px; margin: 0 auto; padding: 22px clamp(18px, 3.5vw, 40px) 88px; }
.page > * + * { margin-block-start: 22px; }

/* ------------------------------------------------------------------ panels */

.card, .draft-card, details.card {
  position: relative;
  padding: 22px 24px;
  background: var(--surface);
  border-radius: var(--radius);
}

.card > h2 + .muted, .card > h2 + p { margin-block-start: 6px; }
.card > h2 + * { margin-block-start: 14px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.head + * { margin-block-start: 16px; }

.grid { display: grid; gap: 22px; align-items: start; }
.grid.two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page .grid { margin-block-start: 22px; }

.field { display: block; margin-block-start: 18px; }
.field:first-child { margin-block-start: 0; }
.field > span, .field > .label { display: block; font-weight: 600; font-size: 0.9rem; margin-block-end: 7px; }
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.84rem; margin-block-start: 6px; }
.field-row { display: flex; align-items: center; gap: 14px; }
.field-row output { min-width: 3.2em; font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; }
.field-row .ends { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

input[type="text"], input[type="number"], input[type="url"], input[type="search"], input[type="password"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { background: #22231e; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
select option { background: var(--surface-2); }

input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent-strong); min-height: 32px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-strong); }
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
textarea.short { min-height: 76px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.row > .field { margin-block-start: 18px; }
.row:first-child > .field { margin-block-start: 0; }

/* buttons: one filled green action per task; everything else is a quiet grey button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 0.93rem;
  color: #fff;
  background: var(--accent-strong);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn:hover:not(:disabled) { background: #378e5e; }
.btn.secondary { color: var(--text); background: var(--surface-3); font-weight: 500; }
.btn.secondary:hover:not(:disabled) { background: #33342d; }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 0.85rem; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.busy { cursor: progress; opacity: 0.75; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-block-start: 18px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-start: 12px; }

.flash { color: var(--accent); font-size: 0.88rem; font-weight: 600; }
.flash.bad { color: var(--danger); }

/* callouts, as the guide's "Make it yours" boxes: a tinted panel with a coloured edge */
.alert {
  padding: 13px 16px;
  margin-block-start: 14px;
  color: var(--text);
  background: var(--warn-soft);
  border-inline-start: 3px solid var(--warn);
  border-radius: 4px var(--radius-sm) var(--radius-sm) 4px;
}
:root[dir="rtl"] .alert { border-radius: var(--radius-sm) 4px 4px var(--radius-sm); }
.alert.danger { background: var(--danger-soft); border-inline-start-color: var(--danger); }
.alert.note { background: var(--surface-2); border-inline-start-color: var(--accent); }
.alert ul { margin: 6px 0 0; padding-inline-start: 20px; }
.alert strong { display: block; }
.alert p + p { margin-block-start: 6px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.cloud, .badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.off { color: var(--muted); background: var(--surface-3); }
.badge.bad, .badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.info { color: #9fd7b6; background: var(--accent-soft); }

.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--accent); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--danger); }

/* rows inside a panel, separated by hairlines like a grouped list */
.status-line { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 9px 0; border-block-end: 1px solid var(--separator); }
.status-line:last-child { border-block-end: 0; }
.status-line .name { flex: 1 1 8em; min-width: 7em; }
.status-line .value { flex: 0 1 auto; max-width: 62%; color: var(--muted); font-size: 0.9rem; text-align: end; overflow-wrap: break-word; }

dl.kv { display: grid; grid-template-columns: auto 1fr; }
dl.kv dt, dl.kv dd { padding: 10px 0; border-block-end: 1px solid var(--separator); }
dl.kv dt { color: var(--muted); font-size: 0.9rem; padding-inline-end: 18px; }
dl.kv dd { font-weight: 600; font-variant-numeric: tabular-nums; text-align: end; overflow-wrap: anywhere; }
dl.kv dt:last-of-type, dl.kv dd:last-of-type { border-block-end: 0; }

progress {
  display: block;
  width: 100%;
  height: 6px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
  color: var(--accent);
}

progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
progress.ok::-webkit-progress-value { background: var(--accent); }
progress.ok::-moz-progress-bar { background: var(--accent); }
progress.warn::-webkit-progress-value { background: var(--warn); }
progress.warn::-moz-progress-bar { background: var(--warn); }
progress.bad::-webkit-progress-value { background: var(--danger); }
progress.bad::-moz-progress-bar { background: var(--danger); }

.meter-label { display: flex; justify-content: space-between; gap: 12px; font-size: 0.88rem; margin-block-end: 7px; }
.meter-label > :last-child { color: var(--muted); }
.meter + .meter { margin-block-start: 16px; }

.subtabs { display: flex; gap: 4px; padding: 3px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; background: var(--surface-2); border-radius: 11px; width: fit-content; max-width: 100%; }

.subtabs button {
  min-height: 32px;
  padding: 5px 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
}

.subtabs button:hover:not([aria-selected="true"]) { color: var(--text); }
.subtabs button[aria-selected="true"] { color: var(--text); background: var(--surface-3); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.4); }
.subtabs + * { margin-block-start: 20px; }

/* numbered steps, as the guide's lists: green numbers, calm text */
.steps { list-style: none; padding: 0; }

.steps li {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 10px 0;
  border-block-end: 1px solid var(--separator);
}

.steps li:last-child { border-block-end: 0; }
.steps .body { flex: 1; min-width: 0; }
.steps .title { font-weight: 600; }
.steps li.done .title { color: var(--muted); font-weight: 500; }

.mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--surface-3);
  border-radius: 50%;
  color: #fff;
}

.nav-item .mark { width: 20px; height: 20px; }
.nav-item .mark:not(.empty) { background: var(--accent-strong); border-color: var(--accent-strong); }
li.done .mark { background: var(--accent-strong); border-color: var(--accent-strong); }
li.current .mark { border-color: var(--accent); }

/* commands, as the guide's dark code blocks */
.cmd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block-start: 10px;
  padding-block: 7px;
  padding-inline: 14px 7px;
  background: #0d0e0b;
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
}

.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; direction: ltr; text-align: start; color: #d9e7c9; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-block: 4px;
  padding-inline: 12px 6px;
  color: var(--text);
  background: var(--surface-2);
  border: 0;
  border-radius: 999px;
  font-size: 0.88rem;
  cursor: pointer;
}

.chip:has(input:checked) { color: #fff; background: var(--accent-strong); }

.chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.chip button:hover { background: rgb(255 255 255 / 0.1); }
.input-add { display: flex; gap: 8px; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { font-family: var(--display); font-size: 1.25rem; font-weight: 400; color: var(--text); margin-block-end: 6px; }
.empty .actions { justify-content: center; }

.skeleton { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--surface), var(--surface-3), var(--surface)); background-size: 200% 100%; }
.skeleton + .skeleton { margin-block-start: 12px; }
.skeleton.tall { height: 120px; border-radius: var(--radius); }

details { margin-block-start: 16px; }
summary { cursor: pointer; font-weight: 600; font-size: 0.93rem; min-height: 32px; list-style-position: inside; }
summary::marker { color: var(--faint); }
details > :not(summary) { margin-block-start: 12px; }

details.card { margin-block-start: 0; padding: 16px 22px; }
details.card[open] { padding-block-end: 22px; }
details.card > summary { font-size: 1rem; }
.plain-list { margin: 8px 0 0; padding-inline-start: 22px; }
.plain-list li { margin-block-start: 7px; line-height: 1.6; }
.plain-list li::marker { color: var(--accent); font-weight: 600; }
.toolbar .grow { flex: 1 1 180px; width: auto; min-height: 36px; padding-block: 5px; }
.tab-body > h3 { margin-block-end: 2px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spaced { margin-block-start: 20px; }
.spaced.wide { margin-block-start: 28px; }
.tight { margin-block-start: 10px; }
.stack > * + * { margin-block-start: 12px; }

/* ------------------------------------------------------------------ drafting */

.draft-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.draft-text {
  margin-block-start: 10px;
  padding: 16px 18px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 1.08rem;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.meta { margin-block-start: 8px; }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-block-start: 18px; }
.compare > section { min-width: 0; padding: 18px 20px; background: var(--surface-2); border-radius: var(--radius); }
.compare h3 { margin-block-end: 2px; }
.example { margin-block-start: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.example .who { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.example .words { white-space: pre-wrap; overflow-wrap: anywhere; margin-block-end: 6px; }

.draft-card { margin-block-start: 14px; }
.draft-card .who { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-block-start: 14px; }
.draft-card .who.spaced { margin-block-start: 18px; }
.quote { margin-block-start: 6px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
textarea.reply { margin-block-start: 6px; min-height: 96px; font-size: 1.05rem; }

.thumb {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-2);
}

.thumb.missing { display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-size: 0.8rem; color: var(--muted); }
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-block-start: 14px; }
.pic { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.pic .caption { overflow-wrap: anywhere; line-height: 1.45; }
.pic.out .thumb { opacity: 0.4; filter: grayscale(1); }

.pick-row { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 8px; }

.pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 144px;
  padding: 8px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.82rem;
}

.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick input { align-self: flex-start; width: 18px; height: 18px; }
.pick .caption { overflow-wrap: anywhere; line-height: 1.4; color: var(--muted); }

.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-block-start: 12px; }

.recent-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 48px; padding: 10px 0; border-block-end: 1px solid var(--separator); }
.recent-row:last-child { border-block-end: 0; }
.recent-row select { width: auto; min-width: 140px; min-height: 34px; padding: 4px 10px; }
.recent-row .muted { flex: 1 1 200px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ lists and tables */

.split { display: grid; grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); gap: 22px; align-items: start; }
.persona-list { display: grid; gap: 6px; }

.persona-card {
  width: 100%;
  padding: 14px 16px;
  text-align: start;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}

.persona-card:hover:not([aria-current="true"]) { background: var(--surface-2); }
.persona-card[aria-current="true"] { background: var(--surface-3); box-shadow: 0 0 0 1.5px var(--accent) inset; }
.persona-card .line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.checklist { display: grid; gap: 1px; margin-block-start: 10px; max-height: 420px; overflow-y: auto; scrollbar-width: thin; border-radius: 12px; }

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  min-height: 44px;
  border-radius: 9px;
  cursor: pointer;
}

.check:hover { background: var(--surface-2); }
.check input { width: 18px; height: 18px; flex: none; }
.check .count-text { margin-inline-start: auto; color: var(--faint); font-size: 0.82rem; white-space: nowrap; }

pre.style-text {
  margin: 10px 0 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.7;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 11px 12px; border-block-end: 1px solid var(--separator); vertical-align: middle; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
td.num, th.num { font-variant-numeric: tabular-nums; }
td.end { text-align: end; }
.table-wrap { overflow-x: auto; }

.facts { list-style: none; padding: 0; margin-block-start: 14px; }
.facts li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-block-end: 1px solid var(--separator); }
.facts li:last-child { border-block-end: 0; }
.facts .text { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.6; }

.source-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-block-end: 1px solid var(--separator); }
.source-row:last-child { border-block-end: 0; }
.source-row .body { flex: 1; min-width: 0; }
.source-row .title { font-weight: 600; }

.icon-arrow { transition: none; }
:root[dir="rtl"] .icon-arrow { transform: scaleX(-1); }

.result-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-block-start: 4px; }
.result-big { font-size: 1.7rem; font-weight: 300; line-height: 1.2; font-variant-numeric: lining-nums tabular-nums; }

/* ------------------------------------------------------------------ Today (the dashboard) */

.today-head { padding-block: 4px 2px; }
.today-kicker { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
:root[dir="rtl"] .today-kicker { letter-spacing: 0; }
.today-greeting { margin-block-start: 8px; font-family: var(--display); font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 400; line-height: 1.12; }
.today-greeting em { font-style: italic; color: var(--accent); }
.today-line { margin-block-start: 10px; color: var(--muted); font-size: 1rem; max-width: 60ch; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.tile { display: flex; flex-direction: column; gap: 14px; }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tile-head h2 { font-size: 1.02rem; }
.link-btn { padding: 4px 2px; color: var(--accent); background: none; border: 0; font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
/* numbers in the system sans, light, with lining figures (Georgia's old-style 0 reads as a letter O) */
.big-number { font-size: 2.6rem; font-weight: 300; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }
.big-number small { font-family: var(--font); font-size: 0.9rem; color: var(--muted); margin-inline-start: 6px; }
.up-next { list-style: none; padding: 0; }
.up-next li { display: grid; grid-template-columns: minmax(72px, max-content) minmax(0, 1fr); gap: 4px 14px; padding: 11px 0; border-block-end: 1px solid var(--separator); }
.up-next li:first-child { padding-block-start: 0; }
.up-next li:last-child { border-block-end: 0; padding-block-end: 0; }
.up-next .when { font-size: 0.82rem; font-weight: 600; color: var(--accent); }
.up-next .when.late { color: var(--warn); }
.up-next .what { min-width: 0; overflow-wrap: anywhere; }
.up-next .course { grid-column: 2; font-size: 0.82rem; color: var(--muted); }
.names { font-size: 0.92rem; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 960px) {
  .app { display: block; }

  .sidebar {
    position: fixed;
    z-index: 20;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(86vw, var(--sidebar-width));
    transform: translateX(-102%);
    box-shadow: var(--shadow);
  }

  :root[dir="rtl"] .sidebar { transform: translateX(102%); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; z-index: 15; inset: 0; background: rgb(0 0 0 / 0.6); backdrop-filter: blur(2px); }
  .menu-btn { display: inline-flex; }
  .grid.two, .grid.even, .compare, .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .card, .draft-card { padding: 18px; border-radius: 14px; }
  .bar { flex-wrap: wrap; padding-top: 16px; }
  .bar-title { order: 3; flex-basis: 100%; }
  .bar-tools { margin-inline-start: auto; }
  .page { padding-block-start: 14px; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { border-block-end: 0; padding-block-end: 0; }
  dl.kv dd { text-align: start; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .persona-card, .check, .nav-item, .seg button, .subtabs button, .icon-btn, input, select, textarea { transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s; }
  .sidebar { transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1); }
  .skeleton { animation: sweep 1.6s linear infinite; }
  @keyframes sweep { to { background-position: -200% 0; } }
}


/* ------------------------------------------------------------------ JARVIS: the galaxy (from the Run Jarvis Fully Local prompts)
   Cinematic: black space, a starfield, stars glowing by group, slow idle rotation. A clean input bar at the bottom shows
   the answer; a status line says who is talking; a badge shows which brain and voice are live. Nothing else on screen. */

body.galaxy-mode { background: #000; overflow: hidden; }
body.galaxy-mode::after, body.galaxy-mode .sidebar, body.galaxy-mode .bar, body.galaxy-mode .runbar { display: none; }
body.galaxy-mode .app { display: block; }
body.galaxy-mode .page { max-width: none; margin: 0; padding: 0; }
html:has(body.galaxy-mode) { background: #000; }

.jv-stage {
  --jv-text: #eef4ff;
  --jv-soft: rgb(200 215 245 / 0.62);
  --jv-line: rgb(150 180 255 / 0.22);
  --jv-glass: rgb(8 11 20 / 0.72);
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: var(--jv-text);
  background: #000004;
  font-family: "Segoe UI Variable Display", "Segoe UI", "Vazirmatn", system-ui, sans-serif;
  font-stretch: normal;
}
.jv-galaxy { position: absolute; inset: 0; }
.jv-galaxy canvas { display: block; }

.jv-top {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 3vw, 32px) 0;
  pointer-events: none;
}
.jv-top > * { pointer-events: auto; }
.jv-mark { display: flex; flex-direction: column; gap: 4px; }
.jv-name { font-size: 1.05rem; font-weight: 300; letter-spacing: 0.42em; color: #fff; text-shadow: 0 0 18px rgb(140 190 255 / 0.55); }
.jv-counts { font-size: 0.78rem; color: var(--jv-soft); letter-spacing: 0.02em; }
.jv-top-tools { display: flex; gap: 8px; }

.jv-pill {
  min-height: 34px;
  padding: 6px 14px;
  color: var(--jv-text);
  background: var(--jv-glass);
  border: 1px solid var(--jv-line);
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.jv-pill:hover { border-color: rgb(170 200 255 / 0.5); }
.jv-pill[aria-pressed="true"] { color: #000; background: #dce9ff; border-color: #dce9ff; }

.jv-dock {
  position: absolute;
  inset-inline: 0;
  inset-block-end: max(22px, env(safe-area-inset-bottom));
  width: min(780px, calc(100% - 32px));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.jv-answer {
  min-height: 1.5em;
  max-height: 30vh;
  overflow-y: auto;
  padding-inline: 8px;
  text-align: center;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 300;
  line-height: 1.5;
  color: #fff;
  text-shadow: 0 0 22px rgb(120 170 255 / 0.4), 0 1px 2px #000;
}
.jv-status-row { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 1.4em; }
.jv-status { font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--jv-soft); }
:root[dir="rtl"] .jv-status, :root[dir="rtl"] .jv-name { letter-spacing: 0; }
.jv-stage[data-status="listening"] .jv-status { color: #7fe3ff; }
.jv-stage[data-status="thinking"] .jv-status { color: #ffd38a; }
.jv-stage[data-status="speaking"] .jv-status { color: #b6ffdf; }
.jv-badge {
  padding: 2px 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #dce9ff;
  border: 1px solid var(--jv-line);
  border-radius: 999px;
  background: var(--jv-glass);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s, transform 0.4s;
}
.jv-badge.show { opacity: 1; transform: none; }

.jv-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: var(--jv-glass);
  border: 1px solid var(--jv-line);
  border-radius: 999px;
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(255 255 255 / 0.02) inset;
  backdrop-filter: blur(14px);
}
.jv-bar:focus-within { border-color: rgb(170 205 255 / 0.55); box-shadow: 0 10px 40px rgb(0 0 0 / 0.6), 0 0 28px rgb(110 160 255 / 0.18); }
.jv-bar input[type="text"] {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  color: #fff;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 1rem;
}
.jv-bar input[type="text"]:focus { box-shadow: none; outline: none; }
.jv-bar input::placeholder { color: rgb(190 205 235 / 0.55); }
.jv-round {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #dce9ff;
  background: rgb(255 255 255 / 0.06);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.jv-round:hover { background: rgb(255 255 255 / 0.12); }
.jv-round.send { color: #000; background: #dce9ff; }
.jv-round.on { color: #000; background: #7fe3ff; box-shadow: 0 0 0 6px rgb(127 227 255 / 0.18); }
:root[dir="rtl"] .jv-round.send svg { transform: scaleX(-1); }
.jv-under { display: flex; justify-content: center; align-items: center; gap: 12px; }
.jv-muted { font-size: 0.75rem; color: #ffd38a; }

.jv-panel {
  position: absolute;
  inset-block-start: 88px;
  inset-inline-end: clamp(12px, 2.5vw, 28px);
  width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 300px);
  overflow-y: auto;
  padding: 18px 20px 20px;
  background: var(--jv-glass);
  border: 1px solid var(--jv-line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.65);
  backdrop-filter: blur(16px);
}
.jv-panel[hidden] { display: none; }
.jv-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.jv-group { display: inline-flex; align-items: center; gap: 8px; font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--jv-soft); }
:root[dir="rtl"] .jv-group { letter-spacing: 0; }
.jv-swatch { width: 9px; height: 9px; border-radius: 50%; background: #7d9cc4; box-shadow: 0 0 10px currentColor; }
.jv-swatch.g-you { background: #fff; color: #fff; }
.jv-swatch.g-family { background: #ff7a59; color: #ff7a59; }
.jv-swatch.g-partner { background: #ff4fa0; color: #ff4fa0; }
.jv-swatch.g-friend { background: #ffd166; color: #ffd166; }
.jv-swatch.g-customer { background: #3ee0a0; color: #3ee0a0; }
.jv-swatch.g-colleague { background: #7fb2ff; color: #7fb2ff; }
.jv-swatch.g-acquaintance { background: #a493ff; color: #a493ff; }
.jv-swatch.g-people { background: #7d9cc4; color: #7d9cc4; }
.jv-swatch.g-knowledge { background: #4fd8ff; color: #4fd8ff; }
.jv-swatch.g-plan { background: #ffb547; color: #ffb547; }
.jv-swatch.g-shop { background: #5effc9; color: #5effc9; }
.jv-swatch.g-memory { background: #e9a6ff; color: #e9a6ff; }
.jv-close { width: 32px; height: 32px; color: var(--jv-soft); background: transparent; border: 0; border-radius: 50%; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.jv-close:hover { color: #fff; background: rgb(255 255 255 / 0.08); }
.jv-panel .jv-panel-title { display: block; margin-block: 10px 8px; font-size: 1.25rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: #fff; }
.jv-panel .jv-panel-title::before { content: none; }
.jv-panel-text { font-size: 0.95rem; line-height: 1.65; color: rgb(225 235 255 / 0.88); white-space: pre-wrap; overflow-wrap: anywhere; }
.jv-panel-meta { margin-block-start: 12px; font-size: 0.78rem; color: var(--jv-soft); }

/* The galaxy library's own rules. It tries to inject them as a style tag, which this page's security policy forbids,
   so they live here instead. */
.float-tooltip-kap { position: absolute; width: max-content; max-width: max(50%, 150px); pointer-events: none; }
.scene-nav-info { position: absolute; bottom: 5px; width: 100%; text-align: center; pointer-events: none; user-select: none; opacity: 0; }
.scene-container canvas:focus { outline: none; }
.graph-info-msg { position: absolute; top: 50%; width: 100%; text-align: center; color: rgb(200 215 245 / 0.6); font-size: 1rem; }
.scene-container .clickable { cursor: pointer; }
.scene-container .grabbable { cursor: grab; }
.scene-container .grabbable:active { cursor: grabbing; }
/* the star names that appear on hover */
.jv-tip { padding: 4px 10px; font: 500 0.85rem "Segoe UI", "Vazirmatn", sans-serif; color: #fff; background: rgb(8 11 20 / 0.82); border: 1px solid rgb(150 180 255 / 0.3); border-radius: 999px; }

@media (max-width: 700px) {
  .jv-panel { inset-block-start: auto; inset-block-end: 190px; inset-inline: 12px; width: auto; max-height: 38vh; }
  .jv-counts { max-width: 60vw; }
  .jv-answer { max-height: 22vh; }
  /* a phone is too narrow for the name and the three buttons side by side: the buttons go under the name and wrap */
  .jv-top { flex-wrap: wrap; gap: 10px; }
  .jv-top-tools { flex-wrap: wrap; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .jv-badge { transition: none; }
}

/* ------------------------------------------------------------------ the week: a timetable */

.view-switch { display: flex; justify-content: flex-end; margin-block-start: -8px; }
.week-card { padding: 18px 18px 20px; }
.week-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-block-end: 14px; }
.week-head h2 { font-family: var(--display); font-size: 1.35rem; font-weight: 400; }
.week-head .toolbar { margin: 0; }
.week-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(92px, 1fr)); overflow-x: auto; scrollbar-width: thin; }
.week-day, .week-scale { min-width: 0; }
.week-date { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 50px; font-size: 0.78rem; color: var(--muted); }
.week-date strong { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; font-size: 1.05rem; font-weight: 500; color: var(--text); border-radius: 999px; }
.week-day.today .week-date strong { color: #fff; background: var(--accent-strong); }
/* one fixed height for every day's all-day strip, so the hours line up across the week (extra chips scroll) */
.week-allday { display: flex; flex-direction: column; gap: 3px; height: 60px; overflow-y: auto; scrollbar-width: none; padding: 3px 3px 6px; border-block-end: 1px solid var(--separator); font-size: 0.72rem; color: var(--faint); }
.week-scale .week-allday { align-items: flex-end; justify-content: center; padding-inline-end: 8px; }
.week-chip { padding: 2px 7px; font-size: 0.74rem; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-hours { position: relative; height: calc(17 * 46px); }
.week-day .week-hours { border-inline-start: 1px solid var(--separator); background: repeating-linear-gradient(to bottom, transparent 0 45px, var(--separator) 45px 46px); }
.week-day.today .week-hours { background-color: rgb(116 197 149 / 0.03); }
.week-scale .week-hours { display: flex; flex-direction: column; }
.week-scale .week-hours span { flex: none; height: 46px; transform: translateY(-7px); padding-inline-end: 8px; font-size: 0.7rem; color: var(--faint); text-align: end; }
.week-item { position: absolute; inset-inline: 3px; display: flex; flex-direction: column; gap: 1px; padding: 3px 7px; overflow: hidden; font-size: 0.76rem; line-height: 1.25; border-radius: 7px; border-inline-start: 3px solid; }
.week-time { font-size: 0.68rem; opacity: 0.85; }
.week-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.week-now { position: absolute; inset-inline: 0; height: 2px; background: var(--danger); }
.week-now::before { content: ""; position: absolute; inset-inline-start: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
/* colour by kind: events blue-grey, deadlines amber, exams red, your tasks green */
.k-event { color: #d7e3ff; background: rgb(110 150 230 / 0.22); border-color: #7f9fe6; }
.k-class { color: #d7e3ff; background: rgb(110 150 230 / 0.22); border-color: #7f9fe6; }
.k-deadline { color: #ffe4b8; background: var(--warn-soft); border-color: var(--warn); }
.k-exam { color: #ffd0cb; background: var(--danger-soft); border-color: var(--danger); }
.k-errand, .k-shop { color: #d3f1df; background: var(--accent-soft); border-color: var(--accent); }
.week-item.done, .week-chip.done { opacity: 0.45; text-decoration: line-through; }

/* ------------------------------------------------------------------ Ask Jarvis, on every page */

.ask-fab {
  position: fixed;
  z-index: 30;
  inset-block-end: max(22px, env(safe-area-inset-bottom));
  inset-inline-end: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px 8px 12px;
  color: var(--text);
  background: rgb(29 30 26 / 0.92);
  border: 1px solid var(--separator);
  border-radius: 999px;
  box-shadow: 0 12px 34px rgb(0 0 0 / 0.55);
  backdrop-filter: blur(14px);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.ask-fab:hover { background: var(--surface-3); }
.ask-fab kbd { padding: 1px 6px; font: 600 0.7rem var(--font); color: var(--faint); background: var(--surface-3); border-radius: 5px; }
.ask-fab[aria-expanded="true"] { display: none; }
body.galaxy-mode .ask-fab, body.galaxy-mode .ask-sheet { display: none; }
.ask-orb { width: 14px; height: 14px; flex: none; border-radius: 50%; background: radial-gradient(circle, #fff 0 18%, var(--accent) 40%, rgb(116 197 149 / 0.2) 70%); box-shadow: 0 0 12px rgb(116 197 149 / 0.6); }

.ask-sheet {
  position: fixed;
  z-index: 31;
  inset-block-end: max(22px, env(safe-area-inset-bottom));
  inset-inline-end: 22px;
  width: min(430px, calc(100% - 32px));
  max-height: min(70vh, 640px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 18px;
  background: rgb(21 22 19 / 0.97);
  border: 1px solid var(--separator);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.7);
  backdrop-filter: blur(18px);
}
.ask-sheet[hidden] { display: none; }
.ask-head { display: flex; align-items: center; gap: 10px; }
.ask-head .muted { flex: 1; }
.ask-title { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 1.15rem; }
.ask-answer { font-size: 0.98rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-bar { display: flex; gap: 8px; }
.ask-bar input { flex: 1; min-width: 0; }

.receipts { display: flex; flex-direction: column; gap: 6px; }
.receipt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; font-size: 0.9rem; background: var(--accent-soft); border-radius: 10px; }
.receipt.bad { background: var(--danger-soft); }
.receipt.ask { background: var(--warn-soft); }
.receipt-mark { width: 18px; height: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.72rem; font-weight: 700; color: #000; background: var(--accent); }
.receipt.bad .receipt-mark { background: var(--danger); }
.receipt.ask .receipt-mark { background: var(--warn); }
.receipt-text { flex: 1 1 12rem; min-width: 0; }
.receipt-actions { display: inline-flex; gap: 6px; }
.jv-receipts { display: flex; justify-content: center; }
.jv-receipts .receipts { width: min(560px, 100%); }
.jv-receipts .receipt { background: rgb(8 11 20 / 0.72); border: 1px solid rgb(150 180 255 / 0.22); color: #eef4ff; backdrop-filter: blur(10px); }

@media (max-width: 600px) {
  .ask-fab kbd { display: none; }
  .ask-sheet { inset-inline: 12px; width: auto; }
}

/* ------------------------------------------------------------------ smaller pieces used by single screens */

/* Performance: the three ways to choose how much of the laptop the learning may use */
.mode-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 12px; margin-block: 14px; }
.mode-card { display: flex; flex-direction: column; gap: 6px; text-align: start; padding: 16px 18px; background: var(--surface-2); border: 1.5px solid transparent; border-radius: 14px; color: inherit; font: inherit; cursor: pointer; }
.mode-card:hover { background: var(--surface-3); }
.mode-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* What I learned: the counted numbers and the small bar charts */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; margin: 14px 0; }
.stat { display: flex; flex-direction: column-reverse; gap: 2px; padding: 14px 16px; background: var(--surface-2); border-radius: 12px; }
.stat dd { margin: 0; font-size: 1.6rem; font-weight: 300; font-variant-numeric: lining-nums tabular-nums; }
.stat dt { font-size: 0.8rem; color: var(--muted); }
svg.bars { width: 100%; max-width: 40rem; height: auto; }
svg.bars .bar { fill: var(--accent); }
svg.bars .bar-label { fill: var(--muted); font-size: 8px; }

/* The learning bar at the top of every screen, and the big overall bar */
.runbar { display: flex; align-items: center; gap: 12px; width: min(1000px, 100%); margin: 14px auto 0; padding: 8px clamp(18px, 3.5vw, 40px); }
.runbar[hidden] { display: none; }
.runbar-body { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 10px 14px; border: 0; border-radius: 12px; background: var(--surface); color: inherit; font: inherit; text-align: start; cursor: pointer; }
.runbar-body:hover { background: var(--surface-2); }
.runbar-body progress { flex: 1; min-width: 6rem; max-width: 22rem; }
.runbar-title { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.runbar-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.runbar-text { color: var(--muted); font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
progress.big { width: 100%; height: 10px; }
.stage-row { margin-block: 14px; }
.stage-row progress { width: 100%; }

/* About me: the basics as a contact card, one line each; a text box only for the one being changed */
.baseline-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) auto auto; gap: 6px 14px; align-items: center; min-height: 48px; padding: 9px 0; border-bottom: 1px solid var(--separator); }
.baseline-row:last-child { border-bottom: 0; }
.base-label { color: var(--muted); font-size: 0.9rem; }
.base-value { min-width: 0; overflow-wrap: anywhere; }
.base-value.muted { color: var(--faint); font-size: 0.9rem; }
.base-actions { display: inline-flex; gap: 14px; justify-content: flex-end; }
.base-edit { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.base-edit input { flex: 1 1 14rem; min-width: 0; }
@media (max-width: 40rem) {
  .baseline-row { grid-template-columns: minmax(0, 1fr) auto; }
  .base-label { grid-column: 1 / -1; grid-row: 1; }
  .base-value { grid-column: 1; grid-row: 2; }
  .base-actions { grid-column: 2; grid-row: 2; }
  .baseline-row > .badge { grid-column: 1; grid-row: 3; justify-self: start; }
  .base-edit { grid-row: 4; }
}

/* What Twin believes about you: one statement per row, Right / Wrong, quiet links for the rest */
.fact-row { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--separator); }
.fact-row:last-child { border-bottom: 0; }
.fact-text { font-size: 0.98rem; line-height: 1.55; overflow-wrap: anywhere; }
.fact-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.fact-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-inline-start: auto; }
.fact-row details { margin-block-start: 0; }
.fact-row details > summary { font-size: 0.84rem; font-weight: 500; color: var(--muted); min-height: 24px; }
.check-buttons { display: inline-flex; gap: 6px; }
.check-buttons .btn.small { min-height: 28px; padding: 3px 10px; font-size: 0.8rem; }
.link-btn.quiet { color: var(--faint); }
.link-btn.quiet:hover { color: var(--danger); }

/* Connecting Telegram: the four steps */
.tg-step { padding: 14px 0; border-bottom: 1px solid var(--separator); }
.tg-step .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tg-step .row input { flex: 1; min-width: 12rem; }

/* The pairing and offline pages */
.narrow { max-width: 30rem; margin: 3rem auto; padding: 0 1rem; }

/* On a phone: room for the notch and the home bar, and inputs big enough that the browser does not zoom in */
@supports (padding: max(0px)) {
  .app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .page { padding-bottom: max(88px, env(safe-area-inset-bottom)); }
}
@media (max-width: 40rem) {
  input, select, textarea { font-size: 16px; }
  .runbar-body { flex-wrap: wrap; row-gap: 6px; }
  .runbar-text { white-space: normal; flex-basis: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .mode-row { grid-template-columns: 1fr; }
}

.big-code { font-family: var(--mono); font-size: 2rem; letter-spacing: 0.25em; font-weight: 700; margin: 4px 0; }

/* Priority list and the chat list on the learning screen */
.prio-add { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 14px 8px; }
.prio-add input { flex: 1 1 14rem; min-width: 0; }
.prio-add .btn { flex: none; min-height: 42px; }
.prio-row { flex-wrap: nowrap; }
.prio-row strong { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.prio-row .muted { flex: 1 1 0; min-width: 0; }
.prio-row .btn { flex: none; }
.btn.step { min-width: 36px; padding-inline: 0; }
.draft-card .title-row { gap: 6px 8px; }
details.card.chats-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
details.card.chats-card > summary::-webkit-details-marker { display: none; }
details.card.chats-card > summary::after { content: "›"; font-size: 1.3rem; color: var(--faint); transition: transform 0.2s; }
details.card.chats-card[open] > summary::after { transform: rotate(90deg); }
@media (max-width: 600px) {
  .prio-row { flex-wrap: wrap; }
  .prio-row .muted { flex-basis: 100%; order: 3; }
  .runbar-body progress { min-width: 0; }
}
@media (pointer: coarse) {
  .btn, .btn.small, .recent-row select, .seg button, .subtabs button { min-height: 44px; }
  .btn.step { min-width: 44px; }
  .check input { width: 22px; height: 22px; }
  .check { min-height: 44px; }
}
