:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f1ec;
  --paper: #faf9f6;
  --line: #d5d0c7;
  --ink: #2f2d2a;
  --mute: #6b6760;
  --hover: #ebe7df;
  --stripe: #eeece7;
  --btn: #3a3732;
  --btn-text: #faf9f6;
  --shadow: 0 10px 28px rgba(47, 45, 42, 0.1);
  --json-key: #3d5a73;
  --json-str: #3d6b52;
  --json-num: #8a5a32;
  --json-bool: #6b4a78;
  --json-null: #6b6760;
  --mood-off: #9a4a42;
  --mood-caut: #b56a3a;
  --mood-neu: #6b6760;
  --mood-con: #5a7a52;
  --mood-on: #3d6b4a;
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #16181c;
  --paper: #1e2228;
  --line: #343a44;
  --ink: #ddd9d2;
  --mute: #8f8b84;
  --hover: #272c34;
  --stripe: #1a1d22;
  --btn: #ddd9d2;
  --btn-text: #1e2228;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --json-key: #9bb8d0;
  --json-str: #8fbf9a;
  --json-num: #d4b48a;
  --json-bool: #c4a8d0;
  --json-null: #8f8b84;
  --mood-off: #d08078;
  --mood-caut: #d4a06a;
  --mood-neu: #8f8b84;
  --mood-con: #8fbf9a;
  --mood-on: #7dba90;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  letter-spacing: 0.01em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--ink); text-decoration: underline; }
a:hover { opacity: 0.7; }

.auth {
  flex: 1 0 auto;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 56px 32px 28px;
  position: relative;
}

.mark {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 8px;
}

h1 {
  font-weight: 500;
  font-size: 28px;
  margin: 0 0 8px;
}

.lede {
  color: var(--mute);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 28px;
}

label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 8px;
}

input {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font: 16px/1.4 "IBM Plex Sans", sans-serif;
  padding: 12px 12px;
  margin-bottom: 18px;
  border-radius: 0;
}

input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}

button, .btn {
  appearance: none;
  border: 1px solid var(--btn);
  background: var(--btn);
  color: var(--btn-text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 16px;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
}
a.btn { text-decoration: none; }
a.btn:hover {
  text-decoration: none;
  opacity: 1;
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

button:disabled { opacity: 0.5; cursor: wait; }

.err {
  color: var(--ink);
  font-size: 13px;
  min-height: 18px;
  margin: 0 0 12px;
}
.ok {
  color: var(--ink);
  font-size: 13px;
  min-height: 18px;
  margin: 0 0 12px;
}
.field-hint {
  color: var(--mute);
  font-size: 12px;
  margin: -12px 0 18px;
  line-height: 1.45;
}
.profile-form { max-width: 420px; }

.foot {
  margin-top: 18px;
  color: var(--mute);
  font-size: 13px;
}

.theme-switch {
  display: inline-flex;
  border: 1px solid var(--line);
}
.theme-switch button {
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 8px 10px;
  letter-spacing: 0.12em;
}
.theme-switch button[aria-pressed="true"] {
  background: var(--btn);
  color: var(--btn-text);
}
.auth-theme {
  position: absolute;
  top: 16px;
  right: 16px;
}

.app {
  flex: 1 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 0;
}
.app-nav {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--paper);
  padding: 22px 14px 28px;
  display: flex;
  flex-direction: column;
}
.app-nav > .mark { margin: 0 10px 22px; }
.app-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-nav-kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 18px 10px 6px;
}
.app-nav-kicker.current { color: var(--ink); }
.app-nav-link {
  display: flex;
  align-items: center;
  min-height: 36px;
  color: var(--mute);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 10px;
  border: 1px solid transparent;
}
.app-nav-link.child { padding-left: 18px; }
.app-nav-link:hover {
  color: var(--ink);
  background: var(--hover);
  opacity: 1;
  text-decoration: none;
}
.app-nav-link.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--bg);
}
.app-nav-who {
  margin: auto 10px 0;
  padding-top: 24px;
  color: var(--mute);
  font-size: 12px;
  word-break: break-all;
}
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app:has(.db-page) {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}
.app-main:has(.db-page) {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}
.app-main:has(.db-page) .site-footer { display: none; }
.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.app-bar .spacer { flex: 1; }
.app-bar-actions { display: flex; gap: 8px; align-items: center; }
.app-bar-mark { display: none; margin: 0; }
body.nav-collapsed .app-bar-mark { display: block; }
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px;
}
.nav-toggle-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 12px;
}
.nav-toggle-icon span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
}
.nav-toggle-icon span:nth-child(1) { top: 0; }
.nav-toggle-icon span:nth-child(2) { top: 5.25px; }
.nav-toggle-icon span:nth-child(3) { top: 10.5px; }
body.nav-collapsed .app {
  grid-template-columns: minmax(0, 1fr);
}
body.nav-collapsed .app-nav { display: none; }
.app-backdrop { display: none; }
.app-main .shell { flex: 1 0 auto; }
.app-main .site-footer { flex-shrink: 0; }

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0 18px;
  margin-bottom: 28px;
}
.nav .mark { margin: 0 12px 0 0; }
.nav a.nav-link {
  color: var(--mute);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}
