
/* Apple-style admin: SF system type, a light gray canvas with white rounded
   panels, hairline rows, blue text links and pill buttons, a frosted top bar. */
:root {
  --bg: #f5f5f7; --surface: #ffffff; --text: #1d1d1f; --muted: #6e6e73;
  --border: #d2d2d7; --hairline: #e8e8ed; --fill: #f5f5f7; --fill-strong: #e8e8ed;
  --primary: #0071e3; --primary-hover: #0077ed; --primary-text: #ffffff; --link: #0066cc;
  --focus: rgba(0, 113, 227, .35);
  --danger: #e30000; --danger-bg: #fff0f0; --ok: #008009; --ok-bg: #edf8ee;
  --warn: #b64400; --warn-bg: #fff5e6; --code-bg: #f5f5f7;
  --bar: rgba(251, 251, 253, .8); --toast: rgba(29, 29, 31, .92); --toast-text: #f5f5f7;
  --radius: 18px; --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --surface: #1d1d1f; --text: #f5f5f7; --muted: #a1a1a6;
    --border: #424245; --hairline: #2c2c2e; --fill: #2c2c2e; --fill-strong: #3a3a3c;
    --primary: #0a84ff; --primary-hover: #409cff; --primary-text: #ffffff; --link: #2997ff;
    --focus: rgba(10, 132, 255, .45);
    --danger: #ff6961; --danger-bg: #3a1717; --ok: #30d158; --ok-bg: #12301b;
    --warn: #ffb340; --warn-bg: #3a2a10; --code-bg: #2c2c2e;
    --bar: rgba(22, 22, 23, .8); --toast: rgba(245, 245, 247, .94); --toast-text: #1d1d1f;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.47 var(--font); letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .82em; letter-spacing: 0;
  background: var(--code-bg); padding: 2px 6px; border-radius: 6px; }
h1 { font-size: 40px; line-height: 1.1; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 8px; text-wrap: balance; }
h2 { font-size: 21px; line-height: 1.19; font-weight: 600; letter-spacing: 0.011em; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; letter-spacing: -0.016em; }
.lead { margin: 0 0 28px; font-size: 19px; line-height: 1.42; max-width: 62ch; }
strong { font-weight: 600; }

/* Frosted global bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  min-height: 52px; padding: 8px max(22px, env(safe-area-inset-right, 0px)) 8px max(22px, env(safe-area-inset-left, 0px));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline); font-size: 14px; }
.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.brand .muted { font-weight: 400; }
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.who strong { color: var(--text); }
.env { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 980px;
  background: var(--fill-strong); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.env-production { background: var(--danger-bg); color: var(--danger); }
.env-uat { background: var(--warn-bg); color: var(--warn); }
.nav { display: flex; gap: 2px; margin-left: 6px; }
.nav a { color: var(--text); opacity: .8; font-size: 14px; padding: 6px 12px; border-radius: 980px; white-space: nowrap; }
.nav a:hover { opacity: 1; text-decoration: none; background: var(--fill); }
.nav a[aria-current="page"] { opacity: 1; font-weight: 600; background: var(--fill-strong); }

main { max-width: 1080px; margin: 0 auto;
  padding: 48px max(22px, env(safe-area-inset-right, 0px)) 96px max(22px, env(safe-area-inset-left, 0px)); }
main.narrow { max-width: 480px; padding-top: 88px; }
main.narrow h1 { font-size: 32px; text-align: center; }
main.narrow > .card > p.muted { text-align: center; margin: 0 0 24px; }
main.narrow .btn-primary { width: 100%; margin-top: 4px; }

/* Panels */
.card { background: var(--surface); border-radius: var(--radius); padding: 28px 30px; margin-bottom: 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px; }
.card > h2 { margin-bottom: 18px; }
.card.status { padding: 22px 30px; }

