/* app.css - styles of the registry UI (owner: M5a). No external fonts or URLs (CSP: default-src 'self').
   Tokens --ink --paper --accent --go --wait --stamp come from the automail site (ARCH-12); --brand is the Promotion blue. */
:root {
  --ink: #1d2433;
  --paper: #f6f4ef;
  --panel: #ffffff;
  --panel-2: #fbfaf7;
  --brand: #385cad;
  --accent: #2b5fd9;
  --go: #1f8a4c;
  --wait: #b7791f;
  --stamp: #c0392b;
  --muted: #667085;
  --line: #d9d6cc;
  --line-soft: #ebe8e0;
  --focus: #2b5fd9;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(29, 36, 51, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaf0;
    --paper: #14171f;
    --panel: #1c2130;
    --panel-2: #20263a;
    --brand: #8aa6e8;
    --accent: #7aa2ff;
    --go: #4cc38a;
    --wait: #e0a94a;
    --stamp: #ff7b6b;
    --muted: #98a2b3;
    --line: #2d3446;
    --line-soft: #262c3d;
    --focus: #7aa2ff;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.45; }
a { color: var(--accent); }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- layout ---- */
.container { max-width: 1240px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--brand); }
.mainnav { display: flex; flex-wrap: wrap; gap: 2px 4px; flex: 1; align-items: center; }
.mainnav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.mainnav a:hover { background: var(--panel-2); text-decoration: none; }
.mainnav a[aria-current="page"] { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 600; }
.mainnav .nav-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.mainnav .nav-admin { color: var(--muted); }
.userbox { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--muted); font-size: 0.92em; }
.footer { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 16px; color: var(--muted); font-size: 0.82em; max-width: 1240px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.row.spread { justify-content: space-between; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.page-head h1 { margin-bottom: 0; }

/* ---- panels, tiles ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel > h2:first-child { margin-top: 0; }
.panel-tight { padding: 0; overflow: hidden; }
.panel-tight > h2 { padding: 14px 16px 0; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .label { color: var(--muted); font-size: 0.85em; }
.tile .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .sub { color: var(--muted); font-size: 0.82em; margin-top: 2px; }
.tile.accent { border-left: 4px solid var(--brand); }
.login-panel { max-width: 400px; margin: 48px auto; }
.error-panel { max-width: 560px; margin: 40px auto; text-align: center; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--muted); margin: 0; }
.prose { max-width: 860px; }
.prose li { margin-bottom: 6px; }
.callout { border-left: 4px solid var(--wait); background: color-mix(in srgb, var(--wait) 8%, var(--panel)); padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.callout.info { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.callout.danger { border-left-color: var(--stamp); background: color-mix(in srgb, var(--stamp) 7%, var(--panel)); }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* ---- forms ---- */
label { display: block; margin-bottom: 12px; font-size: 0.93em; }
.login-panel label, .panel form label { display: block; margin-bottom: 12px; }
input[type=text], input[type=password], input[type=search], input[type=email], input[type=number], input[type=url], input[type=date], input[type=file], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink); font: inherit;
}
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; margin-right: 6px; }
.check { display: flex; align-items: center; gap: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 12px; }
.filters label { margin: 0; min-width: 140px; }
.filters label.grow { flex: 1; min-width: 200px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.btn, button { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; text-decoration: none; line-height: 1.2; }
.btn:hover, button:hover { border-color: var(--muted); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--brand); }
.btn-danger { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn-small { padding: 4px 10px; font-size: 0.88em; }
.linklike { border: none; background: none; color: var(--accent); padding: 0; cursor: pointer; font: inherit; }
form.inline { display: inline; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85em; background: var(--panel-2); position: sticky; top: 0; }
tbody tr:hover { background: var(--panel-2); }
td.actions { white-space: nowrap; text-align: right; }
table.compact th, table.compact td { padding: 5px 8px; }
dl.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---- chips, badges, flags ---- */
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.82em; white-space: nowrap; line-height: 1.6; }
.chip-go { color: var(--go); border-color: color-mix(in srgb, var(--go) 60%, transparent); background: color-mix(in srgb, var(--go) 8%, transparent); }
.chip-wait { color: var(--wait); border-color: color-mix(in srgb, var(--wait) 60%, transparent); background: color-mix(in srgb, var(--wait) 8%, transparent); }
.chip-stamp { color: var(--stamp); border-color: color-mix(in srgb, var(--stamp) 60%, transparent); background: color-mix(in srgb, var(--stamp) 8%, transparent); }
.chip-info { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.cc { display: inline-block; min-width: 2.2em; padding: 1px 6px; border-radius: 4px; font-weight: 700; font-size: 0.8em; text-align: center; background: var(--panel-2); border: 1px solid var(--line); }
.cc.p1 { background: var(--brand); color: #fff; border-color: var(--brand); }
.cc.p2 { background: color-mix(in srgb, var(--brand) 18%, var(--panel)); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }

/* ---- tabs, pagination, bars ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.pager .current { font-weight: 700; }
/* progress bars: native <progress> (no inline styles under the CSP) */
progress.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 80px; height: 8px; margin: 6px 0 2px; border: 0; border-radius: 999px; background: var(--line-soft); color: var(--brand); overflow: hidden; }
progress.bar::-webkit-progress-bar { background: var(--line-soft); border-radius: 999px; }
progress.bar::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress.bar::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
progress.bar.go::-webkit-progress-value { background: var(--go); }
progress.bar.go::-moz-progress-bar { background: var(--go); }
progress.bar.wait::-webkit-progress-value { background: var(--wait); }
progress.bar.wait::-moz-progress-bar { background: var(--wait); }
a.tile { display: block; color: inherit; text-decoration: none; }
a.tile:hover { border-color: var(--brand); text-decoration: none; }

/* ---- flash ---- */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid var(--line); border-left-width: 4px; background: var(--panel); }
.flash-success { border-left-color: var(--go); }
.flash-info { border-left-color: var(--accent); }
.flash-warning { border-left-color: var(--wait); }
.flash-danger { border-left-color: var(--stamp); }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .container { padding: 12px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  th, td { padding: 6px; }
  .topbar { position: static; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }
}

/* ---- inline details (small inline forms in tables) ---- */
details.inline-details { display: inline-block; position: relative; vertical-align: top; }
details.inline-details > summary { list-style: none; }
details.inline-details > summary::-webkit-details-marker { display: none; }
details.inline-details[open] > form { position: absolute; right: 0; z-index: 5; min-width: 280px; margin-top: 6px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.12); text-align: left; }