.nav a.nav-link:hover, .nav a.nav-link.active { color: var(--ink); }
.nav .spacer { flex: 1; }

.home-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 280px));
  gap: 12px;
  margin: 0 0 28px;
}
.home-status article {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 18px 18px 16px;
}
.home-mood .kicker,
.home-status .kicker,
.menu-list .kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 6px;
}
.home-status .title { font-size: 20px; margin: 0 0 6px; }
.home-status .hint { color: var(--mute); font-size: 13px; margin: 0; }
.home-mood {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 18px 18px 16px;
  margin: 0 0 28px;
  max-width: 720px;
}
.home-mood .mood { margin-top: 10px; }
.home-fun {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 980px;
}
.home-fun figure { margin: 0; }
.home-fun img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--paper);
}
.home-fun figcaption {
  color: var(--mute);
  font-size: 13px;
  margin: 8px 2px 0;
  line-height: 1.4;
}
.menu-list .title { font-size: 20px; }
.menu-list .hint { color: var(--mute); font-size: 13px; margin-top: 6px; }

select.role {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  font: 13px/1.4 "IBM Plex Mono", monospace;
  padding: 6px 8px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.admin-side {
  border-right: 1px solid var(--line);
  padding: 0 16px 32px 0;
  min-height: 240px;
}
.admin-side-kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 14px;
}
.admin-side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-side-link {
  display: block;
  color: var(--mute);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 10px;
  border: 1px solid transparent;
}
.admin-side-link:hover {
  color: var(--ink);
  background: var(--hover);
  opacity: 1;
  text-decoration: none;
}
.admin-side-link.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}
.admin-main h1 { margin-top: 0; }

.shell.wide { max-width: 1400px; }

.shell.db-page,
.app-main .shell.db-page {
  max-width: none;
  margin: 0;
  padding: 16px 16px 16px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.shell.db-page h1 {
  font-size: 22px;
  margin: 0 0 4px;
}
.shell.db-page .lede { margin: 0 0 10px; }
.shell.db-page .err { min-height: 0; margin: 0 0 8px; }
.shell.db-page .err:empty { display: none; }

.db-ide {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  flex: 1 1 auto;
  min-height: 0;
}
.db-tables {
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  min-height: 0;
  overflow-y: auto;
}
.db-table-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.db-table-link {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  text-decoration: none;
  color: var(--mute);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 7px 8px;
  border: 1px solid transparent;
}
.db-table-link:hover {
  color: var(--ink);
  background: var(--hover);
  opacity: 1;
  text-decoration: none;
}
.db-table-link.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--bg);
}
.db-count { color: var(--mute); font-size: 11px; }
.db-grid {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.db-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.db-table-name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: var(--ink);
}
.db-meta { color: var(--mute); font-size: 12px; margin: 4px 0 0; }
.db-pager { display: flex; gap: 8px; align-items: center; }
.db-pager[hidden] { display: none; }
.db-page {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--mute);
}
.db-sql {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.db-sql textarea {
  width: 100%;
  margin: 0;
  min-height: 88px;
  resize: vertical;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font: 13px/1.45 "IBM Plex Mono", monospace;
  padding: 10px 12px;
  border-radius: 0;
}
.db-sql textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}
.db-sql button {
  align-self: start;
}
.db-wrap {
  border: 0;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.db-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 1;
}
.db-wrap th, .db-wrap td {
  white-space: nowrap;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-redacted { color: var(--mute); font-style: italic; }
button.db-json {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}
button.db-json:hover { opacity: 0.7; }

.json-pop {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0;
  max-width: min(880px, calc(100% - 32px));
  width: 880px;
  max-height: min(85vh, 820px);
  box-shadow: var(--shadow);
}
.json-pop::backdrop {
  background: color-mix(in srgb, var(--ink) 40%, transparent);
}
.json-pop-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 820px);
}
.json-pop-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.json-pop-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.json-view {
  margin: 0;
  padding: 16px 18px 20px;
  overflow: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
  flex: 1 1 auto;
  min-height: 0;
}
.json-key { color: var(--json-key); }
.json-str { color: var(--json-str); }
.json-num { color: var(--json-num); }
.json-bool { color: var(--json-bool); }
.json-null { color: var(--json-null); font-style: italic; }

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  flex: 1 0 auto;
  width: 100%;
}

