/* Login, registration and admin pages served by server/server.py (Apple-like, 04.10.2026). */
:root {
  color-scheme: light dark;
  --bg: #f5f5f7; --panel: #ffffff; --field: #ffffff; --fill: rgb(118 118 128 / 0.12); --fill-strong: rgb(120 120 128 / 0.2);
  --ink: #1d1d1f; --muted: #6e6e73; --line: #d2d2d7; --separator: rgb(60 60 67 / 0.13);
  --accent: #0071e3; --accent-hover: #0077ed; --accent-soft: rgb(0 113 227 / 0.12); --danger: #d70015; --ok: #248a3d;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 24px rgb(0 0 0 / 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --panel: #1c1c1e; --field: #2c2c2e; --fill: rgb(118 118 128 / 0.24); --fill-strong: rgb(120 120 128 / 0.36);
    --ink: #f5f5f7; --muted: #98989d; --line: #424245; --separator: rgb(84 84 88 / 0.55);
    --accent: #0a84ff; --accent-hover: #409cff; --accent-soft: rgb(10 132 255 / 0.2); --danger: #ff6961; --ok: #30d158;
    --shadow: 0 0 0 1px rgb(255 255 255 / 0.06);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.47; letter-spacing: -0.011em; -webkit-font-smoothing: antialiased;
}
main { max-width: 1100px; margin: 0 auto; padding: 32px 20px 48px; }
h1 { margin: 0 0 20px; font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
h2 { margin: 36px 0 10px; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 12px; }
code { font: 0.9em ui-monospace, "SF Mono", Menlo, monospace; background: var(--fill); padding: 1px 6px; border-radius: 6px; }

/* Sign-in and registration: one centred card. */
.login main {
  max-width: 400px; margin: max(6vh, 32px) auto 32px; background: var(--panel); border-radius: 22px; padding: 36px 28px 28px;
  box-shadow: var(--shadow); text-align: center;
}
.login main::before {
  content: ""; display: block; width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 14px;
  background: radial-gradient(circle at 50% 50%, transparent 9px, #fff 9.5px, #fff 13px, transparent 13.5px),
    linear-gradient(135deg, #2997ff, #0058d1);
}
.login h1 { font-size: 1.75rem; margin-bottom: 6px; }
.login .lede { margin: 0 0 22px; color: var(--muted); font-size: 0.95rem; }
.login form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.login input {
  font: inherit; font-weight: normal; font-size: 1.05rem; padding: 12px 14px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.login label[hidden], .login p[hidden] { display: none; }
.login select { font-size: 1.05rem; font-weight: normal; padding: 12px 38px 12px 14px; border-radius: 12px; background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; }
.login input[readonly] { color: var(--muted); background: var(--fill); }
.login .forgot { text-align: left; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--separator); }
.login .forgot h2 { margin: 0 0 6px; font-size: 1rem; }
.login .forgot p { margin: 0; }
table.invites code { font-size: 1em; }
.login small { font-weight: normal; color: var(--muted); font-size: 0.8rem; }
.login button[type="submit"] { margin-top: 6px; padding: 13px 18px; font-size: 1.05rem; }

button {
  font: inherit; padding: 9px 18px; border-radius: 980px; border: 0; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
button:hover { background: var(--accent-hover); }
button:active { transform: scale(0.98); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.secondary, td button { background: var(--fill); color: var(--accent); }
button.secondary:hover, td button:hover { background: var(--fill-strong); }
td button { padding: 5px 12px; font-weight: 500; font-size: 0.9rem; }

.error { color: var(--danger); margin: 0 0 14px; }
.ok { color: var(--ok); margin: 0 0 14px; }
.note { color: var(--muted); font-size: 0.92em; }
/* «Logg ut» on the page for choosing one's own password: a form button that looks like a link */
button.linklike, .login button.linklike[type="submit"], button.linklike:hover {
  background: none; border: 0; margin: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer;
}
.small { font-size: 0.9em; color: var(--muted); margin: 20px 0 0; }

/* Admin: tables as inset grouped lists. */
table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); font-size: 0.95rem;
}
th { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: var(--panel); }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--separator); }
tr:last-child td { border-bottom: 0; }
td.text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 520px; }
select {
  font: inherit; color: var(--ink); padding: 6px 30px 6px 10px; border: 1px solid var(--line); border-radius: 8px; background-color: var(--field);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
@media (max-width: 700px) {
  table, thead, tbody, tr, td, th { display: block; } thead { display: none; }
  td { border: 0; padding: 4px 14px; } tr { border-bottom: 1px solid var(--separator); padding: 10px 0; }
  tr:last-child { border-bottom: 0; }
}
/* Usage statistics: last 30 days, then the total in grey; on phones each number gets its label */
table.usage .total { color: var(--muted); font-size: 0.9em; }
table.usage tr.sum td { font-weight: 600; border-bottom: 0; }
@media (max-width: 700px) {
  table.usage td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--muted); }
  table.usage td:first-child { font-weight: 700; }
}
details { margin: 12px 0 0; }
summary { cursor: pointer; color: var(--accent); }
.log { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
@media (max-width: 700px) {
  table.shared td:nth-child(1) { font-weight: 700; display: inline-block; padding-right: 0; }
  table.shared td:nth-child(2) { display: inline-block; }
  table.shared td:nth-child(2)::before { content: "→ "; }
  table.shared td:nth-child(3), table.shared td:nth-child(4) { display: inline-block; color: var(--muted); font-size: .9em; padding-top: 0; }
  table.shared td:nth-child(5) { padding-top: 2px; }
}
.code {
  font: 600 1.4rem ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; background: var(--panel); color: var(--ink);
  border: 1.5px dashed var(--accent); border-radius: 12px; padding: 12px 16px; display: inline-block;
}
.code[hidden] { display: none; }

/* Admin: edit, add and remove users. */
h3 { margin: 24px 0 8px; font-size: 1.05rem; }
input[type="text"], input[type="password"] {
  font: inherit; color: var(--ink); padding: 6px 10px; background: var(--field); border: 1px solid var(--line); border-radius: 8px; min-width: 0;
}
input[type="text"]:focus, input[type="password"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
table.users td input[data-name] { width: 100%; }
table.users td.actions { white-space: nowrap; }
.user-add { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--panel); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.user-add label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
dialog { border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); padding: 20px; max-width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; }
table.suggest tr.ready td { background: var(--accent-soft); }

/* «Glemt passord»: the three steps (ask, wait, answer) and the admin list of requests. */
.recover section[hidden], .recover form[hidden], .recover button[hidden] { display: none; }
.recover section { text-align: left; }
.recover .state { font-weight: 700; font-size: 1.15rem; margin: 0 0 6px; text-align: center; }
.recover .state[data-state="pending"]::before { content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 8px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: rc-spin 1s linear infinite; vertical-align: -0.08em; }
.recover .state[data-state="denied"], .recover .state[data-state="closed"], .recover .state[data-state="expired"] { color: var(--danger); }
.recover section .lede { text-align: center; }
.recover section button { display: block; margin: 0 auto; }
.recover .question { margin: 0; padding: 12px 14px; font-weight: 600; background: var(--fill); border-radius: 12px; }
.recover .error { margin: 14px 0 0; text-align: left; font-weight: 600; }
.recover .error.info { color: var(--muted); font-weight: normal; }
@keyframes rc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .recover .state[data-state="pending"]::before { animation: none; } }
table.lists td.actions { white-space: nowrap; }
table.lists td.actions button + button { margin-left: 6px; }
table.lists tr[data-editing] td { background: var(--surface, transparent); }
table.lists input, table.lists textarea { width: 100%; box-sizing: border-box; font: inherit; }
table.lists textarea { min-height: 7em; }
table.recovery td.actions { white-space: nowrap; }
table.recovery td.actions button + button { margin-left: 6px; }
table.recovery td button:not(.secondary) { background: var(--accent); color: #fff; }
table.recovery td button:not(.secondary):hover { background: var(--accent-hover); }
table.recovery tr[data-status="pending"] td:nth-child(3) { font-weight: 700; }

.login label.remember { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
.login label.remember input { width: 20px; height: 20px; flex: none; padding: 0; }
.login label.remember small { color: var(--muted); }

/* Phones: all tables show the column heading before each value (the first cell is the title and stays bold). */
@media (max-width: 700px) {
  table:not(.usage):not(.shared) td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; color: var(--muted); }
  table:not(.usage):not(.shared) td:first-child { font-weight: 700; }
  table.lists td.actions, table.users td.actions { white-space: normal; }
}
/* Practice-list editor and the month badge. */
.badge { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; }
div.editor { display: grid; gap: 10px; }
div.editor .field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; }
div.editor .field small { font-weight: 400; color: var(--muted); }
div.editor .field[hidden] { display: none; }
table.lists input[type="text"], table.lists input[type="number"], table.lists input[type="date"], table.lists textarea, table.lists select {
  font: inherit; color: var(--ink); padding: 6px 10px; background-color: var(--field); border: 1px solid var(--line); border-radius: 8px; min-width: 0;
}
@media (min-width: 701px) { div.editor { grid-template-columns: repeat(2, minmax(0, 1fr)); } div.editor .field.wide { grid-column: 1 / -1; } }

