:root {
    --primary: #3d7ea6;
    --primary-dark: #1d4e6e;
    --primary-light: #86C9F3;
    --bg-dark: #1a1a1a;
    --bg-card: #2d2d2d;
    --text: #ffffff;
    --text-muted: #aaaaaa;
    --border: #444444;
    --accent: #86C9F3;
    --online: #69DFC8;
    --offline: #757575;
    --warn: #ff9800;
    --error: #f44336;
    --transition-fast: 120ms;
    --transition-med: 200ms;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    background: #15283e;
}

body {
    font-family: Inter, "Segoe UI", sans-serif;
    background-color: #15283e;
    color: var(--text);
    height: 100%;
    overflow: hidden;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: transparent;
    border: 1px solid rgba(174, 201, 229, 0.2);
    border-radius: 16px;
    overflow: hidden;
    box-sizing: border-box;
}

.screen {
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* ── Loading overlay ────────────────────────────────────────────── */
#loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 1;
    transition: opacity var(--transition-med) ease;
    pointer-events: all;
}
#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    will-change: transform;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Login Screen ───────────────────────────────────────────────── */
#login-screen {
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(700px 360px at 0% -10%, rgba(134, 201, 243, 0.14), transparent 55%),
        linear-gradient(180deg, #0B1730, #080F1D);
}