.shell.desk-page,
.app-main .shell.desk-page {
  max-width: none;
  margin: 0;
  width: 100%;
  padding: 20px 18px 32px;
}
.app-main:has(.desk-page) .site-footer-inner {
  max-width: none;
}

.desk-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 0 0 8px;
}
.desk-head h1 {
  margin: 0;
}
.ticker-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.ticker-pick span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}
.ticker-pick select {
  min-width: 220px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  font: 15px/1.3 "IBM Plex Mono", monospace;
  padding: 8px 10px;
  margin: 0;
  border-radius: 0;
}
.ticker-pick select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent);
}

.site-footer {
  flex-shrink: 0;
  width: 100%;
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--mute);
  font-size: 12px;
  line-height: 1.5;
  padding: 16px 24px 18px;
}
.site-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
}
.site-footer .mark { color: var(--ink); margin: 0; }
.site-footer p { margin: 0; }
.site-footer .mono, .mono {
  font-family: "IBM Plex Mono", monospace;
}

.version-pop {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow);
}
.version-pop::backdrop {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.version-pop-card { margin: 0; padding: 28px 24px 22px; }
.version-pop-card h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 8px;
}
.version-pop-copy {
  color: var(--mute);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 22px;
}
.version-pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 28px;
}

.top-actions { display: flex; gap: 8px; align-items: center; }
.who { color: var(--mute); font-size: 13px; margin-right: 8px; }

.hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 32px;
}

.score-box {
  border: 1px solid var(--line);
  padding: 22px 20px;
  background: var(--paper);
}

.score-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 72px;
  line-height: 0.9;
  font-weight: 400;
}

.score-label {
  margin-top: 10px;
  font-size: 18px;
}

.score-meta { color: var(--mute); font-size: 13px; margin-top: 8px; }

.mood-risk-off, .score-box.mood-risk-off .score-num, .score-box.mood-risk-off .score-label { color: var(--mood-off); }
.mood-cautious, .score-box.mood-cautious .score-num, .score-box.mood-cautious .score-label { color: var(--mood-caut); }
.mood-neutral, .score-box.mood-neutral .score-num, .score-box.mood-neutral .score-label { color: var(--mood-neu); }
.mood-constructive, .score-box.mood-constructive .score-num, .score-box.mood-constructive .score-label { color: var(--mood-con); }
.mood-risk-on, .score-box.mood-risk-on .score-num, .score-box.mood-risk-on .score-label { color: var(--mood-on); }

