/* Stone Guest ToolKit — "archival ledger" theme, re-paletted from the logo (0.3.2).
   Navy ink, mint accent (a darker mint for text so it passes WCAG AA), stone greys.
   Serif display, plain sans for work, mono for data, a faint paper grain.
   Fonts are local stacks only: no third-party requests from a research server. */

:root {
  --paper: #f2f2ee;
  --paper-2: #e8e9e3;
  --card: #fbfbf8;
  --ink: #1c3446;
  --ink-2: #3b5262;
  --muted: #56626a;
  --rule: #d6d9d3;
  --rule-strong: #b1b8b3;
  --accent: #2a7060;          /* dark mint: links, focus, text accents (5.1:1 on paper) */
  --mint: #6fbfa5;            /* logo mint: fills, rules, highlights */
  --mint-soft: #dcefe7;
  --primary: #1c3446;         /* primary buttons */
  --primary-ink: #ffffff;
  --bar: #fbfbf8;
  --bar-ink: #1c3446;
  --bar-muted: #4c5e6a;
  --ok: #246b5a;
  --ok-soft: #dcefe7;
  --warn: #8a6100;
  --warn-soft: #f6e7bf;
  --fail: #a3261a;
  --fail-soft: #f6d8d3;
  --danger-ink: #ffffff;      /* text on --fail buttons: 7.4:1 */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", "Noto Sans", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --radius: 3px;
  --shadow: 0 1px 0 rgba(28, 52, 70, .04), 0 8px 24px -16px rgba(28, 52, 70, .35);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1b24;
    --paper-2: #132330;
    --card: #172a37;
    --ink: #e4ece9;
    --ink-2: #bccbc6;
    --muted: #8fa0a6;
    --rule: #263b48;
    --rule-strong: #3a5464;
    --accent: #7fd1b6;
    --mint: #6fbfa5;
    --mint-soft: #1b3a36;
    --primary: #6fbfa5;
    --primary-ink: #0f1b24;
    --bar: #0b151c;
    --bar-ink: #e4ece9;
    --bar-muted: #a9b8b4;
    --ok: #86d3b3;
    --ok-soft: #173a31;
    --warn: #e0b558;
    --warn-soft: #3a2f14;
    --fail: #ef8a7c;
    --fail-soft: #43201b;
    --danger-ink: #0f1b24;    /* dark text on the light-red dark-mode danger button: 7.2:1 */
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -18px rgba(0, 0, 0, .9);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.55 var(--sans); color: var(--ink);
  background: var(--grain), var(--paper);
  font-feature-settings: "kern", "liga";
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 30px; margin: 4px 0 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
h2 { font-size: 20px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
code { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 2px; padding: 1px 5px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 24px 0; }
::selection { background: var(--mint); color: #0f1b24; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .9em; }

/* ---------- top bar (light, so the navy-outlined logo stays legible) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 0 28px; height: 60px;
  background: var(--bar); color: var(--bar-ink);
  border-bottom: 3px solid var(--mint);
  box-shadow: 0 6px 18px -16px rgba(28, 52, 70, .6);
}
.topbar a { color: inherit; text-decoration: none; }
.brand { font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: .01em;
  display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand img { width: 36px; height: 36px; display: block; }
.topbar nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.topbar nav a {
  white-space: nowrap; padding: 6px 12px; border-radius: var(--radius);
  font-size: 13.5px; letter-spacing: .02em; color: var(--bar-muted);
  border-bottom: 2px solid transparent; transition: background .15s, color .15s;
}
.topbar nav a:hover { color: var(--bar-ink); background: var(--mint-soft); }
.topbar nav a[aria-current="page"] { color: var(--bar-ink); font-weight: 600; background: var(--mint-soft); border-bottom-color: var(--mint); }
@media (prefers-color-scheme: dark) {
  .brand img { background: #f2f2ee; border-radius: 8px; padding: 2px; }
}

/* account menu: native <details>; Alpine only adds click-outside and Escape */
.account { position: relative; font-size: 13px; }
.account > summary {
  list-style: none; cursor: pointer; color: var(--bar-ink); border: 1px solid var(--rule-strong);
  border-radius: var(--radius); padding: 5px 10px; font-weight: 500; white-space: nowrap;
}
.account > summary::-webkit-details-marker { display: none; }
.account > summary:hover, .account[open] > summary { background: var(--mint-soft); }
.account .role { color: var(--bar-muted); font-weight: 400; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 20;
  background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; display: grid;
}
.account-menu a, .account-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius);
  color: var(--ink); background: transparent; border: 0; font: 500 13.5px var(--sans);
}
.account-menu a:hover, .account-menu button:hover { background: var(--mint-soft); filter: none; }
.account-menu .who-line { padding: 6px 10px 8px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }

/* ---------- layout ---------- */
main { max-width: 1160px; margin: 0 auto; padding: 28px 28px 48px; animation: rise .35s ease-out both; }
.narrow { max-width: 640px; }
footer { max-width: 1160px; margin: 0 auto; padding: 18px 28px 32px; border-top: 1px solid var(--rule);
  color: var(--muted); font: 12px var(--mono); letter-spacing: .04em; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main, .entrance-card { animation: none; } }

.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs > * + *::before { content: "›"; margin-right: 6px; color: var(--rule-strong); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -6px 0 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px 24px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head h2 { margin-bottom: 8px; }

/* ---------- banners & messages ---------- */
.banner { padding: 10px 28px; font-size: 14px; border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); font-weight: 500; }
.messages { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; }
.messages li { padding: 10px 14px 10px 16px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--rule); border-left: 4px solid var(--ink-2); box-shadow: var(--shadow); }
.messages li.success { border-left-color: var(--mint); }
.messages li.warning { border-left-color: var(--warn); }
.messages li.error, .messages .error { border-left-color: var(--fail); color: var(--fail); }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card { position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.cards .card { margin: 0; border-top: 3px solid var(--ink); }
.cards .card:nth-child(3n+2) { border-top-color: var(--mint); }
.cards .card:nth-child(3n+3) { border-top-color: var(--rule-strong); }
.card .value { font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.card .label { margin-top: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card.danger-zone { border-color: var(--fail); border-left: 4px solid var(--fail); }
.card.danger-zone h2 { color: var(--fail); }
.empty { padding: 22px 20px; text-align: center; color: var(--muted); background: var(--card);
  border: 1px dashed var(--rule-strong); border-radius: var(--radius); margin-bottom: 20px; }
.empty p { margin-bottom: 10px; }
.empty p:last-child { margin-bottom: 0; }
td.empty-row { text-align: center; color: var(--muted); padding: 18px 14px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; font-size: 14px; }
th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); background: var(--paper-2); border-bottom: 1px solid var(--rule-strong); }
td { padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, tr:hover > td { background: rgba(111, 191, 165, .07); }
td form.inline { margin: 2px 6px 2px 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }

/* ---------- forms ---------- */
form p { margin: 0 0 14px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input[type="checkbox"] + label, input[type="radio"] + label { display: inline; font-weight: 400; margin-left: 6px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  width: 100%; max-width: 520px; font: 14.5px var(--sans); color: var(--ink);
  background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 8px 10px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--mint-soft); }
td input:not([type="checkbox"]):not([type="radio"]), td select, form.inline input:not([type="hidden"]), form.inline select {
  width: auto; display: inline-block; padding: 5px 8px; font-size: 13px;
}
input::placeholder { color: var(--muted); }
.errorlist { list-style: none; margin: 0 0 8px; padding: 0; color: var(--fail); font-size: 13px; }
form.inline { display: inline; }
.helptext { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }

/* filter bar (lists) */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 0 0 16px;
  padding: 10px 12px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); }