.login-card {
    position: relative;
    width: 420px;
    padding: 36px 32px 28px;
    border-radius: 18px;
    background: #101A30;
    border: 1px solid rgba(185, 209, 250, 0.14);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.gear-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #AAB9D1;
    cursor: pointer;
    font-size: 18px;
}
.gear-btn:hover { background: rgba(134, 201, 243, 0.12); color: #86C9F3; }

.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo img { width: 54px; height: 54px; object-fit: contain; margin-bottom: 8px; }
.login-logo h1 { color: #F4F8FF; font-size: 32px; letter-spacing: 0.08em; margin-bottom: 4px; }
.login-logo p { color: #8A9BB4; font-size: 13px; }

.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-right: 42px; }
.eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #AAB9D1;
    cursor: pointer;
}
.login-card select, .login-card input[type="text"], .login-card input[type="email"], .login-card input[type="password"] {
    width: 100%;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(185, 209, 250, 0.16);
    background: #0B1426;
    color: #F4F8FF;
    padding: 0 12px;
}
.remember { display: flex; align-items: center; gap: 8px; color: #AAB9D1; font-size: 13px; margin: 8px 0 14px; }
#login-screen .login-btn { width: 100%; height: 42px; border-radius: 12px; background: #89baff; color: #10243c; font-weight: 500; border: 0; }
.login-error { min-height: 18px; margin-top: 10px; color: #ff5c6a; font-size: 13px; }
.login-maint {
  margin: 12px 0 2px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 106, 0.42);
  background: linear-gradient(180deg, rgba(42, 32, 16, 0.96), rgba(16, 18, 28, 0.96));
  color: #F3E6C8;
}
.login-maint-kicker {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #D4AF6A;
  margin-bottom: 6px;
}
.login-maint-title {
  font-size: 15px;
  font-weight: 600;
  color: #FFF6E4;
  margin-bottom: 8px;
}
.login-maint p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #E4D4B0;
}
.login-maint p:last-child { margin-bottom: 0; }
.login-maint strong { color: #FFF6E4; font-weight: 600; }
.login-settings { display: none; margin-top: 14px; }
.login-settings.open { display: block; }
.login-hint { color: #8A9BB4; font-size: 12px; margin-top: 6px; }

#login-screen { overflow: visible; }
.login-stage {
  position: relative;
  width: min(1000px, calc(100% - 40px));
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  z-index: 2;
  flex: 0 0 auto;
  transition: transform 1.15s cubic-bezier(.16, .84, .28, 1);
}
.login-stage.map-open .login-card { transform: translateX(-400px); }
.server-pick {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(185, 209, 250, 0.16);
  background: #173049;
  color: #e9f1fa;
  padding: 0 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.server-pick::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #9bb2ca;
  border-bottom: 1.5px solid #9bb2ca;
  transform: rotate(-45deg);
  margin-right: 2px;
}
.login-stage.map-open .server-pick::after { transform: rotate(135deg); }
.server-pick:hover { border-color: #89baff; }
.login-server-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.login-map {
  position: fixed;
  right: 24px;
  top: 50%;
  width: min(860px, calc(100vw - 400px));
  max-width: calc(100vw - 48px);
  padding: 14px 14px 12px;
  border-radius: 19px;
  background: #1b324c;
  border: 1px solid #aec9e533;
  box-shadow: 0 18px 50px #06132655;
  overflow: visible;
  transform: translate(72px, -50%) scale(.94);
  opacity: 0;
  pointer-events: none;
  transition: transform 1.15s cubic-bezier(.16, .84, .28, 1), opacity .95s ease;
}
.login-stage.map-open .login-map {
  transform: translate(0, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.login-map-head h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9bb2ca;
}
.login-map-canvas {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: visible;
  padding: 10px 8px 8px;
  background:
    radial-gradient(120% 80% at 50% 46%, #24527a55, transparent 62%),
    #101e30;
}
.login-map-plot {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: visible;
}
.login-map-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.login-map-hud {
  display: none;
  margin-top: 10px;
  padding: 8px 10px 9px;
  border-radius: 10px;
  background: #12263a;
  border: 1px solid #aec9e533;
  font-size: 12px;
  line-height: 1.45;
  color: #d5e4f4;
  font-variant-numeric: tabular-nums;
}
.login-map-hud.has-srv { display: block; }
.map-hud-you { display: none; }
.map-hud-srv { color: #b7d4f2; }
.map-pin {
  position: absolute;
  z-index: 2;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  appearance: none;
  overflow: visible;
  transform: translate(-50%, -50%);
  cursor: pointer;
  color: #e9f1fa;
  animation: pinIn .7s cubic-bezier(.16, .84, .28, 1) both;
}
.map-pin:nth-of-type(2) { animation-delay: .16s; }
.pin-beacon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.pin-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f7fbff;
  box-shadow: 0 0 0 5px #89baff73, 0 0 14px 2px #89baff;
  transform: translate(-50%, -50%);
  animation: pinCore 1.8s ease-in-out infinite;
}
.pin-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid #9ec4ff;
  animation: pinWave 2.4s ease-out infinite;
}
.pin-wave-2 { animation-delay: 1.2s; }
.map-pin .pin-card {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  min-width: 156px;
  padding: 8px 10px 8px;
  border-radius: 12px;
  background: #173049f2;
  border: 1px solid #aec9e544;
  text-align: left;
  opacity: 0;
  pointer-events: none;
}
.map-pin.armed .pin-card { opacity: 1; }
.map-pin .pin-name { display: block; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.pin-victims { display: grid; gap: 2px; }
.pin-victim {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #b0c2d7;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.pin-victim span:last-child { color: #d5e4f4; }
.map-pin.current .pin-card { border-color: #89baff; }
.map-pin.current .pin-core { box-shadow: 0 0 0 6px #89baff99, 0 0 18px 3px #89baff; }
.map-pin.armed { z-index: 4; }
.map-pin .pin-choose {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  padding: 6px 8px;
  background: #89baff;
  color: #10243c;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}
.map-pin.armed .pin-choose {
  opacity: 1;
  pointer-events: auto;
}
.map-pin.pin-east .pin-card {
  left: auto;
  right: 22px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}
.map-pin.pin-west .pin-card {
  left: 22px;
  right: auto;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}
.map-here {
  position: absolute;
  z-index: 3;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: transparent;
  pointer-events: none;
}
.map-here .here-x,
.map-here .here-x::before,
.map-here .here-x::after {
  position: absolute;
  background: #d9fff2;
  box-shadow: 0 0 8px #a5decaaa;
}
.map-here .here-x {
  inset: 0;
  background: transparent;
  box-shadow: none;
}
.map-here .here-x::before {
  content: "";
  left: 7px;
  top: 0;
  width: 2px;
  height: 16px;
}
.map-here .here-x::after {
  content: "";
  left: 0;
  top: 7px;
  width: 16px;
  height: 2px;
}
.map-here .here-card {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 6px;
  background: #14342cf2;
  border: 1px solid #a5deca55;
  color: #d9fff2;
  font-size: 10px;
  letter-spacing: 0.02em;
}
.map-here.here-east .here-card { left: auto; right: 14px; transform: none; }
.map-here.here-west .here-card { left: 14px; transform: none; }
@keyframes pinIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes pinCore {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.28); }
}
@keyframes pinWave {
  0% { transform: scale(.7); opacity: .9; }
  100% { transform: scale(3.8); opacity: 0; }
}
@keyframes mapDash { to { stroke-dashoffset: -28; } }
.login-map .link { stroke: #89baff88; stroke-width: 1.4; fill: none; stroke-dasharray: 4 5; animation: mapDash 2.8s linear infinite; }

/* ── Main Shell: left nav, same places as the old shell ─────────── */
#main-shell {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    background: #15283e;
}
#main-shell.hidden { display: none !important; }

.nav-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 8px 2px 2px;
}
.nav-email {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #AAB9D1;
    font-size: 11px;
    line-height: 1.2;
}
.nav-btn.icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    flex: 0 0 36px;
    justify-content: center;
}
.nav-foot #logout-btn {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(134, 201, 243, 0.28);
    background: rgba(134, 201, 243, 0.12);
    color: #F4F8FF;
}

.shell-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    padding: 16px 10px 12px;
    background: rgba(23, 48, 73, 0.8);
    border-right: 1px solid rgba(202, 224, 255, 0.15);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    color: #AAB9D1;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 10px;
    font-size: 14px;
    text-align: left;
}
.nav-btn .ic {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-btn .ic img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
    pointer-events: none;
    opacity: 0.58;
    filter: brightness(0) invert(0.78);
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.05); color: #F4F8FF; }
.nav-btn:hover .ic img { opacity: 0.92; filter: brightness(0) invert(0.95); }
.nav-btn.active { background: rgba(134, 201, 243, 0.16); color: #F4F8FF; }
.nav-btn.active .ic img {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(74%) sepia(58%) saturate(620%) hue-rotate(176deg) brightness(98%) contrast(92%);
}
.nav-spacer { flex: 1; min-height: 8px; }

.shell-user {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    color: #8A9BB4;
    font-size: 12px;
    word-break: break-all;
}

.shell-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    position: relative;
}

.shell-content:has(#tab-clients.active),
.shell-content:has(#tab-builds.active),
.shell-content:has(#tab-builder.active),
.shell-content:has(#tab-bots.active),
.shell-content:has(#tab-inject.active),
.shell-content:has(#tab-settings.active) {
    padding: 0;
    overflow: hidden;
}

#tab-clients.tab-content,
#tab-builds.tab-content,
#tab-builder.tab-content,
#tab-bots.tab-content,
#tab-inject.tab-content,
#tab-settings.tab-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.clients-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: 0;
    background: #15283e;
}

.wiz-hosts {
    margin: 8px 0 0;
    min-height: 36px;
    max-height: 140px;
    overflow: auto;
    white-space: pre-wrap;
    color: #AAB9D1;
    font: 12px/1.4 Consolas, "Segoe UI", monospace;
}

.build-log {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: auto;
}

.build-log[hidden] { display: none !important; }

.build-log-card {
    width: min(900px, calc(100vw - 40px));
    max-height: min(80vh, 580px);
    display: flex;
    flex-direction: column;
    background: #101A30;
    border: 1px solid rgba(134, 201, 243, 0.22);
    border-radius: 14px;
}

.build-log-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
}

.alphina-build-log-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#buildLogBody {
    margin: 0;
    padding: 0 14px 14px;
    overflow: auto;
    white-space: pre-wrap;
    color: #d5e4f7;
    font-size: 12px;
    user-select: text;
    -webkit-user-select: text;
}

.screen-host {
    position: fixed;
    z-index: 80;
    left: 50%;
    top: 48px;
    width: min(1180px, calc(100vw - 40px));
    height: min(760px, calc(100vh - 72px));
    transform: translateX(-50%);
    display: flex;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(134, 201, 243, 0.28);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    background: #15283e;
}

.screen-host.maximized {
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    transform: none;
    border-radius: 0;
    border: 0;
}

.screen-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #15283e;
}

.tool-host {
    position: fixed;
    z-index: 85;
    left: 50%;
    top: 56px;
    width: min(1100px, calc(100vw - 36px));
    height: min(740px, calc(100vh - 80px));
    transform: translateX(-50%);
    display: flex;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(134, 201, 243, 0.28);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    background: #15283e;
}

.tool-host.maximized {
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    transform: none;
    border-radius: 0;
    border: 0;
}

.tool-restore {
    position: fixed;
    z-index: 86;
    right: 16px;
    bottom: 16px;
    padding: 8px 14px;
    border: 0;
    border-radius: 8px;
    background: #16324d;
    color: #d7ecff;
    cursor: pointer;
}

.screen-host.pinned,
.tool-host.pinned,
.block-host.pinned {
    z-index: 999 !important;
}

.block-host {
    position: fixed;
    z-index: 90;
    left: 50%;
    top: 90px;
    width: min(460px, calc(100vw - 32px));
    height: min(420px, calc(100vh - 120px));
    transform: translateX(-50%);
    display: flex;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(134, 201, 243, 0.28);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    background: #15283e;
}

.screen-restore {
    position: fixed;
    z-index: 81;
    left: 16px;
    bottom: 16px;
    padding: 8px 14px;
    border: 1px solid rgba(134, 201, 243, 0.4);
    border-radius: 8px;
    background: #151D35;
    color: #F4F8FF;
    cursor: pointer;
}

/* Keep iframe tabs in layout. display:none stops WebView2 from loading
   builder/wizard (Clients works only because it starts .active). */
.tab-content {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    z-index: 0;
    transform: none;
}

.tab-content.active {
    position: relative;
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    z-index: 1;
    transform: none;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-header h3 {
    font-size: 24px;
    color: var(--text);
}

.tab-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Client count / last seen badge ─────────────────────────────── */
.client-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.client-stats .count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(76, 175, 80, 0.12);
    color: var(--online);
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 600;
}

.client-stats .last-seen {
    font-size: 12px;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    transition: border-color var(--transition-fast) ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color var(--transition-fast) ease,
                opacity var(--transition-fast) ease,
                transform var(--transition-fast) ease;
    will-change: transform;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ── Clients Grid ───────────────────────────────────────────────── */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.client-card {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    transition: transform var(--transition-med) ease,
                box-shadow var(--transition-med) ease;
    will-change: transform;
}

.client-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.client-card h4 {
    color: var(--primary-light);
    margin-bottom: 10px;
    font-size: 15px;
}

.client-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ── Status dot ─────────────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    will-change: background-color;
}
.status-dot.online {
    background-color: var(--online);
    box-shadow: 0 0 6px var(--online);
}
.status-dot.offline {
    background-color: var(--offline);
}

/* ── Builds Tab ─────────────────────────────────────────────────── */
.builds-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.hero-create {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 16px 0 8px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    background: linear-gradient(180deg, rgba(45, 45, 45, 0.96), rgba(26, 26, 26, 0.96));
    border: 1px solid rgba(76, 175, 80, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hero-create:hover {
    border-color: rgba(76, 175, 80, 0.46);
    background: linear-gradient(180deg, rgba(45, 79, 55, 0.96), rgba(27, 45, 32, 0.96));
}

.hero-create .plus {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(76, 175, 80, 0.12);
}

.hero-create b {
    display: block;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.1;
    color: var(--text);
}

.hero-create small {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 1px;
}

.stat-pill {
    margin-left: auto;
    align-self: center;
    color: var(--primary-light);
    font-size: 12px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.18);
}

.stat-pill.sync {
    color: var(--warn);
}

.builds-list-wrap {
    overflow: auto;
    padding: 4px 0;
}

.list-head {
    display: grid;
    grid-template-columns: 52px minmax(0, 1.7fr) minmax(220px, 1.35fr) 150px minmax(150px, 1fr) 84px;
    gap: 10px;
    align-items: center;
    padding: 0 16px 8px;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.builds-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
}

.row-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1.7fr) minmax(220px, 1.35fr) 150px minmax(150px, 1fr) 84px;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-card), #222);
    cursor: pointer;
    transition: background-color var(--transition-fast) ease, border-color var(--transition-fast) ease;
}

.row-card:hover {
    background: #353535;
    border-color: rgba(76, 175, 80, 0.22);
}

.row-card.selected {
    border-color: rgba(76, 175, 80, 0.52);
    background: linear-gradient(180deg, rgba(76, 175, 80, 0.16), rgba(76, 175, 80, 0.055));
    box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.16), 0 10px 26px rgba(76, 175, 80, 0.12);
}

.icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-dark);
    border: 1px solid rgba(76, 175, 80, 0.12);
    object-fit: cover;
}