.mood { margin-top: 16px; }
.mood-track {
  position: relative;
  height: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    var(--mood-off) 0%,
    var(--mood-off) 35%,
    var(--mood-caut) 40%,
    var(--mood-neu) 50%,
    var(--mood-con) 60%,
    var(--mood-on) 65%,
    var(--mood-on) 100%
  );
}
.mood-mark {
  position: absolute;
  top: -5px;
  width: 3px;
  height: 20px;
  background: var(--ink);
  transform: translateX(-50%);
  pointer-events: none;
}
.mood-scale {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}
.mood-scale span { white-space: nowrap; }
.mood-parts {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mood-part {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  color: var(--ink);
}
.mood-part-name {
  font-size: 12px;
  color: var(--mute);
}
.mood-part-track {
  display: block;
  height: 6px;
  background: var(--hover);
  border: 1px solid var(--line);
}
.mood-part-track i {
  display: block;
  height: 100%;
  background: currentColor;
}
.mood-part.mood-risk-off { color: var(--mood-off); }
.mood-part.mood-cautious { color: var(--mood-caut); }
.mood-part.mood-neutral { color: var(--mood-neu); }
.mood-part.mood-constructive { color: var(--mood-con); }
.mood-part.mood-risk-on { color: var(--mood-on); }
.mood-part-n {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  text-align: right;
}
.mood-note { color: var(--mute); font-size: 13px; margin: 10px 0 0; line-height: 1.45; }

.mood-legend {
  display: grid;
  grid-template-columns: 35fr 10fr 10fr 10fr 35fr;
  height: 14px;
  border: 1px solid var(--line);
  margin: 12px 0 8px;
}
.mood-legend span:nth-child(1) { background: var(--mood-off); }
.mood-legend span:nth-child(2) { background: var(--mood-caut); }
.mood-legend span:nth-child(3) { background: var(--mood-neu); }
.mood-legend span:nth-child(4) { background: var(--mood-con); }
.mood-legend span:nth-child(5) { background: var(--mood-on); }
.mood-legend-scale {
  display: grid;
  grid-template-columns: 35fr 10fr 10fr 10fr 35fr;
  gap: 4px;
  margin: 0 0 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}
.help-bands td:first-child { width: 5.5rem; }
.help-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  vertical-align: -1px;
  border: 1px solid var(--line);
}
.help-swatch.off { background: var(--mood-off); }
.help-swatch.caut { background: var(--mood-caut); }
.help-swatch.neu { background: var(--mood-neu); }
.help-swatch.con { background: var(--mood-con); }
.help-swatch.on { background: var(--mood-on); }

.chart-wrap {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 16px 16px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chart-wrap h2, .grid h2, .table-wrap h2 {
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--mute);
  margin: 0 0 12px;
}
.chart-hint {
  margin: -8px 0 10px;
  font-size: 12px;
  color: var(--mute);
}
.chart-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.chart-key::before {
  content: "";
  width: 12px;
  height: 2px;
  background: currentColor;
}
.chart-key.spy { color: var(--mood-on); }
.chart-key.vix { color: var(--mood-caut); }
.chart-key.off,
.chart-key[aria-pressed="false"] {
  opacity: 0.4;
  text-decoration: line-through;
}

.chart-box {
  position: relative;
  cursor: crosshair;
  touch-action: none;
  flex: 1 1 auto;
  height: clamp(240px, 30vh, 360px);
  min-height: 240px;
}
@media (min-width: 1200px) {
  .chart-box { height: clamp(300px, 36vh, 480px); min-height: 300px; }
}
@media (min-width: 1800px) {
  .chart-box { height: clamp(360px, 40vh, 560px); min-height: 360px; }
}
.chart-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  opacity: 0.85;
}
.chart-expand:hover { opacity: 1; background: var(--hover); }
.chart-pro {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12, 14, 18, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
}
.chart-pro[hidden] { display: none !important; }
.chart-pro-frame {
  width: min(1280px, 100%);
  height: min(820px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.chart-pro-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.chart-pro-bar h2 {
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--mute);
  margin: 0 0 6px;
}
.chart-pro-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink);
}
.chart-pro-legend strong { font-weight: 500; }
.chart-pro-tools {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.chart-pro-tools button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  padding: 8px 12px;
}
.chart-pro-tools button[aria-pressed="true"],
.chart-pro-tools #chart-pro-close {
  background: var(--btn);
  color: var(--btn-text);
  border-color: var(--btn);
}
.chart-pro-tools [data-chart-series][aria-pressed="false"] {
  opacity: 0.45;
  text-decoration: line-through;
}
.chart-pro-host { min-height: 0; }
body.chart-pro-open { overflow: hidden; }
canvas { display: block; position: relative; z-index: 0; }
.chart-box canvas {
  width: 100%;
  height: 100%;
}
.chart-tip {
  position: absolute;
  pointer-events: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
  z-index: 5;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.chart-tip[hidden] { display: none !important; }
.chart-tip:not([hidden]) { display: block; }
.chart-tip strong { font-weight: 500; }

.flow-wrap {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 16px 16px 8px;
  margin-bottom: 32px;
}
.flow-wrap h2 {
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--mute);
  margin: 0 0 12px;
}
.flow-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px 16px;
  margin-bottom: 16px;
}
.flow-stat .k {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}
.flow-stat .v {
  font-family: "IBM Plex Mono", monospace;
  font-size: 22px;
  margin-top: 4px;
}
.flow-stat .s {
  font-size: 11px;
  color: var(--mute);
  margin-top: 2px;
}
.flow-stat .v.call, td.call, .flow-bar-legend .call { color: var(--mood-on); }
.flow-stat .v.put, td.put, .flow-bar-legend .put { color: var(--mood-off); }
.flow-bar-legend .atm { color: var(--mute); }
.flow-bar-title {
  grid-column: 1 / -1;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 4px 0 -4px;
}
.flow-bar {
  grid-column: 1 / -1;
  display: flex;
  height: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.flow-bar i { display: block; height: 100%; }
.flow-bar i.call { background: var(--mood-on); }
.flow-bar i.put { background: var(--mood-off); }
.flow-bar i.atm { background: var(--mute); }
.flow-bar-legend {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: -8px;
}
.flow-split {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr 1.1fr;
  gap: 20px;
  margin-top: 8px;
}
.flow-split h3 {
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--mute);
  margin: 0 0 8px;
}
.flow-split table { font-size: 12px; }
.flow-wrap[hidden] { display: none !important; }

