/* Ring admin page: the same tokens as the apps (Theme v5), light + dark. No gradients. */
:root {
  --canvas: #f2f3f7; --surface: #fff; --fill: #f0f1f5; --line: #e9eaf0; --stroke: #e2e4eb;
  --text: #0f1117; --text-muted: #6a7083; --text-faint: #a4a9b7;
  --accent: #5a4bf5; --on-accent: #fff; --accent-soft: #eeecff; --on-accent-soft: #3e31c9;
  --danger: #e5483d; --danger-soft: #fdecea; --success: #1dae6e; --inverse: #1b1d24; --on-inverse: #fff;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0a0b0f; --surface: #14161c; --fill: #262a34; --line: #23262f; --stroke: #2f323c;
    --text: #f1f2f6; --text-muted: #8d93a4; --text-faint: #5b6070;
    --accent: #7c70ff; --accent-soft: #221f45; --on-accent-soft: #bdb6ff;
    --danger: #ff6a5e; --danger-soft: #341a19; --success: #34d08a; --inverse: #edeef3; --on-inverse: #111318;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--canvas); color: var(--text); font: 400 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: var(--text-faint); }

.mark { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 26px; }
.mark.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }

.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--stroke); border-radius: 24px; padding: 28px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.card .mark { align-self: center; }
.card h1 { text-align: center; font-size: 22px; margin: 6px 0 8px; }
.error { color: var(--danger); font-size: 14px; text-align: center; }

.field input, .search, textarea {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--fill); border: 1px solid var(--stroke); outline: none;
}
textarea { height: auto; padding: 12px 14px; resize: vertical; }
.field input:focus, .search:focus, textarea:focus { border-color: var(--accent); }

.btn {
  height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid transparent; background: var(--accent); color: var(--on-accent);
  font-weight: 600; cursor: pointer; transition: transform 160ms cubic-bezier(.3, 1.6, .5, 1), filter 140ms;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 14px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--stroke); }
.btn.ghost { background: none; color: var(--text-muted); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-soft { background: var(--danger-soft); color: var(--danger); }
.right { margin-left: auto; }

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.side { background: var(--surface); border-right: 1px solid var(--stroke); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 0 8px 14px; }
.tab { text-align: left; border: none; background: none; padding: 10px 12px; border-radius: 12px; cursor: pointer; font-weight: 500; color: var(--text); }
.tab:hover { background: var(--fill); }
.tab.on { background: var(--accent-soft); color: var(--on-accent-soft); }
.tab.danger { color: var(--danger); }
.grow { flex: 1; }
.page { padding: 28px clamp(16px, 4vw, 40px); max-width: 1100px; width: 100%; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page h2 { font-size: 26px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.badge { font-size: 13px; font-weight: 600; background: var(--fill); color: var(--text-muted); border-radius: 10px; padding: 2px 9px; }
.muted { color: var(--text-muted); }

.stats { display: flex; gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--stroke); border-radius: 20px; padding: 16px 22px; display: flex; flex-direction: column; }
.stat span { font-size: 30px; font-weight: 700; }
.stat small { color: var(--text-muted); }
.group { background: var(--surface); border: 1px solid var(--stroke); border-radius: 20px; overflow: hidden; }
.group.pad { padding: 20px; display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.row { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; cursor: pointer; }
.row + .row { border-top: 1px solid var(--line); }

.switch { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--fill); border: 1px solid var(--stroke); position: relative; cursor: pointer; transition: background 160ms; margin: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform 180ms cubic-bezier(.3, 1.4, .5, 1); }
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--stroke); border-radius: 18px; overflow: hidden; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: none; }
.table.mono td { font-family: var(--mono); font-size: 13px; }
.id { font-family: var(--mono); font-size: 12.5px; color: var(--text-muted); }
.pager { display: flex; gap: 8px; }

.inline { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.inline select { width: auto; }
.group.pad.code-new { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.code-new code { font-family: var(--mono); font-size: 20px; letter-spacing: 0.06em; user-select: all; }
.compose { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.list li { background: var(--surface); border: 1px solid var(--stroke); border-radius: 18px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.list li p { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; }
.list li time { color: var(--text-muted); font-size: 13px; white-space: nowrap; }

.dialog { border: 1px solid var(--stroke); border-radius: 24px; background: var(--surface); color: var(--text); padding: 24px; width: min(400px, calc(100% - 32px)); }
.dialog::backdrop { background: rgb(9 10 16 / .45); }
.dialog h3 { font-size: 19px; margin-bottom: 6px; }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions .btn { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--inverse); color: var(--on-inverse); padding: 10px 18px; border-radius: 16px; font-size: 14px; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--stroke); }
  .brand { width: 100%; padding-bottom: 6px; }
  .grow { display: none; }
  .table thead { display: none; }
  .table td { display: block; border-bottom: none; padding: 4px 14px; }
  .table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
}

/* Servers tab */
tr.click { cursor: pointer; }
tr.click:hover td { background: color-mix(in srgb, var(--text) 4%, transparent); }
.row-check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 14px; white-space: nowrap; }
#srv-detail h4 { margin: 18px 0 8px; }
#srv-detail .wipe { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