.name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 0;
}

.ss-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
    height: 18px;
    padding: 0 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #3b1600;
    background: linear-gradient(135deg, #ffb347, #ff8a1a);
    border: 1px solid rgba(255, 176, 70, 0.85);
    box-shadow: 0 2px 8px rgba(255, 138, 26, 0.28);
}

.name {
    font-weight: 700;
    color: var(--text);
}

.pkg {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
}

/* ── Pipeline processing pills ──────────────────────────────────── */
.proc-cell {
    position: relative;
    min-width: 0;
}

.proc-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.proc-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(185, 209, 250, 0.12);
    background: rgba(26, 26, 26, 0.72);
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1.2;
    max-width: 100%;
    cursor: default;
}

.proc-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.55;
    flex-shrink: 0;
}

.proc-pill.on {
    border-color: rgba(76, 175, 80, 0.34);
    color: #81c784;
    background: rgba(76, 175, 80, 0.10);
}

.proc-pill.on .dot {
    opacity: 1;
    background: var(--online);
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.55);
}

.proc-pill.wait {
    border-color: rgba(255, 152, 0, 0.36);
    color: var(--warn);
    background: rgba(255, 152, 0, 0.08);
}

.proc-pill.wait .dot {
    opacity: 1;
    animation: proc-pulse 1.1s ease-in-out infinite;
}

