:root {
  --bg: #030303;
  --panel: #0a0a0a;
  --panel-hover: #0f0f0f;
  --fg: #f5f5f5;
  --dim: #a3a3a3;
  --muted: #737373;
  --faint: #525252;
  --border: #262626;
  --border-soft: #1f1f1f;
  --tone-ok: #f5f5f5;
  --tone-warn: #d4d4d4;
  --tone-danger: #f5f5f5;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

/* ─── Page header ─────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.page-head .left {
  min-width: 0;
}

.page-head .eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  color: #fafafa;
  font-size: 34px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.page-head p.subhead {
  margin: 10px 0 0;
  max-width: 60ch;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.55;
}

.page-head .right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sync-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.sync-pill.ok {
  color: #d4d4d4;
}

.sync-pill.error {
  color: #fafafa;
}

/* ─── Panels ──────────────────────────────────────────────────── */
.panel {
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.panel.flush {
  padding: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head .eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.panel-head h2 {
  margin: 0;
  color: #fafafa;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.005em;
}

.panel-head h2 .count {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* ─── Metric tiles ────────────────────────────────────────────── */
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.metric .eyebrow {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.metric .value {
  color: #fafafa;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.metric .value.small {
  font-size: 18px;
}

.metric .caption {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .metric-row {
    grid-template-columns: 1fr;
  }
}

/* ─── Records (lists of rows) ─────────────────────────────────── */
.records {
  display: grid;
  gap: 6px;
}

.record {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  align-items: start;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--panel);
  transition: border-color 120ms ease, background 120ms ease;
}

.record.clickable {
  cursor: pointer;
}

.record.clickable:hover {
  border-color: var(--faint);
  background: var(--panel-hover);
}

.record .ts {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.record .ts em {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.record .body strong {
  display: block;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.record .body p {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 12.5px;
  word-break: break-word;
}

.record .body .kbd {
  font-family: var(--font-mono);
  font-size: 12px;
}

.record .tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.record .right {
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Task list rows (Tasks page) ─────────────────────────────── */
.intent-list {
  display: grid;
}

.intent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 22px;
  border-top: 1px solid var(--border-soft);
  color: var(--fg);
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.intent-row:hover {
  background: var(--panel-hover);
}

.intent-row .left {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.intent-row .ts {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intent-row .text {
  margin: 0;
  font-size: 15px;
  color: var(--fg);
  line-height: 1.4;
}

.intent-row .right {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: 0 0 auto;
  font-size: 12px;
}

.intent-row .agent {
  color: var(--dim);
  letter-spacing: 0.02em;
}

.intent-row .agent strong {
  color: var(--fg);
  font-weight: 500;
}

.intent-row .agent em {
  color: var(--muted);
  font-style: normal;
}

.intent-row .hash {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.tone-ok .body strong {
  color: var(--tone-ok);
}

.tone-warn .body strong {
  color: var(--tone-warn);
}

.tone-danger {
  border-color: var(--faint);
}

.tone-danger .body strong {
  color: var(--tone-danger);
}

/* ─── Empty states ────────────────────────────────────────────── */
.empty {
  padding: 18px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}

/* ─── Buttons + forms ─────────────────────────────────────────── */
.btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: border-color 120ms ease, background 120ms ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--faint);
  background: var(--panel-hover);
}

.btn.primary {
  background: #f5f5f5;
  border-color: #f5f5f5;
  color: #030303;
}

.btn.primary:hover:not(:disabled) {
  background: #fafafa;
  border-color: #fafafa;
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--dim);
}

.btn.ghost:hover:not(:disabled) {
  color: var(--fg);
  border-color: var(--faint);
}

.btn.link {
  background: transparent;
  border: 0;
  padding: 4px 0;
  color: var(--dim);
  letter-spacing: 0.14em;
}

.btn.link:hover:not(:disabled) {
  color: var(--fg);
  background: transparent;
}

.btn.chip {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--dim);
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: none;
}

.btn.chip:hover:not(:disabled) {
  color: var(--fg);
  border-color: var(--faint);
  border-style: solid;
}

.sample-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.sample-chips .eyebrow {
  margin-right: 2px;
}

.field {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  padding: 10px 12px;
  outline: none;
  transition: border-color 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--faint);
}

textarea {
  font-family: var(--font-mono);
  resize: vertical;
}

select {
  height: 38px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 10px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

/* ─── Tone helpers (text only) ────────────────────────────────── */
.text-dim {
  color: var(--dim);
}

.text-muted {
  color: var(--muted);
}

.text-mono {
  font-family: var(--font-mono);
}

.eyebrow {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.result {
  overflow: auto;
  max-height: 360px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.result.compact {
  max-height: 240px;
  font-size: 12px;
}

.result.error {
  border-color: var(--faint);
  color: #fafafa;
}

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fade-up 220ms ease both;
}

/* ─── Page layouts ────────────────────────────────────────────── */
.stack {
  display: grid;
  gap: 22px;
}

.stack.tight {
  gap: 14px;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .split-2 {
    grid-template-columns: 1fr;
  }
}

.surface {
  min-width: 0;
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 36px 96px;
}

@media (max-width: 900px) {
  .surface {
    padding: 24px 22px 64px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head .right {
    flex-wrap: wrap;
  }
}

/* ─── Demo-mode banner ──────────────────────────────────────── */

.demo-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 22px;
  background: #131313;
  border-bottom: 1px solid var(--border);
  color: var(--dim);
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.demo-banner strong {
  color: var(--fg);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.demo-banner-link {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: border-color 120ms ease;
}

.demo-banner-link:hover {
  border-bottom-color: var(--fg);
}

@media (max-width: 700px) {
  .demo-banner {
    flex-direction: column;
    gap: 4px;
    text-align: center;
    padding: 10px 16px;
  }
}