.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 8px;
}
.social-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.social-list {
  list-style: none;
  margin: 12px 0 8px;
  padding: 0;
}
.social-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 8px;
}
.social-list a { color: var(--ink); }
.social-list .pill { flex: 0 0 auto; margin: 2px 0 0; }
@media (max-width: 980px) {
  .social-grid { grid-template-columns: 1fr; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.card {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 16px;
  min-height: 150px;
}

.card .name { font-size: 15px; margin-bottom: 4px; }
.card .provider, .card .note { color: var(--mute); font-size: 12px; line-height: 1.45; }
.card .stat {
  font-family: "IBM Plex Mono", monospace;
  font-size: 22px;
  margin: 12px 0 8px;
}

.pill {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}
.pill.live { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.pill.ok { background: var(--mood-on); color: #faf9f6; border-color: var(--mood-on); }
.pill.partial { background: var(--mood-caut); color: #faf9f6; border-color: var(--mood-caut); }
.pill.running { color: var(--mood-caut); }
.pill.error { border-style: dashed; }
.pill.waiting { color: var(--mute); }
.pill.empty { color: var(--mute); }
.table-wrap .pill { margin-bottom: 0; }

tr.sync-row { cursor: pointer; }
tr.sync-row:hover td { background: var(--hover); }
tr.sync-row[aria-expanded="true"] td { background: var(--hover); }
tr.sync-detail td {
  background: var(--stripe);
  padding: 4px 12px 14px;
}
.sync-sources { border: 1px solid var(--line); margin: 8px 0 4px; }
.sync-sources th, .sync-sources td { padding: 7px 10px; font-size: 12px; }
.sync-note { color: var(--mute); font-size: 12px; line-height: 1.4; }
.sync-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.sync-pager-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--mute);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 400;
}
td.mono { font-family: "IBM Plex Mono", monospace; }
tr:hover td { background: var(--hover); }

.banner {
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 24px;
  color: var(--mute);
}
.banner strong { color: var(--ink); }

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  background: var(--btn);
  color: var(--btn-text);
  padding: 10px 14px;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

html:has(.landing-body) { scroll-behavior: smooth; }

.landing-body {
  position: relative;
}
.landing-body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.18  0 0 0 0 0.14  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
html[data-theme="night"] .landing-body::after { opacity: 0.07; }

.shell.landing {
  max-width: 1220px;
  padding: 22px 28px 80px;
}

.landing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 22px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.landing-top .mark { margin: 0; }

.landing-kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 12px;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 40px 56px;
  align-items: center;
  padding: 36px 0 52px;
}

.landing-copy h1 {
  font-size: clamp(2rem, 4.4vw, 3.35rem);
  font-weight: 500;
  letter-spacing: -0.038em;
  line-height: 1.08;
  max-width: 16ch;
  text-wrap: balance;
  margin: 0 0 22px;
}

.landing-lede {
  font-size: 17px;
  line-height: 1.6;
  max-width: 42ch;
  margin: 0;
  color: var(--mute);
}

.landing-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  position: relative;
}
.landing-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 8%, transparent);
}