.proc-pill.bad {
    border-color: rgba(244, 67, 54, 0.38);
    color: #ff8a80;
    background: rgba(244, 67, 54, 0.10);
}

.proc-pill.bad .dot {
    opacity: 1;
    background: var(--error);
}

.proc-pill.idle {
    opacity: 0.72;
}

@keyframes proc-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

.proc-inline {
    display: none;
    margin-top: 6px;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.35;
    color: var(--text-muted);
    background: rgba(26, 26, 26, 0.78);
    border: 1px solid rgba(76, 175, 80, 0.18);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.proc-cell.is-hov .proc-inline {
    display: block;
}

/* ── Progress bar (inside onbuild badge) ────────────────────────── */
.bp {
    min-width: 118px;
    max-width: 168px;
}

.bp-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 5px;
}

.bp-lab {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-light);
}

.bp-num {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary-light);
    font-variant-numeric: tabular-nums;
}

.bp-bar {
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(76, 175, 80, 0.18);
    overflow: hidden;
}

.bp-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #66bb6a, #81c784 55%, #a5d6a7);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.35);
    will-change: width;
}

.bp-left {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── State badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.badge.onbuild {
    background: rgba(129, 199, 132, 0.12);
    color: #a5d6a7;
}

.badge.failed {
    background: rgba(244, 67, 54, 0.16);
    color: #ff8a80;
}

.badge.finished {
    background: rgba(76, 175, 80, 0.16);
    color: var(--online);
}

/* ── Empty state ────────────────────────────────────────────────── */
.empty {
    padding: 52px 28px;
    text-align: center;
    color: var(--text-muted);
}

.empty-glow {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    margin: 0 auto 16px;
    background: radial-gradient(circle, rgba(76, 175, 80, 0.16), transparent 68%);
}

.empty-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

.empty-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-light);
    opacity: 0.35;
}

