/* User portal: warm paper, serif headings, hairlines instead of heavy boxes. The
   CSP forbids inline style attributes and outside fonts, so type comes from
   system stacks and everything visual lives here. */
:root {
  --bg: #faf8f3;
  --surface: #fffdf9;
  --raise: #f1eee6;
  --fg: #26241f;
  --muted: #6b675e;
  --line: #e5e1d6;
  --accent: #b3542f;
  --on-accent: #ffffff;
  --warn: #8a5b12;
  --bad: #a93a26;
  --ok: #3f6b4b;
  --shadow: 0 1px 2px rgb(60 50 30 / 5%);
  --serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", STSong, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e1d1a; --surface: #262521; --raise: #302e29; --fg: #ece8df; --muted: #aaa69b; --line: #3a3832;
    --accent: #dd8a66; --on-accent: #241a14; --warn: #e0b060; --bad: #ec8570; --ok: #8fbf9b; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1e1d1a; --surface: #262521; --raise: #302e29; --fg: #ece8df; --muted: #aaa69b; --line: #3a3832;
  --accent: #dd8a66; --on-accent: #241a14; --warn: #e0b060; --bad: #ec8570; --ok: #8fbf9b; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2.section, .notice h2, .hero h2, .signin-head h1, .legal h2, .stat strong, .card-title { font-family: var(--serif); }
h1 { font-size: 30px; line-height: 1.25; margin: 0; font-weight: 500; letter-spacing: -.005em; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mark { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); flex: none; display: inline-block; }
.mark.small { width: 11px; height: 11px; }

/* Motion stays small: content rises a few pixels as it appears. Hiding and
   showing a page restarts it. Lists that re-render on a timer don't animate,
   so polling can't make them flicker. */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.page, .legal, .hero-inner, .signin-box { animation: rise .28s var(--ease) both; }
#connect, #login-box, .once { animation: rise .2s var(--ease) both; }
body, .top, .panel, .card, .notice, .signin, .btn, .provider, input, select { transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.card, .provider { transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .18s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}

/* Login: an introduction beside the sign-in box. The box comes first on phones. */
.login { min-height: 100vh; display: flex; flex-wrap: wrap-reverse; }
.hero { flex: 3 1 480px; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 48px max(24px, 5vw); }
.hero-inner { width: 100%; max-width: 540px; }
.eyebrow { color: var(--muted); font-size: 13px; }
.hero h2 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.25; font-weight: 500; margin: 14px 0 14px; letter-spacing: -.01em; }
.lead { margin: 0 0 32px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 32px; }
.features li { border-top: 1px solid var(--line); padding: 14px 0 18px; }
.features strong { display: block; font-weight: 600; margin-bottom: 2px; }
.features span { color: var(--muted); font-size: 14px; }

.signin { flex: 2 1 380px; min-width: 0; background: var(--surface); border-left: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.signin-box { width: 100%; max-width: 330px; }
.signin-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.signin-head h1 { font-size: 22px; }
.signin-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.providers { display: flex; flex-direction: column; gap: 10px; }
.provider { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-weight: 500; }
.provider:hover { border-color: var(--muted); transform: translateY(-1px); }
.fine { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.alert { margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); font-size: 14px; }
.dev { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.dev label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }

.top { display: flex; align-items: center; gap: 0 28px; padding: 6px max(16px, 4vw); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }
.brand { font-family: var(--serif); font-size: 18px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.brand.plain { color: var(--fg); text-decoration: none; min-height: 44px; }
nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; order: 3; flex: 1 1 100%; }
@media (min-width: 880px) { nav { order: 0; flex: 0 1 auto; } }
.tab { position: relative; min-height: 44px; display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; white-space: nowrap; transition: color .18s ease; }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 1.5px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .24s var(--ease); }
.tab:hover { color: var(--fg); }
.tab[aria-current="page"] { color: var(--fg); }
.tab[aria-current="page"]::after { transform: scaleX(1); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.theme { display: inline-flex; gap: 2px; }
.theme button { border: 0; border-radius: 8px; background: none; color: var(--muted); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; transition: background-color .18s ease, color .18s ease; }
.theme button:hover { color: var(--fg); }
.theme button[aria-pressed="true"] { background: var(--raise); color: var(--fg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--raise); color: var(--fg); display: flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 600; font-size: 13px; }
main { padding: 44px max(16px, 4vw) 72px; max-width: 980px; margin: 0 auto; }
.page { display: flex; flex-direction: column; gap: 18px; }
.page h1 { margin-bottom: -10px; }
.page-sub { margin: 0; color: var(--muted); }
#hosting { display: flex; flex-direction: column; gap: 18px; }
h2.section { font-size: 22px; font-weight: 500; margin: 26px 0 -10px; }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 40px 28px; text-align: center; }
.notice h2 { font-size: 20px; font-weight: 500; margin: 0; }
.notice p { margin: 10px 0 0; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card.waiting { border-color: var(--warn); }
.card.add { border-style: dashed; background: none; box-shadow: none; text-align: left; font: inherit; color: var(--fg); cursor: pointer; justify-content: center; min-height: 136px; }
.card.add:hover { border-color: var(--muted); transform: translateY(-1px); }
.card.add strong { font-family: var(--serif); font-weight: 500; font-size: 17px; }
.card.add span { color: var(--muted); font-size: 13px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-title { font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.card-kicker { color: var(--accent); font-size: 12px; }
.card-note { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.card-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.state { font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.state.ok { color: var(--ok); } .state.warn { color: var(--warn); } .state.bad { color: var(--bad); }
.base { display: flex; align-items: center; gap: 6px; min-width: 0; }
.base code { overflow-wrap: anywhere; color: var(--muted); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.login-box ol { margin: 0 0 14px; padding-left: 20px; }
.login-box li { margin-bottom: 10px; overflow-wrap: anywhere; }
.code-big { font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.field { color: var(--muted); font-size: 12px; width: 64px; flex: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 32px; border-top: 1px solid var(--line); }
.stat { padding: 16px 0; border-bottom: 1px solid var(--line); }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { font-size: 30px; line-height: 1.3; font-weight: 500; font-variant-numeric: tabular-nums; }
.rows { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.rows > div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.rows > div:nth-last-child(-n+2) { border-bottom: 0; }
.rows .k { color: var(--muted); }
.rows .v { text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.row-action { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-action h2 { margin-bottom: 2px; }
.row-action .hint { margin: 0; }
.doc .panel h2 { font-family: var(--serif); font-size: 18px; font-weight: 500; margin: 2px 0 6px; }
.doc .panel p { margin: 0 0 12px; }
.doc pre { margin: 0; padding: 14px; background: var(--raise); border-radius: 10px; overflow-x: auto; font: 12.5px/1.7 var(--mono); }
.doc code { background: var(--raise); padding: 1px 5px; border-radius: 4px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.hint { margin: -4px 0 10px; color: var(--muted); font-size: 14px; }
.form ~ .hint { margin: 14px 0 0; }

.btn { border: 1px solid var(--line); background: var(--surface); min-height: 44px; padding: 0 16px; border-radius: 10px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 500; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
.btn.danger { color: var(--bad); }
.btn.confirm { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; white-space: nowrap; flex: none; }
.btn.inline { display: inline-flex; align-items: center; text-decoration: none; }
.form { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
input[type=email], .form input:not([type]), select { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 0 12px; }
input[type=email] { width: 100%; }
.form input:not([type]) { width: 240px; max-width: 100%; }
select { min-width: 200px; max-width: 100%; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { color: var(--muted); font-size: 13px; padding: 0; margin-bottom: 4px; }
.form fieldset label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; color: var(--fg); font-size: 14px; margin-right: 14px; min-height: 44px; }
input[type=radio] { accent-color: var(--accent); }
.once { margin-top: 16px; padding: 14px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 10%, transparent); }
.once p { margin: 0 0 8px; }
.copyrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.copyrow code { background: var(--surface); padding: 6px 10px; border-radius: 8px; word-break: break-all; user-select: all; flex: 1 1 240px; }
code { font-family: var(--mono); font-size: 13px; }
.empty { color: var(--muted); padding: 18px 0; margin: 0; text-align: center; }

.legal { max-width: 700px; line-height: 1.8; }
.legal h1 { margin-bottom: 8px; }
.legal h2 { font-size: 19px; font-weight: 500; margin: 30px 0 8px; }
.legal p { margin: 0 0 10px; }
.legal ul { margin: 0 0 10px; padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal .hint { margin: 0 0 8px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 14px; z-index: 5; animation: toast-in .2s var(--ease) both; }
