/* backupOK — nerdy, robotic, calm. */
:root {
  --bg: #f4f5f2;
  --bg-2: #ffffff;
  --bg-3: #eceee9;
  --grid: rgba(30, 40, 35, 0.06);
  --fg: #1d2420;
  --fg-2: #56605b;
  --fg-3: #8a938e;
  --line: #d6dad4;
  --accent: #14706a;      /* links, brackets, focus rings */
  --accent-2: #1a8a82;
  --accent-fill: #14706a; /* filled buttons: dark enough for white text */
  --accent-fill-2: #0f5c57;
  --accent-bg: #e6f4f1;
  --ok: #15803d;   --ok-bg: #e7f6ec;
  --bad: #b91c1c;  --bad-bg: #fbe9e9;
  --warn: #b45309; --warn-bg: #fdf0dc;
  --run: #1d4ed8;  --run-bg: #e6ecfb;
  --mute-bg: #eef0ec;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 3px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412; --bg-2: #161c19; --bg-3: #1c2420;
    --grid: rgba(180, 200, 190, 0.05);
    --fg: #e3e8e4; --fg-2: #a7b0aa; --fg-3: #6f7873;
    --line: #2a332e;
    --accent: #3cbfae; --accent-2: #5ed3c3; --accent-fill: #177f74; --accent-fill-2: #1a9488; --accent-bg: #10302c;
    --ok: #4ade80; --ok-bg: #12301d;
    --bad: #f87171; --bad-bg: #3a1717;
    --warn: #fbbf24; --warn-bg: #3a2a0f;
    --run: #93c5fd; --run-bg: #16244a;
    --mute-bg: #1a211d;
  }
}
* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0; font-family: var(--mono); color: var(--fg); background: var(--bg);
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 22px 22px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.05rem; } h3 { font-size: .95rem; }
h1 small, h2 small { color: var(--fg-3); font-weight: 400; }
p { margin: 0 0 .75rem; }
code, pre, kbd { font-family: var(--mono); }
pre {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem; overflow: auto; font-size: .85rem; line-height: 1.45; margin: 0;
  max-height: 60vh; white-space: pre-wrap; word-break: break-word;
}
code { background: var(--mute-bg); padding: 0 .3em; border-radius: 2px; font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* layout */
.topbar {
  background: var(--bg-2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 1.5rem; padding: 0 1.25rem; height: 48px;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--fg); letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand .bracket { color: var(--accent); }
.tagline { color: var(--fg-3); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tagline-status { color: var(--fg-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .5em; vertical-align: 1px; }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); }
.status-dismissed { color: var(--fg-3); }
.sq-dismissed { background: var(--mute-bg); border-color: var(--fg-3); }
.dismissed-note { display: block; color: var(--fg-3); font-size: .75rem; letter-spacing: 0; font-weight: 400; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--fg-3); font-size: .85rem; }
.topbar form { margin: 0; }
main { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
/* breadcrumbs: "dashboard / project / job" as the heading, ancestors muted */
h1.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5em; margin-bottom: .25rem; }
h1.crumbs a { color: var(--fg-3); font-weight: 400; }
h1.crumbs a:hover { color: var(--fg); text-decoration: none; }
h1.crumbs .sep { color: var(--line); font-weight: 300; }
h1.crumbs .here { color: var(--fg); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: .45rem .75rem; color: var(--fg-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--fg); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--fg); }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* panels & tables */
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.panel + .panel { margin-top: 1rem; }
.grid > .panel { margin-top: 0; } /* side-by-side panels line up */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--fg-3); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--bg-3); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
.muted { color: var(--fg-3); }
.dim { color: var(--fg-2); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.empty { color: var(--fg-3); padding: 1.25rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

/* status: [OK] / [FAIL] — bracketed like a terminal, colour only */
.status { display: inline-block; font-weight: 700; letter-spacing: .04em; font-size: .85rem; white-space: nowrap; }
.status-passed { color: var(--ok); }
.status-failed, .status-error, .status-timeout { color: var(--bad); }
.status-running, .status-pending { color: var(--fg-2); }
.status-never, .status-skipped, .status-disabled, .status-cancelled { color: var(--fg-3); }
h1 .status, h2 .status { font-size: .9em; margin-left: .3em; }
.kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); }