/* ── Context menu ───────────────────────────────────────────────── */
.ctx {
    position: fixed;
    z-index: 20000;
    min-width: 214px;
    background: linear-gradient(180deg, #2d2d2d, #1a1a1a);
    border: 1px solid rgba(76, 175, 80, 0.22);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

.ctx[hidden] {
    display: none !important;
}

.ctx button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    text-align: left;
}

.ctx button svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.ctx button:hover {
    background: rgba(76, 175, 80, 0.12);
}

.ctx button.danger {
    color: #ff8a80;
}

.ctx button.danger:hover {
    background: rgba(244, 67, 54, 0.12);
}

.ctx button[disabled],
.ctx button.is-off {
    opacity: 0.38;
    pointer-events: none;
    cursor: default;
}

.ctx button[hidden] {
    display: none !important;
}

@keyframes wait-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}

/* ── Templates ──────────────────────────────────────────────────── */
.templates-section {
    margin-top: 24px;
}

.templates-section h4 {
    color: var(--text);
    margin-bottom: 12px;
    font-size: 16px;
}

.templates-list {
    list-style: none;
}

.template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.template-name {
    color: var(--text);
    flex: 1;
}

/* ── Wizard (full port from legacy wizard.html) ─────────────────── */
.wiz-steps {
    padding: 10px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.wiz-track {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
}
.wiz-step-btn {
    flex: 1;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    padding: 8px 6px;
    font: inherit;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: background-color var(--transition-fast) ease, color var(--transition-fast) ease;
}
.wiz-step-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.045);
}
.wiz-step-btn.active {
    background: rgba(76, 175, 80, 0.12);
    color: var(--primary-light);
    border-color: rgba(76, 175, 80, 0.28);
}
.wiz-step-btn.done {
    color: var(--primary-light);
}

