/* 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: 22px; }
.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 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; }
.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; }
}
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); }