.landing-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.landing-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mood-on);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--mood-on) 18%, transparent);
  animation: landing-pip 2.4s ease-in-out infinite;
}
@keyframes landing-pip {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.86); opacity: 0.7; }
}

.landing-panel-tag {
  margin-left: auto;
  color: var(--mute);
  letter-spacing: 0.14em;
}

.landing-panel-rows {
  margin: 0;
}
.landing-panel-rows > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.landing-panel-rows dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}
.landing-panel-rows dd {
  margin: 0;
  font-size: 14px;
}

.landing-panel-foot {
  margin: 16px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.landing-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 64px;
  padding: 40px 0 8px;
  border-top: 1px solid var(--line);
}
.landing-split h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.landing-split p {
  margin: 0;
  max-width: 46ch;
  color: var(--mute);
  font-size: 15px;
  line-height: 1.6;
}

.landing-use {
  padding: 48px 0 8px;
}
.landing-use h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0 0 28px;
}
.landing-use ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.landing-use li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.landing-use li span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--mute);
  padding-top: 3px;
}
.landing-use strong {
  display: block;
  font-weight: 500;
  font-size: 17px;
  margin-bottom: 4px;
}
.landing-use li p {
  margin: 0;
  max-width: 54ch;
  color: var(--mute);
  font-size: 14px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .landing-hero,
  .landing-split {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 28px;
    padding: 28px 0 36px;
  }
  .landing-top { flex-wrap: wrap; }
  .landing-copy h1 { max-width: none; }
  .landing-use li { grid-template-columns: 48px 1fr; gap: 12px; }
  .shell.landing { padding: 18px 18px 64px; }
}

.help {
  max-width: 42rem;
}
.help h2 {
  font-weight: 500;
  font-size: 18px;
  margin: 28px 0 8px;
}
.help p {
  margin: 0 0 12px;
  line-height: 1.55;
}
.help-dl {
  margin: 0 0 12px;
}
.help-dl dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 14px 0 4px;
}
.help-dl dd {
  margin: 0;
  color: var(--mute);
  line-height: 1.55;
}
.help-bands {
  width: 100%;
  border: 1px solid var(--line);
  margin: 12px 0 16px;
}

@media (max-width: 980px) {
  .hero, .grid, .admin-layout, .site-footer-inner, .db-ide, .home-status, .home-fun, .flow-stats, .flow-split { grid-template-columns: 1fr; }
  .chart-box { height: 240px; min-height: 220px; }
  .chart-pro { padding: 8px; }
  .chart-pro-frame { height: 100%; width: 100%; }
  .chart-pro-bar { flex-direction: column; }
  .top { flex-direction: column; align-items: flex-start; }
  .nav { flex-wrap: wrap; }
  .admin-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 0;
    padding: 0 0 16px;
  }
  .admin-side-nav { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .app:has(.db-page),
  .app-main:has(.db-page) {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }
  .db-ide {
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .db-tables {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 0;
    max-height: 30vh;
  }
  .db-table-list { flex-direction: row; flex-wrap: wrap; }

  .app {
    display: block;
  }
  .app-main { min-height: 0; }
  body.nav-collapsed .app {
    display: block;
  }
  body.nav-collapsed .app-nav {
    display: flex;
  }
  .app-bar-mark { display: block; }
  .app-bar .who { display: none; }
  .app-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    height: 100%;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    visibility: hidden;
    pointer-events: none;
    box-shadow: var(--shadow);
  }
  body.nav-open .app-nav {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .app-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--ink) 40%, transparent);
    z-index: 30;
  }
  .app-backdrop[hidden] { display: none; }
  body.nav-open { overflow: hidden; }
  .app-nav-link {
    min-height: 44px;
    padding: 12px 12px;
  }
}