/* Status cards, jump menu and collapsible sections (admin pages). */
nav.cards { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
a.card { display: inline-flex; gap: 6px; align-items: baseline; background: var(--panel); color: var(--ink); text-decoration: none; border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow); font-size: .9rem; }
a.card strong { font-size: 1.1rem; }
a.card.attention { box-shadow: inset 0 0 0 2px var(--accent); }
nav.jump { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; background: var(--bg, Canvas); white-space: nowrap; }
nav.jump a { background: var(--fill); color: var(--accent); text-decoration: none; border-radius: 999px; padding: 4px 12px; font-size: .9rem; }
details.sec { margin: 18px 0 0; border-top: 1px solid var(--separator); }
details.sec > summary { cursor: pointer; list-style: none; color: inherit; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary h2 { display: inline-block; margin: 14px 0 8px; }
details.sec > summary::before { content: "▸ "; color: var(--muted); }
details.sec[open] > summary::before { content: "▾ "; }
details.help { margin: 0 0 10px; }
details.help > summary { font-size: .9rem; }
h2[id], h3[id] { scroll-margin-top: 56px; }

/* Receipts, danger buttons, filters and the calendar for «månedens tegn». */
.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 520px; margin: 0 auto; z-index: 20; background: var(--panel); color: var(--ink); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); border-left: 4px solid var(--ok); opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; pointer-events: auto; }
.toast.error { border-left-color: var(--danger); }
button.danger, td button.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
button.danger:hover, td button.danger:hover { background: var(--danger); color: #fff; }
tr[hidden] { display: none !important; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.filters input[type="search"] { flex: 1 1 220px; font: inherit; color: var(--ink); padding: 6px 10px; background: var(--field); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.calendar { margin: 8px 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.calendar h3 { grid-column: 1 / -1; margin: 8px 0 0; }
.month { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); align-items: flex-start; }
.month small { color: var(--muted); }
.month.missing { box-shadow: inset 0 0 0 2px var(--accent); }
.month.missing span { color: var(--accent); font-weight: 600; }
.month.draft span { color: var(--muted); }
table.texts td.actions { white-space: nowrap; }
table.texts td.actions button + button { margin-left: 6px; }
table.texts input[type="text"], table.texts textarea, table.texts select { font: inherit; color: var(--ink); padding: 6px 10px; background-color: var(--field); border: 1px solid var(--line); border-radius: 8px; min-width: 0; width: 100%; box-sizing: border-box; }
table.texts textarea { min-height: 10em; }
@media (max-width: 700px) { table.texts td.actions { white-space: normal; } }
small.preview { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
th.sortable[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
details.old { margin-top: 18px; }
details.bulk { margin: 0 0 16px; }
details.bulk textarea { width: 100%; box-sizing: border-box; font: inherit; color: var(--ink); padding: 6px 10px; background: var(--field); border: 1px solid var(--line); border-radius: 8px; }
details.bulk select, details.bulk input[type="number"] { font: inherit; color: var(--ink); padding: 6px 10px; background-color: var(--field); border: 1px solid var(--line); border-radius: 8px; }
.calendar button.more { grid-column: 1 / -1; justify-self: start; }
