:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #111620;
  --panel-2: #171d29;
  --line: #242d3d;
  --text: #f6f8fc;
  --muted: #8e9aae;
  --accent: #ff3158;
  --accent-2: #ff6c43;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100svh; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.offline-banner { position: fixed; z-index: 100; top: 0; inset-inline: 0; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; text-align: center; background: var(--warn); color: #17130a; font-size: 12px; font-weight: 800; }
.login-view { min-height: 100svh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 22px calc(24px + var(--safe-bottom)); background: radial-gradient(circle at 50% 4%, #3b1521 0, #111019 28%, var(--bg) 62%); }
.login-card { width: min(100%, 420px); }
.brand-mark { width: 68px; height: 68px; display: grid; place-items: center; margin-bottom: 34px; border-radius: 22px; background: linear-gradient(145deg, var(--accent), var(--accent-2)); box-shadow: 0 16px 50px #ff315844; transform: rotate(-5deg); }
.brand-mark span { font-size: 34px; font-weight: 950; transform: rotate(5deg); }
.eyebrow { margin: 0 0 7px; font-size: 11px; letter-spacing: .2em; font-weight: 900; color: var(--accent); }
h1 { margin: 0; font-size: clamp(30px, 10vw, 44px); line-height: 1; letter-spacing: -.045em; }
h1 em { color: var(--accent); font-style: normal; }
h2, h3, p { margin-top: 0; }
.muted { color: var(--muted); }
.login-card > .muted { margin: 12px 0 32px; }
label { display: block; margin: 0 0 18px; color: #cbd3df; font-size: 13px; font-weight: 750; }
input { width: 100%; margin-top: 8px; padding: 15px 16px; color: var(--text); background: #0e131c; border: 1px solid var(--line); border-radius: 14px; outline: none; -webkit-appearance: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #ff315822; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check-row input { width: 20px; height: 20px; margin: 0; padding: 0; accent-color: var(--accent); }
button { border: 0; cursor: pointer; }
.primary, .secondary, .danger, .small-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 45px; padding: 0 16px; border-radius: 13px; font-weight: 850; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 28px #ff31582b; }
.full { width: 100%; justify-content: space-between; min-height: 54px; padding-inline: 19px; }
.secondary { background: var(--panel-2); border: 1px solid var(--line); }
.danger { background: var(--bad); color: #21070d; }
.form-error { margin: 15px 0 0; color: var(--bad); font-size: 13px; }
.secure-note { margin-top: 24px; color: #5f6b7e; text-align: center; font-size: 11px; }

.app-view { min-height: 100svh; padding-bottom: calc(86px + var(--safe-bottom)); }
.app-shell { min-width: 0; }
.desktop-sidebar { display: none; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(18px + env(safe-area-inset-top)) 18px 14px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(24px); border-bottom: 1px solid #ffffff08; }
.topbar h1 { font-size: 26px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.spinning svg { animation: spin .7s linear infinite; }
.server-badge { display: flex; align-items: center; gap: 7px; max-width: 112px; padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 10px; font-weight: 850; white-space: nowrap; overflow: hidden; }
.server-badge span { overflow: hidden; text-overflow: ellipsis; }
.server-badge i { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.server-badge.online i { background: var(--good); box-shadow: 0 0 12px var(--good); }
.server-badge.offline i { background: var(--bad); }

.content { max-width: 780px; margin: auto; padding: 18px 16px 28px; }
.hero { position: relative; overflow: hidden; padding: 22px; border-radius: 22px; background: linear-gradient(135deg, #32121d 0%, #1a1620 50%, #111923 100%); border: 1px solid #ff315833; }
.hero::after { content: "G"; position: absolute; right: -13px; bottom: -45px; font-size: 150px; font-weight: 950; color: #ffffff07; transform: rotate(-10deg); }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero h2 { margin-bottom: 5px; font-size: 25px; letter-spacing: -.03em; }
.hero p { margin: 0; font-size: 13px; }
.health-ring { position: relative; z-index: 1; flex: 0 0 auto; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--good) var(--health), #283141 0); }
.health-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #171923; }
.health-ring b { position: relative; font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.stat-card { padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); }
.stat-card .label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.stat-card strong { font-size: 26px; letter-spacing: -.04em; }
.stat-card small { margin-left: 5px; color: var(--muted); }
.section { margin-top: 24px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.section-heading button { padding: 4px; background: transparent; color: var(--accent); font-size: 12px; font-weight: 800; }
.list { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.list-item { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item-main { flex: 1; min-width: 0; }
.list-item h3 { margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.list-item p { margin: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.avatar, .item-icon { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: #242c3a; color: #dce3ed; font-weight: 900; }
.avatar.admin { background: #ff315823; color: var(--accent); }
.item-icon svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.status-pill { flex: 0 0 auto; padding: 6px 8px; border-radius: 999px; background: #2a3342; color: #aeb8c7; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.status-pill.good { background: #34d3991a; color: var(--good); }
.status-pill.warn { background: #fbbf241a; color: var(--warn); }
.status-pill.bad { background: #fb71851a; color: var(--bad); }
.small-button { flex: 0 0 auto; min-height: 34px; padding-inline: 11px; border: 1px solid var(--line); background: #202837; font-size: 11px; }
.small-button.accent { color: var(--accent); border-color: #ff315855; background: #ff315814; }
.small-button.bad { color: var(--bad); border-color: #fb718555; background: #fb718512; }
.small-button:disabled { opacity: .55; cursor: default; }
.action-strip { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 14px 14px 66px; border-bottom: 1px solid var(--line); }
.action-strip:last-child { border-bottom: 0; }
.progress { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #2c3544; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--text); }
.page-intro { margin: 1px 2px 16px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.key-value { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 14px; border-bottom: 1px solid var(--line); }
.key-value:last-child { border-bottom: 0; }
.key-value span { color: var(--muted); font-size: 12px; }
.key-value b { max-width: 60%; text-align: right; overflow-wrap: anywhere; font-size: 12px; }
.menu-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 15px 14px; background: transparent; border-bottom: 1px solid var(--line); text-align: left; }
.menu-row:last-child { border-bottom: 0; }
.menu-row > span { flex: 1; font-weight: 750; }
.menu-row > b { color: var(--muted); font-size: 18px; }
.menu-row.danger-text { color: var(--bad); }
.power-zone { border-color: #fb718544; background: linear-gradient(180deg, #25131a, var(--panel)); }
.power-zone .menu-row { color: #ffc7d1; }
.faceid-card { padding: 18px; }
.faceid-state { display: flex; align-items: center; gap: 14px; }
.faceid-symbol { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 17px; background: #38bdf81a; color: #7dd3fc; font-size: 25px; }
.faceid-copy { flex: 1; }
.faceid-copy h3 { margin: 0 0 4px; }
.faceid-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.skeleton { min-height: 68px; background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.tabbar { position: fixed; z-index: 20; bottom: 0; inset-inline: 0; height: calc(72px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 5px var(--safe-bottom); background: #0d111aeF; border-top: 1px solid var(--line); backdrop-filter: blur(24px); }
.tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; background: transparent; color: #6f7b8d; font-size: 9px; font-weight: 750; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button:first-child svg { fill: currentColor; stroke: none; }
.tabbar button.active { color: var(--accent); }
.tabbar b { position: absolute; top: 1px; right: calc(50% - 20px); min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 99px; background: var(--accent); color: white; font-size: 9px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(90px + var(--safe-bottom)); max-width: calc(100% - 32px); padding: 12px 16px; transform: translateX(-50%); border-radius: 13px; background: #edf2f7; color: #151922; box-shadow: 0 12px 40px #0008; font-size: 12px; font-weight: 800; }
dialog { padding: 0; border: 0; border-radius: 22px; color: var(--text); background: transparent; }
dialog::backdrop { background: #000a; backdrop-filter: blur(8px); }
.dialog-card { width: min(88vw, 390px); padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); text-align: center; }
.dialog-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: #fb71851c; color: var(--bad); font-weight: 950; }
.dialog-icon.form { background: #ff31581c; color: var(--accent); }
.dialog-card h2 { margin-bottom: 8px; }
.dialog-card p { line-height: 1.5; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
.dialog-phrase { margin: 16px 0 0; text-align: left; }
.dialog-phrase span { display: block; margin-bottom: 6px; color: var(--warn); font-size: 11px; }
.form-fields { margin-top: 18px; text-align: left; }
.form-fields label { margin-bottom: 13px; }
.form-fields input { margin-top: 6px; }
.form-fields .check-row input { width: 20px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (min-width: 680px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .tabbar { left: 50%; right: auto; width: min(640px, 100%); transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; }
}
@media (min-width: 960px) {
  body { background: #0a0e15; }
  .app-view { display: grid; grid-template-columns: 264px minmax(0, 1fr); padding: 0; }
  .desktop-sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; padding: 22px 16px 18px; background: #0c1119; border-right: 1px solid var(--line); overflow-y: auto; }
  .desktop-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
  .sidebar-logo { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; background: linear-gradient(145deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px #ff315833; font-size: 22px; font-weight: 950; }
  .desktop-brand strong, .desktop-brand span { display: block; }
  .desktop-brand strong { font-size: 17px; letter-spacing: .02em; }
  .desktop-brand span { margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .18em; }
  .desktop-nav { flex: 1; }
  .desktop-nav > p { margin: 18px 10px 7px; color: #586579; font-size: 9px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
  .desktop-nav button { position: relative; width: 100%; display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 0 11px; border-radius: 12px; background: transparent; color: #8e9aae; text-align: left; font-size: 12px; font-weight: 730; transition: .15s ease; }
  .desktop-nav button:hover { color: var(--text); background: #151c27; }
  .desktop-nav button.active { color: #fff; background: linear-gradient(90deg, #ff315820, #ff315808); box-shadow: inset 3px 0 var(--accent); }
  .desktop-nav button.active .nav-symbol { color: var(--accent); }
  .desktop-nav button > span:nth-child(2) { flex: 1; }
  .desktop-nav button b { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border-radius: 999px; background: var(--accent); color: white; font-size: 9px; }
  .nav-symbol { width: 21px; color: #6e7b8e; text-align: center; font-size: 15px; }
  .desktop-sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: 22px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
  .desktop-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; }
  .desktop-user > div { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: #ff31581b; color: var(--accent); font-weight: 900; }
  .desktop-user span { min-width: 0; }
  .desktop-user strong, .desktop-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-user strong { font-size: 11px; }
  .desktop-user small { margin-top: 3px; color: var(--muted); font-size: 8px; }
  .sidebar-logout { width: 32px; height: 32px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 17px; }
  .sidebar-logout:hover { background: #fb718519; color: var(--bad); }
  .app-shell { min-height: 100svh; }
  .topbar { padding: 25px 34px 19px; background: #0a0e15e8; }
  .topbar h1 { font-size: 31px; }
  .server-badge { max-width: 190px; padding-inline: 13px; font-size: 11px; }
  .content { max-width: 1440px; padding: 28px 34px 54px; }
  .hero { padding: 29px 31px; border-radius: 24px; }
  .hero h2 { font-size: 31px; }
  .health-ring { width: 72px; height: 72px; }
  .stat-grid { gap: 14px; margin-top: 16px; }
  .stat-card { min-height: 111px; padding: 21px; border-radius: 18px; }
  .stat-card strong { font-size: 31px; }
  .dashboard-lower { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 18px; align-items: start; }
  .section { margin-top: 27px; }
  .list { border-radius: 19px; }
  .list-item { min-height: 76px; padding: 15px 18px; }
  .list-item h3 { font-size: 14px; }
  .list-item p { font-size: 12px; }
  .action-strip { padding: 11px 18px 15px 76px; }
  .key-value { padding: 17px 18px; }
  .page-intro { max-width: 820px; font-size: 14px; }
  .tabbar { display: none; }
  .toast { bottom: 28px; }
  .dialog-card { width: min(440px, 90vw); }
}
@media (min-width: 1280px) {
  .app-view { grid-template-columns: 282px minmax(0, 1fr); }
  .desktop-sidebar { padding-inline: 20px; }
  .topbar { padding-inline: 42px; }
  .content { padding-inline: 42px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; } }
