:root {
  --bg: #0b0e13;
  --sidebar: #0d1117;
  --panel: #11161e;
  --panel-2: #151b24;
  --panel-3: #1a212c;
  --input: #0c1117;
  --result: #0a0f15;
  --border: #2a3442;
  --text: #f5f7fa;
  --text-strong: #ffffff;
  --text-soft: #d4dbe4;
  --muted: #a4afbd;
  --eyebrow: #9aa6b5;
  --table-head: #a5afbc;
  --accent: #5b8cff;
  --accent-2: #82a8ff;
  --success: #43d19e;
  --danger: #ff7c89;
  --shadow: 0 20px 60px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 245px; flex: 0 0 245px; border-right: 1px solid var(--border); background: var(--sidebar); padding: 20px 14px; display: flex; flex-direction: column; }
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 8px 24px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--text-strong); font-weight: 800; }
.brand-name { font-size: 14px; font-weight: 750; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.nav-label, .eyebrow { color: var(--eyebrow); letter-spacing: .12em; font-size: 10px; font-weight: 750; }
.nav-label { padding: 0 10px 8px; }
.nav-item { width: 100%; border: 0; background: transparent; color: var(--text-soft); border-radius: 9px; padding: 10px 11px; display: flex; gap: 10px; align-items: center; text-align: left; margin: 2px 0; }
.nav-item:hover:not(.disabled), .nav-item.active { background: var(--panel-2); color: var(--text-strong); }
.nav-item.active { box-shadow: inset 2px 0 0 var(--accent); }
.nav-item.disabled { opacity: .42; cursor: not-allowed; }
.nav-icon { width: 18px; text-align: center; }
.sidebar-bottom { margin-top: auto; }
.connection-pill { margin: 8px 5px 0; border: 1px solid var(--border); background: var(--panel); border-radius: 9px; padding: 8px 9px; color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 7px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #6c7684; }
.status-dot.ok { background: var(--success); }
.status-dot.bad { background: var(--danger); }
.main { flex: 1; min-width: 0; }
.topbar { padding: 31px 34px 23px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
h1 { font-size: 27px; margin: 5px 0 5px; letter-spacing: -.03em; }
h2 { font-size: 17px; margin: 5px 0 0; }
h3 { margin: 0 0 6px; font-size: 15px; }
.topbar p, .panel-empty p { color: var(--muted); margin: 0; font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; }
.secondary-btn { background: var(--panel-2); color: var(--text-soft); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; }
.secondary-btn:hover { background: var(--panel-3); }
.secondary-btn.small { padding: 7px 10px; font-size: 11px; }
.account-bar { margin: 22px 34px 0; padding: 14px 16px; border: 1px solid var(--border); background: var(--panel); border-radius: 12px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.account-select-wrap { min-width: 270px; }
label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
select, input, textarea { width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; outline: none; }
select:focus, input:focus, textarea:focus { border-color: #5f8fff; }
.muted { color: var(--muted); font-size: 11px; }
.notice { margin: 14px 34px 0; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); font-size: 12px; }
.notice.success { border-color: rgba(67,209,158,.35); background: rgba(67,209,158,.08); }
.notice.error { border-color: rgba(255,111,125,.35); background: rgba(255,111,125,.08); }
.hidden { display: none !important; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; padding: 24px 34px 40px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.section-note { color: var(--muted); font-size: 11px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.action-card { min-height: 135px; text-align: left; position: relative; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 12px; padding: 17px; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.action-card:hover { transform: translateY(-1px); border-color: #465568; background: var(--panel-2); }
.action-card .star { position: absolute; right: 12px; top: 10px; color: #ffd76b; font-size: 12px; }
.action-icon { font-size: 21px; color: var(--accent-2); }
.action-card strong { font-size: 13px; }
.action-card small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.zones-heading { margin-top: 28px; }
.table-card { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); font-size: 11px; }
th { color: var(--table-head); font-weight: 650; background: rgba(255,255,255,.015); }
td { color: var(--text-soft); }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 26px; }
.details-panel { border: 1px solid var(--border); background: var(--panel); border-radius: 12px; min-height: 520px; overflow: hidden; box-shadow: var(--shadow); }
.panel-empty { min-height: 520px; display: grid; place-items: center; align-content: center; text-align: center; padding: 40px; }
.empty-icon { width: 52px; height: 52px; border-radius: 15px; background: var(--panel-3); display: grid; place-items: center; font-size: 24px; margin-bottom: 15px; color: var(--accent-2); }
.panel-inner { padding: 20px; }
.panel-inner .panel-title { margin: 5px 0 5px; font-size: 17px; }
.panel-inner .panel-description { color: var(--muted); font-size: 11px; line-height: 1.5; margin-bottom: 20px; }
.form-group { margin-bottom: 12px; }
.primary-btn { width: 100%; border: 0; border-radius: 8px; padding: 10px 12px; background: var(--accent); color: var(--text-strong); font-weight: 700; margin-top: 5px; }
.primary-btn:hover { background: var(--accent-2); }
.danger-btn { background: transparent; color: var(--danger); border: 1px solid rgba(255,111,125,.25); }
.result-box { margin-top: 15px; background: var(--result); border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 260px; overflow: auto; }
.result-box pre { margin: 0; white-space: pre-wrap; word-break: break-word; color: #d1d9e3; font-size: 10px; line-height: 1.45; }
.inline-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help { color: var(--muted); font-size: 10px; line-height: 1.45; margin-top: 5px; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(620px, calc(100vw - 30px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.modal-header h2 { font-size: 18px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 24px; }
#modalBody { padding: 20px; }
.badge { display: inline-block; padding: 4px 7px; border-radius: 999px; font-size: 9px; background: rgba(67,209,158,.1); color: var(--success); }
@media (max-width: 1050px) {
  .content-grid { grid-template-columns: 1fr; }
  .details-panel { min-height: 0; }
  .panel-empty { min-height: 240px; }
}
@media (max-width: 800px) {
  .sidebar { width: 190px; flex-basis: 190px; }
  .content-grid, .topbar { padding-left: 18px; padding-right: 18px; }
  .account-bar, .notice { margin-left: 18px; margin-right: 18px; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-item.disabled { display: none; }
  .action-grid { grid-template-columns: 1fr; }
  .account-bar { align-items: stretch; flex-direction: column; }
}

.settings-body { padding: 20px; }
.settings-section { padding: 0 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: 0; margin-bottom: 0; }
.settings-title { font-size: 13px; font-weight: 750; margin-bottom: 6px; }
.settings-help { color: var(--muted); font-size: 11px; line-height: 1.5; margin-bottom: 14px; }
.security-status { border: 1px solid var(--border); background: var(--input); border-radius: 8px; padding: 10px; color: var(--muted); font-size: 11px; }
.login-screen { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 20px; }
.login-card { width: min(390px, 100%); border: 1px solid var(--border); background: var(--panel); border-radius: 14px; padding: 30px; box-shadow: var(--shadow); }
.login-mark { margin-bottom: 18px; }
.login-card h1 { font-size: 24px; margin: 6px 0; }
.login-card p { color: var(--muted); font-size: 12px; margin: 0 0 22px; }
.login-help { color: var(--eyebrow); font-size: 10px; line-height: 1.5; margin-top: 14px; text-align: center; }
.login-error { margin-top: 10px; border: 1px solid rgba(255,111,125,.35); background: rgba(255,111,125,.08); color: #ff9da7; border-radius: 8px; padding: 9px; font-size: 11px; }


/* Appearance themes */
html[data-theme="light"] {
  --bg: #f5f7fa;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel-2: #f0f3f7;
  --panel-3: #e7ecf2;
  --input: #ffffff;
  --result: #f3f6f9;
  --border: #d5dce5;
  --text: #17202b;
  --text-strong: #101720;
  --text-soft: #354252;
  --muted: #5e6b7a;
  --eyebrow: #596779;
  --table-head: #526070;
  --shadow: 0 18px 50px rgba(30,45,65,.12);
}
html[data-theme="light"] .modal-backdrop { background: rgba(15,23,35,.42); }
html[data-theme="light"] .nav-item:hover:not(.disabled),
html[data-theme="light"] .nav-item.active { color: var(--text-strong); }
html[data-theme="light"] .notice.success { background: rgba(28,166,117,.08); }
html[data-theme="light"] .notice.error { background: rgba(210,55,70,.08); }
html[data-theme="light"] .security-status { background: #f4f6f8; }
html[data-theme="light"] .badge { background: rgba(28,166,117,.10); }

.theme-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-option { border: 1px solid var(--border); background: var(--panel-2); color: var(--text-soft); border-radius: 8px; padding: 9px 12px; font-size: 11px; font-weight: 700; }
.theme-option:hover { border-color: var(--accent); }
.theme-option.active { background: var(--accent); border-color: var(--accent); color: #fff; }
