:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --line: #e2e2dc;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --error: #b42318;
  --ok: #157f3b;
  --warn: #a15c00;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
/* Element styles apply only to this app's own areas, never inside the embedded editor. */
:where(.page, .topbar, .review-bar) a { color: var(--accent); }
.page h1 { font-size: 1.5rem; margin: 0 0 1rem; }
.muted { color: var(--muted); }
.error { color: var(--error); }

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.6rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex: 1; }
.topbar nav a:not(.button) { color: var(--text); text-decoration: none; }
.signout { display: flex; align-items: center; gap: 0.75rem; margin: 0; }

.page { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }
.page.narrow { max-width: 380px; margin-top: 12vh; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.empty { padding: 2rem; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; }

:where(.page, .review-bar) label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 500; }
:where(.page, .review-bar) :is(input, select, textarea) {
  font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
}
:where(.page, .topbar, .review-bar) button, .button {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block;
  padding: 0.55rem 1rem; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-text);
}
.button.small { padding: 0.35rem 0.75rem; }
:where(.page, .topbar, .review-bar) button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; }
:where(.page, .topbar, .review-bar) button:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: 0.75rem; }
}

.page h2 { font-size: 1.15rem; margin: 0; }
.hint { color: var(--muted); font-size: 0.9rem; font-weight: 400; margin: 0; }
.crumbs { margin: 0 0 0.25rem; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; }
.form { max-width: 560px; }
.short input { max-width: 12rem; }
.page fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.page legend { font-weight: 600; padding: 0 0.25rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
label.check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; }
.page progress { width: 100%; height: 0.75rem; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); }
table.list th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
table.list tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
.status { font-size: 0.85rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--line); white-space: nowrap; }
.status-ready { background: #dcf3e3; color: var(--ok); }
.status-failed { background: #fde4e1; color: var(--error); }
.status-queued, .status-running { background: #fff0d6; color: var(--warn); }

.spinner { display: inline-block; width: 0.9em; height: 0.9em; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -0.1em; }
@keyframes spin { to { transform: rotate(360deg); } }

details.danger { margin-top: 3rem; color: var(--muted); }
details.danger summary { cursor: pointer; }
details.danger form { margin-top: 0.75rem; padding: 1rem; border: 1px solid #f3c1bb; border-radius: 8px; background: var(--panel); color: var(--text); }
button.destructive { background: var(--error); }

@media (max-width: 600px) {
  table.list th:nth-child(4), table.list td:nth-child(4), table.list th:nth-child(5), table.list td:nth-child(5) { display: none; }
}

/* Review: the editor fills the window below the bars. */
body.full { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
main.review { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.review-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.4rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 0.9rem; }
.review-bar .spacer { flex: 1; }
.review-bar .download { white-space: nowrap; }
aethalides-editor.editor { flex: 1; min-height: 0; }
details.danger.inline { margin: 0; position: relative; }
details.danger.inline form { position: absolute; right: 0; top: 1.75rem; width: 18rem; z-index: 10; box-shadow: 0 6px 24px rgb(0 0 0 / 0.12); }

/* Recorder */
.recorder .meter { display: flex; align-items: center; gap: 1rem; }
.recorder .clock { font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 600; }
.recorder meter { flex: 1; height: 0.75rem; }
.recorder .dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--line); }
.recorder.live .dot { background: var(--error); animation: pulse 1.2s ease-in-out infinite; }
.recorder.live.paused .dot { animation: none; background: var(--warn); }
.recorder .buttons { display: flex; gap: 0.75rem; }
@keyframes pulse { 50% { opacity: 0.3; } }
:where(.page) button.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.warn-panel { border-color: #f1d39c; background: #fff8eb; margin-bottom: 1rem; }
