:root {
  color-scheme: light dark;
  --bg: #f6f5f1; --fg: #1d1c1a; --muted: #6e6a62; --card: #ffffff; --line: #e4e1da;
  --accent: #2f5fd1; --accent-fg: #fff; --danger: #b4321f; --ok: #227a4c;
  --bar: #2f5fd1; --topbar: linear-gradient(160deg, #0b1a33, #0f2a4d);
  --radius: 12px; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #151515; --fg: #ece9e2; --muted: #9d998f; --card: #1f1f1f; --line: #2d2d2d; --accent: #7aa2ff; --accent-fg: #0c1430; --danger: #f0735f; --ok: #32b370; --bar: #5b86f0; }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { --bg: #151515; --fg: #ece9e2; --muted: #9d998f; --card: #1f1f1f; --line: #2d2d2d; --accent: #7aa2ff; --accent-fg: #0c1430; --danger: #f0735f; --ok: #32b370; --bar: #5b86f0; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font); }
a { color: inherit; text-decoration: none; }
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(14px + env(safe-area-inset-top)) 20px 14px; color: #f3f6fb; background: var(--topbar); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand img { display: block; }
.top nav { display: flex; align-items: center; gap: 16px; font-size: 14px; min-width: 0; }
@media (max-width: 480px) { .top { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; } .top .who { display: none; } }
.top nav a.active { color: #cfe0ff; font-weight: 600; }
.top .who { color: #a7b4ca; }
.who-icon { display: none; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -10px -8px; }
.top .who-icon, .topbar .who-icon { color: #a7b4ca; }
@media (max-width: 480px) { .top .who-icon, .topbar .who-icon { display: inline-flex; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.card h1 { font-size: 20px; margin: 0 0 8px; }
.login { max-width: 420px; margin: 64px auto; }
.login form { display: flex; gap: 8px; margin-top: 16px; }
input[type=email] { flex: 1; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
button.primary { font: inherit; font-weight: 600; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-fg); cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------------------------------------------------------------- front page */
.topbar { position: sticky; top: 0; z-index: 20; color: #f3f6fb; padding: env(safe-area-inset-top) 0 8px;
  background: var(--topbar); }
.topbar .hero-row { padding-top: 14px; }
.topbar::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.topbar.glow-ok::after { background: #3fd39c; animation: glow 900ms ease-out; }
.topbar.glow-fail::after { background: #e5484d; animation: glow 900ms ease-out; }
@keyframes glow { 0% { opacity: 0; } 25% { opacity: .35; } 100% { opacity: 0; } }
.topbar .brand, .hero .brand { color: #f3f6fb; }
.topbar nav a { color: #f3f6fb; }
.topbar .who { color: #a7b4ca; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.topbar nav { display: flex; align-items: center; gap: 14px; font-size: 14px; min-width: 0; }
@media (max-width: 480px) { .topbar .who { display: none; } }
.hero { color: #f3f6fb; padding: 14px 0 22px;
  background: radial-gradient(700px 300px at 90% -20%, rgb(255 138 92 / .22), transparent 60%),
              radial-gradient(600px 340px at 0% 120%, rgb(63 211 156 / .16), transparent 60%),
              linear-gradient(160deg, #0b1a33, #123566); }
/* Dark above the hero, so the gap a pull opens under the top bar is dark too (pull.js moves the hero down by at most
   140px). At rest it is behind the top bar or above the page; a box-shadow is paint only, no layout or scrolling. */
.hero { box-shadow: 0 -80px 0 80px #0b1a33; }
.hero-in { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hero .brand { color: #f3f6fb; }
.hero nav { display: flex; align-items: center; gap: 14px; font-size: 14px; min-width: 0; }
.hero nav a { color: #f3f6fb; }
.hero-main { margin-top: 0; align-items: flex-end; flex-wrap: nowrap; }
.hero h1 { font-size: 26px; margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
.today { margin: 2px 0 0; color: #a7b4ca; font-size: 14px; }
.today::first-letter { text-transform: uppercase; }
.viewtog { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 10px; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .14); }
.viewtog button { display: grid; place-items: center; width: 38px; height: 32px; border: 0; border-radius: 7px; background: none; color: #a7b4ca; cursor: pointer; }
.viewtog button[aria-pressed="true"] { background: rgb(255 255 255 / .2); color: #fff; }

.sec { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.sec span { text-transform: none; letter-spacing: 0; font-weight: 400; }
#fav, #top { margin-bottom: 26px; }
.app { position: relative; min-width: 0; }
.app a { -webkit-touch-callout: none; }
.cards .app a { user-select: none; -webkit-user-select: none; }
.app.blink a { animation: blink 700ms ease-in-out; }
@keyframes blink { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 40% { box-shadow: 0 0 0 4px var(--accent); border-color: var(--accent); } }
.app.lifted { z-index: 5; transition: none; }
.app.lifted a, .grid .app.lifted a:hover { transform: scale(1.04); box-shadow: 0 12px 30px -8px rgb(0 0 0 / .35); }
#fav .app a, #fav .app img { -webkit-user-drag: none; } /* drag.js moves favourites, not the system's link drag */
.app.sliding { transition: transform .2s; }
.dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--card); }
.lock, .ext { position: absolute; top: 8px; font-size: 12px; color: var(--muted); }
.ext { left: 10px; } .lock { right: 22px; }

/* icons */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid .app a { display: flex; flex-direction: column; align-items: center; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 12px 16px; text-align: center; transition: transform .12s, border-color .12s; user-select: none; -webkit-user-select: none; }
.grid .app a:hover { transform: translateY(-2px); border-color: var(--accent); }
.grid h2 { font-size: 15px; font-weight: 600; margin: 12px 0 0; line-height: 1.3; overflow-wrap: anywhere; }
.grid.top4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .grid.top4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .grid .app a { padding: 16px 4px 12px; border-radius: 16px; }
  .grid h2 { font-size: 12.5px; margin-top: 8px; hyphens: auto; }
  .grid .icon { --size: 60px; }
  .grid.top4 .app a { padding: 14px 2px 10px; }
  .grid.top4 .icon { --size: 48px; }
  .grid.top4 h2 { font-size: 11.5px; }
}

/* cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 640px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.cards .app a { display: flex; align-items: center; gap: 12px; min-height: 72px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 48px 12px 12px; transition: border-color .12s; }
.cards .app a:hover { border-color: var(--accent); }
.cards .icon { --size: 48px; }
.cards .txt { min-width: 0; }
.cards h2 { font-size: 15.5px; font-weight: 650; margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.summary { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.summary.locked { font-size: 12px; opacity: .7; }
.cards .ext, .cards .lock { position: static; display: none; }
.cards .dot { top: 10px; right: 40px; }
.pin { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 19px; cursor: pointer; }
.pin:hover { background: var(--bg); color: var(--fg); }
.pin[aria-pressed="true"] { color: #e0a100; }

/* long-press / right-click menu in the icon view */
.pinmenu { position: fixed; z-index: 10; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 10px 30px -10px rgb(0 0 0 / .35); }
.pinmenu button { display: block; width: 100%; font: inherit; font-size: 15px; text-align: left; padding: 10px 14px; border: 0; border-radius: 7px; background: none; color: var(--fg); cursor: pointer; white-space: nowrap; }
.pinmenu button:hover { background: var(--bg); }

/* "Velg apper": the big card on an empty front page, the small button under the apps, and the list.
   .sheet is a bottom sheet on phones and a centred dialog on wider screens; the admin page's #appSheet uses it too. */
.addcard { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 40px 20px; border: 2px dashed var(--line); border-radius: 18px; background: var(--card); color: var(--fg); font: inherit; text-align: center; cursor: pointer; }
.addcard:hover { border-color: var(--accent); }
.addcard .plus { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); font-size: 38px; line-height: 1; }
.addcard b { font-size: 18px; }
.addcard > span:last-child { color: var(--muted); font-size: 14px; max-width: 260px; }
.more { position: relative; display: block; margin: 28px auto 0; font: inherit; font-size: 14px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.more:hover { color: var(--fg); border-color: var(--accent); }
.more .dot { top: 0; right: 4px; box-shadow: 0 0 0 2px var(--bg); }

.sheet { padding: 0; border: 0; border-radius: 18px; background: var(--card); color: var(--fg); width: min(440px, calc(100vw - 32px)); max-height: min(86vh, 720px); box-shadow: 0 10px 40px rgb(0 0 0 / .25); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgb(0 0 0 / .4); }
/* flex: 1 1 auto here and in what a sheet holds, never flex: 1. Its basis of 0 made a sheet on an iPhone as tall as its
   padding, at the bottom of the screen, because nothing else sets a sheet's height. */
.sheet-in { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#picker header { padding: 18px 18px 8px; }
#picker h1 { font-size: 19px; margin: 0; outline: none; }  /* takes focus when opened, so no tick shows a focus ring */
#picker header p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
#picker ul { list-style: none; margin: 0; padding: 4px 8px; overflow: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
#picker li label { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; cursor: pointer; }
#picker li label:hover { background: var(--bg); }
#picker input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
#picker .icon { --size: 44px; }
#picker .txt { flex: 1; min-width: 0; }
#picker .txt b { display: block; font-size: 15.5px; font-weight: 650; overflow-wrap: anywhere; }
#picker .txt small { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
#picker .new { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 700; vertical-align: 2px; }
#picker .lockmark { font-size: 12px; }
.tick { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
#picker input:checked ~ .tick { background: var(--accent); border-color: var(--accent); }
#picker input:checked ~ .tick::after { content: "✓"; color: var(--accent-fg); font-size: 15px; font-weight: 700; }
#picker input:focus-visible ~ .tick { outline: 2px solid var(--accent); outline-offset: 2px; }
#picker .none { margin: 8px 18px 16px; color: var(--muted); }
#picker footer { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
#picker footer button { width: 100%; padding: 13px; font-size: 16px; }
@media (max-width: 640px) {
  .sheet { width: 100%; max-width: 100%; max-height: 86vh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
}

/* icon: uploaded image > emoji > first letter on a per-slug colour */
.icon { --size: 72px; width: var(--size); height: var(--size); flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: calc(var(--size) * .24); overflow: hidden; background: var(--bg); }
.icon img { width: 100%; height: 100%; object-fit: cover; }
.icon .emoji { font-size: calc(var(--size) * .55); line-height: 1; }
.icon .letter { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: hsl(var(--hue) 55% 48%); color: #fff; font-weight: 700; font-size: calc(var(--size) * .45); }
.icon-sm { --size: 36px; }

.drop { margin-top: 12px; padding: 36px 16px; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); transition: border-color .12s, background .12s; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop p { margin: 0; }
.link-like { color: var(--accent); cursor: pointer; text-decoration: underline; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.log { list-style: none; padding: 0; margin: 12px 0 0; font-size: 14px; }
.log .ok { color: var(--ok); } .log .err { color: var(--danger); }
.log a { text-decoration: underline; }

button.small { font: inherit; font-size: 13px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); cursor: pointer; margin-left: 6px; }
button.danger { color: var(--danger); }
code { font-size: 13px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.editor { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--fg); padding: 24px; width: min(440px, calc(100vw - 32px)); }
/* Text fields are 16px: iOS zooms in on smaller ones when they get focus, and stays zoomed after.
   While a dialog is open only the dialog scrolls, not the page behind it. */
html:has(dialog[open]) { overflow: hidden; }
dialog { overscroll-behavior: contain; }
.editor::backdrop { background: rgb(0 0 0 / .35); }
.code-shown { font-size: 32px; font-weight: 700; letter-spacing: .3em; text-align: center; margin: 8px 0; font-variant-numeric: tabular-nums; }
.editor h1 { font-size: 20px; margin: 0 0 12px; outline: none; }  /* takes focus when opened: no keyboard, no focus ring */
.editor label { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; font-size: 14px; font-weight: 600; }
.editor label.check { flex-direction: row; font-weight: 400; }
.editor input:not([type=checkbox]):not([type=radio]) { font: inherit; font-size: 16px; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); width: 100%; }
.editor .prefixed { display: flex; align-items: center; gap: 4px; font-weight: 400; }
.editor-preview { display: flex; align-items: center; gap: 12px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.editor-actions .small { margin: 0; padding: 10px 14px; font-size: 14px; }
.err { color: var(--danger); margin: 8px 0 0; min-height: 1em; }
.link-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.link-form span { flex-basis: 100%; }
.link-form input { flex: 1 1 160px; font: inherit; font-size: 16px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.link-form button.small { margin: 0; padding: 7px 12px; font-size: 14px; }
.editor [hidden] { display: none !important; }
.ac-people { margin-top: 8px; padding: 8px 0 0 26px; }
.ac-list { list-style: none; margin: 0 0 4px; padding: 0; max-height: 40vh; overflow: auto; }
.ac-list label.check { margin-top: 6px; overflow-wrap: anywhere; }
.ac-people .link-form { margin-top: 8px; }
.plist { list-style: none; margin: 12px 0 0; padding: 0; }
.plist li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.plist .e { min-width: 0; overflow-wrap: anywhere; }
.plist button.small { margin: 0; flex: none; }

/* ---------------------------------------------------------------- admin: tabs and statistics */
.tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 15px; }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
@media (max-width: 480px) { .tabs { gap: 2px; } .tabs a { padding: 11px; font-size: 14px; } }  /* all four on one line, 44 px high */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 24px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi span { display: block; font-size: 13px; color: var(--muted); }
.kpi b { display: block; font-size: 32px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
#stats .sec { margin-top: 8px; }
.rank { list-style: none; margin: 0 0 16px; padding: 0; }
.rank > li { border-top: 1px solid var(--line); }
.rank summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 0; cursor: pointer; list-style: none; }
.rank summary::-webkit-details-marker { display: none; }
.rank .name { flex: 1 1 auto; font-weight: 600; overflow-wrap: break-word; }  /* a long e-mail pushes .meta onto the next line */
.rank .meta { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.rank .who { font-size: 13px; color: var(--muted); }
.rank .n { min-width: 3ch; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.rank .bar { flex-basis: 100%; height: 8px; }
.rank .bar i { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; background: var(--bar); }
.rank .sub { list-style: none; margin: 0 0 10px; padding: 0; font-size: 14px; }
.rank .sub li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--muted); overflow-wrap: anywhere; }
.icon-xs { --size: 24px; }
.notice { margin: 12px 0 0; }

/* ---------------------------------------------------------------- settings */
.seg { margin: 16px 0 0; padding: 0; border: 0; min-width: 0; }
.seg legend { padding: 0; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.seg .opts { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { flex: 1; position: relative; }
.seg label + label { border-left: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 44px; padding: 0 12px; background: var(--card); color: var(--fg); font-size: 15px; }
.seg input:checked + span { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -4px; }
.setrow { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-top: 16px; padding: 0 4px; border-top: 1px solid var(--line); color: var(--fg); }
.setrow span { color: var(--muted); }

/* ---------------------------------------------------------------- the code lock */
/* type=text, not password: a password field brings the keychain and the wrong keyboard. So the dots come from here. */
.code { width: 100%; font: inherit; font-size: 24px; text-align: center; letter-spacing: .4em; -webkit-text-security: disc; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.code::placeholder { font-size: 16px; letter-spacing: 0; }  /* the spacing is for the dots; a label would not fit */
#lockCard h2, #accountCard h2 { margin: 0 0 4px; font-size: 18px; }
#accountCard .setrow { width: 100%; margin-top: 0; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; text-align: left; cursor: pointer; }
#accountCard .setrow.danger { border-bottom: 0; color: var(--danger); font-weight: 600; }
#deleteDone { margin: 0; color: var(--ok); }
#deleteAsk .code { min-height: 44px; }
#deleteAsk button.primary { background: var(--danger); color: var(--accent-fg); }
#lockCard .muted { margin: 0 0 4px; }
#lockCard form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
#lockCard .code, #lockAsk .code { min-height: 44px; }
#lockCard button.primary { min-height: 44px; }
#lockCard summary { display: flex; align-items: center; min-height: 44px; margin-top: 10px; color: var(--accent); cursor: pointer; }
#lockAsk .code { margin-top: 12px; font-size: 24px; text-align: center; letter-spacing: .4em; }  /* beats .editor input */
#lockAsk .editor-actions button { min-height: 44px; }
.lockscreen { text-align: center; }
.lockscreen h1 { margin: 12px 0 0; overflow-wrap: anywhere; }
.lockscreen p { margin: 4px 0 0; }
.lockscreen form { flex-direction: column; }
.lockback a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }

/* ---------------------------------------------------------------- admin: the app list */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.asearch { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.asearch:focus-within { border-color: var(--accent); }
.asearch input { flex: 1; min-width: 0; min-height: 42px; padding: 0; border: 0; outline: none; appearance: none; background: none; color: var(--fg); font: inherit; font-size: 16px; }  /* 16px: see .editor */
.asearch input::placeholder { color: var(--muted); opacity: 1; }
.acount { margin: 0 2px 8px; }
.alist { list-style: none; margin: 0; padding: 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.alist li { margin-top: -1px; border-top: 1px solid var(--line); }  /* the line above the top row stays clipped, whichever row the search leaves on top */
.aempty { padding: 16px 12px; color: var(--muted); }
.aempty a { color: var(--accent); }
.arow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px; border: 0; background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.arow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) { .arow:hover { background: var(--bg); } }
.arow .txt { flex: 1; min-width: 0; }
.arow b { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.arow small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.arow .claude-warn { display: block; margin: 2px 0 0; min-height: 0; line-height: 1.35; }
.chev { flex: none; color: var(--muted); font-size: 20px; line-height: 1; }

/* ---------------------------------------------------------------- admin: the settings sheet for one app */
#appSheet [hidden] { display: none; }
.view { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.as-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
#asIcon { display: flex; flex: none; }
#asIcon .icon { --size: 52px; }
.as-top .txt { flex: 1; min-width: 0; }
.as-top h1 { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.25; outline: none; overflow-wrap: anywhere; }  /* takes focus when opened: no focus ring on the first row */
.as-top p { margin: 1px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
#asOpen { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 -10px; color: var(--accent); font-size: 14px; }
#asClose { flex: none; width: 44px; height: 44px; margin: -10px -10px 0 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 18px; cursor: pointer; }
.as-group { margin-top: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.set { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--fg); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.set:first-child { border-top: 0; }
.set:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.set em { min-width: 0; color: var(--muted); font-size: 14px; font-style: normal; text-align: right; }
.set input { position: absolute; right: 12px; width: 46px; height: 28px; margin: 0; opacity: 0; cursor: pointer; }
.sw { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); background: color-mix(in srgb, var(--muted) 45%, var(--card)); transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .15s; }
.set input:checked + .sw { background: var(--accent); }
.set input:checked + .sw::after { transform: translateX(18px); background: var(--accent-fg); }
.set input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.as-hint { margin: 6px 2px 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
#asError { margin: 0; min-height: 0; }
#asError:not(:empty) { margin-top: 10px; }
#asDelete { display: block; width: 100%; min-height: 48px; margin-top: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: none; color: var(--danger); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
/* the views in the sheet: the forms keep .editor without its box, and every target is 44 px, as in the main view */
.sheet .editor { border: 0; width: auto; padding: 8px 18px 18px; background: none; }
.sheet .editor, .sheet .editor form { display: flex; flex-direction: column; }
.sheet .editor form { flex: 1 1 auto; }
.sheet .editor p { overflow-wrap: anywhere; }
.sheet .editor label.check { min-height: 44px; margin-top: 0; }
.sheet .editor input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }
.sheet .editor-actions { flex-wrap: wrap; margin-top: auto; padding-top: 20px; }  /* at the bottom when a short view keeps the sheet's height */
.sheet .editor-actions button, .sheet .link-form button { min-height: 44px; }
.view-top { display: flex; align-items: center; gap: 2px; margin: 0 0 8px -12px; }
.view-top h1 { min-width: 0; margin: 0; font-size: 18px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.view-back { flex: none; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 30px; line-height: 1; cursor: pointer; }
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  #appSheet[open] { animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
