:root {
  --bg: #fff; --text: #1a1a1a; --muted: #737373; --line: #e5e5e5; --soft: #f5f5f5;
  --accent: #1a1a1a; --accent-text: #fff; --red: #c62828; --green: #2e7d32;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141414; --text: #ededed; --muted: #9a9a9a; --line: #2b2b2b; --soft: #1e1e1e;
    --accent: #ededed; --accent-text: #141414; --red: #ef7070; --green: #6cc070; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
.hidden { display: none !important; }
a { color: inherit; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 20px; }
h2 { font-size: 15px; font-weight: 600; margin: 32px 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.err { color: var(--red); font-size: 14px; }
.ok { color: var(--green); }
.grow { flex: 1; }
code, pre { font: 13px ui-monospace, Consolas, monospace; }

input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--text); outline-offset: -1px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.btn { padding: 8px 16px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn:hover { border-color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link:hover { color: var(--text); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input, .row select { width: auto; margin: 0; }
.row .grow { min-width: 180px; }

/* sign-in */
.auth { max-width: 340px; margin: 12vh auto; padding: 0 16px; }
.auth .brand { font-weight: 700; margin-bottom: 32px; }
.auth .btn.primary { width: 100%; margin-top: 4px; }
.auth .err { margin-top: 12px; }
.code { font: 22px ui-monospace, Consolas, monospace; letter-spacing: 6px; text-align: center; margin-bottom: 14px; }
.qr { width: 220px; margin: 8px auto 16px; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 6px; }
.manual { margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.manual summary { cursor: pointer; }
.manual .secret { margin-top: 8px; color: var(--text); }
.secret { font: 16px ui-monospace, Consolas, monospace; background: var(--soft); padding: 12px; border-radius: 6px; text-align: center; word-break: break-all; }

/* layout */
.top { display: flex; align-items: center; gap: 28px; max-width: 760px; margin: 0 auto; padding: 18px 16px; flex-wrap: wrap; }
.top .brand { font-weight: 700; text-decoration: none; }
#tabs { display: flex; gap: 20px; flex: 1; }
#tabs a, .subnav a { text-decoration: none; color: var(--muted); }
#tabs a.active, .subnav a.active { color: var(--text); text-decoration: underline; text-underline-offset: 6px; }
.who { color: var(--muted); font-size: 14px; }
.notice { max-width: 760px; margin: 0 auto 8px; padding: 10px 16px; font-size: 14px; background: var(--soft); border-radius: 6px; }
.notice.bad { color: var(--red); }
.page { max-width: 760px; margin: 0 auto; padding: 16px 16px 80px; }

/* block */
.drop { border: 1.5px dashed var(--muted); border-radius: 8px; padding: 56px 16px; text-align: center; cursor: pointer; }
.drop:hover, .drop.over, .drop:focus-visible { border-color: var(--text); outline: none; }
.drop-main { font-size: 17px; font-weight: 500; margin-bottom: 4px; }
.drop .muted { margin: 0; }
.ready { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 12px 14px; background: var(--soft); border-radius: 8px; }

/* lists */
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); }
.list td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.list .num { font-family: ui-monospace, Consolas, monospace; }
.list .right { text-align: right; white-space: nowrap; }
.list .small, .small { font-size: 13px; color: var(--muted); }
.list tr.click { cursor: pointer; }
.list tr.click:hover td { background: var(--soft); }
.list td.detail { padding: 4px 0 14px; color: var(--muted); font-size: 13px; }
.list td.detail div { font-family: ui-monospace, Consolas, monospace; }
.list .empty { color: var(--muted); padding: 20px 0; }
.good { color: var(--green); }
.bad { color: var(--red); }
#p-history .list { margin-top: 16px; }

/* admin */
.subnav { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; font-size: 14px; }
.sub > h2:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid.one { grid-template-columns: 1fr; }
.note { padding: 10px 14px; border-radius: 6px; background: var(--soft); }
.note.good { color: var(--text); border-left: 3px solid var(--green); }
.note.bad { border-left: 3px solid var(--red); }
.copy { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy code { background: var(--soft); padding: 8px 10px; border-radius: 6px; overflow-wrap: anywhere; }
pre { background: var(--soft); padding: 14px; border-radius: 6px; overflow-x: auto; white-space: pre; }
#new-key code { display: block; margin: 8px 0; font-size: 14px; overflow-wrap: anywhere; }
.narrow { max-width: 360px; }
#a-keys .list, #a-users .list, #a-safelist .list { margin-top: 16px; }
#safe-form textarea { margin-bottom: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-size: 14px; max-width: calc(100vw - 32px); }

@media (max-width: 600px) {
  .top { gap: 12px 20px; }
  .who { width: 100%; order: 3; }
  .grid { grid-template-columns: 1fr; }
  .list th:nth-child(4), .list td:nth-child(4), #p-history .list th:nth-child(5), #p-history .list td:nth-child(5) { display: none; }
}
