:root{
  color-scheme:dark;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif;
  color:#edf2f7;
  background:#0a0f17;
  line-height:1.45;
  font-synthesis:none;
  --border:#263446;
  --muted:#8fa2ba;
  --good:#5ee3ab;
  --warn:#f6c86a;
  --bad:#fb8192;
  --auto:#7dc4ff;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:radial-gradient(ellipse at 12% 0,#16283d66,transparent 48%),#0a0f17}
main{max-width:1760px;margin:auto;padding:36px 24px 52px}
h1,h2,p{margin:0}
h1{font-size:clamp(26px,3.2vw,40px);letter-spacing:-.035em;line-height:1.2}
h2{font-size:19px;letter-spacing:-.02em}
p,small,.muted,footer{color:var(--muted)}
p{margin:6px 0}
.eyebrow{font-size:10px;letter-spacing:.15em;color:#80b6d7;font-weight:750;text-transform:uppercase;display:block}
section{background:#111925;border:1px solid var(--border);border-radius:14px;padding:20px;margin:16px 0}
input,select,textarea,button{font:inherit;border-radius:7px}
input,select,textarea{background:#0b111b;border:1px solid #324358;color:#e6eef8;padding:8px 11px;max-width:100%}
button{border:1px solid #3e7d78;background:#1f5b55;color:#dcfff3;padding:8px 12px;font-size:12px;font-weight:650;cursor:pointer;transition:background .14s,border-color .14s}
button:hover{background:#2a726a}
button:disabled{opacity:.5;cursor:wait}
.secondary{border:1px solid var(--border);background:#182433;color:#c7d6e8}
.secondary:hover{background:#233449}
.danger{background:#451e2b;color:#ffb0bd;border-color:#703342}
.danger:hover{background:#5a2637}
a{color:#83c7ed}
:focus-visible{outline:2px solid #91cfff;outline-offset:2px}
.good{color:var(--good)!important}
.warn{color:var(--warn)!important}
.bad{color:var(--bad)!important}
.unknown{color:#7c8fa6!important}
.mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;overflow-wrap:anywhere}
.icon-button{background:transparent;border:0;font-size:24px;line-height:1;padding:2px 6px;color:var(--muted)}
.icon-button:hover{background:#ffffff10;color:#fff}

/* Install & Login pages */
.install{max-width:820px}
.install li{margin:10px 0}
.install code{overflow-wrap:anywhere}
.install .button{display:inline-block;background:#1f5b55;border:1px solid #3e7d78;color:#dcfff3;padding:11px 16px;border-radius:8px;text-decoration:none;margin:10px 0}
.install h2{margin-top:20px}


/* Dense Linear Pipeline Dashboard */
.dashboard-page main{max-width:none;padding:10px 14px 18px}
#dashboard-content .topbar{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:0 0 8px;flex-wrap:wrap}
.topbar-brand{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap}
#dashboard-content .topbar h1{font-size:20px;letter-spacing:-.025em;margin:0;color:#f3f7fc}
.pipeline-legend{display:flex;align-items:center;gap:5px;font-size:11px;color:#8ba1bc;flex-wrap:wrap}
.pipeline-legend span{background:#131f2e;border:1px solid #243448;padding:2px 7px;border-radius:999px;font-weight:500;color:#b8cbe2}
.pipeline-legend i{font-style:normal;color:#556b85;font-size:10px}
.account-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.live-indicator{display:flex;gap:7px;align-items:center;font-size:11px;color:var(--muted);padding:4px 8px;background:#111b28;border:1px solid #223143;border-radius:999px}
.live-indicator i{width:7px;height:7px;border-radius:50%;background:var(--warn)}
.live-indicator.online i{background:var(--good);box-shadow:0 0 0 4px #5ee3ab1c}
.live-indicator.error i{background:var(--bad)}
#dashboard-content button,#dashboard-content a.secondary{padding:6px 10px;font-size:11px;border-radius:6px;text-decoration:none;font-weight:650;display:inline-flex;align-items:center}
#open-pool b{display:inline-block;margin-left:4px;padding:1px 5px;border-radius:4px;background:#24384e;color:#9ed6ff;font-size:10px;font-weight:700}

.fleet-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;flex-wrap:wrap}
#dashboard-content .summary{display:flex;gap:7px;margin:0;padding:0;border:0;background:none;flex-wrap:wrap}
#dashboard-content .metric{display:flex;align-items:baseline;gap:9px;padding:6px 11px;border-radius:8px;background:linear-gradient(135deg,#172231,#101824);border:1px solid var(--border)}
#dashboard-content .metric span{font-size:11px;color:#9eb2c9}
#dashboard-content .metric strong{font-size:19px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums;color:#f1f6fc}
#dashboard-content .filters{display:flex;gap:6px;align-items:center}
#dashboard-content .filters input,#dashboard-content .filters select{padding:6px 9px;font-size:12px;border-radius:6px}
#dashboard-content .filters input{width:230px}
#dashboard-content .filters select{width:205px}

/* Connected Linear Chain Table */
#dashboard-content .fleet-section{margin:0;padding:0;border:0;background:none}
#dashboard-content .fleet-grid{border:1px solid #263749;border-radius:10px;overflow:auto;max-height:calc(100dvh - 108px);background:#0e1622;scrollbar-width:thin}
#dashboard-content .fleet-head,#dashboard-content .phone-row{
  display:grid;
  grid-template-columns:minmax(168px,1.08fr) minmax(106px,.74fr) minmax(126px,.86fr) minmax(215px,1.52fr) minmax(112px,.74fr) minmax(112px,.78fr) minmax(116px,.82fr) minmax(122px,.86fr) minmax(94px,.65fr);
  min-width:1192px;
  padding:0 8px;
  gap:0;
  align-items:stretch;
}
#dashboard-content .fleet-head{
  height:32px;
  position:sticky;
  top:0;
  z-index:3;
  background:#162334;
  border-bottom:1px solid #2b3d52;
  align-items:center;
}
#dashboard-content .fleet-head>span{
  font-size:10px;
  font-weight:700;
  letter-spacing:.03em;
  text-transform:uppercase;
  color:#a8bdd6;
  padding:0 6px;
  white-space:nowrap;
}
#dashboard-content .phone-row{
  min-height:56px;
  border-top:1px solid #202e3e;
  background:#0f1926;
  transition:background .12s;
}
#dashboard-content .phone-row:nth-child(odd){background:#111c2b}
#dashboard-content .phone-row:hover{background:#162538}
#dashboard-content .phone-row.row-is-ready{background:#0e201d}
#dashboard-content .phone-row.row-is-ready:hover{background:#132a26}

#dashboard-content .row-cell{padding:4px 5px;min-width:0;display:flex;flex-direction:column;justify-content:center}
#dashboard-content .row-cell strong{font-size:12px;font-weight:650;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#dashboard-content .row-cell small{font-size:10px;line-height:1.25;color:#879eb8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}

/* Identity column */
.identity-top{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0}
.phone-name{cursor:pointer;color:#eef5ff;font-weight:700;font-size:12px}
.phone-name:hover{color:#9ad6ff;text-decoration:underline}
.battery-pill{flex-shrink:0;font-size:10px;font-weight:700;padding:1px 5px;border-radius:5px;background:#182637;border:1px solid #2a3c52;font-variant-numeric:tabular-nums}

/* Connected chain stages */
#dashboard-content .chain-stage{
  position:relative;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:4px 5px;
  z-index:0;
}
#dashboard-content .chain-stage:before{
  content:'';
  position:absolute;
  left:-5px;
  right:-5px;
  top:50%;
  height:2px;
  background:#31455b;
  z-index:0;
}
#dashboard-content .chain-stage[data-stage="network"]:before{left:50%}
#dashboard-content .chain-stage[data-stage="ready"]:before{right:50%}
#dashboard-content .stage-complete:before{background:#3fa883}
#dashboard-content .stage-current:before{background:#d49e45}
#dashboard-content .stage-current.stage-bad:before{background:#c95668}
#dashboard-content .stage-auto:before{background:#b08a3e}

#dashboard-content .stage-surface{
  position:relative;
  z-index:1;
  width:100%;
  min-height:44px;
  border:1px solid #27394e;
  background:#142131;
  border-radius:8px;
  padding:4px 7px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:flex-start;
  gap:2px;
}
#dashboard-content .stage-complete .stage-surface{
  background:linear-gradient(120deg,#12302a,#112420);
  border-color:#3fa883;
  box-shadow:0 0 0 1px #5ee3ab1f,0 0 12px #5ee3ab1a;
}
/* Active operator action highlight (yellow for warn/update, red-amber for missing/bad) */
#dashboard-content .stage-current .stage-surface{
  background:linear-gradient(120deg,#362b17,#242620);
  border-color:#f0ba56;
  box-shadow:0 0 0 1px #f0ba5626,0 0 14px #f0ba5622;
}
#dashboard-content .stage-current.stage-bad .stage-surface{
  background:linear-gradient(120deg,#3a1d26,#261c24);
  border-color:#fb8192;
  box-shadow:0 0 0 1px #fb819229,0 0 14px #fb819224;
}
/* Automatic stage in progress (warmup / auto-dressing) */
#dashboard-content .stage-auto .stage-surface{
  background:linear-gradient(120deg,#2c2516,#1f211d);
  border-color:#c9a04f;
  border-style:dashed;
  box-shadow:0 0 0 1px #f6c86a1a,0 0 10px #f6c86a14;
}

/* Inline operator action button inside active stage */
#dashboard-content .inline-action{
  display:inline-flex;
  align-items:center;
  gap:4px;
  max-width:100%;
  margin-top:2px;
  padding:2px 6px;
  border-radius:5px;
  border:1px solid #f0ba5688;
  background:#f0ba5622;
  color:#ffe09e;
  font-size:10px;
  font-weight:700;
  line-height:1.25;
  text-align:left;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  cursor:pointer;
}
#dashboard-content .inline-action:hover{background:#f0ba5638;color:#fff}
#dashboard-content .stage-bad .inline-action{
  border-color:#fb819299;
  background:#fb819226;
  color:#ffc2cb;
}
#dashboard-content .stage-bad .inline-action:hover{background:#fb819240;color:#fff}
#dashboard-content .inline-action.auto-action{
  border-color:#5da9e966;
  background:#5da9e91c;
  color:#a8d8ff;
  font-weight:600;
}

/* Optional SOCKS5 stage: dashed frame, never highlighted as the mandatory next step */
#dashboard-content .stage-optional .stage-surface{border-style:dashed}
#dashboard-content .stage-optional:not(.stage-complete):before{background:repeating-linear-gradient(90deg,#31455b 0 4px,transparent 4px 8px)}
#dashboard-content .inline-action.optional-action{border-color:#7c8fa666;background:#7c8fa61a;color:#c3d2e4;font-weight:600}
.journey-step.optional .step-number{border-style:dashed}
.proxy-checks{list-style:none;margin:3px 0 0;padding:0;font-size:11px;line-height:1.45}
.proxy-check-button{margin-top:4px}

/* Stage 3: 3x Telegram accounts layout */
#dashboard-content .row-accounts .stage-surface{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:2px 6px;
}
#dashboard-content .row-accounts .inline-action{
  grid-column:1/-1;
  width:100%;
  justify-content:center;
}
.account-count{
  font-size:10px;
  font-weight:700;
  padding:2px 5px;
  border-radius:5px;
  background:#1d2e42;
  border:1px solid currentColor;
  font-variant-numeric:tabular-nums;
}
.account-names{min-width:0;display:flex;flex-direction:column;gap:1px}
#dashboard-content .row-accounts button.account{
  border:0;
  background:none;
  padding:0 2px;
  margin:0;
  text-align:left;
  font-size:10.5px;
  line-height:13px;
  font-weight:500;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  cursor:pointer;
  border-radius:3px;
}
#dashboard-content .row-accounts button.account:hover{background:#ffffff12;text-decoration:underline}
#dashboard-content .row-accounts button.missing-slot{font-weight:650;opacity:.95}

/* Stage 4, 5, 6: 3 numbered slot badges [1] [2] [3] */
.account-slots{display:flex;gap:4px;align-items:center;flex-wrap:nowrap}
#dashboard-content .account-dot{
  width:23px;
  height:23px;
  padding:0;
  border-radius:6px;
  border:1.5px solid currentColor;
  background:#ffffff06;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:10.5px;
  font-weight:750;
  line-height:1;
  flex-shrink:0;
  font-variant-numeric:tabular-nums;
}
#dashboard-content button.account-dot:hover{background:#ffffff18}
#dashboard-content .account-dot.good{background:#5ee3ab1a}
#dashboard-content .account-dot.warn{background:#f6c86a1c}
#dashboard-content .account-dot.bad{background:#fb81921c}
#dashboard-content .slot-empty{border-style:dashed;opacity:.72;cursor:default}

/* Stage 7: Ready & CRM limit */
#dashboard-content .row-ready .stage-surface{
  align-items:center;
  text-align:center;
  padding:4px;
}
#dashboard-content .row-ready strong{font-size:13px;font-variant-numeric:tabular-nums}
.ready-limit{font-size:9.5px!important;font-variant-numeric:tabular-nums}

/* Dialogs: Journey & Auto-Dressing Pool */
#journey-panel,#pool-panel{
  width:480px;
  max-width:100%;
  height:100dvh;
  max-height:100dvh;
  margin:0 0 0 auto;
  border:0;
  border-left:1px solid #314359;
  padding:18px 20px;
  background:#101a27;
  color:#edf2f7;
  box-shadow:-16px 0 60px #0009;
  overflow-y:auto;
}
#pool-panel{width:540px}
#journey-panel::backdrop,#pool-panel::backdrop{background:#040912a6}
.journey-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.journey-tools{display:flex;gap:6px;margin:10px 0}
#journey-accounts{display:flex;gap:5px;flex-wrap:wrap;margin:10px 0}
#dashboard-content .journey-account{padding:5px 8px;font-size:11px;border:1px solid #314359;background:#172536;color:#adc2db}
#dashboard-content .journey-account[aria-pressed=true]{border-color:#7fb2e0;color:#fff;background:#263e59}
#dashboard-content .journey-account.slot-missing{border-style:dashed;color:var(--bad);border-color:#fb819266}

.journey-next{padding:12px;background:#1b2635;border:1px solid #3c5470;border-radius:9px;margin:12px 0}
.journey-next>strong{color:#ffda85;font-size:13px;display:block}
.journey-next p{font-size:12px;line-height:1.5;color:#cbd7e6;margin:6px 0 10px}
#journey-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.journey-link{display:inline-block;padding:6px 10px;background:#1f5b55;border:1px solid #3e7d78;border-radius:6px;font-size:11px;color:#dcfff3;text-decoration:none;font-weight:650}
.journey-phone{font-size:11px}

#journey-steps{list-style:none;padding:0;margin:14px 0 0}
.journey-step{display:flex;align-items:center;gap:11px;position:relative;min-height:42px;padding:6px 8px;border-radius:7px}
.journey-step:not(:last-child):after{content:'';position:absolute;left:19px;top:32px;bottom:-6px;width:1.5px;background:#2f4156}
.step-number{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;border:1.5px solid currentColor;border-radius:50%;font-size:11px;font-weight:700;background:#101a27;z-index:1}
.journey-step strong{font-size:12px;font-weight:650;display:block}
.journey-step small{display:block;font-size:11px;color:#95aac2;margin-top:1px}
.journey-step.current{background:#f6c86a12;outline:1px solid #f6c86a4d}
.journey-step.current .step-number,.journey-step.current strong{color:#f6c86a}

/* Pool configuration styles */
.pool-lead{font-size:12px;line-height:1.5;margin:10px 0 14px}
.pool-box{background:#152233;border:1px solid #2b3e55;border-radius:9px;padding:12px;margin-bottom:14px}
.pool-box-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;font-size:12px}
.upload-btn{display:inline-block;padding:6px 11px;border-radius:6px;background:#1f5b55;border:1px solid #3e7d78;color:#dcfff3;font-size:11px;font-weight:650;cursor:pointer}
.upload-btn:hover{background:#2a726a}
.pool-gender-row{display:flex;align-items:center;gap:12px;margin-top:8px;font-size:11px;color:#a8bdd6}
.pool-gender-row label{display:inline-flex;align-items:center;gap:5px;cursor:pointer}
.checkbox-row{display:flex!important;align-items:center;gap:8px;font-size:12px!important;color:#dce7f5!important;cursor:pointer}

/* Supporting sections */
.meta-form{display:grid;gap:12px;max-width:820px}
.meta-form label{display:grid;gap:5px;font-size:12px;color:var(--muted)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.form-actions{display:flex;gap:12px;align-items:center}
.pair{display:flex;justify-content:space-between;align-items:center;gap:20px}
.pair p{font-size:12px}
.pair-code{display:grid;gap:8px}
.pair-code strong{font-size:24px;letter-spacing:.12em}
#dashboard-content .pair,#dashboard-content .meta-editor,#dashboard-content .control-section{margin:10px 0 0;padding:14px 16px;border-radius:10px}
.section-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.toolbar>div{flex:1}
.workspace{display:flex;gap:18px;margin-top:12px}
.screen{background:#070c13;border:1px solid #1f2d3d;border-radius:10px;min-height:240px;flex:1;display:flex;justify-content:center;align-items:center;padding:10px}
.screen img{max-width:100%;max-height:72vh;object-fit:contain;touch-action:none;user-select:none}
.actions{display:grid;gap:9px;width:230px;align-content:start}
.actions p,.actions label{font-size:12px}
.actions textarea{min-height:80px}
.empty{padding:34px;text-align:center;color:var(--muted);font-size:13px}
#status{white-space:pre-wrap;font-size:11px;margin:6px 2px 0;color:#9ecbff}
#status:empty{display:none}

@media(max-width:1150px){
  .pipeline-legend{display:none}
  #dashboard-content .fleet-grid{max-height:calc(100dvh - 145px)}
}
@media(max-width:720px){
  .dashboard-page main{padding:8px}
  .form-grid{grid-template-columns:1fr}
  .workspace{flex-direction:column}
  .actions{width:100%}
  #dashboard-content .filters{width:100%}
  #dashboard-content .filters input{flex:1;width:auto}
  #dashboard-content .fleet-head>span:first-child,#dashboard-content .row-identity{
    position:sticky;left:-8px;background:#132030;z-index:2;border-right:1px solid var(--border);
  }
}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Physical / Emulators tabs */
.kind-tabs{display:flex;gap:4px;margin:4px 0 12px;border-bottom:1px solid var(--border)}
.kind-tab{background:none;border:0;border-bottom:2px solid transparent;border-radius:0;padding:9px 16px;font-weight:650;color:var(--muted);cursor:pointer;box-shadow:none}
.kind-tab b{font-weight:650;margin-left:7px;padding:1px 8px;border-radius:999px;background:#1a2636;color:inherit;font-size:.85em}
.kind-tab:hover{color:#edf2f7}
.kind-tab.active,.kind-tab[aria-selected="true"]{color:#edf2f7;border-bottom-color:var(--auto)}
.kind-tab:focus-visible{outline:2px solid var(--auto);outline-offset:2px}

/* other clients of the hub (CRM Agent devices are on /clients) */
.hub-strip{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;margin:-4px 0 12px;font-size:12px;color:var(--muted)}
.hub-strip a{padding:3px 10px;border-radius:999px;background:#182433;border:1px solid var(--border);color:#c7d6e8;text-decoration:none;font-weight:600}
.hub-strip a:hover{background:#233449;color:#fff}