/* job cards (dashboard + project grid) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; min-width: 0; }
.card-bad { border-left: 3px solid var(--bad); }
.card-link { cursor: pointer; }
.card-link:hover { border-color: var(--fg-3); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.card-title { font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.group + .group { margin-top: 1.5rem; }
.group-head { display: flex; align-items: baseline; gap: .5em; margin: 0 0 .6rem; font-size: 1rem; }
.group-head a { color: var(--fg); }
.group-head a::after { content: " ›"; color: var(--fg-3); font-weight: 400; }
/* paused note: a project whose plan does not run checks says so next to
   its name, quietly but everywhere */
.paused-note { display: inline-flex; align-items: baseline; gap: 0 .4em; font-size: .82rem; font-weight: 400; color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn); border-radius: var(--radius); padding: .2rem .6rem; }
.paused-note a { color: inherit; text-decoration: underline; }
.paused-note .muted { color: inherit; opacity: .8; }
.paused-mark { font-size: .75em; }
.plan-note { margin: .6rem 0 .25rem; }
/* on the overview a paused project shows only the icon; the text is its tooltip */
.paused-icon { font-size: .75em; color: var(--warn); text-decoration: none; margin-left: .15em; }
.paused-icon:hover { text-decoration: none; }
.paused-icon .tip-body { font-weight: 400; font-size: .85rem; white-space: normal; width: max-content; max-width: 22rem; }
.keybox { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .4rem; }
.keybox code { font-size: .9rem; word-break: break-all; }
.choices { display: flex; flex-direction: column; gap: .35rem; }
.prose.small { font-size: .9rem; }
.prose.small pre { font-size: .82rem; white-space: pre-wrap; word-break: break-all; }
.group-head a:hover { text-decoration: none; color: var(--accent); }
.card-sub { color: var(--fg-3); font-size: .82rem; margin-top: .1rem; }
.lines { list-style: none; margin: .6rem 0 0; padding: 0; }
.line { display: flex; gap: .5em; align-items: baseline; font-size: .88rem; line-height: 1.6; white-space: nowrap; min-width: 0; }
.line > span { min-width: 0; }
.line .mark { flex: 0 0 1.1em; text-align: center; }
.line .lname { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.line .lbody { flex: 1 1 0; min-width: 0; }
.line .lbody .lname { display: block; }
.line .lout { display: block; color: var(--fg-3); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.line-failed .lname, .line-error .lname, .line-timeout .lname { color: var(--bad); }
.line-passed .mark { color: var(--ok); }
.line-failed .mark, .line-error .mark, .line-timeout .mark { color: var(--bad); }
.line-skipped .mark, .line-running .mark, .line-pending .mark { color: var(--fg-3); }
.line-sum { margin-top: .35rem; color: var(--fg-2); white-space: normal; }
.line-sum.line-passed { color: var(--ok); }
.line-sum.line-failed, .line-sum.line-error, .line-sum.line-timeout { color: var(--bad); }
.card:not(.card-bad) .line-sum.line-failed, .card:not(.card-bad) .line-sum.line-error, .latest:not(.card-bad) .line-sum.line-failed, .latest:not(.card-bad) .line-sum.line-error { color: var(--fg-3); }
.mark-passed { color: var(--ok); } .mark-failed, .mark-error, .mark-timeout { color: var(--bad); } .mark-skipped { color: var(--fg-3); }
.history { display: flex; gap: 3px; margin-top: .7rem; flex-wrap: wrap; }
.sq { display: block; width: 13px; height: 13px; border-radius: 2px; background: var(--mute-bg); border: 1px solid var(--line); }
.sq:hover { outline: 2px solid var(--fg-3); outline-offset: 1px; }
.sq-passed { background: var(--ok); border-color: var(--ok); }
.sq-failed, .sq-error, .sq-timeout { background: var(--bad); border-color: var(--bad); }
.sq-running, .sq-pending { background: var(--fg-3); border-color: var(--fg-3); }
.sq-cancelled { background: var(--mute-bg); border-color: var(--fg-3); }
table.jobs .history { margin-top: 0; }
table.jobs tr.row-bad td:first-child { box-shadow: inset 3px 0 var(--bad); }

/* tooltips: hover or focus the dotted text to see the full output */
.tip { position: relative; cursor: help; text-decoration: underline dotted var(--fg-3); text-underline-offset: 3px; }
.tip:focus { outline: none; }
.tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tip-body {
  display: none; position: absolute; z-index: 30; right: 0; top: calc(100% + 8px);
  width: max-content; min-width: 220px; max-width: min(520px, 80vw);
  background: var(--fg); color: var(--bg); padding: .55rem .75rem; border-radius: var(--radius);
  font-size: .8rem; font-weight: 400; letter-spacing: 0; line-height: 1.45; text-align: left;
  white-space: pre-wrap; word-break: break-word; box-shadow: 0 8px 24px rgba(0,0,0,.28);
  max-height: 40vh; overflow: auto;
}
.tip-body::before { content: ""; position: absolute; bottom: 100%; right: 12px; border: 6px solid transparent; border-bottom-color: var(--fg); }
.tip-l .tip-body { left: 0; right: auto; }
.tip-l .tip-body::before { left: 12px; right: auto; }
.tip:hover .tip-body, .tip:focus .tip-body, .tip:focus-within .tip-body { display: block; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }
.latest .panel-head h2 { display: flex; align-items: baseline; gap: .4em; }

/* job documentation (overview) and modal prose */
.doc h3, .prose h3 { margin: 1.1rem 0 .35rem; font-size: .95rem; }
.doc h3:first-of-type { margin-top: .75rem; }
.doc p, .prose p { margin: 0 0 .6rem; max-width: 72ch; }
.doc ol, .doc ul { margin: 0 0 .75rem; padding-left: 1.5rem; max-width: 72ch; }
.doc li { margin: .15rem 0; }
.doc ul.detail { margin: .15rem 0 .3rem; padding-left: 1.2rem; color: var(--fg-2); font-size: .85rem; list-style: none; }
.doc ul.detail li::before { content: "· "; color: var(--fg-3); }
.doc .doc-sub { margin-top: -.4rem; }
.doc .doc-step { margin: .6rem 0 .9rem; }
.doc .doc-step p { margin-bottom: .35rem; }
.doc .doc-step pre { max-width: 72ch; margin-bottom: .35rem; }
.doc .doc-step ul.detail { padding-left: .4rem; }
.doc textarea[hidden] { display: none; }
.prose .status { font-size: .85em; }

/* modals */
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); color: var(--fg); padding: 1.1rem 1.25rem; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(10, 14, 12, .5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
details.advanced summary { font-size: .85rem; }

/* forms */
form { margin: 0; }
label { display: block; font-size: .8rem; color: var(--fg-2); margin-bottom: .2rem; text-transform: uppercase; letter-spacing: .05em; }
.field { margin-bottom: .9rem; }
.field .help { color: var(--fg-3); font-size: .8rem; margin-top: .2rem; }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=url], textarea, select {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .45rem .6rem;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { min-height: 4.5rem; resize: vertical; }
.row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.row .field { flex: 1 1 160px; margin-bottom: 0; }
.row .field.narrow { flex: 0 1 120px; }
.check { display: flex; align-items: center; gap: .5rem; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--fg); }
.check input { width: auto; }
.btn {
  font: inherit; font-size: .88rem; cursor: pointer; border: 1px solid var(--line); background: var(--bg-2); color: var(--fg);
  padding: .4rem .8rem; border-radius: var(--radius); display: inline-flex; align-items: center; gap: .4em; line-height: 1.2;
}
.btn:hover { border-color: var(--fg-3); text-decoration: none; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.btn-primary:hover { background: var(--accent-fill-2); border-color: var(--accent-fill-2); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn-sm { font-size: .78rem; padding: .2rem .5rem; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--bg-3); }
.btn[disabled] { opacity: .5; cursor: default; }
.alert { padding: .6rem .8rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; font-size: .92rem; }
.alert-error { color: var(--bad); background: var(--bad-bg); border-color: var(--bad); }
.alert-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.alert-info { color: var(--fg-2); background: var(--mute-bg); border-color: var(--line); }
#error:empty { display: none; }
.htmx-request .btn { opacity: .6; }
.htmx-indicator { display: none; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* steps (configured) */
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: 1fr auto; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); align-items: start; min-width: 0; }
.step:last-child { border-bottom: 0; }
.step details { min-width: 0; }
.step summary { display: flex; flex-wrap: wrap; gap: .4em; align-items: baseline; color: var(--fg); cursor: pointer; }
.step summary::marker, .step summary::-webkit-details-marker { color: var(--fg-3); }
.step .n { color: var(--fg-3); font-variant-numeric: tabular-nums; }
.step .name { font-weight: 600; }
.step .params { color: var(--fg-2); font-size: .82rem; margin: .3rem 0 0 1.2rem; white-space: pre-wrap; }
.step .ctl { display: flex; gap: .2rem; }
.step-output { font-size: .82rem; margin-top: .4rem; }
details summary { cursor: pointer; color: var(--fg-2); }
.login-box { max-width: 420px; margin: 8vh auto 0; }
.login-box .brand { font-size: 1.4rem; display: block; margin-bottom: 1rem; }
.chip { display: inline-block; background: var(--mute-bg); border: 1px solid var(--line); border-radius: 2px; padding: 0 .4em; font-size: .8rem; color: var(--fg-2); }
.footer { text-align: center; color: var(--fg-3); font-size: .78rem; margin-top: 3rem; }
.mono-dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; font-size: .9rem; }
.mono-dl dt { color: var(--fg-3); } .mono-dl dd { margin: 0; }
.when-narrow { display: none; }
@media (max-width: 640px) {
  .topbar { gap: .75rem; padding: 0 .75rem; } .tagline { display: none; }
  main { padding: 1rem .75rem 3rem; }
  .step { grid-template-columns: 1fr; } .cards { grid-template-columns: 1fr; }
  /* tabs scroll sideways instead of wrapping onto a second row */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; flex-shrink: 0; }
  /* jobs table: last/next check move under the job name; runs table: trigger, started and duration do */
  .when-wide { display: none; }
  .when-narrow { display: block; margin-top: .15rem; }
  /* "+ new verification job" and similar section buttons sit on their own line */
  .section-head { flex-direction: column; align-items: stretch; gap: .5rem; }
  .section-head .btn { text-align: center; }
}

