/* OpenArtifacts dashboard. Vanilla CSS, no framework, no build step.
   Design system: the landing page's plain-document aesthetic, set with intent —
   serif text, Courier data, hairline rules, square corners, default-blue links.
   Semantic status colors are kept: legibility of state is UX, not decoration. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #ffffff;
  --fg: #000000;
  --muted: #555550;
  --line: #c9c9c4;
  --rule: #000000;
  --link: #0000ee;
  --visited: #551a8b;
  --accent: #000000;
  --accent-fg: #ffffff;
  --code-bg: #f4f4f0;
  --btn-bg: #efefef;
  --btn-line: #767676;
  --ok: #1d6e46;
  --warn: #8a5a00;
  --bad: #9d1c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121210;
    --panel: #121210;
    --fg: #e9e7e2;
    --muted: #9d9a92;
    --line: #3a3a36;
    --rule: #e9e7e2;
    --link: #8cb4ff;
    --visited: #c7a4e8;
    --accent: #e9e7e2;
    --accent-fg: #121210;
    --code-bg: #1c1c19;
    --btn-bg: #22221f;
    --btn-line: #6b6b66;
    --ok: #6fc793;
    --warn: #d9a84e;
    --bad: #e07a7a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 Georgia, "Times New Roman", Times, serif;
}

a { color: var(--link); text-decoration: underline; }
a:visited { color: var(--visited); }
a:hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

code, pre, .mono {
  font-family: "Courier New", Courier, monospace;
}
code {
  background: var(--code-bg);
  padding: 0.05em 0.3em;
  font-size: 0.92em;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

/* --- chrome ------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  text-decoration: none;
}
.brand:visited { color: var(--fg); }
.brand::before { content: none; }
.topbar nav { display: flex; gap: 1.1rem; flex: 1; flex-wrap: wrap; }
.topbar nav a {
  font-size: 0.95rem;
}
.topbar nav a.active {
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
}
.topbar nav a.active:visited { color: var(--fg); }

main { max-width: 60rem; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
main.narrow { max-width: 40rem; }

h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 0.35rem; }
h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}
.muted { color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }

/* --- surfaces ----------------------------------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
}
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.stats { display: flex; gap: 0; flex-wrap: wrap; margin: 1rem 0 0; border: 1px solid var(--line); }
.stat {
  flex: 1 1 8rem;
  padding: 0.6rem 0.9rem;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-family: "Courier New", Courier, monospace;
}
.stat .v { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* An overdrawn balance is the one number that has to read as a problem. */
.stat .v.neg { color: var(--bad); }
/* Sub-lines under a stat: the rate behind the number, in the data face. */
.stat .s {
  margin-top: 0.15rem;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}
@media (max-width: 640px) {
  .stat { flex-basis: 45%; border-bottom: 1px solid var(--line); }
}

/* --- controls ----------------------------------------------------------- */

button, .btn {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--fg);
  border-radius: 3px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}
button:hover, .btn:hover { border-color: var(--fg); }
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
button.primary:hover { opacity: 0.85; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button[disabled] { opacity: 0.45; cursor: default; }
button.small, select.small, input.small { font-size: 13px; padding: 0.2rem 0.5rem; }

input, select, textarea {
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--btn-line);
  border-radius: 0;
  padding: 0.4rem 0.6rem;
  width: 100%;
}
select { font-family: Arial, Helvetica, sans-serif; }
label { display: block; font-size: 0.95rem; font-weight: 700; }
label input, label select, label textarea { margin-top: 0.3rem; font-weight: 400; }

/* --- table -------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg);
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
}
tr:last-child td { border-bottom: none; }
.table-wrap {
  border: 1px solid var(--line);
  overflow-x: auto;
}
/* A price is one token: let the wrapper scroll rather than break "$0.05 / GB-month". */
.nowrap { white-space: nowrap; }

/* --- badges ------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.05rem 0.35rem;
  border: 1px solid currentColor;
}
.badge.pass { color: var(--ok); }
.badge.pending { color: var(--muted); }
.badge.review { color: var(--warn); }
.badge.blocked { color: var(--bad); }

/* --- messaging ---------------------------------------------------------- */

.out {
  margin-top: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.note {
  border-left: 3px solid var(--rule);
  padding: 0.3rem 0 0.3rem 0.9rem;
  color: var(--muted);
}
.error { color: var(--bad); }
.ok { color: var(--ok); }
.empty { color: var(--muted); padding: 1.5rem 0.7rem; text-align: center; font-style: italic; }
.log { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.log-step {
  border: 1px solid var(--line);
  border-left: 3px solid var(--rule);
  background: var(--panel);
  padding: 0.55rem 0.8rem;
  font-size: 0.92rem;
}
.log-step .label { font-weight: 700; }
.log-step pre { margin: 0.5rem 0 0; }