/* Forms */
label { display: block; font-weight: 600; font-size: 12px; letter-spacing: 0; color: var(--muted); margin: 0 0 6px; }
input, select, textarea { width: 100%; font: 17px/1.3 var(--font); letter-spacing: -0.022em; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 15px; min-height: 50px; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.btn:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
textarea { font: 15px/1.45 var(--mono); letter-spacing: 0; min-height: 96px; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0 10px 0 0; accent-color: var(--primary); flex: none; }
input[type="file"] { padding: 11px 12px; font-size: 15px; }
input[type="search"] { border-radius: 980px; padding-left: 18px; }
form > input { margin-bottom: 16px; }
.hint { margin: -8px 0 16px; font-size: 13px; color: var(--muted); }

/* Buttons: blue pill for the main action, gray pill, red text, blue text link */
.btn { font: 600 15px/1 var(--font); letter-spacing: -0.01em; border-radius: 980px; padding: 13px 22px; cursor: pointer;
  border: 0; min-height: 44px; white-space: nowrap; transition: background-color .15s, opacity .15s; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--fill-strong); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.topbar .btn-ghost { min-height: 32px; padding: 8px 14px; font-size: 13px; }
.btn-danger { background: transparent; color: var(--danger); padding: 6px 8px; min-height: 0; font-size: 14px; font-weight: 400; }
.btn-danger:hover { text-decoration: underline; }
.btn-link { background: transparent; color: var(--link); padding: 6px 8px; min-height: 0; font-size: 14px; font-weight: 400; }
.btn-link:hover { text-decoration: underline; }
.btn-link::after { content: " \203A"; }
.btn:disabled { opacity: .4; cursor: default; }

.add-form, .grid-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.add-form .field { min-width: 220px; }
.add-form .grow, .grid-form .grow { flex: 1; min-width: 240px; }
.grid-form .field { min-width: 180px; }
.stack-form { display: flex; flex-direction: column; gap: 18px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.check { display: flex; align-items: center; font-weight: 400; font-size: 15px; color: var(--text); margin: 0 0 14px; }
.scopes { border: 0; border-radius: var(--radius-sm); background: var(--fill); padding: 16px 18px 4px; margin: 0;
  display: flex; flex-wrap: wrap; gap: 4px 28px; }
.scopes legend { float: left; width: 100%; font-weight: 600; font-size: 12px; color: var(--muted); padding: 0; margin-bottom: 10px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input { width: 240px; min-height: 40px; padding: 9px 16px; font-size: 15px; }
.inline-form select { width: auto; min-height: 40px; padding-top: 9px; padding-bottom: 9px; font-size: 15px; border-radius: 980px; }
.inline-form .btn { min-height: 40px; padding: 10px 18px; }

/* Messages */
.error { color: var(--danger); background: var(--danger-bg); border-radius: var(--radius-sm); padding: 12px 16px;
  margin: 16px 0 0; font-size: 15px; }
.ok-box { color: var(--ok); background: var(--ok-bg); border-radius: var(--radius-sm); padding: 12px 16px; margin: 16px 0 0; font-size: 15px; }
.row-errors { margin: 12px 0 0; padding-left: 20px; color: var(--danger); font-size: 14px; max-height: 220px; overflow: auto; }
.hint-row { margin: 14px 0 0; }
.empty { color: var(--muted); margin: 12px 0 0; font-size: 15px; }
.toast { position: fixed; bottom: max(24px, env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--toast); color: var(--toast-text); padding: 12px 20px; border-radius: 980px; font-size: 15px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); max-width: calc(100% - 32px); text-align: center; }

/* Status */
.status-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.status-row + .status-row { margin-top: 12px; }
.badge { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 980px; background: var(--fill-strong); color: var(--muted); }
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--warn-bg); color: var(--warn); }
.badge.deny { background: var(--danger-bg); color: var(--danger); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 3px 10px;
  border-radius: 980px; background: var(--fill); color: var(--muted); white-space: nowrap; letter-spacing: -0.01em; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--danger-bg); color: var(--danger); }
.pill.ok::before, .pill.bad::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Lists: hairline rows, quiet headers */
.table-wrap { overflow-x: auto; position: relative; margin: 0 -6px; padding: 0 6px; } /* position keeps screen-reader-only labels inside the scroll box */
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; letter-spacing: -0.016em; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; padding-top: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
td.actions, th.actions { text-align: right; width: 1%; white-space: nowrap; }
td.actions > .btn { display: block; margin-left: auto; }
td code { white-space: nowrap; }
tr.you td:first-child code { box-shadow: inset 0 0 0 1px var(--ok); }
td .chips { display: flex; flex-wrap: wrap; gap: 6px; }
td strong { font-weight: 600; }

/* One-time secret */
.secret-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.secret { font-size: 15px; padding: 14px 16px; border-radius: var(--radius-sm); word-break: break-all; flex: 1; min-width: 0; }
#secret-box { box-shadow: inset 0 0 0 2px var(--primary); }
#stores-more { margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 734px) {
  body { font-size: 17px; }
  h1 { font-size: 32px; }
  .topbar { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .who span { display: none; }
  .brand .muted { display: none; }
  main { padding-top: 32px; padding-bottom: 64px; }
  .card { padding: 22px 18px; border-radius: 14px; }
  .lead { font-size: 17px; }
  .inline-form input, .inline-form select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
details.exchange { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
details.exchange summary { cursor: pointer; font-weight: 600; font-size: 14px; }
pre.json { white-space: pre-wrap; word-break: break-all; font-size: 12px; background: var(--fill); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; }

.store-main { max-width: 760px; margin: 0 auto; padding: 16px; }
.big-message { font-size: 22px; font-weight: 700; line-height: 1.35; padding: 16px; border-radius: 12px; background: var(--fill); margin: 12px 0; }
.big-message.ok { border-left: 6px solid #1e8e3e; }
.big-message.wait { border-left: 6px solid #b06000; }
.big-message.stop { border-left: 6px solid #c5221f; }
.sale-meta { font-size: 14px; }
.stack > * + * { margin-top: 10px; }
.store-main input, .store-main select { font-size: 16px; }
.wide-btn { width: 100%; padding: 14px; font-size: 17px; }