.filters input:not([type="hidden"]), .filters select { width: auto; min-width: 150px; flex: 0 1 220px; padding: 6px 9px; font-size: 13.5px; }
.filters .grow { flex: 1 1 220px; }
.filters a { font-size: 13px; align-self: center; }

/* typed confirmation */
.confirm { display: grid; gap: 8px; max-width: 520px; padding: 14px 16px; margin: 8px 0 12px;
  background: var(--fail-soft); border: 1px solid var(--fail); border-radius: var(--radius); }
.confirm .consequence { margin: 0; color: var(--ink); font-size: 13.5px; }
.confirm label { margin: 0; font-weight: 500; }
.confirm .row { display: flex; flex-wrap: wrap; gap: 8px; }
.confirm .row input { flex: 1 1 200px; width: auto; }
details.remove { display: inline-block; }
details.remove > summary { cursor: pointer; color: var(--fail); font-size: 13px; list-style: none; }
details.remove > summary::-webkit-details-marker { display: none; }
details.remove[open] { display: block; text-align: left; white-space: normal; }

/* ---------- buttons ---------- */
button, .button, input[type="submit"] {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 13.5px var(--sans); letter-spacing: .02em;
  color: var(--primary-ink); background: var(--primary);
  border: 1px solid var(--primary); border-radius: var(--radius);
  padding: 7px 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, filter .15s, background .15s;
}
button:hover, .button:hover { filter: brightness(1.12); }
button:active, .button:active { transform: translateY(1px); }
.button.secondary, button.secondary, td button, form.inline button {
  background: var(--card); color: var(--ink); border-color: var(--rule-strong);
}
td button, form.inline button { padding: 5px 10px; font-size: 12.5px; }
.button.secondary:hover, button.secondary:hover, td button:hover, form.inline button:hover { border-color: var(--ink); background: var(--mint-soft); filter: none; }
button.danger, .button.danger, form.inline button.danger, td button.danger { background: var(--fail); border-color: var(--fail); color: var(--danger-ink); }
.button.small { padding: 4px 10px; font-size: 12.5px; }
h1 .button { font-family: var(--sans); font-size: 13px; }
h1 > a:not(.button) { font: 500 13px var(--sans); }

