/* 2382026 — Apple-style design: system type, quiet greys, one blue accent, soft depth, light + dark. No external assets. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --surface-3: #e8e8ed;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --link: #0066cc;
  --danger: #e30000;
  --danger-soft: rgba(227, 0, 0, 0.08);
  --success: #1d8f3a;
  --warn-soft: #fff4dc;
  --focus: rgba(0, 113, 227, 0.35);
  --glass: rgba(246, 246, 248, 0.72);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.06), 0 24px 60px rgba(0, 0, 0, 0.1);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 24px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --serif: var(--display);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c;
    --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #8e8e93;
    --line: rgba(255, 255, 255, 0.1); --line-strong: rgba(255, 255, 255, 0.18);
    --accent: #0a84ff; --accent-hover: #409cff; --accent-soft: rgba(10, 132, 255, 0.18); --link: #2997ff;
    --danger: #ff453a; --danger-soft: rgba(255, 69, 58, 0.16); --success: #30d158; --warn-soft: #3a2f12;
    --focus: rgba(10, 132, 255, 0.5); --glass: rgba(22, 22, 24, 0.72);
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c;
  --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #8e8e93;
  --line: rgba(255, 255, 255, 0.1); --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #0a84ff; --accent-hover: #409cff; --accent-soft: rgba(10, 132, 255, 0.18); --link: #2997ff;
  --danger: #ff453a; --danger-soft: rgba(255, 69, 58, 0.16); --success: #30d158; --warn-soft: #3a2f12;
  --focus: rgba(10, 132, 255, 0.5); --glass: rgba(22, 22, 24, 0.72);
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.47 var(--sans); letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0; color: var(--ink); }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -0.028em; font-weight: 700; }
h2 { font-size: 1.3rem; letter-spacing: -0.02em; }
h3 { font-size: 1.05rem; letter-spacing: -0.015em; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); padding: 0.12em 0.4em; border-radius: 6px; letter-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; }
.icon.tiny { width: 13px; height: 13px; opacity: 0.55; margin-left: auto; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Layout: sidebar in the style of Apple Music / iCloud ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  padding: 22px 12px 18px; background: var(--glass); border-right: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  scrollbar-width: thin;
}
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 0 10px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(145deg, #3a3a3c, #000); color: #fff; font: 700 1rem/1 var(--display);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25);
}
.brand-name { font: 600 1.06rem var(--display); letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { margin: 14px 10px 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; color: var(--ink-3); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px;
  color: var(--ink); font-size: 0.9rem; font-weight: 450; text-decoration: none; transition: background 0.15s var(--ease);
}
.nav a .icon { color: var(--accent); width: 19px; height: 19px; }
.nav a:hover { background: var(--line); text-decoration: none; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a.active .icon { color: #fff; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1px; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar-foot form { margin: 0; }
.foot-link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink-2); font: 450 0.86rem var(--sans); letter-spacing: -0.01em; text-align: left; cursor: pointer; text-decoration: none;
}
.foot-link .icon { width: 17px; height: 17px; }
.foot-link:hover { background: var(--line); color: var(--ink); text-decoration: none; }
.main { padding: 44px clamp(18px, 4.5vw, 56px) 80px; max-width: 1180px; width: 100%; }
.main.public { margin: 0 auto; max-width: 720px; padding-top: 24px; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 52px; padding: 0 clamp(16px, 4vw, 40px); background: var(--glass); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.topbar .brand { padding: 0; }
.topbar .brand-mark { width: 26px; height: 26px; border-radius: 7px; font-size: 0.9rem; }
.topbar-nav { display: flex; align-items: center; gap: 22px; white-space: nowrap; font-size: 0.84rem; }
.topbar-nav a, .topbar-nav .link-button { color: var(--ink-2); font-size: 0.84rem; }
.topbar-nav a:hover { color: var(--ink); text-decoration: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 8px 12px; padding: 10px 14px 8px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .brand-mark { width: 28px; height: 28px; }
  .nav { order: 3; width: 100%; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group { display: none; }
  .nav a { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 0.86rem; }
  .nav a .icon { width: 16px; height: 16px; }
  .nav a .icon.tiny { display: none; }
  .sidebar-foot { order: 2; margin: 0 0 0 auto; flex-direction: row; gap: 2px; padding: 0; border: 0; }
  .foot-link { width: auto; padding: 6px 8px; }
  .foot-link span { display: none; }
  .main { padding: 28px 16px 64px; }
}

/* ---------- Building blocks ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(1.9rem, 3.6vw, 2.5rem); }
.page-head p.muted { margin: 8px 0 0; }
.eyebrow { margin: 0 0 6px; color: var(--ink-2); font-size: 0.8rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 0.84rem; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.quiet { color: var(--link); font-size: 0.9rem; }
.quiet:hover { text-decoration: underline; }
.empty { color: var(--ink-2); padding: 20px 0; margin: 0; }
.notice { background: var(--warn-soft); color: var(--ink); padding: 12px 16px; border-radius: 12px; font-size: 0.9rem; line-height: 1.45; }
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card.narrow { max-width: 540px; margin: 40px auto; }
.card.center { text-align: center; }
.card-title { margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 1.15rem; }
.foot { margin: 16px 0 0; }
.mt { margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 14px; } }

/* Buttons: Apple's pill buttons */
.button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 8px 18px;
  border: 0; border-radius: 980px; background: var(--accent); color: var(--accent-ink);
  font: 500 0.94rem var(--sans); letter-spacing: -0.01em; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.2s var(--ease), transform 0.1s var(--ease);
}
.button:hover { background: var(--accent-hover); text-decoration: none; }
.button:active { transform: scale(0.98); }
.button.large { min-height: 46px; padding: 12px 24px; font-size: 1.02rem; }
.button.small { min-height: 30px; padding: 5px 14px; font-size: 0.84rem; }
.button.ghost { background: var(--surface-2); color: var(--ink); }
.button.ghost:hover { background: var(--surface-3); }
.button.danger { background: var(--danger-soft); color: var(--danger); }
.button.danger:hover { background: var(--danger); color: #fff; }
.button[disabled] { opacity: 0.4; cursor: default; }
.button-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button-row form { display: contents; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; font-size: 0.9rem; letter-spacing: inherit; }
.link-button:hover { text-decoration: underline; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  font-size: 0.74rem; font-weight: 500; letter-spacing: 0; text-decoration: none; white-space: nowrap;
}
.badge.public { background: var(--accent-soft); color: var(--accent); }
.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--surface-3); gap: 2px; }
.segmented a { padding: 5px 14px; border-radius: 7px; color: var(--ink); font-size: 0.86rem; text-decoration: none; }
.segmented a.active { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 500; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 0.88rem; color: var(--ink); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), textarea, select {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: 1rem var(--sans); letter-spacing: -0.01em;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 17px; height: 17px; }
textarea { resize: vertical; line-height: 1.55; min-height: 120px; }
.editor textarea { font-family: var(--mono); font-size: 0.92rem; letter-spacing: 0; }
input[type="file"] { font: 0.88rem var(--sans); color: var(--ink-2); max-width: 100%; }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 7px 14px; border: 0; border-radius: 980px; background: var(--surface-2); color: var(--ink); font: 500 0.86rem var(--sans); cursor: pointer;
}
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.search { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.search input { max-width: 440px; border-radius: 10px; background: var(--surface-2); border-color: transparent; }
.upload { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.upload label { flex: 1 1 280px; }

/* ---------- Flash messages ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.flash { margin: 0; padding: 12px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); font-size: 0.92rem; }
.flash-success { background: var(--accent-soft); box-shadow: none; }
.flash-error { background: var(--danger-soft); box-shadow: none; color: var(--ink); }

/* ---------- Sign in (Apple ID style) ---------- */
body.auth { background: var(--bg); }
body.auth .main.public { min-height: calc(100vh - 52px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px 64px; }
body.auth .flashes { width: min(400px, 100%); margin-bottom: 26px; text-align: center; }
.signin { width: min(400px, 100%); text-align: center; }
.signin-mark {
  display: inline-grid; place-items: center; width: 72px; height: 72px; margin-bottom: 22px; border-radius: 18px;
  background: linear-gradient(145deg, #3a3a3c, #000); color: #fff; font: 700 2.2rem/1 var(--display);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), inset 0 0 0 0.5px rgba(255, 255, 255, 0.3);
}
.signin h1 { font-size: clamp(1.75rem, 5vw, 2.1rem); }
.signin-sub { margin: 10px 0 30px; color: var(--ink-2); font-size: 1.02rem; }
.signin .notice { text-align: left; margin-bottom: 18px; }
.signin-form { display: flex; flex-direction: column; gap: 18px; }
.field-group { display: flex; flex-direction: column; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong); overflow: hidden; }
.field-group .field { display: block; }
.field-group .field + .field { border-top: 1px solid var(--line-strong); }
.field-group .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) {
  min-height: 54px; border: 0; border-radius: 0; background: transparent; font-size: 1.04rem; padding: 14px 18px; box-shadow: none; }
.field-group .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):focus { box-shadow: inset 0 0 0 2px var(--accent); }
.signin-form .button { width: 100%; }
.signin-foot { margin: 26px 0 0; color: var(--ink-3); font-size: 0.8rem; }

/* ---------- Home ---------- */
.hello { margin: 4px 0 30px; }
.hello h1 { font-size: clamp(2.2rem, 5vw, 3.1rem); }
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 36px; }
.launch {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.launch:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.launch:active { transform: scale(0.98); }
.launch-text { display: flex; flex-direction: column; min-width: 0; }
.launch-text strong { font-weight: 600; font-size: 0.98rem; letter-spacing: -0.015em; }
.launch-text span { color: var(--ink-2); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-icon {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 11px; color: #fff;
  background: linear-gradient(160deg, var(--c1), var(--c2)); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.12);
}
.app-icon .icon { width: 24px; height: 24px; stroke-width: 2; }
.app-icon.blue { --c1: #47a3ff; --c2: #0066e0; }
.app-icon.indigo { --c1: #7d7bff; --c2: #4b49d6; }
.app-icon.purple { --c1: #d17bff; --c2: #9b3ad9; }
.app-icon.pink { --c1: #ff6b8a; --c2: #e0254b; }
.app-icon.red { --c1: #ff6b5f; --c2: #e0231a; }
.app-icon.orange { --c1: #ffb340; --c2: #f27b00; }
.app-icon.yellow { --c1: #ffd84d; --c2: #f0ae00; }
.app-icon.green { --c1: #4cd97b; --c2: #1fa84a; }
.app-icon.mint { --c1: #5ce0d6; --c2: #00a89c; }
.app-icon.teal { --c1: #5ac8fa; --c2: #1d8fd0; }
.app-icon.cyan { --c1: #7ee0ff; --c2: #22a6d6; }
.app-icon.brown { --c1: #c8a47a; --c2: #8f6b43; }
.app-icon.gray { --c1: #a1a1a6; --c2: #636366; }
@media (max-width: 520px) {
  .launcher { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .launch { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .launch-text span { white-space: normal; }
}

section.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 760px) { section.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.stat:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.stat.attention { background: var(--accent-soft); box-shadow: none; }
.stat-value { font: 700 1.9rem/1.05 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-2); font-size: 0.82rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list li > a { display: flex; flex-direction: column; min-width: 0; color: var(--ink); text-decoration: none; }
.list li > a strong { font-weight: 500; font-size: 0.97rem; }
.list li > a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86rem; }
.list li > a:hover strong { color: var(--link); }
.list li > time, .list li > .badge { flex-shrink: 0; white-space: nowrap; }

/* ---------- Notes ---------- */
.note-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.note-card {
  display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: var(--radius); background: var(--surface);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.note-card p { margin: 0; flex: 1; font-size: 0.92rem; color: var(--ink-2); }
.prose { font-size: 1.06rem; line-height: 1.65; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { margin: 1.4em 0 0.5em; }
.prose pre { background: var(--surface-2); padding: 16px; border-radius: 12px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose blockquote { margin: 0; padding-left: 16px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.prose img { max-width: 100%; border-radius: 12px; }

/* ---------- Inbox ---------- */
.inbox, .pages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.inbox-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.inbox-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--ink); text-decoration: none; }
.inbox-main:hover { text-decoration: none; }
.inbox-main span { overflow-wrap: anywhere; font-size: 0.92rem; color: var(--ink-2); }
.inbox-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 600px) { .inbox-item { flex-direction: column; align-items: stretch; } }

/* ---------- Pages ---------- */
.page-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; padding: 16px 20px; }
.page-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.page-title { font-weight: 600; color: var(--ink); text-decoration: none; }
.page-title:hover { color: var(--link); text-decoration: none; }
.page-settings { grid-column: 1 / -1; }
.page-settings summary, .archived summary { cursor: pointer; color: var(--link); font-size: 0.88rem; }
.page-settings[open] { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.page-settings > * + * { margin-top: 12px; }
.page-settings .button-row form { display: inline-flex; gap: 8px; }
.archived { margin-top: 24px; }

/* ---------- Tables ---------- */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 12px 20px; text-align: left; border-top: 1px solid var(--line); }
.table thead th { border-top: 0; color: var(--ink-2); font-weight: 500; font-size: 0.78rem; }
.table tbody tr { transition: background 0.15s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .filename { overflow-wrap: anywhere; min-width: 180px; }
.table .actions { text-align: right; }
table.small { width: 100%; border-collapse: collapse; }
table.small th, table.small td { text-align: left; padding: 6px 10px 6px 0; border-top: 1px solid var(--line); }

/* ---------- Calendar ---------- */
.cal-grid { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal-grid th { color: var(--ink-3); font-weight: 600; font-size: 0.72rem; padding-bottom: 4px; }
.cal-grid td { text-align: center; padding: 0; }
.cal-grid td span { display: grid; place-items: center; height: 44px; border-radius: 50%; aspect-ratio: 1; margin: 0 auto; font-variant-numeric: tabular-nums; }
.cal-grid.compact td span { height: 32px; font-size: 0.86rem; }
.cal-grid .wk { color: var(--ink-3); font-size: 0.72rem; width: 2.6em; }
.cal-grid td.out span { color: var(--ink-3); opacity: 0.5; }
.cal-grid td.weekend span { color: var(--ink-2); }
.cal-grid tr.this-week td:not(.wk) span { background: var(--surface-2); }
.cal-grid td.today span { background: var(--danger) !important; color: #fff !important; font-weight: 600; opacity: 1; }

/* ---------- Options / market ---------- */
.kv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 8px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.kv-grid dt { margin: 0; color: var(--ink-2); font-size: 0.78rem; }
.kv-grid dd { margin: 2px 0 0; font: 600 1.2rem var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---------- Progress (Breeze) ---------- */
progress { appearance: none; -webkit-appearance: none; width: 100%; max-width: 220px; height: 6px; border: 0;
  border-radius: 999px; background: var(--surface-3); vertical-align: middle; overflow: hidden; }
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; }
dl.stats { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 12px 0 0; }
dl.stats dt { color: var(--ink-2); }
dl.stats dd { margin: 0; overflow-wrap: anywhere; }
dl.stats meter { width: 90px; vertical-align: middle; }
.progress-list { list-style: none; margin: 0; padding: 0; }
.progress-list li { padding: 14px 0; border-top: 1px solid var(--line); }
.progress-list li:first-child { border-top: 0; padding-top: 0; }
.progress-list li:last-child { padding-bottom: 0; }
.progress-list progress { max-width: none; display: block; margin: 8px 0 4px; }
.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.progress-row strong { overflow-wrap: anywhere; }

/* ---------- Apps page ---------- */
.app-group h2 { font-size: 1.15rem; margin: 34px 0 14px; }
.app-group:first-of-type h2 { margin-top: 8px; }
.app-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.app-tile {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.app-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.app-tile .launch-text span { white-space: normal; }

/* ---------- Errors / public pages ---------- */
.card.narrow.center h1 { margin-bottom: 10px; }
.app-letter { font: 700 1.3rem/1 var(--display); letter-spacing: -0.02em; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark, :root:not([data-theme="light"]) .signin-mark { background: linear-gradient(145deg, #ffffff, #d2d2d7); color: #000; }
}
:root[data-theme="dark"] .brand-mark, :root[data-theme="dark"] .signin-mark { background: linear-gradient(145deg, #ffffff, #d2d2d7); color: #000; }

/* ---------- Broker ---------- */
.broker-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.broker-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.broker-head h2 { font-size: 1.2rem; }
.broker-head p { margin: 2px 0 0; }
.broker-head .status-pill { margin-left: auto; }
.status-pill { padding: 4px 11px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; letter-spacing: 0; }
.status-pill.ok { background: rgba(52, 199, 89, 0.16); color: var(--success); }
.status-pill.ready { background: var(--accent-soft); color: var(--accent); }
.status-pill.off { background: var(--surface-2); color: var(--ink-2); }
.setup-steps { margin: 0; padding-left: 20px; color: var(--ink-2); line-height: 1.6; }
.setup-steps li + li { margin-top: 6px; }
.setup-steps code { overflow-wrap: anywhere; }
.key-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.key-box summary { cursor: pointer; color: var(--ink-2); font-size: 0.86rem; list-style-position: outside; }
.key-box summary strong { color: var(--ink); font-family: var(--mono); letter-spacing: 0; }
.key-box[open] summary { margin-bottom: 14px; }
.key-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.copy-line { margin: -4px 0 14px; }
.copy-line code { display: block; padding: 8px 10px; overflow-wrap: anywhere; user-select: all; }
.danger-link { color: var(--danger); }
.breeze-links { margin: 14px 0 8px; }
.broker-card .button-row form { display: inline-flex; }

/* ---------- Broker Check API ---------- */
.conn-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.status-pill.bad { background: var(--danger-soft); color: var(--danger); }
.check-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.check-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.check-side .card { padding: 18px; }
.check-side h2 { font-size: 1rem; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.check-list a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; color: var(--ink); font-size: 0.88rem; text-decoration: none; }
.check-list a:hover { background: var(--surface-2); text-decoration: none; }
.check-list li.current a { background: var(--accent-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); flex: none; }
.dot.ok { background: var(--success); }
.dot.bad { background: var(--danger); }
.check-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.check-form { padding: 16px; }
.check-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.check-toolbar input { flex: 1 1 220px; }
.check-toolbar .button .icon { width: 16px; height: 16px; }
textarea.code-editor {
  min-height: 380px; font: 0.86rem/1.6 var(--mono); letter-spacing: 0; tab-size: 2; white-space: pre; overflow: auto;
  background: var(--surface-2); border-color: transparent; border-radius: 12px; padding: 14px 16px;
}
.editor-hint { margin: 10px 2px 0; }
kbd { font: 600 0.72rem var(--sans); padding: 1px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.delete-row { margin: -6px 4px 0; }
.result-card .card-head { align-items: center; }
.result-error { color: var(--danger); background: var(--danger-soft); padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; }
.result-label { margin: 18px 0 8px; font-size: 0.8rem; color: var(--ink-2); font-weight: 600; }
pre.console {
  margin: 0; max-height: 420px; overflow: auto; padding: 14px 16px; border-radius: 12px; background: #1d1d1f; color: #f5f5f7;
  font: 0.82rem/1.55 var(--mono); letter-spacing: 0; white-space: pre-wrap; overflow-wrap: anywhere;
}
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 2px; }
.card.alert { border: 1px solid var(--danger); }
strong.danger { color: var(--danger); }
pre.select-all { user-select: all; -webkit-user-select: all; margin-bottom: 12px; }
.compact-table th, .compact-table td { padding: 8px 10px; }
.routes-card summary { cursor: pointer; font-weight: 500; }
.routes-card[open] summary { margin-bottom: 8px; }
.route-list { line-height: 1.9; color: var(--ink-2); overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .check-layout { grid-template-columns: minmax(0, 1fr); }
  .check-side { position: static; order: 2; }
}
.crumbs { margin: 0 0 6px; overflow-wrap: anywhere; }
.crumbs a { color: var(--ink-2); }
