:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: #101b2c;
  --panel-2: #152338;
  --line: #263957;
  --text: #edf4ff;
  --muted: #94a8c5;
  --accent: #58d6c7;
  --accent-2: #43a9ff;
  --danger: #ff6f7d;
  --warning: #ffc76a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% 5%, #132a45 0, transparent 34%), var(--bg); color: var(--text); }
a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(480px, 100%); background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: 0 24px 80px #0008; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #05202a; font-weight: 900; }
h1, h2, h3 { margin: 0 0 12px; }
p { color: var(--muted); line-height: 1.6; }
label { display: grid; gap: 7px; margin: 15px 0; color: var(--muted); font-size: 14px; }
.field-hint { color: #7187a6; font-size: 12px; line-height: 1.45; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--text); background: #091425; outline: none; }
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.install-prompt { min-height: 330px; margin: 14px 0; font-size: 13px; white-space: pre; }
input:focus, textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px #43a9ff22; }
.button { border: 0; border-radius: 11px; padding: 12px 16px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #041522; font-weight: 750; }
.button.secondary { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.button.danger { color: white; background: #a8394a; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row > .button { flex: 1; }
.server-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.server-actions .button { width: 100%; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; text-align: center; line-height: 1.25; }
.message { margin: 14px 0; border-radius: 10px; padding: 11px 13px; font-size: 14px; }
.message.error { background: #5b1d2a; color: #ffdce1; }
.message.success { background: #123e3a; color: #cafff7; }
.message.info { background: #173855; color: #d8eeff; }
.message { white-space: pre-line; overflow-wrap: anywhere; }
.error-help-link { display: block; width: fit-content; margin-top: 8px; font-weight: 650; text-underline-offset: 3px; }
.qr { display: block; width: 220px; max-width: 100%; margin: 18px auto; border-radius: 14px; background: white; padding: 8px; }
.secret { padding: 10px; border-radius: 8px; background: #08111e; overflow-wrap: anywhere; text-align: center; font-family: ui-monospace, monospace; }
.code { font-size: 36px; letter-spacing: 8px; text-align: center; font-weight: 800; color: var(--accent); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { border-right: 1px solid var(--line); background: #091321dd; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: grid; gap: 7px; margin-top: 26px; }
.sidebar a { text-decoration: none; padding: 11px 13px; border-radius: 10px; color: var(--muted); }
.sidebar a.active, .sidebar a:hover { color: var(--text); background: var(--panel-2); }
.main { padding: 30px clamp(18px, 4vw, 54px); max-width: 1320px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; gap: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 19px; }
.card p { margin-bottom: 0; }
.card-heading { justify-content: space-between; }
.address-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 0; }
.address-row .address { margin: 0; }
.address-toggle { border: 0; padding: 5px 0; color: var(--accent-2); background: transparent; font-size: 12px; white-space: nowrap; }
.address-toggle:hover { color: var(--accent); }
.server-notes { white-space: pre-wrap; padding: 10px 12px; border-left: 3px solid var(--line); background: #091425; border-radius: 0 8px 8px 0; }
.edit-form, .repair-form, .root-form { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 5px 9px; background: #1b2a40; font-size: 12px; color: var(--muted); }
.status.online, .status.trusted, .status.active { color: #93fae7; background: #123d39; }
.status.pending, .status.installing, .status.uninstalling, .status.upgrade_required { color: var(--warning); background: #493817; }
.status.offline, .status.revoked, .status.failed, .status.uninstall_failed, .status.repair_required { color: #ffadb6; background: #4d2028; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: min(520px, calc(100% - 28px)); }
dialog::backdrop { background: #0009; }
.main { min-width: 0; }
.error-guide { margin-bottom: 18px; }
.error-guide h2 { font-size: 18px; }
.error-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 230px) auto; align-items: end; gap: 16px; margin-top: 12px; }
.error-filters label { margin: 0; }
.error-filters select { font: inherit; width: 100%; min-height: 46px; padding: 12px 13px; color: var(--text); background: #091425; border: 1px solid var(--line); border-radius: 11px; }
.error-results { display: grid; gap: 12px; }
.error-entry { min-width: 0; padding: 0; overflow-wrap: anywhere; }
.error-entry summary { padding: 19px; cursor: pointer; border-radius: 16px; }
.error-entry summary::marker { color: var(--accent); }
.error-entry-heading { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: calc(100% - 22px); vertical-align: middle; }
.error-code { color: var(--accent); font-size: 14px; font-weight: 700; }
.error-entry-title { font-weight: 650; }
.error-entry-summary { display: block; margin-top: 9px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.error-detail { border-top: 1px solid var(--line); padding: 19px; }
.error-detail h3 { font-size: 15px; margin: 0; }
.error-detail ul, .error-detail ol { margin: 10px 0 0; padding-left: 22px; color: var(--muted); line-height: 1.8; }
.error-retry { padding: 12px; background: #091425; border-radius: 10px; }
.error-permalink { display: inline-block; margin-top: 14px; color: var(--accent-2); font-size: 13px; text-underline-offset: 3px; }
.error-empty h2 { font-size: 18px; }
:is(a, button, summary, select):focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; }
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { grid-template-columns: repeat(4, 1fr); overflow-x: auto; }
  .sidebar a[data-page="errors"] { grid-column: 1 / -1; }
  .split { grid-template-columns: 1fr; }
  .server-actions { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .error-filters { grid-template-columns: 1fr; gap: 12px; }
  .error-filters .button { justify-self: start; }
  .error-entry-heading { gap: 8px; }
  .error-entry-heading .status { font-size: 11px; }
}
