:root {
  color-scheme: dark;
  --bg: #080b14;
  --bg-soft: #0d1220;
  --panel: rgba(17, 23, 39, .78);
  --panel-solid: #111827;
  --panel-2: rgba(24, 32, 53, .72);
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.14);
  --text: #f6f7fb;
  --muted: #8f9bb3;
  --violet: #866dff;
  --violet-2: #5d7bff;
  --cyan: #48d8e8;
  --green: #4de0a5;
  --coral: #ff806e;
  --amber: #f7b955;
  --shadow: 0 26px 80px rgba(0,0,0,.32);
  --radius: 22px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fb;
  --bg-soft: #edf0f8;
  --panel: rgba(255,255,255,.82);
  --panel-solid: #fff;
  --panel-2: rgba(245,247,252,.9);
  --line: rgba(29,39,64,.09);
  --line-strong: rgba(29,39,64,.15);
  --text: #141928;
  --muted: #68738c;
  --shadow: 0 24px 70px rgba(45,55,85,.12);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overflow-x: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.ambient { position: fixed; width: 680px; height: 680px; border-radius: 50%; filter: blur(120px); opacity: .16; pointer-events: none; z-index: 0; }
.ambient-one { background: #664cff; top: -330px; left: 18%; }
.ambient-two { background: #00c2d9; right: -380px; top: 32%; opacity: .11; }
.shell { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 22px; background: rgba(8, 12, 23, .76); border-right: 1px solid var(--line); backdrop-filter: blur(26px); }
:root[data-theme="light"] .sidebar { background: rgba(250,251,255,.8); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 8px; }
.brand > span:last-child { display: grid; line-height: 1.2; }
.brand strong { font-size: 15px; letter-spacing: -.02em; }
.brand small { color: var(--muted); margin-top: 5px; font-size: 11px; }
.brand-mark { position: relative; width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.16); border-radius: 13px; background: linear-gradient(145deg, rgba(134,109,255,.95), rgba(70,106,255,.72)); box-shadow: 0 12px 30px rgba(92,81,255,.32), inset 0 1px rgba(255,255,255,.3); overflow: hidden; }
.brand-mark i { position: absolute; width: 18px; height: 2px; background: #fff; border-radius: 2px; transform-origin: left center; }
.brand-mark i:nth-child(1) { transform: translate(-5px,5px) rotate(-54deg); }
.brand-mark i:nth-child(2) { transform: translate(0,-5px) rotate(40deg); width: 14px; }
.brand-mark i:nth-child(3) { transform: translate(7px,-2px) rotate(-70deg); width: 11px; }

.nav { margin-top: 46px; display: grid; gap: 7px; }
.nav p { margin: 20px 13px 7px; color: #65718a; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.nav a { position: relative; display: flex; align-items: center; gap: 13px; padding: 12px 13px; color: #a7b1c6; border: 1px solid transparent; border-radius: 13px; transition: .2s ease; }
.nav a span { width: 19px; color: #8390aa; font-size: 17px; text-align: center; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav a.active { color: #fff; background: linear-gradient(110deg, rgba(119,94,255,.26), rgba(67,103,255,.1)); border-color: rgba(132,111,255,.25); box-shadow: inset 3px 0 var(--violet); }
:root[data-theme="light"] .nav a.active { color: #3b2ca5; }
.sidebar-foot { margin-top: auto; padding: 18px 12px 0; border-top: 1px solid var(--line); }
.sidebar-foot small { display: block; color: var(--muted); margin-top: 9px; font-size: 11px; }
.connection { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgba(255,128,110,.1); }
.connection i.online { background: var(--green); box-shadow: 0 0 0 4px rgba(77,224,165,.11), 0 0 18px rgba(77,224,165,.45); }

.main { min-width: 0; padding: 28px 34px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.topbar h1 { margin: 2px 0 0; font-size: 27px; letter-spacing: -.035em; }
.eyebrow { margin: 0; color: #77839b; font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions form { margin: 0; }
.icon-button, .user-chip { border: 1px solid var(--line); color: var(--text); background: var(--panel); cursor: pointer; transition: .2s; }
.icon-button { width: 40px; height: 40px; border-radius: 13px; font-size: 17px; }
.user-chip { width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 700; background: linear-gradient(145deg, var(--violet), #416ff4); box-shadow: 0 8px 22px rgba(91,89,255,.3); }
.icon-button:hover, .user-chip:hover { transform: translateY(-1px); border-color: var(--line-strong); }

.mode-banner { min-height: 82px; display: flex; align-items: center; gap: 15px; padding: 16px 18px; margin-bottom: 18px; border: 1px solid rgba(247,185,85,.23); border-radius: 18px; background: linear-gradient(95deg, rgba(89,62,19,.48), rgba(78,51,17,.22)); }
.mode-banner.live { border-color: rgba(77,224,165,.28); background: linear-gradient(95deg, rgba(18,81,62,.5), rgba(12,61,53,.18)); }
.mode-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 43px; border-radius: 14px; color: var(--amber); background: rgba(247,185,85,.11); font-size: 19px; }
.mode-banner.live .mode-icon { color: var(--green); background: rgba(77,224,165,.11); }
.mode-banner strong { display: block; font-size: 14px; }
.mode-banner p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.mode-banner .ghost-button { margin-left: auto; }
.ghost-button, .period-chip, .status-pill { border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.035); color: #b8c1d4; }
.ghost-button { padding: 10px 14px; cursor: pointer; }
.ghost-button:hover { color: var(--text); border-color: var(--line-strong); }
.period-chip, .status-pill { padding: 7px 10px; font-size: 11px; }
.status-pill.ok { color: var(--green); border-color: rgba(77,224,165,.23); background: rgba(77,224,165,.08); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric, .panel { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.metric { position: relative; min-height: 154px; padding: 18px; border-radius: 18px; overflow: hidden; }
.metric:after { content: ""; position: absolute; width: 100px; height: 100px; right: -48px; top: -47px; border-radius: 50%; background: var(--glow, var(--violet)); opacity: .08; filter: blur(3px); }
.metric p { margin: 17px 0 4px; color: #9ba6bc; font-size: 11px; }
.metric strong { display: block; font-size: 28px; letter-spacing: -.04em; }
.metric small { color: #6f7b94; font-size: 10px; }
.metric-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-weight: 700; }
.metric-icon.violet { color: #ab9aff; background: rgba(134,109,255,.13); --glow: var(--violet); }
.metric-icon.cyan { color: var(--cyan); background: rgba(72,216,232,.11); --glow: var(--cyan); }
.metric-icon.green { color: var(--green); background: rgba(77,224,165,.11); --glow: var(--green); }
.metric-icon.coral { color: var(--coral); background: rgba(255,128,110,.11); --glow: var(--coral); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .8fr); gap: 14px; margin-bottom: 14px; }
.panel { border-radius: var(--radius); }
.chart-panel, .import-panel, .page-panel, .settings-card { padding: 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-head h2, .safety-panel h2 { margin: 3px 0 0; font-size: 16px; letter-spacing: -.02em; }
.chart-wrap { width: 100%; height: 265px; padding-top: 14px; }
.chart-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-area { fill: url(#chartGradient); opacity: .34; }
.chart-line { fill: none; stroke: #8e79ff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 4px 8px rgba(134,109,255,.42)); }
.chart-point { fill: #a798ff; stroke: var(--panel-solid); stroke-width: 3; }
.chart-label { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.chart-foot span { display: flex; align-items: center; gap: 7px; }
.chart-foot strong { color: var(--text); font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.violet-bg { background: var(--violet); box-shadow: 0 0 10px rgba(134,109,255,.55); }

.import-panel { display: flex; flex-direction: column; }
.radar { width: 30px; height: 30px; border: 1px solid rgba(72,216,232,.22); border-radius: 50%; background: radial-gradient(circle, rgba(72,216,232,.23) 0 12%, transparent 13% 42%, rgba(72,216,232,.1) 43% 47%, transparent 48%); }
.import-empty { flex: 1; display: grid; justify-items: center; align-content: center; gap: 18px; min-height: 255px; text-align: center; color: var(--muted); font-size: 12px; }
.import-empty p { max-width: 270px; margin: 0; }
.orbit { position: relative; width: 92px; height: 92px; display: grid; place-items: center; border: 1px solid rgba(134,109,255,.22); border-radius: 50%; }
.orbit:after { content: ""; position: absolute; inset: 13px; border: 1px dashed rgba(72,216,232,.22); border-radius: 50%; }
.orbit span { width: 43px; height: 43px; z-index: 1; display: grid; place-items: center; color: #b7aaff; border-radius: 14px; background: rgba(134,109,255,.13); font-size: 16px; font-weight: 750; }
.orbit i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px rgba(72,216,232,.7); }
.orbit i:first-child { top: 4px; left: 28px; }.orbit i:nth-child(2) { right: 7px; bottom: 21px; background: var(--violet); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 15px; min-height: 44px; padding: 0 17px; border: 0; border-radius: 13px; color: #fff; background: linear-gradient(110deg, #795fff, #4f79ff); box-shadow: 0 12px 30px rgba(91,89,255,.26); font-weight: 700; cursor: pointer; transition: .2s; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(91,89,255,.35); }
.primary-button:disabled { opacity: .43; cursor: not-allowed; transform: none; box-shadow: none; }
.primary-button.full { width: 100%; }
.import-progress { flex: 1; padding: 55px 2px 25px; }
.progress-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.progress-row strong { color: var(--text); }
.progress { height: 8px; margin: 10px 0 27px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.06); }
.progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .35s; }
.mini-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.mini-stats div { padding: 12px 6px; text-align: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.mini-stats strong { display: block; font-size: 16px; }.mini-stats span { color: var(--muted); font-size: 9px; }
.hidden { display: none !important; }

.upcoming-panel { overflow: hidden; }
.upcoming-panel > .panel-head, .page-panel > .panel-head { padding: 20px 20px 16px; }
.page-panel > .panel-head { padding: 0 0 20px; }
.text-link { color: #a999ff; font-size: 11px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { padding: 12px 18px; color: #68758e; background: rgba(255,255,255,.025); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 9px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 15px 18px; border-bottom: 1px solid var(--line); color: #c6cddd; font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.018); }
.client-cell { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; }
.avatar { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: #b5a7ff; background: rgba(134,109,255,.12); font-size: 10px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 99px; color: #b7aaff; background: rgba(134,109,255,.1); font-size: 9px; }
.tag.warn { color: var(--amber); background: rgba(247,185,85,.1); }.tag.ok { color: var(--green); background: rgba(77,224,165,.1); }.tag.stop { color: var(--coral); background: rgba(255,128,110,.1); }
.empty-cell { height: 100px; text-align: center; color: var(--muted); }
.page-panel { min-height: calc(100vh - 140px); }
.search { display: flex; align-items: center; gap: 8px; min-width: 260px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.search span { color: var(--muted); }.search input { width: 100%; height: 39px; border: 0; outline: 0; color: var(--text); background: transparent; }
.section-copy { max-width: 720px; margin: 12px 0 22px; color: var(--muted); font-size: 12px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-card { min-height: 420px; }
.stack-form { display: grid; gap: 15px; margin-top: 25px; }
.stack-form.compact { margin-top: 22px; }
.stack-form label { display: grid; gap: 7px; color: #a7b0c3; font-size: 11px; }
.stack-form input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--text); background: rgba(255,255,255,.035); transition: .2s; }
.stack-form input:focus { border-color: rgba(134,109,255,.65); box-shadow: 0 0 0 4px rgba(134,109,255,.1); }
.copy-field { display: flex; align-items: center; gap: 8px; margin: 26px 0; padding: 8px 8px 8px 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.copy-field code { flex: 1; min-width: 0; overflow: hidden; color: #aeb7cc; font: 11px/1.4 ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.copy-field button { border: 0; border-radius: 9px; padding: 8px 10px; color: #c7bdff; background: rgba(134,109,255,.12); cursor: pointer; font-size: 10px; }
.check-list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; color: #a7b0c3; font-size: 11px; }
.check-list li:before { content: "✓"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 8px; border-radius: 6px; color: var(--green); background: rgba(77,224,165,.09); }
.safety-panel { display: flex; align-items: center; gap: 16px; margin-top: 14px; padding: 20px; }
.safety-panel p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }.shield { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 14px; color: var(--green); background: rgba(77,224,165,.1); }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-card { position: relative; z-index: 2; width: min(440px, 100%); padding: 32px; border: 1px solid var(--line-strong); border-radius: 26px; background: rgba(15,21,36,.82); box-shadow: 0 35px 100px rgba(0,0,0,.45); backdrop-filter: blur(28px); }
:root[data-theme="light"] .auth-card { background: rgba(255,255,255,.86); }
.auth-brand { padding: 0; margin-bottom: 35px; }
.auth-card h1 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.auth-card > p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.auth-card .primary-button { margin-top: 5px; }
.form-error { margin-top: 16px; padding: 11px 12px; border: 1px solid rgba(255,128,110,.22); border-radius: 11px; color: #ff9c8e; background: rgba(255,128,110,.08); font-size: 11px; }
.safe-note { display: block; margin-top: 20px; color: #67738b; text-align: center; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: 360px; padding: 13px 16px; border: 1px solid var(--line-strong); border-radius: 13px; color: var(--text); background: var(--panel-solid); box-shadow: var(--shadow); opacity: 0; transform: translateY(14px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,128,110,.4); }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card { min-height: auto; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(4, 1fr); margin-top: 18px; gap: 5px; }
  .nav p, .sidebar-foot { display: none; }
  .nav a { justify-content: center; padding: 10px 6px; font-size: 10px; }.nav a span { display: none; }
  .main { padding: 20px 14px 40px; }
  .mode-banner { align-items: flex-start; }.mode-banner .ghost-button { display: none; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px; }.metric { min-height: 140px; padding: 14px; }
  .chart-panel, .import-panel, .page-panel, .settings-card { padding: 15px; }
  .search { min-width: 0; width: 100%; }.page-panel > .panel-head { flex-direction: column; }
}
@media (max-width: 460px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 24px; }
  .auth-card { padding: 24px; }
}

