/* Onboarding panel — iOS dark, Liquid Glass only on floating chrome.
   Spacing/colour discipline follows unslop by Damir Sokolovsky (@heydamir), CC BY 4.0. */
:root {
  --bg: #000;
  --surface: #1c1c1e;
  --raised: #2c2c2e;
  --raised2: #3a3a3c;
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .14);
  --text: #f5f5f7;
  --text2: #aeaeb2;
  --muted: #8e8e93;
  --accent: #0a84ff;
  --accent-fill: #0071e3;
  --accent-text: #4aa3ff;
  --pick: rgba(10, 132, 255, .14);
  --pick-strong: rgba(10, 132, 255, .22);
  --press: rgba(255, 255, 255, .06);
  --ok: #4cc38a;
  --warn: #f0a740;
  --err: #ff5c5c;
  --glass: rgba(36, 36, 40, .58);
  --glass-strong: rgba(28, 28, 30, .78);
  --glass-edge: rgba(255, 255, 255, .14);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .1), inset 0 0 0 .5px rgba(255, 255, 255, .06);
  --float: 0 12px 40px rgba(0, 0, 0, .45);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  /* Visible height: Telegram's stable viewport when the panel runs as a Mini App, otherwise the dynamic viewport. */
  --app-h: 100vh;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
