:root {
  color-scheme: dark;
  --bg: #0d1117; --panel: #151b23; --panel2: #1c2430; --line: #2a3442;
  --text: #dde5ee; --muted: #8a97a8; --accent: #FDB813; --accent-ink: #1a1400;
  --ok: #3fb950; --warn: #d29922; --err: #f85149;
  --bar-h: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .grow { flex: 1; }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 24px; }

button, select, input, textarea {
  font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px;
}
button { cursor: pointer; }
button:hover { border-color: var(--muted); }
button.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost, a.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover, a.ghost:hover { color: var(--text); text-decoration: none; }
button.danger { color: var(--err); }
button:disabled { opacity: .5; cursor: default; }
input, textarea { width: 100%; }
label { display: block; margin: 8px 0; color: var(--muted); font-size: 12px; }
label > input, label > textarea, label > select { margin-top: 3px; color: var(--text); font-size: 14px; }
label.chk { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
label.chk input { width: auto; }
kbd { border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-size: 11px; }

#bar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 10; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; white-space: nowrap; }
.brand svg { width: 34px; height: 17px; }
#bar nav { display: flex; gap: 2px; }
#bar nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); }
#bar nav a.on, #bar nav a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
#sitePick { max-width: 280px; }
#accountLink { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 8px; }

#main { padding-top: var(--bar-h); min-height: 100%; }
#main.viewer { height: 100%; }
#main.viewer iframe { display: block; width: 100%; height: calc(100vh - var(--bar-h)); border: 0; background: #000; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 60px; }
.page h2 { margin: 4px 0 16px; font-size: 20px; }
.page h3 { margin: 28px 0 10px; font-size: 15px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex;
  flex-direction: column; gap: 6px; min-height: 130px; }
.card b { font-size: 16px; }
.card .grow { flex: 1; }
.card a.open { align-self: flex-start; background: var(--accent); color: var(--accent-ink); padding: 6px 14px;
  border-radius: 6px; font-weight: 600; }
.card a.open:hover { text-decoration: none; filter: brightness(1.08); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--panel2); }
tr:last-child td { border-bottom: 0; }
td .row { justify-content: flex-end; }
.tablewrap { overflow-x: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.form .row > label { flex: 1; min-width: 160px; margin: 0; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: var(--panel2);
  border: 1px solid var(--line); margin: 1px 2px 1px 0; }
.tag.ok { color: var(--ok); border-color: #2a5532; } .tag.warn { color: var(--warn); border-color: #5a4a20; }
.tag.err { color: var(--err); border-color: #5a2a2a; } .tag.acc { color: var(--accent); border-color: #5a4a10; }
.banner { background: #2a2210; border: 1px solid #5a4a10; color: var(--accent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.site-block { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 18px; }
.site-block table { background: var(--bg); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.secret { font-size: 15px; letter-spacing: 1px; background: var(--panel2); padding: 8px 10px; border-radius: 6px; word-break: break-all; }

#drawer { position: fixed; top: var(--bar-h); right: 0; bottom: 0; width: min(380px, 100vw); background: var(--panel);
  border-left: 1px solid var(--line); z-index: 9; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,.4); }
.drawer-head, .drawer-foot { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-foot { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.drawer-body { padding: 4px 14px 14px; overflow: auto; flex: 1; }
.drawer-body h4 { margin: 18px 0 2px; font-size: 13px; }
.drawer-body p { margin: 4px 0 8px; }
.chips { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.chips li { display: flex; gap: 6px; align-items: center; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 6px 4px 8px; font-size: 12px; }
.chips li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips li em { color: var(--muted); font-style: normal; }
.chips li button { padding: 0 6px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 20;
  transition: all .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { border-color: var(--err); color: #ffb3ad; }

@media (max-width: 760px) {
  .brand span, #bar nav { display: none; }
  #bar { gap: 4px; padding: 0 6px; }
  #sitePick { max-width: 45vw; }
}
