:root {
  --bg: #1e1e2e;
  --fg: #cdd6f4;
  --entry-bg: #313244;
  --sel-bg: #45475a;
  --accent: #89b4fa;
  --green: #a6e3a1;
  --red: #f38ba8;
  --orange: #fab387;
  --yellow: #f9e2af;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

body { display: flex; flex-direction: column; min-height: 100vh; }

button { font-family: inherit; cursor: pointer; }

/* ══════════ Demo banner ══════════ */
.demo-banner {
  background: var(--orange);
  color: #1c1210;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 12px;
}

/* ══════════ Topbar ══════════ */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--sel-bg);
  padding: 8px 14px;
}
.topbar-title { font-weight: 700; font-size: 15px; color: var(--accent); }
.topbar-license { font-size: 11px; font-weight: 700; color: var(--yellow); }
.topbar-actions { margin-left: auto; display: flex; gap: 6px; }
.tb-btn {
  background: var(--entry-bg); color: var(--fg); border: none;
  border-radius: 4px; padding: 6px 12px; font-size: 12px; font-weight: 600;
}
.tb-btn:hover { filter: brightness(1.2); }
.tb-btn-accent { background: var(--accent); color: #1e1e2e; }
.tb-btn-red { background: var(--red); color: #1e1e2e; }

/* ══════════ Shell layout ══════════ */
.app-shell { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 190px;
  flex: 0 0 190px;
  background: var(--entry-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.nav { padding: 6px 0; flex: 1; }

.nav-cat-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #9399b2;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px 4px;
}
.nav-cat-arrow { transition: transform .15s; display: inline-block; }
.nav-cat.collapsed .nav-cat-arrow { transform: rotate(-90deg); }
.nav-cat.collapsed .nav-cat-body { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 13px;
  padding: 8px 14px;
}
.nav-item:hover { background: var(--sel-bg); }
.nav-item.active { background: var(--accent); color: #1e1e2e; font-weight: 700; }

.sidebar-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--sel-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.sidebar-logo { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.cta-btn {
  display: block;
  text-align: center;
  background: var(--green);
  color: #1e1e2e;
  font-weight: 700;
  font-size: 11px;
  padding: 7px 8px;
  border-radius: 5px;
  text-decoration: none;
  width: 100%;
}

/* ══════════ Content ══════════ */
.content { flex: 1; overflow-y: auto; background: var(--bg); }
.screen { display: none; }
.screen.active { display: block; }

.screen-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sel-bg);
  padding: 8px 14px;
}
.screen-title { font-weight: 700; font-size: 14px; margin-right: auto; }
.screen-topbar .tb-btn { font-size: 11px; }

.screen-body { padding: 14px; }

/* ══════════ Sections ══════════ */
.section {
  background: var(--entry-bg);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.section-title { font-weight: 700; font-size: 13px; color: var(--accent); margin: 0 0 4px; }
.section-sub { font-size: 11px; color: #9399b2; margin: 0 0 10px; }

.info-box {
  background: rgba(137,180,250,.08);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  font-size: 11.5px;
  color: var(--fg);
  border-radius: 4px;
  margin-bottom: 12px;
}
.warn-box {
  background: rgba(250,179,135,.1);
  border-left: 3px solid var(--orange);
  padding: 8px 12px;
  font-size: 11.5px;
  border-radius: 4px;
  margin-bottom: 12px;
}

/* ══════════ Forms ══════════ */
.form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.form-row label { font-weight: 600; font-size: 12px; min-width: 110px; }
.form-row input[type=text], .form-row input[type=number], .form-row input[type=password],
.form-row input[type=time], .form-row select, select, input[type=text] {
  background: var(--bg);
  border: 1px solid var(--sel-bg);
  color: var(--fg);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 12px;
}
.form-row input:focus, select:focus { outline: 1px solid var(--accent); }
.chk-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }

/* ══════════ Buttons ══════════ */
.btn {
  border: none;
  border-radius: 4px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #1e1e2e;
  background: var(--sel-bg);
}
.btn:hover { filter: brightness(1.15); }
.btn-accent { background: var(--accent); }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-orange { background: var(--orange); }
.btn-yellow { background: var(--yellow); }
.btn-purple { background: #cba6f7; }
.btn-neutral { background: var(--sel-bg); color: var(--fg); }
.btn-sm { padding: 4px 9px; font-size: 11px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }

/* ══════════ Tables ══════════ */
table.dtable { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.dtable th {
  background: var(--bg);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  padding: 6px 4px;
  border-bottom: 1px solid var(--sel-bg);
}
table.dtable td {
  padding: 6px 4px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
table.dtable td.left { text-align: left; }
.tbl-wrap { overflow-x: auto; }

.status-ok { color: var(--green); font-weight: 700; }
.status-warn { color: var(--orange); font-weight: 700; }
.status-err { color: var(--red); font-weight: 700; }

/* ══════════ Cards ══════════ */
.card {
  background: var(--sel-bg);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(137,180,250,.25);
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-head .name { font-weight: 700; font-size: 13px; }
.badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.badge-green { background: rgba(166,227,161,.18); color: var(--green); }
.badge-grey { background: rgba(255,255,255,.08); color: #9399b2; }
.badge-red { background: rgba(243,139,168,.18); color: var(--red); }

/* ══════════ Pills (anti-detection) ══════════ */
.pills { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 14px; background: var(--sel-bg); }
.pill {
  background: var(--entry-bg);
  border: none;
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 14px;
}
.pill.active { background: var(--accent); color: #1e1e2e; }

/* ══════════ Log console ══════════ */
.log-console {
  background: #0a0a14;
  color: #aaaaaa;
  font-family: "Consolas", monospace;
  font-size: 11px;
  padding: 10px;
  border-radius: 4px;
  height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}
.log-console .ok { color: #a6e3a1; }
.log-console .warn { color: #f9a825; }
.log-console .err { color: #f38ba8; }
.log-console .info { color: #6a7a9a; }
.log-console .price { color: #cba6f7; }
.log-console .head { color: #cdd6f4; font-weight: 700; }

.log-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 14px; background: var(--sel-bg); }
.log-filter { font-size: 11px; display: flex; align-items: center; gap: 3px; }

/* ══════════ Theme swatches ══════════ */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.theme-swatch {
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
}
.theme-swatch.active { border-color: var(--accent); }
.theme-swatch .tname { font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.theme-swatch .tdots { display: flex; gap: 4px; }
.theme-swatch .tdot { width: 14px; height: 14px; border-radius: 50%; }
.theme-swatch .tactive-tag {
  position: absolute; top: 6px; right: 8px; font-size: 10px; color: var(--yellow); font-weight: 700;
}

/* ══════════ Wizard steps ══════════ */
.wizard-steps { display: flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.wstep { flex: 1; text-align: center; padding: 8px 4px; border-radius: 4px; background: var(--entry-bg); font-size: 11px; font-weight: 700; color: #9399b2; }
.wstep.active { background: var(--accent); color: #1e1e2e; }
.wstep.done { background: var(--green); color: #1e1e2e; }

/* ══════════ Toggle switch ══════════ */
.switch { position: relative; display: inline-block; width: 38px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--sel-bg); border-radius: 20px; transition: .2s; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .2s; }
input:checked + .slider { background: var(--green); }
input:checked + .slider:before { transform: translateX(18px); }

/* ══════════ Modal ══════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg);
  border-radius: 8px;
  padding: 20px 22px;
  max-width: 640px;
  width: 92%;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.modal h3 { margin-top: 0; color: var(--accent); }
.modal-close { float: right; background: var(--sel-bg); border: none; color: var(--fg); border-radius: 4px; padding: 4px 10px; font-weight: 700; }

/* ══════════ Footer ══════════ */
.footer {
  display: flex;
  justify-content: space-between;
  background: var(--sel-bg);
  color: #888;
  font-size: 11px;
  padding: 5px 14px;
}

/* ══════════ Misc ══════════ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.hint { font-size: 10.5px; color: #7a819c; }
hr.sep { border: none; border-top: 1px solid var(--sel-bg); margin: 14px 0; }