@supports (height: 100dvh) { :root { --app-h: 100dvh; } }
:root.tg { --app-h: var(--tg-viewport-stable-height, 100vh); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; background: var(--bg); }
html, body { margin: 0; min-height: 100%; overflow-x: clip; }
body { font: 15px/20px var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button, [role="button"], label, summary, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-text); text-decoration: none; }
.mono { font-family: var(--mono); font-size: 13px; }
.num, .bal { font-variant-numeric: tabular-nums; }
.muted { color: var(--text2); }
.dim { color: var(--muted); }
.hidden { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 10px; border: 0;
  background: var(--raised); color: var(--text); cursor: pointer; font-weight: 500; white-space: nowrap; user-select: none; -webkit-user-select: none;
  transition: background-color .15s var(--ease), opacity .15s var(--ease), transform .12s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(.97); background: var(--raised2); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.primary { background: var(--accent-fill); color: #fff; }
.btn.primary:active:not(:disabled) { background: #0062c4; }
.btn.ghost { background: transparent; color: var(--accent-text); }
.btn.ghost:active:not(:disabled) { background: rgba(255, 255, 255, .1); }
.btn.danger { background: rgba(255, 92, 92, .12); color: var(--err); }
.btn.danger:active:not(:disabled) { background: rgba(255, 92, 92, .24); }
.btn.sm { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 14px; }
.btn.lg { height: 48px; padding: 0 20px; border-radius: 12px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }

.spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: currentColor; animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- status: dot + text, no glow ---------- */
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text2); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.ok { color: var(--text); } .pill.ok::before { background: var(--ok); }
.pill.err { color: var(--err); } .pill.err::before { background: var(--err); }
.pill.warn { color: var(--text); } .pill.warn::before { background: var(--warn); }
.pill.info { color: var(--text); } .pill.info::before { background: var(--accent); }
.pill.mute::before { background: #636366; }
.sess { display: inline-flex; align-items: center; gap: 8px; color: var(--text2); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #636366; flex: none; }
.dot.ok { background: var(--ok); } .dot.err { background: var(--err); } .dot.warn { background: var(--warn); }

/* ---------- login ---------- */
.login-wrap { min-height: var(--app-h); display: grid; place-items: center; padding: calc(24px + var(--sat)) calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal)); }
.login { width: min(400px, 100%); padding: 32px; border-radius: 20px; background: var(--surface); }
.login-wait { display: grid; justify-items: center; gap: 12px; color: var(--text2); font-size: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .mark { width: 32px; height: 32px; border-radius: 8px; background: var(--text); display: grid; place-items: center; flex: none; }
.brand .mark svg { width: 18px; height: 18px; stroke: #000; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand b { font-size: 17px; font-weight: 600; display: block; line-height: 20px; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 16px; }
.login h1 { margin: 32px 0 8px; font-size: 28px; line-height: 32px; font-weight: 600; }
.login p { margin: 0 0 24px; color: var(--text2); }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--text2); }
.input, select.input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 10px; border: 0; background: var(--raised);
  outline: none; transition: box-shadow .15s var(--ease); min-width: 0;
}
textarea.input { height: auto; padding: 12px; resize: vertical; line-height: 20px; font-family: var(--mono); font-size: 13px; }
.input:focus, .input:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.input::placeholder { color: var(--muted); }
.form-error { min-height: 20px; color: var(--err); font-size: 14px; margin-bottom: 12px; }

/* ---------- top bar (glass) ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; min-height: 64px;
  padding: var(--sat) calc(32px + var(--sar)) 0 calc(32px + var(--sal));
  background: var(--glass); backdrop-filter: blur(28px) saturate(170%); -webkit-backdrop-filter: blur(28px) saturate(170%);
  border-bottom: .5px solid var(--glass-edge);
}
.tabs { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: rgba(118, 118, 128, .24); min-width: 0; }
.tab { flex: none; height: 32px; padding: 0 16px; border-radius: 8px; border: 0; background: transparent; color: var(--text2); cursor: pointer; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.tab:active { background: rgba(255, 255, 255, .08); }
.tab.active { background: #636366; color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.tab:focus-visible, .chip:focus-visible { outline-offset: -2px; }
.tab .count { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; font-weight: 400; }
.tab.active .count { color: #d1d1d6; }
.tab .count.alert { color: #ff8a8a; }
.top .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 12px; color: var(--text2); font-size: 14px; flex: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--raised2); display: grid; place-items: center; font-weight: 500; color: var(--text); text-transform: uppercase; font-size: 14px; flex: none; }
.role { font-size: 13px; color: var(--muted); }

main { padding: 32px calc(32px + var(--sar)) calc(160px + var(--sab)) calc(32px + var(--sal)); max-width: 1440px; margin: 0 auto; }

/* ---------- pipeline (the one rich element) ---------- */
.stats { margin-bottom: 32px; }
.pipeline { padding: 24px; border-radius: 16px; background: var(--surface); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 40px; align-items: end; }
.pipeline .total { font-size: 40px; line-height: 44px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pipeline .total small { font-size: 15px; color: var(--text2); font-weight: 400; margin-left: 8px; letter-spacing: 0; }
.pipeline .side { display: flex; gap: 32px; }
.pipeline .side div { text-align: right; }
.pipeline .side b { display: block; font-size: 22px; line-height: 28px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pipeline .side b.bad { color: var(--err); }
.pipeline .side span { font-size: 13px; color: var(--text2); }
.track { grid-column: 1 / -1; display: flex; gap: 4px; height: 12px; }
.track i { display: block; border-radius: 4px; min-width: 4px; transition: flex-grow .4s var(--ease); }
.legend { grid-column: 1 / -1; display: flex; gap: 8px 24px; flex-wrap: wrap; font-size: 14px; color: var(--text2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search { position: relative; flex: 0 1 280px; min-width: 0; }
.search input { padding-left: 36px; height: 36px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.chips { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: rgba(118, 118, 128, .24); flex-wrap: wrap; min-width: 0; }
.chip { height: 32px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: var(--text2); cursor: pointer; font-size: 14px; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.chip:active { background: rgba(255, 255, 255, .08); }
.chip.active { background: #636366; color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }

/* ---------- table as an inset grouped list ---------- */
.card { background: var(--surface); border-radius: 16px; overflow: hidden; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 400; padding: 12px 16px; border-bottom: .5px solid var(--line); white-space: nowrap; }
.table td { padding: 0 16px; height: 60px; border-bottom: .5px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr[data-p] { cursor: pointer; transition: background-color .12s var(--ease); }
.table tbody tr[data-p]:active { background: var(--press); }
.table tbody tr:focus-visible { outline-offset: -2px; }
/* Selection reads apart: picked = accent tint, open in the drawer = neutral surface step with an accent edge. */
.table tbody tr.picked, .acard.picked { background: var(--pick); }
.table tbody tr.selected, .acard.selected { background: var(--raised); box-shadow: inset 3px 0 0 var(--accent); }
.table tbody tr.selected.picked, .acard.selected.picked { background: var(--pick-strong); }
.pname { font-weight: 500; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pname .busy { color: var(--accent-text); }
.bal small { color: var(--muted); }
.empty { padding: 64px 24px; text-align: center; color: var(--text2); }
.empty b { display: block; color: var(--text); font-size: 17px; font-weight: 500; margin-bottom: 4px; }
.table th.cbx, .table td.cbx { width: 56px; padding: 0 0 0 4px; }
.table td.acts { text-align: right; white-space: nowrap; padding-right: 16px; }
.table td.acts .btn + .btn { margin-left: 4px; }
.check { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; cursor: pointer; flex: none; border-radius: 50%; }
.check input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.check span { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #8e8e93; display: grid; place-items: center; transition: background-color .12s var(--ease), border-color .12s var(--ease), transform .12s var(--ease); pointer-events: none; }
.check:active span { transform: scale(.9); }
.check input:checked + span, .check input:indeterminate + span { background: var(--accent); border-color: var(--accent); }
.check input:checked + span::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input:indeterminate + span::after { content: ""; width: 10px; height: 2px; border-radius: 1px; background: #fff; }
.check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- accounts as cards (phones) ---------- */
.acards-head { display: flex; align-items: center; gap: 4px; padding: 4px 16px 4px 4px; border-bottom: .5px solid var(--line); font-size: 14px; color: var(--text2); min-height: 52px; }
.acards-head .spacer { flex: 1; }
.acard { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 4px; padding: 8px 16px 12px 4px; border-bottom: .5px solid var(--line); cursor: pointer; transition: background-color .12s var(--ease); }
.acard:last-child { border-bottom: 0; }
.acard:active { background: var(--press); }
.acard:focus-visible { outline-offset: -2px; }
.acard > .check { margin-top: 0; }
.acard-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.acard-top .pname { font-size: 17px; line-height: 22px; }
.acard-top .owner { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.acard-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; }
.acard-grid > div { min-width: 0; }
.acard-grid .k { display: block; font-size: 12px; line-height: 16px; color: var(--muted); margin-bottom: 4px; }
.acard-grid .pill, .acard-grid .sess { white-space: normal; align-items: flex-start; line-height: 18px; }
.acard-grid .pill::before, .acard-grid .sess .dot { margin-top: 5px; }
.acard-grid .sub-t { white-space: normal; }
.acard-grid .bal { font-size: 15px; line-height: 18px; }

/* ---------- drawer (glass sheet) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); touch-action: none; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: calc(12px + var(--sat)); right: calc(12px + var(--sar)); bottom: calc(12px + var(--sab)); width: min(520px, calc(100% - 24px)); z-index: 31; border-radius: 24px; overflow: hidden;
  background: var(--glass-strong); backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: var(--glass-hi), var(--float); border: .5px solid var(--glass-edge);
  transform: translateX(calc(100% + 24px)); visibility: hidden; transition: transform .4s var(--ease), visibility 0s .4s; display: flex; flex-direction: column;
}
.drawer.open { transform: none; visibility: visible; transition: transform .4s var(--ease); }
.drawer-head { flex: none; padding: 24px 16px 16px 24px; display: flex; align-items: flex-start; gap: 16px; }
.drawer-head h2 { margin: 0; font-size: 34px; line-height: 40px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.drawer-head .sub { color: var(--text2); font-size: 14px; margin-top: 8px; display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.drawer-close { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(118, 118, 128, .24); color: var(--text2); display: grid; place-items: center; cursor: pointer; transition: background-color .12s var(--ease); }
.drawer-close:active { background: rgba(118, 118, 128, .4); }
.drawer-close svg { width: 18px; height: 18px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 16px calc(32px + var(--sab)); display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 24px; }
.section { min-width: 0; }
.section h3 { margin: 0 0 8px; padding: 0 16px; font-size: 13px; color: var(--text2); font-weight: 400; display: flex; align-items: center; gap: 8px; }
.section > .group { background: rgba(58, 58, 60, .55); border-radius: 12px; padding: 4px 16px; }
.vrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 0; }
.vrow + .vrow { border-top: .5px solid var(--line); }
.vrow.sep { border-top: .5px solid var(--line); }
.vrow .what { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; font-weight: 500; font-size: 16px; flex-wrap: wrap; }
.vrow .note { color: var(--text2); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.vrow .note.err { color: var(--err); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Secondary buttons on the grey grouped sections need their own step, or they melt into the group. */
.group .btn:not(.primary):not(.danger):not(.ghost), .batch .btn:not(.primary):not(.danger):not(.ghost) { background: rgba(255, 255, 255, .1); }
.group .btn:not(.primary):not(.danger):not(.ghost):active:not(:disabled), .batch .btn:not(.primary):not(.danger):not(.ghost):active:not(:disabled) { background: rgba(255, 255, 255, .18); }
.linkbox { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 10px; background: rgba(0, 0, 0, .28); min-width: 0; }
.linkbox .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13px; color: var(--text2); }
.linkbox .btn { flex: none; }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 0 12px; font-size: 15px; }
.kv dt, .kv dd { padding: 12px 0; border-bottom: .5px solid var(--line); margin: 0; min-height: 44px; display: flex; align-items: center; }
.kv dt:nth-last-child(2), .kv dd:last-child { border-bottom: 0; }
.kv dt { color: var(--text2); }
.kv dd { gap: 8px; min-width: 0; }
.kv dd .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kv dd .copy { margin: -8px 0; }
.money { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: .5px solid var(--line); }
.money > div { min-width: 0; }
.money span { display: block; font-size: 13px; color: var(--text2); }
.money b { font-size: 28px; line-height: 32px; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.money b small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.copy { width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; display: inline-grid; place-items: center; flex: none; color: var(--accent-text); transition: background-color .12s var(--ease); }
.copy:active { background: rgba(255, 255, 255, .12); }
.copy svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.steps { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); flex-wrap: wrap; }
.steps .st { display: inline-flex; align-items: center; gap: 8px; }
.steps .st i { width: 8px; height: 8px; border-radius: 50%; background: #636366; }
.steps .st.done i { background: var(--ok); }
.steps .st.now { color: var(--text); } .steps .st.now i { background: var(--accent); }
.steps .bar { width: 16px; height: 1px; background: var(--line2); }

/* ---------- feed ---------- */
.feed { display: grid; }
.ev { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 12px 0; }
.ev + .ev { border-top: .5px solid var(--line); }
.ev .ic { width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); }
.ev .ic svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ev.ok .ic { color: var(--ok); }
.ev.error .ic, .ev.error .t { color: var(--err); }
.ev.pending .ic { color: var(--accent-text); }
.ev .t { white-space: pre-line; font-size: 14px; overflow-wrap: anywhere; }
.ev .when { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: center; }
.ev .when a { display: inline-flex; align-items: center; min-height: 32px; }

/* ---------- create / jobs ---------- */
.create-grid { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
.create-card, .jobs-card { padding: 24px; min-width: 0; }
.create-card h2, .jobs-card h2 { margin: 0 0 4px; font-size: 22px; line-height: 28px; font-weight: 600; }
.create-card .hint, .jobs-card .hint { color: var(--text2); font-size: 14px; margin: 0 0 16px; }
.create-card .hint.foot { margin: 16px 0 0; font-size: 13px; }
.rule { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; background: var(--raised); color: var(--text2); font-size: 14px; }
.rule b { color: var(--text); font-weight: 500; }
.counter { display: flex; justify-content: space-between; gap: 12px; color: var(--text2); font-size: 13px; margin: 8px 0 16px; }
.counter b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.batch { border-radius: 12px; background: var(--raised); margin-top: 16px; overflow: hidden; }
.batch-head { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; padding: 12px 16px; font-size: 13px; color: var(--text2); border-bottom: .5px solid var(--line); }
.batch-head b { color: var(--text); font-weight: 500; }
.job { padding: 12px 16px; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.job + .job { border-top: .5px solid var(--line); }
.job .ix { width: 24px; height: 24px; display: grid; place-items: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.job .ix svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.job.RUNNING .ix { color: var(--accent-text); } .job.DONE .ix { color: var(--ok); } .job.FAILED .ix { color: var(--err); }
.job .title { font-weight: 500; display: flex; gap: 4px 12px; align-items: center; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.job .step { color: var(--text2); font-size: 13px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .errbox { grid-column: 2 / -1; padding: 8px 12px; border-radius: 8px; background: rgba(255, 92, 92, .1); color: #ff8a8a; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
.job details { grid-column: 2 / -1; min-width: 0; }
.job summary { cursor: pointer; color: var(--accent-text); font-size: 13px; list-style: none; display: inline-flex; align-items: center; min-height: 32px; }
.job summary::-webkit-details-marker { display: none; }
.job .log { margin-top: 8px; padding: 12px; border-radius: 8px; background: rgba(0, 0, 0, .35); font-family: var(--mono); font-size: 12px; line-height: 18px; color: var(--text2); max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-overflow-scrolling: touch; }

/* ---------- users ---------- */
.users-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.users-grid .form { padding: 24px; min-width: 0; }
.users-grid .form h2 { margin: 0 0 4px; font-size: 22px; line-height: 28px; font-weight: 600; }
.users-grid details summary { cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- bulk bar (glass) ---------- */
.bulkbar {
  position: fixed; left: 50%; bottom: calc(24px + var(--sab)); z-index: 25; width: min(1200px, calc(100% - 32px));
  display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 22px;
  background: var(--glass); backdrop-filter: blur(32px) saturate(180%); -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: .5px solid var(--glass-edge); box-shadow: var(--glass-hi), var(--float);
  transform: translate(-50%, calc(100% + 48px)); visibility: hidden;
  transition: transform .4s var(--ease), visibility 0s .4s;
}
.bulkbar.open { transform: translate(-50%, 0); visibility: visible; transition: transform .4s var(--ease); }
.bulk-head { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.bulk-count { padding: 0 12px; font-size: 15px; color: var(--text2); white-space: nowrap; }
.bulk-count b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bulk-groups { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; min-width: 0; }
.bulk-group { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.bulk-group + .bulk-group { padding-left: 12px; border-left: .5px solid var(--line2); }
.bulk-group > span { font-size: 12px; color: var(--muted); margin-right: 4px; white-space: nowrap; }
.bulkbar .btn.sm { background: rgba(255, 255, 255, .08); }
.bulkbar .btn.sm:active:not(:disabled) { background: rgba(255, 255, 255, .16); }
.bulkbar .btn.primary { background: var(--accent-fill); }
.bulkbar .btn.danger { background: rgba(255, 92, 92, .14); }
.bulkbar .btn.ghost { background: transparent; }

/* ---------- results popover (glass) ---------- */
.results {
  position: fixed; right: calc(24px + var(--sar)); top: calc(80px + var(--sat)); z-index: 26; width: min(520px, calc(100% - 32px)); max-height: calc(var(--app-h) - 240px);
  display: none; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: var(--glass-strong); backdrop-filter: blur(36px) saturate(180%); -webkit-backdrop-filter: blur(36px) saturate(180%);
  border: .5px solid var(--glass-edge); box-shadow: var(--glass-hi), var(--float);
}
.results.open { display: flex; animation: rise .3s var(--ease); }
.results-head { flex: none; display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: .5px solid var(--line); }
.results-head b { font-size: 17px; font-weight: 600; }
.results-head .muted { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.results-list { overflow-y: auto; padding: 4px 8px 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; min-height: 0; }
.rrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) 36px; gap: 12px; align-items: center; padding: 4px 12px; min-height: 44px; }
.rrow + .rrow { border-top: .5px solid var(--line); }
.rrow b { cursor: pointer; font-weight: 500; font-variant-numeric: tabular-nums; }
.rval { min-width: 0; display: flex; gap: 8px; align-items: center; overflow: hidden; font-size: 14px; }
.rval .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.err-t { color: var(--err); font-size: 14px; }
.rval .rtext { min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 20px; padding: 8px 0; }
.rempty { padding: 16px 12px; font-size: 14px; }
.results-head.rh { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 12px 12px 20px; }
.rh-top, .rh-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.rh-top b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-sub .muted { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rh-sub .btn { flex: none; }
.results .rval .mono { white-space: normal; word-break: break-all; font-size: 13px; line-height: 18px; padding: 6px 0; }

/* ---------- toast & modal ---------- */
.toasts { position: fixed; left: 50%; top: calc(76px + var(--sat)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast {
  padding: 12px 16px; border-radius: 16px; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere;
  background: var(--glass-strong); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: .5px solid var(--glass-edge); box-shadow: var(--glass-hi), var(--float); animation: rise .3s var(--ease);
}
.toast.err { color: #ffb3b3; }
@keyframes rise { from { opacity: 0; transform: translateY(-8px); } }
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, .45); padding: calc(24px + var(--sat)) calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal)); overscroll-behavior: contain; }
.modal {
  width: min(320px, 100%); max-height: calc(var(--app-h) - 48px); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; text-align: center;
  background: var(--glass-strong); backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: .5px solid var(--glass-edge); box-shadow: var(--glass-hi), var(--float); animation: rise .25s var(--ease);
}
.modal h3 { margin: 20px 16px 4px; font-size: 17px; font-weight: 600; flex: none; overflow-wrap: anywhere; }
.modal p { margin: 0 16px 20px; color: var(--text2); font-size: 13px; line-height: 18px; white-space: pre-line; overflow-y: auto; overflow-wrap: anywhere; min-height: 0; }
.modal .row { flex: none; display: grid; grid-template-columns: 1fr 1fr; border-top: .5px solid var(--line2); }
.modal .row .btn { height: 48px; border-radius: 0; background: transparent; color: var(--accent-text); font-size: 17px; }
.modal .row .btn + .btn { border-left: .5px solid var(--line2); font-weight: 600; }
.modal .row .btn.danger { color: var(--err); }
.modal .row .btn:focus-visible { outline-offset: -2px; }
.modal .row .btn:active:not(:disabled) { background: rgba(255, 255, 255, .1); transform: none; }

/* ---------- verifier ---------- */
.v-wrap { max-width: 520px; margin: 0 auto; padding: calc(24px + var(--sat)) calc(16px + var(--sar)) calc(48px + var(--sab)) calc(16px + var(--sal)); }
.v-head { padding: 8px 4px 24px; }
.v-acc { margin-top: 32px; font-size: 15px; color: var(--text2); }
.v-num { font-size: 48px; line-height: 52px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.v-step { padding: 20px; border-radius: 20px; background: var(--surface); margin-bottom: 16px; }
.v-step.bad { box-shadow: inset 0 0 0 .5px rgba(255, 92, 92, .45); }
.v-step-head { display: flex; align-items: center; gap: 8px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.v-step-head h2.sm { font-size: 17px; }
.v-badge { width: 28px; height: 28px; border-radius: 50%; background: var(--raised2); display: grid; place-items: center; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; flex: none; }
.v-badge svg { width: 16px; height: 16px; stroke: #000; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.v-step.done .v-badge { background: var(--ok); }
.v-step-head h2 { margin: 0; font-size: 20px; line-height: 24px; font-weight: 600; flex: 1; }
.v-step-head .pill { white-space: normal; }
.v-note { color: var(--text2); font-size: 15px; margin: 0 0 16px; white-space: pre-line; overflow-wrap: anywhere; }
.v-note.flat { margin: 0; }
.v-note.err { color: #ff8a8a; padding: 12px; border-radius: 12px; background: rgba(255, 92, 92, .1); }
.v-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v-btns .btn { height: 44px; border-radius: 12px; min-width: 0; }
.v-btns .btn:not(.primary):not(.danger) { background: rgba(255, 255, 255, .1); }
.v-btns .btn:not(.primary):not(.danger):active:not(:disabled) { background: rgba(255, 255, 255, .18); }
.v-btns .btn:only-child, .v-btns .v-link + .btn:last-child { grid-column: 1 / -1; }
.v-btns .btn.lg { grid-column: 1 / -1; height: 48px; }
.v-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }
.v-foot.tight { margin: 12px 0 0; }
.flash { animation: flash 1s var(--ease); }
@keyframes flash { 30% { box-shadow: 0 0 0 2px var(--err); } }

.sub-t { display: block; font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.rej, .v-rej { margin-top: 4px; border-radius: 10px; background: rgba(255, 92, 92, .08); padding: 8px 12px; }
.v-rej { margin: 0 0 16px; }
.rej-h, .v-rej-h { font-size: 13px; color: var(--err); margin-bottom: 4px; }
.rej-r, .v-rej-r { font-size: 13px; color: var(--text2); padding: 4px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
.rej-r + .rej-r, .v-rej-r + .v-rej-r { border-top: .5px solid var(--line); }
.rej-r span, .v-rej-r span { color: var(--muted); font-variant-numeric: tabular-nums; }
.v-link { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 4px; }
.v-link .input { height: 44px; font-size: 13px; }
.v-link .btn { height: 44px; border-radius: 12px; }
.links-modal { width: min(560px, 100%); text-align: left; }
.links-modal h3, .links-modal p { text-align: left; }
.links-list { padding: 0 16px 16px; display: grid; gap: 8px; max-height: calc(var(--app-h) * .5); overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.lrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.lrow b { font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lrow .input { height: 36px; font-size: 13px; }

/* kuser: several accounts on one link */
.v-sum { font-size: 15px; color: var(--text2); margin-top: 4px; }
.v-feed { padding: 0 4px; }
.v-feed summary { cursor: pointer; color: var(--accent-text); font-size: 14px; list-style: none; display: flex; align-items: center; min-height: 44px; }
.v-feed summary::-webkit-details-marker { display: none; }

/* kuser: accounts as separate collapsible blocks */
.v-list { display: grid; gap: 12px; }
.v-card { border-radius: 20px; background: var(--surface); border: .5px solid var(--line); overflow: hidden; scroll-margin-top: 16px; }
.v-card.bad { border-color: rgba(255, 92, 92, .45); }
.v-card-sum { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 20px; grid-template-areas: "num chev" "st chev"; gap: 8px 12px; align-items: center; padding: 16px 20px; border: 0; background: transparent; text-align: left; cursor: pointer; transition: background-color .12s var(--ease); }
.v-card-sum:active { background: var(--press); }
.v-card-sum:focus-visible { outline-offset: -2px; border-radius: 20px; }
.v-card-num { grid-area: num; font-size: 22px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.v-card-st { grid-area: st; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.v-card-st > span { display: inline-flex; align-items: center; gap: 8px; }
.v-card-st .pill { font-size: 13px; }
.v-chev { grid-area: chev; width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.v-card.open .v-chev { transform: rotate(180deg); }
.v-card-body { padding: 12px; border-top: .5px solid var(--line); }
.v-card-body .v-step { background: rgba(58, 58, 60, .45); margin-bottom: 12px; }
.v-card-body .v-feed { padding: 0 8px; }

/* ---------- hover only where a real pointer hovers (no sticky hover on touch) ---------- */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
  .btn:hover:not(:disabled) { background: var(--raised2); }
  .btn.primary:hover:not(:disabled) { background: #0a7cf0; }
  .btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
  .btn.danger:hover:not(:disabled) { background: rgba(255, 92, 92, .18); }
  .tab:not(.active):hover, .chip:not(.active):hover { background: rgba(255, 255, 255, .06); color: var(--text); }
  .table tbody tr[data-p]:hover, .acard:hover { background: rgba(255, 255, 255, .04); }
  .table tbody tr.picked:hover, .acard.picked:hover { background: rgba(10, 132, 255, .18); }
  .table tbody tr.selected:hover, .acard.selected:hover { background: var(--raised); }
  .table tbody tr.selected.picked:hover, .acard.selected.picked:hover { background: var(--pick-strong); }
  .check:hover span { border-color: var(--text2); }
  .check:hover input:checked + span { border-color: var(--accent); }
  .copy:hover { background: rgba(255, 255, 255, .08); }
  .group .btn:not(.primary):not(.danger):not(.ghost):hover:not(:disabled), .batch .btn:not(.primary):not(.danger):not(.ghost):hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
  .drawer-close:hover { background: rgba(118, 118, 128, .34); color: var(--text); }
  .rrow b:hover { color: var(--accent-text); }
  .bulkbar .btn.sm:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
  .bulkbar .btn.primary:hover:not(:disabled) { background: #0a7cf0; }
  .modal .row .btn:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
  .v-card-sum:hover { background: rgba(255, 255, 255, .03); }
  .v-btns .btn:not(.primary):not(.danger):hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
}

/* ---------- touch: 44px targets, 16px inputs so iOS does not zoom ---------- */
@media (pointer: coarse), (max-width: 720px) {
  .input, select.input, textarea.input, .v-link .input, .lrow .input { font-size: 16px; }
  .btn, .btn.sm { min-height: 44px; }
  .btn.sm { padding: 0 14px; }
  .btn.icon { width: 44px; }
  .copy { width: 44px; height: 44px; }
  .tab, .chip { height: 40px; }
  .search input { height: 44px; }
  .rrow, .lrow { grid-template-columns: 64px minmax(0, 1fr) 44px; }
  .lrow .input { height: 44px; }
  .job summary, .ev .when a { min-height: 44px; }
}

@media (max-width: 1100px) { .create-grid, .users-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) { .table .hide-md { display: none; } }
@media (max-width: 760px) {
  .table .hide-sm { display: none; }
  .table td, .table th { padding-left: 12px; padding-right: 12px; }
  .table th.cbx, .table td.cbx { padding: 0 0 0 4px; }
}
@media (max-width: 720px) {
  /* The brand row scrolls away, the tabs stay pinned. */
  .top { top: calc(-52px - var(--sat)); padding: calc(8px + var(--sat)) calc(16px + var(--sar)) 8px calc(16px + var(--sal)); gap: 8px 12px; min-height: 0; flex-wrap: wrap; }
  .top > .brand, .top > .me { height: 40px; }
  .top .spacer { display: none; }
  .me { margin-left: auto; gap: 8px; }
  .me .btn.sm { padding: 0 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; justify-content: center; padding: 0 12px; scroll-snap-align: start; }
  .me .who { display: none; }
  main { padding: 16px calc(16px + var(--sar)) calc(176px + var(--sab)) calc(16px + var(--sal)); }
  .stats { margin-bottom: 24px; }
  .pipeline { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 16px; }
  .pipeline .total { font-size: 34px; line-height: 40px; }
  .pipeline .side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .pipeline .side div { text-align: left; }
  .toolbar { gap: 8px; }
  .search { flex: 1 1 100%; }
  .chips { width: 100%; }
  .chip { flex: 1 0 auto; }
  .toolbar .spacer { display: none; }
  #toCreate { width: 100%; }
  .card { border-radius: 14px; }
  .create-card, .jobs-card, .users-grid .form { padding: 20px 16px; }
  .job { grid-template-columns: 24px minmax(0, 1fr); padding: 12px; }
  .job > .actions { grid-column: 2 / -1; }
  .job > .actions:empty { display: none; }

  .drawer { top: calc(8px + var(--sat)); left: 0; right: 0; bottom: 0; width: auto; border-radius: 20px 20px 0 0; border-bottom: 0; transform: translateY(calc(100% + 16px)); }
  .drawer.open { transform: none; }
  .drawer-head { padding: 16px 12px 12px 20px; }
  .drawer-head h2 { font-size: 28px; line-height: 34px; }
  .drawer-body { padding: 0 12px calc(32px + var(--sab)); }
  .section > .group { padding: 4px 12px; }
  .section h3 { padding: 0 12px; }
  .kv { grid-template-columns: 80px minmax(0, 1fr); }
  .money b { font-size: 22px; line-height: 28px; }

  .bulkbar { left: 8px; right: 8px; width: auto; bottom: calc(8px + var(--sab)); transform: translateY(calc(100% + 48px)); flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; border-radius: 20px; }
  .bulkbar.open { transform: none; }
  .bulk-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .bulk-groups { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; gap: 8px; margin: 0 -8px; padding: 0 8px; }
  .bulk-groups::-webkit-scrollbar { display: none; }
  .bulk-group { flex-wrap: nowrap; flex: none; }
  .bulk-group + .bulk-group { padding-left: 8px; }

  .results { top: auto; left: 8px; right: 8px; width: auto; bottom: calc(8px + var(--sab)); max-height: calc(var(--app-h) - 96px - var(--sat)); z-index: 27; }
  .toasts { top: calc(12px + var(--sat)); }
  .modal p { font-size: 14px; line-height: 20px; }

  .login { padding: 24px; }
  .v-num { font-size: 40px; line-height: 44px; }
  .v-step { padding: 16px; }
}
@media (max-width: 380px) {
  .acard-grid { gap: 12px; }
  .pipeline .total small { display: block; margin: 4px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *:not(.spin), *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