.wiz-body {
    max-width: 920px;
    margin: 0 auto;
}
.wiz-step {
    display: none;
}
.wiz-step.active {
    display: block;
}
.wiz-step h2 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}
.wiz-hint {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 12px;
}
.wiz-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}
@media (max-width: 700px) {
    .wiz-grid { grid-template-columns: 1fr; }
}
.wiz-card {
    background: linear-gradient(180deg, var(--bg-card), #222);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.wiz-section-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px;
}
.wiz-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.wiz-field:last-child { margin-bottom: 0; }
.wiz-field label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.wiz-field input, .wiz-field select, .wiz-field textarea {
    appearance: none;
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    outline: none;
    transition: border-color var(--transition-fast) ease;
}
.wiz-field input:focus, .wiz-field select:focus, .wiz-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.12);
}
.wiz-field textarea { min-height: 80px; resize: vertical; }
.wiz-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.wiz-row > * { flex: 1; }
.wiz-row .btn { flex: 0 0 auto; }
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); }
.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

/* ── Wizard icon gallery ────────────────────────────────────────── */
.wiz-icon-gallery {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    height: 80px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
}
.wiz-ico {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--bg-dark);
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wiz-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wiz-ico:hover { border-color: rgba(76, 175, 80, 0.35); }
.wiz-ico.on { border-color: rgba(76, 175, 80, 0.7); box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2); }
.wiz-ico-empty {
    flex: 1 1 auto;
    color: var(--text-muted);
    font-size: 12px;
    padding: 10px;
    text-align: center;
    white-space: nowrap;
}
.wiz-icon-box {
    display: flex;
    gap: 14px;
    align-items: center;
}
.wiz-icon-preview {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    object-fit: cover;
}

/* ── Wizard permissions ─────────────────────────────────────────── */
.wiz-perms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 600px) { .wiz-perms { grid-template-columns: 1fr; } }
.wiz-perm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}
.wiz-perm.lock .wiz-toggle { cursor: default; opacity: 0.9; }
.wiz-perm-nm { font-weight: 700; font-size: 13px; }
.wiz-perm-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.wiz-toggle {
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--bg-card);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid var(--border);
    transition: background-color var(--transition-fast) ease;
}
.wiz-toggle.on { background: rgba(76, 175, 80, 0.35); border-color: rgba(76, 175, 80, 0.5); }
.wiz-toggle::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c5ccd8;
    transition: left 0.15s ease, background-color 0.15s ease;
}
.wiz-toggle.on::after { left: 20px; background: var(--primary-light); }

