/* snurr — plain CSS, design tokens + components (Fizzy-style, no framework). */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1a1d21;
  --ink-soft: #5b636e;
  --ink-faint: #8b929c;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;

  --ok: #1a7f4b;
  --ok-bg: #e6f4ec;
  --err: #c02b3a;
  --err-bg: #fbeaec;
  --info: #1f6fb2;
  --info-bg: #e7f1f9;
  --muted: #6b7280;
  --muted-bg: #eef0f3;

  --radius: 8px;
  --radius-sm: 5px;
  --pad: 16px;
  --gap: 12px;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

code, .mono { font-family: var(--mono); font-size: 0.86em; }

/* Nav */
.nav {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.nav__brand { font-weight: 700; color: var(--ink); font-family: var(--mono); letter-spacing: -0.02em; }
.nav__brand:hover { text-decoration: none; }
.nav__links { display: flex; gap: 18px; }
.nav__links a { color: var(--ink-soft); font-weight: 500; }
.nav__links a:hover { color: var(--ink); text-decoration: none; }
.nav__user { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Layout */
.container { max-width: 1000px; margin: 0 auto; padding: 28px 24px 64px; }
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.page-header h1 { margin-right: auto; }
.breadcrumbs { font-size: 0.85rem; color: var(--ink-faint); margin-bottom: 6px; }
.breadcrumbs a { color: var(--ink-soft); }

/* Panels / cards */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel + .panel { margin-top: 20px; }
.panel__head { padding: 14px var(--pad); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.panel__head h2 { margin-right: auto; }
.panel__body { padding: var(--pad); }
.panel--pad { padding: var(--pad); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); color: inherit; }
.card:hover { border-color: var(--line-strong); text-decoration: none; }
.card__title { font-weight: 600; }
.card__meta { color: var(--ink-faint); font-size: 0.85rem; margin-top: 4px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px var(--pad); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table td.num { font-family: var(--mono); color: var(--ink-soft); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent; font: inherit; font-weight: 550; cursor: pointer;
  line-height: 1; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(0.95); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: #fafbfc; filter: none; }
.btn--danger { background: var(--err); }
.btn--sm { padding: 5px 10px; font-size: 0.85rem; }
.btn--link { background: none; color: var(--accent); padding: 0; border: none; }
.btn--link:hover { text-decoration: underline; filter: none; }
.actions { display: flex; gap: 8px; align-items: center; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge--ok { color: var(--ok); background: var(--ok-bg); }
.badge--err { color: var(--err); background: var(--err-bg); }
.badge--info { color: var(--info); background: var(--info-bg); }
.badge--muted { color: var(--muted); background: var(--muted-bg); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 620px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .hint { color: var(--ink-faint); font-size: 0.82rem; }
.field input[type=text], .field input[type=email], .field input[type=number],
.field textarea, .field select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); width: 100%;
}
.field textarea { font-family: var(--mono); font-size: 0.88rem; min-height: 60px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; border-color: var(--accent);
}
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.errors { background: var(--err-bg); color: var(--err); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.9rem; }
.errors ul { margin: 0; padding-left: 18px; }

/* Auth screen */
.auth { max-width: 400px; margin: 12vh auto 0; }
.auth h1 { margin-bottom: 6px; }
.auth .btn { width: 100%; justify-content: center; margin-top: 4px; }
.auth .stack { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

/* Logs */
.logs {
  background: #0d1117; color: #c9d1d9; font-family: var(--mono); font-size: 0.82rem;
  line-height: 1.55; padding: 14px 16px; border-radius: var(--radius);
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
  max-height: 60vh; overflow-y: auto;
}
.logs:empty::after { content: "Waiting for output…"; color: #6e7681; }
.log-line--stderr { color: #ff7b72; }
.log-line--stdout { color: #c9d1d9; }

/* Definition list for run/job metadata */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; }
.kv dt { color: var(--ink-faint); font-size: 0.85rem; }
.kv dd { font-variant-numeric: tabular-nums; }

/* Flash */
.flashes { max-width: 1000px; margin: 16px auto -4px; padding: 0 24px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; border: 1px solid transparent; }
.flash--notice { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 20%, transparent); word-break: break-all; }
.flash--alert { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 20%, transparent); }

/* Utilities */
.muted { color: var(--ink-faint); }
.soft { color: var(--ink-soft); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.right { margin-left: auto; }
.empty { text-align: center; color: var(--ink-faint); padding: 32px; }
.mt { margin-top: 20px; }

fieldset.ds-fields { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 14px; margin: 0; }
fieldset.ds-fields[hidden] { display: none; }
