:root {
  --paper: #f7f8fa;
  --surface: #ffffff;
  --ink: #131820;
  --ink-soft: #3a434f;
  --muted: #5a6472;
  --rule: #e1e5ea;
  --accent: #16697a;
  --ship: #2e7d4f;
  --hold: #a96a00;
  --stop: #a33227;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 -apple-system, "Segoe UI", system-ui, sans-serif;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.brand { font-weight: 700; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.bar-right { display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: 14px; }

/* Wider than a reading column: the Diagrams and Stock pages embed full
   applications, and 880px makes Remotion Studio unusable. */
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 20px 80px; display: flex; flex-direction: column; gap: 22px; }

h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 15px; margin: 0 0 4px; letter-spacing: -.01em; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.head-meta { display: flex; align-items: center; gap: 14px; }
.cost { font-family: var(--mono); font-size: 14px; color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hint, .empty, .muted { color: var(--muted); font-size: 14px; margin: 0; }
.scene-text { margin: 0; color: var(--ink-soft); }

.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.actions { display: flex; flex-direction: column; gap: 10px; }

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
}
textarea { width: 100%; font-family: var(--mono); font-size: 14px; resize: vertical; }
input.wide { flex: 1 1 320px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }

button, .button {
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.08); }
button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--stop); border-color: var(--rule); padding: 4px 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.link { color: var(--accent); text-decoration: none; font-size: 14px; }
.link:hover { text-decoration: underline; }

.grid { width: 100%; border-collapse: collapse; font-size: 15px; }
.grid th, .grid td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--rule); }
.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.err { color: var(--stop); font-size: 13px; }

.assets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.assets li { border: 1px solid var(--rule); border-radius: 3px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.asset-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asset-foot { display: flex; align-items: center; gap: 12px; }
.fname { font-family: var(--mono); font-size: 13px; }
video { width: 100%; max-width: 480px; border-radius: 3px; background: #000; }
audio { width: 100%; max-width: 480px; }

.tag, .pill {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.tag.clip { color: var(--accent); border-color: var(--accent); }
.tag.narration { color: var(--ship); border-color: var(--ship); }
.pill.done { color: var(--ship); border-color: var(--ship); }
.pill.failed { color: var(--stop); border-color: var(--stop); }
.pill.running, .pill.queued { color: var(--hold); border-color: var(--hold); }
.pill.warn { color: var(--stop); border-color: var(--stop); }

.notice { background: #fff8e6; border: 1px solid var(--hold); color: #6b4300; padding: 10px 14px; border-radius: 3px; margin: 0; font-size: 14px; }
.error { color: var(--stop); margin: 0; font-size: 14px; }

.nav { display: flex; gap: 4px; flex: 1; margin-left: 12px; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 3px;
}
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a.on { background: var(--paper); color: var(--accent); }

.machine-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.mono { font-family: var(--mono); font-size: 13px; }
code { font-family: var(--mono); font-size: 13px; background: var(--paper); padding: 1px 5px; border-radius: 2px; }

.steps { margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: 15px; display: flex; flex-direction: column; gap: 7px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; margin: 0 0 8px; }
h3.good { color: var(--ship); }
h3.bad { color: var(--stop); }
@media (max-width: 620px) { .two-col { grid-template-columns: 1fr; } }

button:disabled { opacity: .4; cursor: not-allowed; }

.balances { display: flex; gap: 6px; }
.bal {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 2px;
  border: 1px solid var(--rule);
  color: var(--muted);
  white-space: nowrap;
}
.bal.low { color: var(--stop); border-color: var(--stop); }
.bal.off { opacity: .55; }

.cap {
  border-left: 3px solid var(--rule);
  padding: 10px 0 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}
.cap strong { font-size: 15px; }
.cap span { color: var(--muted); }
.cap code { align-self: flex-start; }
.cap.full { border-left-color: var(--ship); }
.cap.good { border-left-color: var(--accent); }
.cap.limited { border-left-color: var(--hold); }
.cap.minimum { border-left-color: var(--stop); }
.small { font-size: 13.5px; color: var(--muted); }
.small.limited, .small.minimum { color: var(--hold); }

.fields { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 600; }
.field-help { font-size: 13px; color: var(--muted); }
.field input { width: 100%; }
.notice.ok { background: #eaf7ef; border-color: var(--ship); color: #1c5c39; }

.login { max-width: 320px; margin: 60px auto; display: flex; flex-direction: column; gap: 16px; }
.login input { width: 100%; }
.login button { width: 100%; }

/* Embedded tool UIs. Both are full applications, so they need real height —
   a short iframe makes them unusable. */
.embed {
  width: 100%;
  height: 620px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
}
.embed.tall { height: 780px; }

/* Settings: one form per field, each with its own password confirmation. */
.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}
.field-row:last-child { border-bottom: none; padding-bottom: 0; }
.field-save { display: flex; gap: 8px; align-items: center; }
.field-save input { width: 150px; }
@media (max-width: 700px) {
  .field-row { grid-template-columns: 1fr; align-items: stretch; }
  .field-save input { flex: 1; width: auto; }
}