/* pagination */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; margin: -6px 0 20px; }
.pagination a, .pagination span { padding: 4px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); text-decoration: none; }
.pagination .current { border-color: var(--ink); font-weight: 600; }
.pagination .disabled { color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 600 11px var(--sans);
  letter-spacing: .08em; text-transform: uppercase; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule); }
.badge.ok, .badge.done, .badge.active, .badge.ready, .badge.running, .badge.recruiting { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn, .badge.pending, .badge.queued, .badge.draft { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.fail, .badge.failed { background: var(--fail-soft); color: var(--fail); border-color: transparent; }
.badge.archived, .badge.closed { background: var(--paper-2); color: var(--muted); }

/* ---------- misc ---------- */
pre.changelog { white-space: pre-wrap; background: var(--card); border: 1px solid var(--rule);
  border-left: 3px solid var(--mint); border-radius: var(--radius);
  padding: 12px 16px; font-size: 12.5px; line-height: 1.6; max-height: 320px; overflow: auto; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
img[src^="data:image/svg"] { max-width: 220px; height: auto; background: #fff; padding: 8px; border: 1px solid var(--rule); }

/* ---------- entrance (login, password reset, 2FA code) ---------- */
.entrance { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 5fr) 6fr; }
.entrance-mark {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  padding: 56px; color: #1c3446; border-right: 1px solid var(--rule);
  background: radial-gradient(circle at 70% 30%, rgba(111, 191, 165, .28), transparent 60%), var(--grain), #e9ece6;
}
.entrance-mark::after {
  content: ""; position: absolute; inset: auto -12% -30% auto; width: 520px; height: 520px; border-radius: 50%;
  border: 1px solid rgba(28, 52, 70, .1);
  box-shadow: 0 0 0 48px rgba(111, 191, 165, .06), 0 0 0 112px rgba(111, 191, 165, .04);
}
.entrance-logo { width: 240px; max-width: 70%; height: auto; margin-bottom: 28px; position: relative; z-index: 1; }
.entrance-kicker { font: 600 11px var(--sans); letter-spacing: .22em; text-transform: uppercase; color: #2a7060; margin-bottom: 14px; }
.entrance-title { font: 600 clamp(36px, 4.4vw, 58px)/1.02 var(--serif); letter-spacing: -.02em; margin-bottom: 18px; }
.entrance-note { max-width: 34ch; color: #3b5262; font-size: 14px; }
.entrance-card { align-self: center; justify-self: center; width: min(420px, 100% - 48px); margin: 48px 0; animation: rise .4s ease-out both; }
.entrance-card h1 { font-size: 34px; margin-bottom: 22px; }
.entrance-card input:not([type="checkbox"]):not([type="hidden"]) { max-width: none; padding: 11px 12px; font-size: 15px; }
.entrance-card button[type="submit"] { width: 100%; justify-content: center; padding: 11px 14px; font-size: 14.5px; margin-top: 6px; }
.entrance-card form p:has(input[type="checkbox"]) { display: flex; align-items: center; }
.entrance-brand { display: none; align-items: center; gap: 12px; font: 600 16px var(--serif); margin-bottom: 28px; }
.entrance-brand img { width: 48px; height: 48px; }
.entrance-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 12.5px; }
@media (prefers-color-scheme: dark) {
  .entrance-mark { border-right-color: #000; }
  .entrance-brand img { background: #f2f2ee; border-radius: 10px; padding: 3px; }
}

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .topbar nav { order: 3; flex-basis: 100%; }
  .account { margin-left: auto; }
  main { padding: 22px 16px 40px; }
  table { display: block; overflow-x: auto; }
  td form.inline, td .confirm { white-space: normal; }
  .entrance { grid-template-columns: 1fr; }
  .entrance-mark { display: none; }
  .entrance-brand { display: flex; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
ul.activity li { padding: 5px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
ul.activity li:last-child { border-bottom: 0; }
