:root {
  color-scheme: dark;
  --bg: #090d14;
  --surface: #101722;
  --surface-2: #151e2b;
  --line: #263245;
  --text: #eef4ff;
  --muted: #8998ad;
  --accent: #ff6b2c;
  --accent-2: #ff8f59;
  --green: #46d394;
  --red: #ff5c6c;
  --blue: #5f8fff;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background:
  radial-gradient(circle at 12% -10%, rgba(255, 107, 44, .14), transparent 28rem),
  radial-gradient(circle at 90% 10%, rgba(95, 143, 255, .08), transparent 24rem), var(--bg); }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar { height: 72px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.07); background: rgba(9,13,20,.88); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand > span:last-child { display: grid; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg, var(--accent-2), var(--accent)); color: #fff; font-weight: 900; font-size: 27px; box-shadow: 0 14px 35px rgba(255,107,44,.22); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 19px; }
.top-actions, .control-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.service-pill { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.service-pill > span { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px currentColor; }
.service-pill.online > span { background: var(--green); }

.container { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 70px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 48px); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
h3 { margin-bottom: 5px; font-size: 16px; }
.eyebrow { margin-bottom: 8px; color: var(--accent-2); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.muted { color: var(--muted); }

.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 14px; color: #fff; cursor: pointer; font-weight: 700; font-size: 12px; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--accent); }
.button.primary:hover { background: var(--accent-2); }
.button.secondary { background: var(--surface-2); border-color: var(--line); }
.button.success { background: rgba(70,211,148,.12); border-color: rgba(70,211,148,.35); color: #7be9b9; }
.button.danger { background: rgba(255,92,108,.1); border-color: rgba(255,92,108,.3); color: #ff8994; }
.button.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.button.compact { padding: 8px 11px; }
.button.full { width: 100%; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { min-height: 132px; padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(21,30,43,.95), rgba(13,20,30,.95)); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-card .stat-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { margin-top: auto; font-size: 34px; letter-spacing: -.04em; }
.stat-card strong small { color: var(--muted); font-size: 17px; }
.stat-card strong.text-value { font-size: 20px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card > span:last-child { margin-top: 4px; color: var(--muted); font-size: 11px; }

.main-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(340px, .8fr); gap: 18px; align-items: start; }
.side-stack { display: grid; gap: 18px; position: sticky; top: 92px; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: rgba(16,23,34,.94); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { min-height: 76px; padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.path-chip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.settings-form { padding: 20px; }

label { display: grid; gap: 7px; }
label > span:first-child { color: #bec9d8; font-size: 11px; font-weight: 700; }
label small { color: var(--muted); font-size: 10px; }
input, select { width: 100%; min-height: 41px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #0c121b; color: var(--text); transition: border-color .16s ease, box-shadow .16s ease; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,107,44,.12); }
.field-grid { display: grid; gap: 15px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid .wide { grid-column: 1 / -1; }

.toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 22px; }
.toggle-card { padding: 12px; border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px; cursor: pointer; background: rgba(255,255,255,.01); }
.toggle-card input { display: none; }
.toggle-card > span:last-child { display: grid; gap: 3px; }
.toggle-card strong { font-size: 12px; }
.toggle-card small { line-height: 1.35; }
.toggle-ui { width: 34px; height: 19px; padding: 2px; border-radius: 999px; background: #344052; transition: background .18s; }
.toggle-ui::after { content: ""; display: block; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .18s; }
.toggle-card input:checked + .toggle-ui { background: var(--accent); }
.toggle-card input:checked + .toggle-ui::after { transform: translateX(15px); }

.subsection-heading { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.subsection-heading p { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.rotation-list { display: grid; gap: 9px; margin-top: 14px; }
.rotation-row { display: grid; grid-template-columns: 24px minmax(0,1fr) 130px 34px; align-items: end; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #0d141e; }
.drag-handle { align-self: center; color: #526176; letter-spacing: -4px; user-select: none; }
.icon-button { width: 34px; height: 41px; border: 1px solid rgba(255,92,108,.25); border-radius: 8px; color: #ff8994; background: rgba(255,92,108,.08); font-size: 22px; cursor: pointer; }
.form-actions { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

.log-panel .panel-heading { min-height: 70px; }
.log-view { height: 480px; margin: 0; padding: 17px; overflow: auto; background: #080d13; color: #a9b8ca; font: 10.5px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; scrollbar-color: #344052 #080d13; }
.password-panel form { padding: 18px; }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 17px; }

.alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.alert.success { color: #8becc1; border-color: rgba(70,211,148,.3); background: rgba(70,211,148,.08); }
.alert.error { color: #ff9aa4; border-color: rgba(255,92,108,.3); background: rgba(255,92,108,.08); }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(420px, 100%); }
.login-card { padding: 38px; border: 1px solid var(--line); border-radius: 20px; background: rgba(16,23,34,.96); box-shadow: 0 35px 120px rgba(0,0,0,.48); }
.login-card .brand-mark { margin-bottom: 28px; }
.login-card h1 { font-size: 34px; margin-bottom: 8px; }
.login-card .muted { font-size: 13px; margin-bottom: 26px; }
.secure-note { margin: 20px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.secure-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--green); }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .main-grid { grid-template-columns: 1fr; }
  .side-stack { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 66px; padding: 12px 16px; }
  .service-pill { display: none; }
  .container { width: min(100% - 24px, 1480px); padding-top: 24px; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .stats-grid, .side-stack, .field-grid.two, .toggle-grid { grid-template-columns: 1fr; }
  .rotation-row { grid-template-columns: 18px 1fr 34px; }
  .rotation-row label:nth-of-type(2) { grid-column: 2 / 3; }
  .rotation-row .icon-button { grid-column: 3; grid-row: 1 / 3; align-self: center; }
  .form-actions { display: grid; }
  .log-view { height: 360px; }
  .login-card { padding: 28px 22px; }
}
