:root {
  --bg: #0e0e10;
  --panel: #18181b;
  --panel-2: #222227;
  --line: #2e2e35;
  --text: #f2f2f4;
  --muted: #9a9aa5;
  --accent: #e5484d;
  --accent-soft: #3b1a1c;
  --ok: #46a758;
  --warn: #f5a524;
  --radius: 14px;
  --tap: 44px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(14, 14, 16, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo { background: var(--accent); color: #fff; border-radius: 7px; width: 26px; height: 26px; display: grid; place-items: center; font-size: 12px; }
main { max-width: 720px; margin: 0 auto; padding: 18px 16px 96px; }
[hidden] { display: none !important; }
h1 { font-size: 24px; margin: 4px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { color: var(--muted); margin: 0 0 18px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.card.tight { padding: 12px 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

label.field { display: block; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
input[type=text], input[type=password], input[type=email], input[type=url], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button.danger { color: #ff8b8f; }
button.icon { width: var(--tap); padding: 0; font-size: 18px; }
button:disabled { opacity: 0.45; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns.end { justify-content: flex-end; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.chip.ok { color: #8fe0a0; border-color: #24502d; background: #12261a; }
.chip.warn { color: #ffd38a; border-color: #5a4313; background: #271d08; }

.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; user-select: none; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.toggle.on { border-color: var(--accent); background: var(--accent-soft); }

.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--panel-2); flex: none; }
.avatar.sm { width: 36px; height: 36px; }
.thumb { width: 96px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; }
.dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; color: #fff; }

.channel { border-top: 1px solid var(--line); padding: 12px 0; }
.channel:first-child { border-top: 0; padding-top: 2px; }
.channel .title { font-weight: 600; }
.details { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.pl { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pl:first-child { border-top: 0; }
.pl.hidden .thumb, .pl.hidden .pl-text { opacity: 0.4; }
.pl-text { flex: 1; min-width: 0; }
.pin.on { color: var(--warn); border-color: #5a4313; }

.list-link { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.code { font: 600 28px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.12em; }
.copy { display: flex; gap: 8px; }
.copy input { font-size: 14px; }

.warnbox { border: 1px solid #5a4313; background: #271d08; color: #ffe2a8; border-radius: 12px; padding: 12px 14px; }
.okbox { border: 1px solid #24502d; background: #12261a; color: #c4f2cd; border-radius: 12px; padding: 12px 14px; }
.diff { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.diff b { font-weight: 600; }

.savebar { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 6; padding: 10px 16px; background: rgba(24, 24, 27, 0.96); border-top: 1px solid var(--line); display: flex; justify-content: center; gap: 10px; }
.savebar[hidden] { display: none; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(14, 14, 16, 0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; border-radius: 10px; }
.tabs a span { font-size: 20px; line-height: 1; }
.tabs a.active { color: var(--text); background: var(--panel); }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(140px + env(safe-area-inset-bottom)); z-index: 9; max-width: calc(100% - 32px); background: #2a2a31; border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); }
#toast.error { border-color: #6b2125; background: #2a1214; }

.login { max-width: 380px; margin: 12vh auto 0; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
details > summary { cursor: pointer; color: var(--muted); }
@media (min-width: 760px) {
  body { padding-bottom: 24px; }
  .tabs { position: sticky; top: 61px; bottom: auto; max-width: 720px; margin: 0 auto; grid-template-columns: repeat(3, auto); justify-content: start; gap: 6px; background: transparent; border: 0; backdrop-filter: none; padding: 12px 16px 0; }
  .tabs a { flex-direction: row; padding: 8px 14px; font-size: 14px; }
  .tabs a span { font-size: 16px; }
  .savebar { bottom: 0; }
  #toast { bottom: 80px; }
}
