/* porch dashboard. Brand colours arrive as --primary / --accent from
   /brand.css; everything else derives from them or from these tokens. */
:root {
  --primary: #1f6f5c;
  --accent: #e8a33d;
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1d1f1e;
  --muted: #6a6f6c;
  --line: #e3e1da;
  --bad: #b3261e;
  --ok: #2e7d4f;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141615;
    --card: #1d201f;
    --ink: #e9ebe8;
    --muted: #9aa19d;
    --line: #2d3230;
    --bad: #f2867d;
    --ok: #6fcf97;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
h1, h2 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
small { font-weight: 400; color: var(--muted); font-size: .85em; }
code { font: .9em ui-monospace, "SF Mono", Menlo, monospace; background: color-mix(in srgb, var(--primary) 10%, transparent); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
a { color: var(--primary); }
@media (prefers-color-scheme: dark) { a { color: color-mix(in srgb, var(--primary) 55%, white); } }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  border-bottom: 4px solid var(--accent);
}
.top a, .top .link { color: #fff; text-decoration: none; }
.mark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.mark img { height: 28px; width: auto; }
.top nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.top nav a:hover, .top .link:hover { text-decoration: underline; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 16px 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
}
.card.narrow { max-width: 440px; margin-inline: auto; }
.card.empty { text-align: center; padding: 40px 20px; }
.card.danger { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head h1, .head h2 { margin: 0; }
.muted { color: var(--muted); }
.head .muted { margin: 4px 0 0; }

.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > label, .row > input { flex: 1 1 200px; }
.row > form.row { flex: 1 1 360px; flex-wrap: nowrap; }
.row.split { justify-content: space-between; align-items: center; }
form.row + table { margin-top: 16px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
input {
  font: inherit; color: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  min-width: 0;
}
input[type=color] { padding: 2px; height: 42px; }
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
details { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; }
details[open] summary { margin-bottom: 12px; }
summary { cursor: pointer; font-weight: 600; }

button, .button {
  font: inherit; font-weight: 600;
  display: inline-block;
  padding: 9px 16px;
  border: 0; border-radius: 8px;
  background: var(--primary); color: #fff;
  cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { filter: brightness(1.08); }
button.bad { background: #b3261e; } /* fixed red: --bad is too light behind white text in dark mode */
button.link { background: none; padding: 0; color: var(--primary); font-weight: 500; text-decoration: underline; }
form { margin: 0; }

.notice, .error { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.notice { background: color-mix(in srgb, var(--ok) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.error { background: color-mix(in srgb, var(--bad) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list:not(.plain) > li > a {
  display: grid; gap: 2px;
  padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.list:not(.plain) > li > a:hover { border-color: var(--primary); }
.list .muted { overflow-wrap: anywhere; font-size: .9rem; }
.list.plain { margin-bottom: 14px; }
.list.plain li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
td { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  td { border: 0; padding: 2px 0; }
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  font-weight: 600; font-size: .9rem;
}
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: middle; }
.dot.finished { background: var(--ok); }
.dot.failed, .dot.cancelled-by-user { background: var(--bad); }
.dot.in_progress, .dot.queued { background: var(--accent); }

.log {
  background: #111413; color: #d8dcd9;
  padding: 16px; border-radius: var(--radius);
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 70vh;
}
.log .stderr { color: #ff9b91; }

.creds { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 16px 0 20px; }
.creds dt { color: var(--muted); }
.creds dd { margin: 0; overflow-wrap: anywhere; }

