/* Comic Foundry — web v1. Dark, plain type, teal accent. No frameworks, no webfonts, no images. */

:root {
  --bg: #0b0f14;
  --bg-raised: #111821;
  --panel: #141c26;
  --panel-2: #1a2430;
  --line: #24313f;
  --line-soft: #1c2733;
  --ink: #dce6ee;
  --ink-dim: #a7b9c8;
  --muted: #7e93a5;
  --accent: #2dd4bf;
  --accent-deep: #0f766e;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --ok: #34d399;
  --warn: #f5c451;
  --bad: #f0716a;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-weight: 600; margin: 0 0 6px; line-height: 1.25; }
h1 { font-size: 19px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px; flex: none;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-deep) 70%);
}
.brand-text h1 { margin: 0; letter-spacing: 0.2px; }
.brand-sub { margin: 0; color: var(--muted); font-size: 12.5px; }
.topbar-meta { display: flex; align-items: center; gap: 8px; }
.tag {
  font-size: 12px; color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 999px; padding: 2px 10px;
}

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: calc(100vh - 55px); }
.sidenav {
  position: sticky; top: 0; align-self: start;
  padding: 18px 12px 28px;
  border-right: 1px solid var(--line);
  background: var(--bg-raised);
  min-height: calc(100vh - 55px);
}
.nav-label {
  margin: 14px 10px 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted);
}
.nav-item {
  display: block; padding: 7px 10px; border-radius: 6px;
  color: var(--ink-dim); font-size: 14px;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft); color: var(--ink);
  border-left-color: var(--accent);
}
.nav-note { margin: 16px 10px 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.content { padding: 22px 26px 60px; max-width: 1120px; }
.screen-head { margin-bottom: 18px; }
.screen-sub { color: var(--muted); margin: 0; font-size: 13.5px; }

/* ---------------------------------------------------------------- cards + grid */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card.tight { padding: 12px 14px; }
.card h3 { margin-bottom: 8px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.dim { color: var(--ink-dim); }
.small { font-size: 12.5px; }
.note {
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  padding: 9px 12px; border-radius: 0 6px 6px 0;
  font-size: 13px; color: var(--ink-dim);
  margin: 10px 0;
}
.note.warn { border-left-color: var(--warn); background: rgba(245, 196, 81, 0.09); }
.note.bad { border-left-color: var(--bad); background: rgba(240, 113, 106, 0.09); }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1 1 auto; }

/* ---------------------------------------------------------------- controls */
button, .button {
  font-family: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
button:hover:not(:disabled), .button:hover { border-color: var(--accent); color: #fff; }
button.primary {
  background: var(--accent-soft);
  border-color: rgba(45, 212, 191, 0.45);
  color: var(--accent);
}
button.primary:hover:not(:disabled) { background: rgba(45, 212, 191, 0.2); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.small { padding: 3px 9px; font-size: 12.5px; }
input[type="number"], input[type="file"], select {
  font-family: inherit; font-size: 13.5px;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px;
}
input[type="number"] { width: 70px; }
label.field { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- drop zone */
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 30px 20px; text-align: center;
  background: var(--panel);
  transition: border-color 120ms ease, background 120ms ease;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone h3 { margin-bottom: 4px; }
.dropzone p { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.dropzone .hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------------------------------------------------------------- tables */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line); padding: 6px 8px;
  position: sticky; top: 0; background: var(--panel);
}
table.data td {
  border-bottom: 1px solid var(--line-soft);
  padding: 6px 8px; vertical-align: top;
}
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-y { max-height: 420px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 6px; }

/* ---------------------------------------------------------------- chips + badges */
.chip {
  display: inline-block; font-size: 11.5px; line-height: 1.6;
  padding: 0 7px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink-dim);
  border: 1px solid var(--line);
  margin: 0 4px 4px 0;
  max-width: 100%; overflow-wrap: anywhere;
}
.chip.accent { color: var(--accent); border-color: rgba(45, 212, 191, 0.4); background: var(--accent-soft); }
.chip.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); }
.chip.warn { color: var(--warn); border-color: rgba(245, 196, 81, 0.4); background: rgba(245, 196, 81, 0.08); }
.chip.bad { color: var(--bad); border-color: rgba(240, 113, 106, 0.4); background: rgba(240, 113, 106, 0.08); }
.chip.running { color: #7cc4ff; border-color: rgba(124, 196, 255, 0.4); background: rgba(124, 196, 255, 0.08); }
.badge-line { margin: 2px 0 0; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.status-dot.ok { background: var(--ok); }
.status-dot.bad { background: var(--bad); }
.status-dot.warn { background: var(--warn); }
.status-dot.running { background: #7cc4ff; }

/* ---------------------------------------------------------------- progress */
.progress { width: 110px; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------------------------------------------------------------- compose */
.page-preview {
  position: relative;
  width: 100%; max-width: 460px;
  aspect-ratio: 2 / 3;
  background: #0e141b;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 6px 0 4px;
}
.page-slot {
  position: absolute;
  border: 1.5px dashed #38505f;
  border-radius: 4px;
  background: repeating-linear-gradient(45deg, rgba(45, 212, 191, 0.04) 0 8px, transparent 8px 16px);
  padding: 6px 7px;
  overflow: hidden;
  font-size: 11.5px; color: var(--ink-dim);
}
.page-slot .slot-id { color: var(--accent); font-family: var(--mono); font-size: 11px; display: block; margin-bottom: 3px; }
.page-slot .slot-beat { color: var(--ink); font-size: 12px; display: block; margin-bottom: 2px; }
.page-slot .slot-desc { color: var(--muted); font-size: 11px; display: block; }
.page-slot .slot-noart { color: var(--warn); font-size: 10.5px; display: block; margin-top: 4px; }

/* ---------------------------------------------------------------- queue rows */
.error-text { color: var(--bad); font-size: 12px; overflow-wrap: anywhere; }
.job-label { font-weight: 600; font-size: 13.5px; }
.kind-chip { font-family: var(--mono); font-size: 11px; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 9px 14px; font-size: 13px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  max-width: 620px; z-index: 40;
}
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }

/* ---------------------------------------------------------------- misc */
.kv { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 3px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
ul.plain { margin: 4px 0 10px; padding-left: 18px; }
ul.plain li { margin-bottom: 3px; }
.placeholder-box {
  border: 1.5px dashed var(--line);
  border-radius: 6px; padding: 16px;
  color: var(--muted); font-size: 13px; text-align: center;
}
.disabled-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--line-soft);
}
.disabled-row:last-child { border-bottom: none; }
.disabled-row .name { min-width: 220px; font-weight: 600; }
.disabled-row .reason { color: var(--muted); font-size: 13px; }
.engine-table .name { min-width: 230px; }
hr.soft { border: none; border-top: 1px solid var(--line-soft); margin: 14px 0; }
