:root {
  --bg: #f6f4fb; --card: #ffffff; --text: #1d1b26; --muted: #6b6780; --line: #e4e0ef; --soft: #efecf7;
  --accent: #6b4fd8; --accent-text: #ffffff; --danger: #b3261e; --ok: #1e7a46; --warn: #9a6200;
  --red: #e5484d; --orange: #f76b15; --yellow: #e2a400; --green: #30a46c; --teal: #12a594;
  --blue: #0090ff; --purple: #8e4ec6; --pink: #d6409f; --gray: #8b8d98;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13111c; --card: #1d1a2a; --text: #ece9f6; --muted: #a39fb8; --line: #2e2a40; --soft: #26223a;
    --accent: #9b85ff; --accent-text: #13111c; --danger: #ff8a80; --ok: #7ddc9f; --warn: #f5c86b;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
a { color: var(--accent); }
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 64px; }

/* Top bar */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: 8px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.nav a.active, .nav a:hover { background: var(--soft); color: var(--text); }
.who { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

h1 { font-size: 1.5rem; margin: 4px 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
section, .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .85rem; }
.msg { background: var(--card); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.msg.error { border-left-color: var(--danger); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Rows and lists */
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between;
  padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .main { flex: 1 1 240px; min-width: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }

/* Forms */
label { display: block; margin: 12px 0 4px; font-size: .9rem; color: var(--muted); }
label.check { display: inline-flex; gap: 6px; align-items: center; color: var(--text); margin: 4px 14px 4px 0; font-size: 1rem; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; max-width: 360px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; }
input[type=number] { max-width: 120px; }
input[type=time], input[type=date] { max-width: 180px; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.has-error input, .has-error select { border-color: var(--danger); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 14px; margin: 12px 0; }
legend { color: var(--muted); font-size: .9rem; padding: 0 4px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.steps { display: grid; gap: 6px; }
.step-row { display: grid; gap: 6px; grid-template-columns: 2fr 1.5fr; }
.step-row .symbol-field { max-width: none; }
.hidden { display: none !important; }

/* SF Symbol fields and the symbol browser (admin.js) */
.symbol-field { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 360px; }
.symbol-field input { flex: 1 1 0; min-width: 0; }
.symbol-hint { flex-basis: 100%; color: var(--warn); font-size: .85rem; }
.symbol-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 32px)); padding: 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text);
  display: none; flex-direction: column; gap: 10px; }
.symbol-dialog[open] { display: flex; }
.symbol-dialog::backdrop { background: rgb(0 0 0 / .45); }
.symbol-dialog p { margin: 0; }
.symbol-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.symbol-bar input { flex: 2 1 200px; max-width: none; }
.symbol-bar select { flex: 1 1 140px; max-width: none; }
.symbol-results { overflow-y: auto; min-height: 120px; border: 1px solid var(--line); border-radius: 10px; }
.symbol-option { display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; text-align: left;
  border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; padding: 8px 12px; }
.symbol-option:first-child { border-top: 0; }
.symbol-option:hover, .symbol-option:focus-visible { background: var(--soft); outline: none; }
.symbol-option.sel { box-shadow: inset 3px 0 0 var(--accent); }
.symbol-option .symbol { color: var(--text); font-size: .9rem; }

button, .button { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.4; }
button:hover, .button:hover { border-color: var(--muted); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--danger); }
button.small, .button.small { padding: 3px 9px; font-size: .85rem; }
button.icon { padding: 2px 8px; }
.apple { background: #000; color: #fff; border-color: #000; padding: 10px 18px; }

/* Bits */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 6px; background: var(--gray); }
.c-red { background: var(--red); } .c-orange { background: var(--orange); } .c-yellow { background: var(--yellow); }
.c-green { background: var(--green); } .c-teal { background: var(--teal); } .c-blue { background: var(--blue); }
.c-purple { background: var(--purple); } .c-pink { background: var(--pink); } .c-gray { background: var(--gray); }
.badge { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); margin-left: 4px; white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--danger); }
.symbol { font: .8rem ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.stars { display: flex; gap: 12px; flex-wrap: wrap; font-size: .95rem; }
.stars b { font-size: 1.1rem; }
.code { font: 600 1.6rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
code { word-break: break-all; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; margin-bottom: 16px; }
.strip a { display: block; text-align: center; padding: 6px 0; border-radius: 8px; text-decoration: none;
  color: var(--text); background: var(--card); border: 1px solid var(--line); font-size: .78rem; }
.strip a.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.strip a.full { background: color-mix(in srgb, var(--green) 22%, var(--card)); }
.strip a.partial { background: color-mix(in srgb, var(--yellow) 18%, var(--card)); }
.strip .n { display: block; color: var(--muted); font-size: .72rem; }
@media (max-width: 640px) {
  .strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .step-row { grid-template-columns: 1fr; }
}

/* Utilities (inline styles are blocked by the Content-Security-Policy) */
.w-sm { max-width: 200px !important; } .w-md { max-width: 280px !important; }
.mb0 { margin-bottom: 0; } .my { margin: 6px 0; } .mt { margin-top: 12px; }
progress { width: 100%; height: 8px; margin: 8px 0; appearance: none; border: 0; border-radius: 999px; background: var(--soft); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--soft); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