/* ── Wizard accessibility preview ───────────────────────────────── */
.wiz-acc-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 280px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 700px) { .wiz-acc-layout { grid-template-columns: 1fr; } }
.wiz-acc-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.wiz-a11y-phone {
    width: 260px;
    height: 480px;
    border-radius: 32px;
    padding: 10px;
    background: linear-gradient(180deg, #1a1d21, #0c0d0f);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    position: relative;
}
.phone-notch {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 9px;
    border-radius: 8px;
    background: #000;
    z-index: 2;
}
.acc-screen {
    height: 100%;
    border-radius: 24px;
    overflow: hidden;
    background: #121212;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
}
.acc-screen.rtl { direction: rtl; }
.acc-top { padding: 24px 14px 8px; text-align: center; font-size: 14px; font-weight: 600; }
.acc-sec { padding: 6px 14px 3px; font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: #8ab4f8; }
.acc-list { padding: 0 4px; }
.acc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 4px;
}
.acc-row.hi { background: rgba(138, 180, 248, 0.08); }
.acc-ico {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    object-fit: cover;
    background: #1a73e8;
    flex-shrink: 0;
    display: block;
}
.acc-ico.ph {
    background: linear-gradient(135deg, #4285f4, #1a73e8);
}
.acc-name { flex: 1; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-off { font-size: 10px; color: #8ab4f8; font-weight: 600; }
.acc-bubble {
    margin: 4px 12px 8px;
    background: #e8eaed;
    color: #202124;
    border-radius: 10px;
    padding: 10px 12px;
    position: relative;
}
.acc-bubble::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 24px;
    width: 14px;
    height: 14px;
    background: #e8eaed;
    transform: rotate(45deg);
    border-radius: 2px;
}
.acc-screen.rtl .acc-bubble::before { left: auto; right: 24px; }
.acc-bubble-title { font-size: 12px; font-weight: 700; margin-bottom: 3px; line-height: 1.25; }
.acc-bubble-msg { font-size: 11px; line-height: 1.35; color: #3c4043; }
.acc-btn {
    margin: auto 18px 16px;
    height: 38px;
    border: 0;
    border-radius: 20px;
    background: #1a73e8;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.35);
}
.wiz-phone-cap { color: var(--text-muted); font-size: 11px; text-align: center; }

/* ── Wizard navigation ──────────────────────────────────────────── */
.wiz-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-top: 16px;
    border-top: 1px solid var(--border);
}
.wiz-tip { flex: 1; color: var(--text-muted); font-size: 12px; }

/* ── Wizard checkboxes (Steps 3-4) ──────────────────────────────── */
.wiz-chk {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 8px;
    cursor: pointer;
}
.wiz-chk input { accent-color: var(--primary-light); }

/* ── Wizard listbox (tracking, tags) ────────────────────────────── */
.wiz-listbox {
    min-height: 100px;
    max-height: 160px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-dark);
    padding: 6px;
}
.wiz-list-it {
    padding: 7px 10px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
}
.wiz-list-it:hover, .wiz-list-it.sel {
    background: rgba(76, 175, 80, 0.12);
    color: var(--primary-light);
}

.debug-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    max-height: 220px;
    border: 1px solid rgba(134, 201, 243, 0.28);
    border-radius: 12px;
    background: rgba(8, 15, 29, 0.94);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
.debug-dock.hidden,
.debug-dock[hidden] { display: none !important; }
.debug-dock-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(134, 201, 243, 0.14);
    color: #86C9F3;
    font-size: 12px;
}
.debug-dock-head .spacer { flex: 1; }
.debug-dock-hint { color: #8A9BB4; font-weight: 500; }
#debugDockBody {
    margin: 0;
    padding: 8px 12px 10px;
    min-height: 96px;
    overflow: auto;
    color: #C5D4E8;
    font: 11px/1.45 Consolas, "Cascadia Mono", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Wizard dropper section (Step 4) ────────────────────────────── */
.wiz-dropper {
    margin-top: 0;
}
.wiz-drop-ico-panel {
    margin-top: 10px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
}