/* billing: plan picker and the Stripe card field (project settings) */
.plans-pick { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.plan-pick {
  display: grid; grid-template-columns: auto 1fr; column-gap: .5rem; align-items: start; cursor: pointer;
  text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--fg); margin: 0;
  border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; background: var(--bg);
}
.plan-pick:hover { border-color: var(--fg-3); }
.plan-pick.current { border-color: var(--accent); }
.plan-pick:has(input:checked) { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.plan-pick input { width: auto; margin: .2rem 0 0; grid-row: 1 / span 3; }
.plan-pick .plan-name { font-weight: 600; }
.plan-pick .plan-price { font-variant-numeric: tabular-nums; }
.plan-pick .plan-price small { color: var(--fg-3); }
.plan-pick .plan-jobs { color: var(--fg-2); font-size: .82rem; }
.card-element { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .6rem; max-width: 480px; }
.card-element.StripeElement--focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.card-on-file { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.row-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.billing-foot { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.billing-foot .row { align-items: center; }
.billing-history { margin-top: 1rem; }
.billing-history summary { font-size: .85rem; color: var(--fg-2); cursor: pointer; }
.billing-history table { margin-top: .5rem; }

/* admin overview: totals as tiles */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: .15rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; color: var(--fg); min-width: 0; }
a.stat:hover { border-color: var(--fg-3); text-decoration: none; }
.stat-n { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: .8rem; font-weight: 400; color: var(--fg-3); }
.stat-bad { color: var(--bad); }
.stat-l { color: var(--fg-3); font-size: .82rem; }
