/* Pohuy Agency web panel. Vercel-style dark theme; every color lives in the variables below. */

/* ---------- Theme: Vercel (the only theme) ---------- */
:root {
  --font: "Geist", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  --radius: 8px;
  --radius-lg: 12px;

  --bg: #000000;
  --bg-glow: none;
  --surface: #000000;
  --surface-2: #0a0a0a;
  --surface-3: #111111;
  --hover: #0f0f0f;
  --card-blur: none;
  --border: #1f1f1f;
  --border-strong: #2a2a2a;
  --text: #ededed;
  --text-strong: #ffffff;
  --text-muted: #a1a1a1;
  --text-faint: #6b6b6b;
  --accent: #ffffff;
  --accent-fg: #000000;
  --accent-hover: #d4d4d4;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-text: #ffffff;
  --focus: rgba(255, 255, 255, 0.35);
  --ok: #45d483;
  --ok-soft: rgba(69, 212, 131, 0.12);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.12);
  --danger: #ff5c5c;
  --danger-soft: rgba(255, 92, 92, 0.12);
  --info: #52a8ff;
  --info-soft: rgba(82, 168, 255, 0.12);
  --row-warn: rgba(245, 165, 36, 0.05);
  --header-bg: rgba(0, 0, 0, 0.8);
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  --chart-sim: #ededed;
  --chart-internet: #8f8f8f;
  --chart-other: #3d3d3d;
  --chart-grid: #1a1a1a;
  --qr-dark: #000000;
  --qr-light: #ffffff;
  --swatch: #ffffff;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-glow);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; color: var(--text-strong); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 14px; }
.mono { font-family: var(--mono); font-feature-settings: normal; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 1440px; margin: 0 auto; height: 56px; padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* Logo: Inter Display Black, "PA" with -0.145em tracking (A tucks under P), white on pure black, 7% corners. */
@font-face { font-family: "Inter Display Logo"; src: url(InterDisplay-Black.woff2) format("woff2"); font-weight: 900; font-display: block; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: #000; color: #fff;
}
.brand-mark .pa {
  font-family: "Inter Display Logo", Inter, sans-serif; font-weight: 900; font-size: 14.4px; line-height: 1;
  letter-spacing: -.145em; position: relative; left: -.054em; top: -.047em;
}
.brand-mark.big { width: 44px; height: 44px; margin: 0 auto 14px; }
.brand-mark.big .pa { font-size: 22.7px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; }
.brand-text b { color: var(--text-strong); font-weight: 600; font-size: 14px; }
.brand-text small { color: var(--text-faint); font-size: 11px; }

.tabs { display: flex; gap: 4px; height: 100%; }
.tab {
  position: relative; background: none; border: 0; padding: 0 12px; height: 100%;
  color: var(--text-muted); font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text-strong); }
.tab.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: var(--accent-text); border-radius: 2px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.conn.ok i { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn.err i { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.conn.err { color: var(--danger); }


.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius);
  background: none; border: 1px solid transparent; color: var(--text-muted);
}
.icon-btn:hover { color: var(--text-strong); background: var(--hover); border-color: var(--border); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.ok { color: var(--ok); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn[disabled] { opacity: .4; pointer-events: none; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; z-index: 30;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 6px; box-shadow: var(--shadow);
  backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
}
.menu-label { font-size: 11px; color: var(--text-faint); padding: 6px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px;
  background: none; text-align: left; color: var(--text);
}
.menu-item:hover { background: var(--hover); }
.menu-item.active { color: var(--text-strong); }
.menu-item.active::after { content: "✓"; margin-left: auto; color: var(--accent-text); }
.menu-item.danger { color: var(--danger); }
.menu-item .sw { width: 12px; height: 12px; border-radius: 50%; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- Layout ---------- */
.main { max-width: 1440px; margin: 0 auto; padding: 24px 24px 64px; }
.tabpane { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.page-title { font-size: 18px; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat {
  text-align: left; padding: 14px 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
button.stat:hover { border-color: var(--border-strong); background: var(--hover); }
.stat.active { border-color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
.stat-label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 26px; line-height: 1.1; font-weight: 600; color: var(--text-strong); letter-spacing: -0.02em; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-faint); margin-left: 4px; letter-spacing: 0; }
.stat-sub { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex: none; }
.stat.t-ok .dot { background: var(--ok); }
.stat.t-warn .dot { background: var(--warn); }
.stat.t-info .dot { background: var(--info); }
.stat.t-ok .stat-value { color: var(--ok); }
.stat.t-warn .stat-value { color: var(--warn); }

/* ---------- Toolbar, chips, inputs ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar.sub { margin: 0; }
.toolbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; width: 300px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-faint);
}
.search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--text-muted); }
.search input[type="search"] { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); height: 100%; padding: 0; box-shadow: none; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }
.search input::placeholder { color: var(--text-faint); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip .n { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }

.btn {
  height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); color: var(--text-strong); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text-strong); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--accent-fg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); font-size: 13px; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.link:hover { text-decoration-color: currentColor; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
input[type="text"], input[type="url"], input[type="password"], input[type="search"], input[type="date"], input[type="month"], input[type="number"], select {
  height: 38px; width: 100%; padding: 0 10px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-strong);
  outline: none; min-width: 0;
}
select { padding-right: 28px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--surface-3); color: var(--text); }
input:focus, select:focus { border-color: var(--text-faint); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--text-faint); }
input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field.compact input, .field.compact select { height: 34px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-muted);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--text-muted); white-space: nowrap; font-weight: 500; }
.tag-manual { color: var(--info); border-color: var(--info-soft); background: var(--info-soft); }

/* ---------- Phones table ---------- */
.ptable { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden;
  backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); }
.prow {
  display: grid; align-items: center; gap: 12px; padding: 0 16px; min-height: 54px;
  grid-template-columns: 44px minmax(140px, 1.15fr) minmax(150px, .95fr) minmax(130px, 1fr) minmax(250px, 1.5fr) minmax(150px, 1fr) 110px;
  border-top: 1px solid var(--border);
}
.prow:first-child { border-top: 0; }
.prow:not(.phead):hover { background: var(--hover); }
.phead { min-height: 38px; font-size: 12px; color: var(--text-faint); font-weight: 500; background: var(--surface-2); }
.prow.is-empty .c-name, .prow.is-empty .c-sim, .prow.is-empty .c-num { opacity: .55; }
.prow > div { min-width: 0; }
.chnum { font-family: var(--mono); font-size: 13px; color: var(--text-muted); display: inline-grid; place-items: center; width: 30px; height: 24px; border-radius: 6px; border: 1px solid var(--border); }
.c-name .nm { display: flex; align-items: center; gap: 6px; }
.editable { background: none; border: 0; padding: 2px 0; text-align: left; color: var(--text-strong); font-weight: 500; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px dashed transparent; }
.editable:hover { border-bottom-color: var(--text-faint); }
.editable.placeholder { color: var(--text-faint); font-weight: 400; }
.sub { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.sdot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.sdot.idle { background: var(--warn); }
.mode { font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--text-muted); }
.mode-usb { color: var(--text-strong); border-color: var(--text-faint); }
.mode-otg { color: var(--info); border-color: var(--info-soft); background: var(--info-soft); }
.mode-off { color: var(--text-faint); }
.sim-op { color: var(--text-strong); font-weight: 500; }
.net { font-size: 11px; font-family: var(--mono); color: var(--text-muted); margin-left: 6px; }
.nosim { color: var(--text-faint); }
.num-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.num { font-family: var(--mono); font-size: 13.5px; color: var(--text-strong); white-space: nowrap; letter-spacing: .01em; }
.num-unknown { color: var(--warn); font-size: 13px; font-family: var(--font); font-weight: 500; }
.num-actions { display: inline-flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity .12s; }
.prow:hover .num-actions, .num-actions:focus-within { opacity: 1; }
.edit-wrap { display: flex; align-items: center; gap: 4px; width: 100%; }
.edit-wrap input { height: 32px; font-family: inherit; }
.edit-wrap input.mono { font-family: var(--mono); }
.c-check { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-faint); }
.lbl-m { display: none; }

/* ---------- Expenses ---------- */
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.segmented button { border: 0; background: none; height: 30px; padding: 0 14px; border-radius: 6px; color: var(--text-muted); font-weight: 500; font-size: 13px; }
.segmented button.active { background: var(--surface-3); color: var(--text-strong); box-shadow: 0 0 0 1px var(--border-strong); }
.exp-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.form-card { padding: 0 0 16px; position: sticky; top: 72px; display: flex; flex-direction: column; gap: 14px; }
.form-card > :not(.card-head) { margin: 0 16px; }
.form-card > .btn-block { width: auto; }
#exp-summary { display: flex; flex-direction: column; gap: 16px; }
.field.inline select { width: 110px; }
.form-card.editing { border-color: var(--accent-text); }
.cat-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cat-pick label { position: relative; }
.cat-pick input { position: absolute; opacity: 0; pointer-events: none; }
.cat-pick span {
  display: grid; place-items: center; text-align: center; height: 38px; padding: 0 6px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-muted); font-size: 12.5px; font-weight: 500; cursor: pointer; line-height: 1.15;
}
.cat-pick span:hover { color: var(--text); }
.cat-pick input:checked + span { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.cat-pick input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.amount-row { grid-template-columns: 1fr 104px; }
.amount-input { font-size: 18px !important; font-weight: 600; font-family: var(--mono) !important; height: 44px !important; }

.list-card { overflow: hidden; }
.filters { display: grid; grid-template-columns: 170px minmax(160px, 1fr) 170px auto; gap: 10px; align-items: end; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.totals { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.totals .t-main { color: var(--text-strong); font-weight: 600; }
.totals span { color: var(--text-muted); white-space: nowrap; }
.totals b { color: var(--text); font-weight: 500; font-family: var(--mono); font-size: 12.5px; }
.elist { display: flex; flex-direction: column; }
.erow {
  display: grid; align-items: center; gap: 12px; padding: 10px 16px; min-height: 52px;
  grid-template-columns: 88px minmax(170px, 1.3fr) 150px minmax(80px, 1fr) 120px 68px;
  border-top: 1px solid var(--border);
}
.erow:first-child { border-top: 0; }
.erow:hover { background: var(--hover); }
.erow.editing { background: var(--accent-soft); }
.e-date { font-family: var(--mono); font-size: 12.5px; color: var(--text-muted); }
.e-who { display: flex; flex-direction: column; min-width: 0; }
.e-who b { font-weight: 500; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-cat { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.e-note { color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-amt { text-align: right; font-family: var(--mono); color: var(--text-strong); font-weight: 500; white-space: nowrap; }
.e-amt small { color: var(--text-faint); font-weight: 400; margin-left: 3px; }
.e-act { display: flex; justify-content: flex-end; gap: 2px; }
.cat-sim { color: var(--chart-sim); }
.c-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.c-dot.sim, .sw-sim { background: var(--chart-sim); }
.c-dot.internet, .sw-internet { background: var(--chart-internet); }
.c-dot.other, .sw-other { background: var(--chart-other); }
.catlbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); white-space: nowrap; }
.del-confirm { width: auto !important; padding: 0 8px; font-size: 12px; color: var(--danger) !important; background: var(--danger-soft) !important; }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { padding: 8px 12px 6px; }
.chart svg { display: block; width: 100%; height: auto; stroke: none; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { fill: var(--text-faint); font-size: 11px; font-family: var(--font); }
.chart .axis.cur { fill: var(--text-strong); font-weight: 600; }
.chart .val { fill: var(--text-muted); font-size: 10.5px; font-family: var(--mono); }
.chart .b-sim { fill: var(--chart-sim); }
.chart .b-internet { fill: var(--chart-internet); }
.chart .b-other { fill: var(--chart-other); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--hover); }

.pptable { display: flex; flex-direction: column; }
.pprow {
  display: grid; align-items: center; gap: 12px; padding: 0 16px; min-height: 48px;
  grid-template-columns: 44px minmax(190px, 1.6fr) 90px 100px 90px 110px 130px minmax(170px, 1.1fr);
  border-top: 1px solid var(--border); font-size: 13px;
}
.pprow:first-child { border-top: 0; }
.pprow.phead { min-height: 38px; }
.pprow .r, .pprow.phead .r { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.pprow .r.tot { color: var(--text-strong); font-weight: 600; }
.pprow.unpaid { background: var(--row-warn); box-shadow: inset 3px 0 0 var(--warn); }
.pp-who { display: flex; flex-direction: column; min-width: 0; }
.pp-who b { font-family: var(--mono); font-weight: 500; color: var(--text-strong); font-size: 13px; white-space: nowrap; }
.pp-status { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

/* ---------- Security ---------- */
.sec-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
#pw-form { padding-bottom: 16px; display: flex; flex-direction: column; gap: 14px; }
#pw-form > :not(.card-head) { margin: 0 16px; }
#pw-form .btn { align-self: flex-start; }
#tfa-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.tfa-setup { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.qr-box { padding: 12px; background: var(--qr-light); border-radius: var(--radius); width: 212px; }
.qr-box svg { width: 188px; height: 188px; display: block; stroke: none; }
.qr-box .qd { fill: var(--qr-dark); }
.qr-box .ql { fill: var(--qr-light); }
.secret { font-family: var(--mono); font-size: 14px; letter-spacing: .06em; color: var(--text-strong); word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 10px; }
.codes { max-width: 440px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px dashed var(--border-strong); font-family: var(--mono); font-size: 13.5px; color: var(--text-strong); }
.codes span { white-space: nowrap; }
.codes span::before { content: attr(data-i); color: var(--text-faint); margin-right: 8px; font-size: 11px; }
.step { display: flex; flex-direction: column; gap: 10px; }
.step-h { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-strong); }
.step-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.confirm-row { display: flex; gap: 10px; align-items: stretch; }
.confirm-row input { max-width: 200px; }
.note-box { padding: 10px 12px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 13px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px 28px; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card form > p.muted { text-align: center; margin: 0 0 6px; font-size: 13px; }
.login-card input { height: 44px; font-size: 15px; }
.otp-input { text-align: center; font-family: var(--mono) !important; font-size: 28px !important; letter-spacing: .45em; height: 60px !important; padding-left: .45em !important; font-weight: 600; }
.otp-input.recovery { font-size: 20px !important; letter-spacing: .12em; padding-left: .12em !important; }
.login-err { margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; }

/* ---------- Toasts, boot ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 420px; padding: 11px 14px; border-radius: var(--radius); font-size: 13px;
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-strong); box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: flex-start; animation: tin .18s ease-out;
}
.toast i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--ok); }
.toast.error i { background: var(--danger); }
.toast.error { border-color: var(--danger-soft); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--text-strong); animation: spin .8s linear infinite; }
.bottombar { display: none; }

/* ---------- Medium widths ---------- */
@media (max-width: 1280px) {
  .prow { grid-template-columns: 40px minmax(120px, 1fr) minmax(140px, .9fr) minmax(120px, .9fr) minmax(230px, 1.5fr) minmax(130px, .9fr) 92px; gap: 10px; }
  .exp-layout { grid-template-columns: 330px minmax(0, 1fr); }
  .erow { grid-template-columns: 82px minmax(150px, 1.3fr) 130px minmax(60px, 1fr) 110px 64px; }
  .pprow { grid-template-columns: 40px minmax(170px, 1.6fr) 80px 90px 80px 100px 110px minmax(160px, 1fr); }
  .search { width: 240px; }
}
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exp-layout { grid-template-columns: minmax(0, 1fr); }
  .form-card { position: static; }
  .sec-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) and (min-width: 701px) {
  .prow { grid-template-columns: 36px minmax(110px, 1fr) 120px minmax(110px, .9fr) minmax(210px, 1.4fr) 120px; }
  .prow .c-check { display: none; }
}

/* ---------- Phone layout (cards) ---------- */
@media (max-width: 700px) {
  body { font-size: 15px; }
  .topbar-in { height: 52px; padding: 0 16px; gap: 12px; }
  .tabs, .brand-text small { display: none; }
  .topbar-right { gap: 8px; }
  #mock-badge { display: none; }
  .icon-btn { width: 40px; height: 40px; }
  .main { padding: 14px 16px calc(88px + env(safe-area-inset-bottom)); }
  .tabpane { gap: 12px; }

  .bottombar {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--header-bg); border-top: 1px solid var(--border);
    backdrop-filter: blur(14px) saturate(150%); -webkit-backdrop-filter: blur(14px) saturate(150%);
  }
  .bottombar button {
    height: 52px; border: 0; background: none; color: var(--text-faint); border-radius: var(--radius);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500;
    min-width: 0; padding: 0 2px;
  }
  .bottombar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottombar button svg { width: 22px; height: 22px; }
  .bottombar button.active { color: var(--text-strong); }
  .bottombar button.active svg { color: var(--accent-text); }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 10px 12px; gap: 4px; }
  .stat-value { font-size: 20px; }
  #stats .stat-sub { display: none; }
  .stats .stat:first-child .stat-sub { display: block; }

  .toolbar { gap: 10px; }
  .search { width: 100%; height: 44px; order: 1; }
  .search input { font-size: 16px; }
  .chips { order: 2; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; width: calc(100% + 32px); }
  .chips::-webkit-scrollbar { display: none; }
  .chip { height: 38px; padding: 0 14px; font-size: 14px; }
  #tab-phones .toolbar-end { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .btn { height: 42px; font-size: 14px; }
  .btn-sm { height: 36px; }

  .ptable { border: 0; background: none; overflow: visible; display: flex; flex-direction: column; gap: 10px; backdrop-filter: none; }
  .phead { display: none; }
  .prow {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "ch name status" "num num num" "sim sim data" "check check check";
    gap: 10px 10px; padding: 14px; border: 1px solid var(--border) !important; border-radius: var(--radius-lg);
    background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
  }
  .prow:not(.phead):hover { background: var(--surface); }
  .c-ch { grid-area: ch; } .c-name { grid-area: name; } .c-status { grid-area: status; }
  .c-num { grid-area: num; padding: 10px 12px; margin: 0 -2px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
  .c-sim { grid-area: sim; } .c-data { grid-area: data; justify-self: end; }
  .c-check { grid-area: check; font-size: 12px; color: var(--text-faint); border-top: 1px solid var(--border); padding-top: 10px; }
  .chnum { width: 34px; height: 28px; font-size: 14px; }
  .editable { font-size: 15px; }
  .num { font-size: 16px; }
  .num-actions { opacity: 1; }
  .num-actions .icon-btn { width: 40px; height: 40px; }
  .num-actions .icon-btn svg { width: 18px; height: 18px; }
  .status .lbl-s { display: none; }
  .lbl-m { display: inline; color: var(--text-faint); }
  .edit-wrap input { height: 42px; font-size: 16px; }
  .edit-wrap .icon-btn { width: 42px; height: 42px; flex: none; }

  #tab-expenses > .toolbar .segmented { flex: 1; }
  .segmented button { flex: 1; height: 36px; font-size: 14px; }
  #tab-expenses > .toolbar .toolbar-end { margin-left: 0; }
  #export-btn span { display: none; }
  #export-btn { width: 42px; padding: 0; }
  .exp-layout { gap: 12px; }
  .form-card { gap: 14px; }
  .cat-pick span { height: 48px; font-size: 13.5px; }
  input[type="text"], input[type="url"], input[type="password"], input[type="search"], input[type="date"], input[type="month"], select { height: 46px; font-size: 16px; }
  .amount-input { height: 52px !important; font-size: 22px !important; }
  .field.compact input, .field.compact select { height: 42px; font-size: 15px; }
  #form-submit { height: 50px; font-size: 15px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field:nth-child(2) { grid-column: 1 / -1; order: -1; }
  .filters .btn { height: 42px; }
  .erow {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "who amt" "cat date" "note act";
    gap: 6px 10px; padding: 12px 14px;
  }
  .e-who { grid-area: who; } .e-amt { grid-area: amt; font-size: 15px; }
  .e-cat { grid-area: cat; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
  .e-date { grid-area: date; text-align: right; }
  .e-note { grid-area: note; align-self: center; }
  .e-act { grid-area: act; }
  .e-act .icon-btn { width: 40px; height: 40px; }
  .totals { gap: 6px 16px; }

  .legend { gap: 10px; }
  .card-head { flex-wrap: wrap; }
  .pptable { padding: 4px 0; }
  .pprow.phead { display: none; }
  .pprow {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "ch who tot" "parts parts parts" "st st st";
    gap: 6px 10px; padding: 12px 14px;
  }
  .pp-ch { grid-area: ch; } .pp-who { grid-area: who; } .pp-tot { grid-area: tot; }
  .pp-parts { grid-area: parts; }
  .pp-sim, .pp-int, .pp-oth, .pp-last { display: none; }
  .pp-status { grid-area: st; justify-content: space-between; }
  .pp-parts-m { display: flex !important; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }

  .tfa-setup { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .tfa-setup > div { width: 100%; }
  .confirm-row input { max-width: none; }
  .codes { font-size: 14px; }
  .toasts { left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .menu { position: fixed; right: 12px; left: auto; top: 58px; min-width: 240px; }
  .menu-item { padding: 12px; }
}
.pp-parts-m { display: none; }

/* =====================================================================
   Screens tab: live phone grid (assets/screens.js, contract web/STREAM.md)
   ===================================================================== */
.scr-head { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 14px; align-items: start; }
.scard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
  display: flex; flex-direction: column; min-width: 0; transition: border-color .12s;
}
.scard:hover { border-color: var(--border-strong); }
.scard-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 9px 10px; min-width: 0; }
.scard-head .chnum { width: 30px; height: 24px; flex: none; }
.scard-title { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.scard-title b { font-weight: 500; color: var(--text-strong); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard-title .sub { font-family: var(--mono); font-size: 11px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.scard-title .sub-num { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-title .sub-op {
  flex-shrink: 0; margin-left: auto; padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: var(--text-muted);
  font-family: var(--font); font-size: 10px; line-height: 13px; white-space: nowrap;
}
.scard-title .sub-op[hidden] { display: none; }
.scard-ghost { visibility: hidden; pointer-events: none; min-height: 1px; }
.sdot.err { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.sdot.idle { background: var(--warn); }

.scard-screen {
  position: relative; display: block; width: 100%; aspect-ratio: 9 / 19.5; max-height: 70vh; padding: 0; margin: 0;
  background: #000; border: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  overflow: hidden; cursor: pointer; color: inherit;
}
.scard-screen canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.scard-screen:focus-visible { outline-offset: -2px; }
.sv-open {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: var(--radius); background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .14); color: #fff;
  opacity: 0; transition: opacity .12s;
}
.scard-screen:hover .sv-open, .scard-screen:focus-visible .sv-open { opacity: 1; }
.sv-ov {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; text-align: center; font-size: 12px; line-height: 1.4; color: #a1a1a1; background: rgba(0, 0, 0, .62);
}
.sv-ov:empty { display: none; }
.sv-ov b { color: #fff; font-weight: 600; font-size: 13px; }
.sv-ov .spinner { width: 18px; height: 18px; border-color: #2a2a2a; border-top-color: #ededed; }

.scard-actions { display: flex; align-items: center; gap: 6px; padding: 8px; }
.scard-actions.busy, .orow-a.busy { opacity: .5; pointer-events: none; }
.mode-seg { display: flex; flex: 1; min-width: 0; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.mode-seg button {
  flex: 1; min-width: 0; height: 30px; padding: 0 4px; border: 0; border-radius: 6px; background: none;
  color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.mode-seg button:hover { color: var(--text-strong); background: var(--hover); }
.mode-seg button.active { background: var(--surface-3); color: var(--text-strong); box-shadow: 0 0 0 1px var(--border-strong); }
.mode-seg button[data-mode="otg"].active { color: var(--info); }
.mode-seg button[data-mode="off"].active { color: var(--text-faint); }
.reboot-btn, .paste-btn { flex: none; width: 36px; height: 36px; border-color: var(--border); }

.olist { display: flex; flex-direction: column; }
.orow { display: grid; grid-template-columns: 40px minmax(0, 1fr) 260px; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.orow:first-child { border-top: 0; }
.orow-t { display: flex; flex-direction: column; min-width: 0; }
.orow-t b { font-weight: 500; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow-a { display: flex; align-items: center; gap: 6px; }

/* ---------- Dialog ---------- */
.dlg-back { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: var(--overlay); animation: tin .15s ease-out; }
.dlg { width: 100%; max-width: 400px; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); box-shadow: var(--shadow); }
.dlg h2 { font-size: 16px; }
.dlg p { margin: 0; font-size: 13.5px; }
.dlg-input {
  width: 100%; min-height: 110px; resize: vertical; padding: 10px; border-radius: var(--radius); outline: none;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-strong); font-size: 16px;
}
.dlg-input:focus { border-color: var(--text-faint); box-shadow: 0 0 0 3px var(--accent-soft); }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.1); background: var(--danger); color: #fff; }

/* ---------- Clipboard toast ---------- */
.clip-toast { align-items: center; }
.clip-toast i { margin-top: 0; background: var(--info); }
.clip-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.clip-text { font-family: var(--mono); font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.clip-toast .btn { flex: none; }

/* ---------- Full-screen phone view ---------- */
body.fv-open { overflow: hidden; }
.fv {
  position: fixed; left: 0; right: 0; top: 0; height: 100vh; height: 100dvh; z-index: 90;
  display: flex; flex-direction: column; background: #000; color: #ededed;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: contain; touch-action: none; -webkit-user-select: none; user-select: none;
}
.fv-top { flex: none; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px; border-bottom: 1px solid var(--border); }
.fv-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.fv-tt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.fv-tt b { font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-ime { flex: none; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-stats { flex: none; font-size: 11.5px; color: var(--text-faint); min-width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.fv-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 10px; overflow: hidden; }
.fv-canvas {
  display: block; width: 0; height: 0; background: #050505; border-radius: 6px; box-shadow: 0 0 0 1px var(--border-strong);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.fv-ov { background: transparent; }
.fv-ov:not(:empty) { background: rgba(0, 0, 0, .55); }
.fv-bar { flex: none; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 12px 10px; border-top: 1px solid var(--border); }
.fv-group { display: flex; align-items: center; gap: 4px; }
.fv-nav { order: 1; }
.fv-tools { order: 2; }
.fv-nav::after { content: ""; width: 1px; height: 24px; background: var(--border); margin: 0 8px 0 12px; }
.fv-btn {
  width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: var(--radius);
  background: none; border: 1px solid transparent; color: var(--text-muted); -webkit-tap-highlight-color: transparent;
}
.fv-btn svg { width: 20px; height: 20px; }
.fv-btn:hover { background: var(--hover); color: var(--text-strong); border-color: var(--border); }
.fv-btn:active { background: var(--surface-3); color: var(--text-strong); }
.fv-btn.active { background: var(--accent-soft); color: var(--text-strong); border-color: var(--border-strong); }
.fv-btn.nav { width: 64px; }
.fv-btn.nav svg { width: 22px; height: 22px; }
.fv-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.fv .fv-kbd {
  position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; margin: 0;
  opacity: 0; font-size: 16px; pointer-events: none; caret-color: transparent; background: none; box-shadow: none;
}
body.fv-open .toasts { top: calc(64px + env(safe-area-inset-top)); bottom: auto; }

@media (max-width: 1100px) {
  .scr-hint { display: none; }
}
@media (max-width: 700px) {
  .sgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .scard-head { padding: 8px 8px 7px; gap: 6px; }
  .scard-head .chnum { width: 28px; height: 22px; font-size: 12px; }
  .scard-title b { font-size: 13px; }
  .scard-title .sub { font-size: 10.5px; }
  .scard-actions { padding: 6px; gap: 4px; }
  .mode-seg button { height: 36px; font-size: 12px; padding: 0 2px; }
  .reboot-btn.icon-btn, .paste-btn.icon-btn { width: 40px; height: 40px; }
  .sv-open { opacity: 1; width: 28px; height: 28px; top: 6px; right: 6px; }
  #scr-refresh span { display: none; }
  #scr-refresh { width: 42px; padding: 0; }
  #tab-screens > .toolbar { flex-wrap: nowrap; }
  .orow { grid-template-columns: 34px minmax(0, 1fr); grid-template-areas: "ch t" "a a"; padding: 12px 14px; gap: 8px 10px; }
  .orow .chnum { grid-area: ch; }
  .orow-t { grid-area: t; }
  .orow-a { grid-area: a; }
  .orow-a .mode-seg button { height: 38px; }

  .fv-top { height: 52px; padding: 0 8px; gap: 8px; }
  .fv-top .chnum { display: none; }
  .fv-stats { min-width: 0; font-size: 11px; }
  .fv-stage { padding: 6px; }
  .fv-bar { flex-direction: column; align-items: stretch; gap: 4px; padding: 4px 8px 6px; }
  .fv-nav { order: 2; justify-content: space-around; }
  .fv-nav::after { display: none; }
  .fv-tools { order: 1; justify-content: space-between; }
  .fv-btn { width: 48px; height: 46px; }
  .fv-btn.nav { width: 30%; height: 46px; }
  .fv-sep { display: none; }
  body.fv-open .toasts { top: calc(58px + env(safe-area-inset-top)); bottom: auto; }
  .clip-text { max-width: none; }
}

@media (hover: hover) and (pointer: fine) {
  .scard.is-live .scard-screen { cursor: default; }
  .scard.is-live .sv-open { cursor: pointer; }
}

/* Touch screens: control phones right on the cards (toggle #scr-touch); page scrolls by the card header/buttons/gaps. */
#scr-touch { display: none; }
@media (hover: none), (pointer: coarse) {
  #scr-touch { display: inline-flex; }
  #scr-touch span { display: none; }
  #scr-touch { width: 42px; padding: 0; }
  #scr-touch[aria-pressed="true"] { color: var(--bg, #000); background: currentColor; background: #ededed; border-color: #ededed; }
  #scr-touch[aria-pressed="true"] svg { stroke: #000; }
  .sgrid.touch-ctl .scard.is-live .scard-screen { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

/* Desktop (Mac etc.): the screens tab uses the full window width, 5 phones per row. */
@media (min-width: 1100px) {
  .main:has(#tab-screens:not([hidden])) { max-width: none; }
  .topbar-in { max-width: none; }
  .sgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .scard-screen { max-height: none; }
}

/* Full view header: no fps/latency/IME pills; the phone number is a one-tap copy button. */
.fv .fv-stats, .fv .fv-ime { display: none !important; }
.fv-num { background: none; border: 0; padding: 2px 0; margin: 0; text-align: left; font-size: 13px; color: var(--text-muted, #a1a1a1); white-space: nowrap; cursor: pointer; -webkit-user-select: none; user-select: none; }
.fv-num:active { color: var(--text-strong, #fff); }
.fv-num:disabled { cursor: default; }

/* ---------- Reels auto-scroll ---------- */
.rl-badge { margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ok); color: #000; font-size: 11px; line-height: 18px; text-align: center; }
.rl-overlay { position: fixed; inset: 0; z-index: 60; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.rl-overlay[hidden] { display: none; }
.rl-card { width: 100%; max-width: 560px; background: var(--surface-2); box-shadow: var(--shadow); }
.rl-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.rl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rl-quick { font-size: 12px; color: var(--text-faint); }
.rl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-chip { min-width: 44px; height: 34px; padding: 0 8px; border-radius: var(--radius); border: 1px solid var(--border); background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.rl-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.rl-chip.on i { background: var(--ok); }
.rl-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.rl-chip.busy { border-color: var(--ok); }
.rl-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rl-actions { display: flex; gap: 8px; }
.rl-status { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.rl-st { display: grid; grid-template-columns: 32px 82px 1fr; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.rl-st b { font-family: var(--mono); color: var(--text-strong); }
.rl-st .bar { grid-column: 1 / -1; height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.rl-st .bar i { display: block; height: 100%; background: var(--ok); }
@media (max-width: 520px) { .rl-nums { grid-template-columns: 1fr 1fr; } .rl-overlay { padding-top: 12px; } }
.rl-ai-row { display: flex; gap: 8px; }
.rl-ai-row input { flex: 1; min-width: 0; }
@media (max-width: 520px) { .rl-ai-row { flex-wrap: wrap; } .rl-ai-row input { flex-basis: 100%; } }
/* ---------- Tasks tab ---------- */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.task-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.task-body { display: flex; flex-direction: column; gap: 6px; }
.task-title { font-size: 15px; font-weight: 600; color: var(--text-strong); margin: 0; }
.task-desc { margin: 0; line-height: 1.45; }
#tasks-reels-summary { color: var(--text-faint); min-height: 1.2em; }
.task-actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 700px) { .task-grid { grid-template-columns: 1fr; } }

/* Video library (Видео для Reels) */
.md-card { width: min(760px, calc(100vw - 32px)); }
.md-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.md-pick { cursor: pointer; }
.md-bulk { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.md-list { display: flex; flex-direction: column; gap: 6px; max-height: 42vh; overflow: auto; margin: 6px 0 10px; }
.md-row { border: 1px solid var(--border, #2a2a2a); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.md-row-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.md-row-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; font-weight: 600; }
.md-row .rl-chips { gap: 4px; }
.md-row .rl-chip { padding: 2px 7px; font-size: 12px; }
.md-empty { padding: 14px; text-align: center; }

/* ---------- Аккаунты ---------- */
.ac-root { display: flex; flex-direction: column; gap: 16px; }
.ac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.ac-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .15s; min-width: 0; }
.ac-card:hover { border-color: var(--border-strong); }
.ac-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ac-ava { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-strong); font-weight: 600; }
.ac-ava.big { width: 52px; height: 52px; font-size: 20px; }
.ac-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ac-who b, .ac-who h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.ac-err { margin: 0; color: var(--danger); background: var(--danger-soft); border-radius: var(--radius); padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ac-nums > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ac-n { font-size: 18px; font-weight: 600; color: var(--text-strong); letter-spacing: -0.01em; white-space: nowrap; }
.ac-l { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-delta { font-size: 11px; font-weight: 600; margin-left: 6px; letter-spacing: 0; }
.ac-delta.up { color: var(--ok); }
.ac-delta.down { color: var(--danger); }
.ac-cap { margin-bottom: -4px; }
.ac-tw { container-type: inline-size; }
.ac-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; overflow-y: auto; overscroll-behavior: contain;
  max-height: calc(((100cqw - 12px) / 3 * 16 / 9 + 6px) * 2 - 6px);
  scrollbar-width: none; -ms-overflow-style: none; }
.ac-thumbs::-webkit-scrollbar { display: none; width: 0; height: 0; }
.ac-thumbs.r3 { max-height: calc(((100cqw - 12px) / 3 * 16 / 9 + 6px) * 3 - 6px); }
.ac-tile { position: relative; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); padding: 0; cursor: pointer; }
.ac-tile.empty { cursor: default; background: var(--surface-2); border-style: dashed; }
.ac-tile img, .ac-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ac-tile video { opacity: 0; transition: opacity .15s; }
.ac-tile.playing video { opacity: 1; }
.ac-views { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.ac-views svg { width: 11px; height: 11px; fill: #fff; stroke: none; }
.ac-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ac-actions { display: flex; gap: 6px; }
.ac-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ac-jobs { overflow: hidden; }
.ac-job { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.ac-job:first-of-type { border-top: 0; }
.ac-job-ch { font-family: var(--mono); color: var(--text-muted); width: 24px; flex: none; }
.ac-job-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ac-job-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-job-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-bar { display: block; width: 100%; height: 3px; border: 0; border-radius: 2px; background: var(--surface-3); overflow: hidden; appearance: none; -webkit-appearance: none; }
.ac-bar::-webkit-progress-bar { background: var(--surface-3); }
.ac-bar::-webkit-progress-value { background: var(--info); }
.ac-bar::-moz-progress-bar { background: var(--info); }
.ac-page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ac-two { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.ac-panel-body { padding: 14px 16px; }
.ac-spark { width: 100%; height: 120px; color: var(--text-strong); display: block; }
.ac-spark-axis { display: flex; justify-content: space-between; margin-top: 6px; }
.ac-pubrow { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); min-width: 0; }
.ac-pubrow:first-child { border-top: 0; }
.ac-pubrow b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-table-wrap { overflow-x: auto; }
.ac-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ac-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ac-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ac-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ac-table td.num .pill { margin-left: 6px; }
.ac-table tr.best td { background: var(--ok-soft); }
.ac-capt { color: var(--text-muted); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-mini { width: 44px; aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden; padding: 0; border: 1px solid var(--border); background: var(--surface-3); display: block; cursor: pointer; }
.ac-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ac-player-card { max-width: 720px; }
.ac-player-body { display: flex; gap: 16px; padding: 16px; flex-wrap: wrap; }
.ac-player-media { flex: 0 0 240px; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--surface-3); }
.ac-player-media video, .ac-player-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ac-player-side { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ac-player-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ac-player-nums > div { display: flex; flex-direction: column; gap: 2px; }
.ac-player-nums b { font-size: 18px; color: var(--text-strong); }
.ac-pub-card { max-width: 640px; }
.ac-lib { display: flex; flex-direction: column; gap: 6px; max-height: 30vh; overflow: auto; }
.ac-vid { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; min-width: 0; flex-wrap: wrap; }
.ac-vid.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ac-vid-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-warn { color: var(--warn); font-weight: 500; }
.ac-text { width: 100%; min-height: 110px; padding: 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-strong); font: inherit; resize: vertical; outline: none; }
.ac-text:focus { border-color: var(--text-faint); box-shadow: 0 0 0 3px var(--accent-soft); }
.ac-issues { display: flex; flex-direction: column; color: var(--danger); }
.ac-gen { display: flex; gap: 8px; }
.ac-review { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ac-covers { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; max-width: 640px; }
.ac-cover { position: relative; aspect-ratio: 9 / 16; padding: 0; border-radius: 6px; overflow: hidden; border: 2px solid var(--border); background: var(--surface-3); cursor: pointer; }
.ac-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ac-cover.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ac-ai { position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 700; background: var(--accent); color: var(--accent-fg); border-radius: 4px; padding: 1px 4px; }
@media (max-width: 700px) { .ac-covers { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ac-gen input { flex: 1 1 40%; min-width: 0; }
.ac-gen select { flex: 1 1 55%; width: auto; min-width: 0; }
.ac-gen .btn { flex: none; }
.ac-check { align-self: end; min-height: 38px; }
.ac-check input { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 1100px) { .ac-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ac-two { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .ac-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ac-grid { grid-template-columns: 1fr; }
  #tab-accounts > .toolbar .toolbar-end { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 8px; }
  #tab-accounts > .toolbar .toolbar-end .btn { flex: 1 1 140px; justify-content: center; }
  #tab-accounts > .toolbar .segmented { flex: 1 1 100%; }
  #tab-accounts > .toolbar .segmented button { flex: 1; white-space: nowrap; }
  #tab-accounts > .toolbar > .muted { display: none; }
  .ac-job { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .ac-pub-card .field-row { grid-template-columns: 1fr; }
  .ac-page-head .toolbar-end { margin-left: 0; width: 100%; }
  .ac-player-media { flex-basis: 100%; max-width: 280px; margin: 0 auto; }
}

.ac-reach { margin: 0; border-radius: var(--radius); padding: 5px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-reach.ok { color: var(--ok, #3ecf8e); background: var(--ok-soft, rgba(62,207,142,.12)); }
.ac-reach.warn { color: var(--warn, #f5a524); background: var(--warn-soft, rgba(245,165,36,.12)); }
.ac-reach.bad { color: var(--danger); background: var(--danger-soft); }
.ac-reach.ghost { color: var(--muted, #888); background: rgba(127,127,127,.1); }

.ac-vid.blocked { opacity: .45; }
.ac-vflag { margin-right: 6px; }
.ac-incidents .ac-inc { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); }
.ac-incidents .ac-inc:first-of-type { border-top: 0; }

.ac-story .ac-story-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ac-story .ac-story-row input, .ac-story .ac-story-row select { flex: 1 1 240px; min-width: 0; }

.ac-schedule .card-head { flex-wrap: wrap; gap: 8px; }
.ac-sch { display: grid; grid-template-columns: 190px 170px minmax(0, 1.2fr) auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.ac-sch-file, .ac-sch-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-sch-act { white-space: nowrap; }
.ac-sch-sep { margin: 12px 0 0; }
.acb-lib { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.acb-item { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--radius); background: var(--surface-2); }
.acb-item span:first-of-type { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acb-item.off { opacity: .5; }
@media (max-width: 900px) { .ac-sch { grid-template-columns: 1fr 1fr; } }

.acb-card-wide { width: min(1240px, 96vw); max-width: none; }
.acb-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0; }
.acb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; max-height: 52vh; overflow: auto; padding: 2px; }
.acb-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden; display: flex; flex-direction: column; }
.acb-card video { width: 100%; aspect-ratio: 9 / 16; max-height: 300px; object-fit: cover; background: #000; display: block; }
.acb-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.acb-card.asg { border-color: var(--info); }
.acb-card.off { opacity: .45; }
.acb-meta { display: flex; flex-direction: column; gap: 6px; padding: 8px; min-width: 0; }
.acb-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acb-mus { display: flex; }
.acb-mus button { flex: 1 1 50%; font-size: 11px; padding: 4px 6px; }
.acb-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.acb-to { font-size: 11px; }
.acb-acc.on { outline: 2px solid var(--info); }
.acb-n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--info); color: #000; font-size: 11px; text-align: center; }

/* account page: story card padding, reels as an Instagram-like grid on phones */
.ac-story .ac-story-row, .ac-story > p { padding: 0 16px; }
.ac-story > p { padding-bottom: 14px; }
.ac-reelgrid { display: none; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 12px 16px 16px; }
.ac-reelgrid.always { display: grid; }
.ac-table-wrap.never { display: none; }
.ac-tile.best { border-color: var(--ok); }
.ac-tile-best { position: absolute; top: 6px; left: 6px; font-size: 10px; }
.ac-tile-sub { position: absolute; left: 6px; right: 6px; bottom: 22px; font-size: 10px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); text-align: left; }
@media (max-width: 1100px) { .ac-reelgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .ac-reelgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px 12px 12px; }
  .ac-table-wrap { display: none; }
  .ac-page-head #ac-back { flex: 1 1 100%; justify-content: center; }
  .ac-page-head .toolbar-end { display: flex; gap: 8px; }
  .ac-page-head .toolbar-end .btn { flex: 1 1 0; justify-content: center; }
  .ac-story .ac-story-row .btn { flex: 1 1 100%; justify-content: center; }
  .ac-story .ac-story-row, .ac-story > p { padding: 0 12px; }
  .ac-stats .stat-value { font-size: 22px; }
}

/* account cards: no avatar circle, every line wraps instead of being cut off */
.ac-head2 { flex-direction: column; align-items: stretch; gap: 6px; }
.ac-who2 b { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; word-break: break-word; font-size: 15px; line-height: 1.3; }
.ac-who2 .small { white-space: normal; overflow-wrap: anywhere; }
.ac-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-card .ac-err, .ac-card .ac-reach { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.ac-card .ac-n { font-size: 15px; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.ac-card .ac-l { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
.ac-card .ac-nums { gap: 6px; }

/* iPhone Safari: grid rows shrank inside the scrolling thumbs box and tiles overlapped — the height now comes from
   the width (padding 16:9), not from aspect-ratio on a button */
.ac-thumbs, .ac-reelgrid { grid-auto-rows: max-content; align-content: start; align-items: start; }
.ac-tile { display: block; width: 100%; height: auto; aspect-ratio: auto; padding: 177.78% 0 0 0; margin: 0; min-height: 0; -webkit-appearance: none; appearance: none; }

/* «Задачи по аккаунтам», «План публикаций», «Проблемные видео»: one row, swipe / scroll sideways */
.ac-strip { display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain; padding-bottom: 6px; margin-bottom: 16px; }
.ac-strip-item { flex: 0 0 min(520px, 88%); scroll-snap-align: start; min-width: 0; display: flex; }
.ac-strip-item > .card { flex: 1 1 auto; min-width: 0; margin: 0; max-height: 380px; overflow-y: auto; overscroll-behavior: contain; }
.ac-strip-item .ac-sch { grid-template-columns: 1fr auto; gap: 4px 10px; }
.ac-strip-item .ac-sch > * { min-width: 0; }
.ac-strip-item .ac-sch-file, .ac-strip-item .ac-sch-note { grid-column: 1 / -1; white-space: normal; overflow-wrap: anywhere; }
.ac-strip::-webkit-scrollbar { height: 6px; }
.ac-strip::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.ac-strip-item .ac-sch, .ac-strip-item .ac-sch-sep, .ac-strip-item .ac-inc, .ac-strip-item .ac-job { padding-left: 16px; padding-right: 16px; }

/* «Аккаунты»: cards in one row, three at a time, swipe / scroll sideways */
.ac-hrow { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 32px) / 3); gap: 16px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; padding-bottom: 8px; align-items: start; }
.ac-hrow > .ac-card { scroll-snap-align: start; min-width: 0; margin: 0; }
.ac-hrow::-webkit-scrollbar { height: 8px; }
.ac-hrow::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
@media (max-width: 1100px) { .ac-hrow { grid-auto-columns: calc((100% - 16px) / 2); } }
@media (max-width: 700px) { .ac-hrow { grid-auto-columns: 88%; gap: 12px; } }
.ac-tasks-link { margin: 0 0 12px; }
/* «Задачи»: the account jobs, the plan and problem videos, one under another */
.ac-tasks { display: grid; gap: 16px; margin-bottom: 20px; }
.ac-tasks > .card { margin: 0; max-height: 560px; overflow-y: auto; overscroll-behavior: contain; min-width: 0; }
.ac-tasks .ac-sch > * { min-width: 0; }
.ac-tasks-h { margin: 0; font-size: 15px; }
@media (max-width: 700px) {
  .ac-tasks .ac-sch { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .ac-tasks .ac-sch-file, .ac-tasks .ac-sch-note { grid-column: 1 / -1; white-space: normal; overflow-wrap: anywhere; }
}
/* library: what happened to each video */
.acb-st { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.acb-stc b { font-weight: 600; opacity: .7; margin-left: 2px; }
.acb-stc.st-viral[aria-pressed="true"] { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.acb-stc.st-limited[aria-pressed="true"] { background: #e08a00; border-color: #e08a00; color: #fff; }
.acb-stc.st-removed[aria-pressed="true"] { background: #d64545; border-color: #d64545; color: #fff; }
.acb-viral { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.acb-viral select { width: auto; min-height: 30px; padding: 2px 8px; }
.acb-card.st-viral { box-shadow: 0 0 0 2px #1f9d55; }
.acb-card.st-limited { box-shadow: 0 0 0 2px #e08a00; }
.acb-card.st-removed { box-shadow: 0 0 0 2px #d64545; }
.acb-stb { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2, rgba(127,127,127,.12)); color: var(--muted, inherit); }
.acb-stb.st-viral { background: rgba(31,157,85,.15); color: #1f9d55; }
.acb-stb.st-limited { background: rgba(224,138,0,.16); color: #c27700; }
.acb-stb.st-removed { background: rgba(214,69,69,.15); color: #d64545; }

/* ---------- Монтаж ---------- */
.mt-head { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 640px; }
.mt-add { flex-wrap: wrap; }
.mt-drop {
  display: flex; align-items: center; gap: 14px; padding: 22px 20px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-2); color: var(--text-muted); cursor: pointer; transition: border-color .12s, background .12s;
}
.mt-drop > svg { width: 26px; height: 26px; color: var(--text-faint); }
.mt-drop > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mt-drop b { color: var(--text); font-weight: 600; }
.mt-drop:hover, .mt-drop.over { border-color: var(--text-faint); background: var(--hover); }
.mt-drop.over { border-color: var(--info); background: var(--info-soft); }
.mt-up { margin-left: auto; text-align: right; }
.mt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-chips .pill { font-weight: 500; }

.mt-table { display: flex; flex-direction: column; }
.mt-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) 190px minmax(200px, 2fr) 210px; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); min-width: 0; }
.mt-row:last-child { border-bottom: 0; }
.mt-row.mt-th { color: var(--text-faint); font-size: 12px; font-weight: 500; padding-top: 8px; padding-bottom: 8px; }
.mt-src { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mt-src img, .mt-src .mt-ph { width: 34px; height: 60px; border-radius: 6px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--border); flex: none; }
.mt-src b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mt-src > div { min-width: 0; }
.mt-decided { font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.mt-errtxt { color: var(--danger); font-size: 12px; }
.mt-flag { display: inline-block; margin: 2px 4px 0 0; padding: 0 6px; border-radius: 999px; font-size: 11px; background: var(--warn-soft); color: var(--warn); }
.mt-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.mt-prog { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mt-bar { display: block; width: 150px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.mt-bar b { display: block; height: 100%; background: var(--info); transition: width .4s; }
.mt-empty { padding: 28px 16px; text-align: center; color: var(--text-faint); font-size: 13px; }

.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 16px; }
.mt-card { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; min-width: 0; }
.mt-card .mt-thumb { position: relative; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--surface-3); border: 2px solid var(--border-strong); display: grid; place-items: center; }
.mt-card .mt-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mt-card .mt-thumb .pill { position: absolute; left: 6px; top: 6px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.mt-card .mt-thumb .mt-dur { position: absolute; right: 6px; bottom: 6px; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .65); color: #fff; font-variant-numeric: tabular-nums; }
.mt-card.ok .mt-thumb { border-color: var(--ok); }
.mt-card.warn .mt-thumb { border-color: var(--warn); }
.mt-card.bad .mt-thumb { border-color: var(--danger); }
.mt-card:hover .mt-thumb { filter: brightness(1.08); }
.mt-card .mt-cap { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-legend { display: inline-flex; align-items: center; gap: 6px; }
.mt-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.mt-legend i.ok { background: var(--ok); } .mt-legend i.warn { background: var(--warn); } .mt-legend i.bad { background: var(--danger); }

.mt-dcard { max-width: 1040px; }
.mt-dcard .card-head { flex-wrap: wrap; }
.mt-dhead { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mt-dhead h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-dbody { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 18px; padding: 16px; }
.mt-players { display: grid; gap: 12px; align-content: start; }
.mt-players.v-both { grid-template-columns: 1fr 1fr; }
.mt-players.v-before .mt-pl-after, .mt-players.v-after .mt-pl-before { display: none; }
.mt-pl { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mt-pl video { width: 100%; max-height: 64vh; background: #000; border-radius: 10px; border: 1px solid var(--border); }
.mt-pl-after video { aspect-ratio: 9 / 16; object-fit: contain; }
.mt-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mt-cover { display: flex; gap: 12px; align-items: center; }
.mt-cover img { width: 54px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-3); }
.mt-cover > div { display: flex; flex-direction: column; gap: 2px; }
.mt-steps { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); }
.mt-step { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 4px 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.mt-step:last-child { border-bottom: 0; }
.mt-step input { margin: 2px 0 0; accent-color: var(--accent); }
.mt-step b { font-weight: 600; font-size: 13px; }
.mt-step b span { color: var(--text-muted); font-weight: 400; }
.mt-step .muted { grid-column: 2; }
.mt-step.off b { color: var(--text-faint); text-decoration: line-through; }
.mt-step.na { cursor: default; opacity: .6; }
.mt-dact { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-lib-row { flex-direction: row; align-items: center; cursor: pointer; }
.btn-hook { background: var(--accent-soft, var(--info-soft)); color: var(--accent, var(--info)); border: 1px solid var(--accent, var(--info)); }
.btn-hook:hover { filter: brightness(1.12); }
.mt-hooklbl { font-weight: 600; }
.mt-hookcard { max-width: 520px; }
.mt-hookcard .segmented { align-self: flex-start; width: auto; }
.mt-hook-what { font-weight: 600; overflow-wrap: anywhere; margin: 0 0 6px; }
.mt-step-info { cursor: default; }
.mt-step-info .mt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--info)); margin: 6px 0 0 4px; }
.mt-lib-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

@media (max-width: 1100px) {
  .mt-row { grid-template-columns: minmax(160px, 1fr) 170px minmax(160px, 1.4fr); }
  .mt-row .mt-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .mt-row.mt-th .mt-acts { display: none; }
}
@media (max-width: 860px) {
  .mt-dbody { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .mt-add { margin-left: 0; width: 100%; }
  .mt-add .btn { flex: 1 1 auto; }
  .mt-drop { padding: 16px 14px; flex-wrap: wrap; }
  .mt-up { margin-left: 0; text-align: left; flex-basis: 100%; }
  .mt-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; }
  .mt-row.mt-th { display: none; }
  .mt-bar { width: 100%; }
  .mt-prog { width: 100%; }
  .mt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
  .mt-players.v-both { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mt-pl video { max-height: 56vh; }
  .mt-dact .btn { flex: 1 1 calc(50% - 8px); }
  .mt-dcard .segmented { order: 3; width: 100%; }
  .mt-dcard .segmented button { flex: 1; }
}

/* iOS: no grey tap flash over the phone screen while controlling it */
.scard-screen, .scard-screen *, .fv, .fv-stage, .fv-stage *, #fv-canvas { -webkit-tap-highlight-color: rgba(0,0,0,0) !important; }

/* «Опубликовать рилс»: library as video cards with a playable preview */
#acp-lib.ac-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 52vh; flex-direction: initial; }
#acp-lib .ac-vid { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 6px; padding: 8px; }
#acp-lib .ac-vid input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
#acp-lib .ac-vid { position: relative; }
#acp-lib .ac-vid-prev { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: var(--surface-3); border-radius: 6px; display: block; }
#acp-lib .ac-vid-name { white-space: normal; overflow-wrap: anywhere; font-size: 13px; }
#acp-lib .ac-vflag { align-self: flex-start; }
@media (max-width: 640px) { #acp-lib.ac-lib { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 60vh; } }

/* «Опубликовать рилс» — full screen */
#ac-publish.rl-overlay { padding: 0; align-items: stretch; }
#ac-publish .ac-pub-card { max-width: none; width: 100%; min-height: 100%; border-radius: 0; border: 0; display: flex; flex-direction: column; }
#ac-publish .card-head { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
#ac-publish .rl-body { max-width: 1400px; width: 100%; margin: 0 auto; flex: 1; }
#ac-publish #acp-lib.ac-lib { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: none; }
@media (max-width: 640px) { #ac-publish #acp-lib.ac-lib { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#ac-publish.rl-overlay { background: var(--bg); }
#ac-publish .ac-pub-card { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
#ac-publish .card-head { background: var(--bg); }

/* «Опубликовать рилс»: compact settings on top, publish button in the sticky header */
.acp-head { display: flex; align-items: center; gap: 10px; }
.acp-head h2 { flex: none; }
.acp-head .acp-plan { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.acp-body { gap: 10px; padding-top: 10px; }
.acp-top { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.acp-row { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.acp-lbl { flex: none; width: 70px; font-size: 12px; color: var(--text-muted); padding-top: 5px; }
.acp-chips { gap: 4px; }
.acp-chips .rl-chip { padding: 3px 9px; font-size: 12px; min-height: 0; height: 26px; }
.acp-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 10px 14px; }
.acp-cap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.acp-cap input, .acp-opts select, .acp-opts input { height: 32px; font-size: 13px; padding-top: 0; padding-bottom: 0; }
.acp-cap .ac-text { min-height: 52px; font-size: 13px; resize: vertical; }
.acp-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.acp-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-content: start; }
.acp-opt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acp-opt .acp-lbl { width: auto; padding-top: 0; }
.acp-mhint { grid-column: 1 / -1; }
.acp-chk { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.acp-chk:last-child { grid-column: span 1; }
@media (max-width: 760px) {
  .acp-grid { grid-template-columns: 1fr; }
  .acp-lbl { width: 62px; }
  .acp-head .acp-plan { display: none; }
}
#acp-lib .ac-vid-sel { position: absolute; top: 14px; left: 14px; z-index: 1; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.45); color: #000; font-size: 13px; font-weight: 700; display: grid; place-items: center; pointer-events: none; }
#acp-lib .ac-vid.on .ac-vid-sel { background: #fff; }
.acp-libtools { display: flex; align-items: center; gap: 12px; }
#acp-lib .acp-new { align-self: flex-start; font-size: 11px; white-space: normal; line-height: 1.3; }
.acp-libtools { flex-wrap: wrap; justify-content: flex-end; }
.acp-viral select { height: 26px; font-size: 12px; padding: 0 6px; }

/* Accounts toolbar: statistics through the desktop browser */
.ac-ws { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ac-ws[hidden] { display: none; }
.ac-ws-chip { cursor: pointer; font: inherit; font-size: 12px; font-weight: 500; border: 0; }
.ac-ws-chip.pill-ghost { border: 1px solid var(--border-strong); }

.ac-foot.ac-foot-top { margin-top: 0; padding-top: 6px; border-top: 1px solid var(--border); }

/* «Пачка видео → план»: full screen like «Опубликовать рилс», compact settings on top, the videos below */
#ac-batch.rl-overlay { padding: 0; align-items: stretch; background: var(--bg); }
#ac-batch .acb-card-wide { max-width: none; width: 100%; min-height: 100%; border-radius: 0; border: 0; display: flex; flex-direction: column; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
#ac-batch .card-head { position: sticky; top: 0; z-index: 2; background: var(--bg); }
#ac-batch .rl-body { max-width: 1400px; width: 100%; margin: 0 auto; flex: 1; }
#ac-batch .acb-grid { max-height: none; overflow: visible; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.acb-set { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px; }
.acb-set select, .acb-set input[type=text] { height: 32px; font-size: 13px; padding-top: 0; padding-bottom: 0; }
.acb-set .acp-opt select { min-width: 64px; }
.acb-set .acb-topic { flex: 1 1 240px; }
.acb-set .acp-chk { height: 32px; }
.acb-info { font-size: 12px; color: var(--text-muted); cursor: help; height: 32px; display: inline-flex; align-items: center; }
#ac-batch .acb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#ac-batch #acb-acc .rl-chip { padding: 3px 9px; font-size: 12px; min-height: 0; height: 26px; }
@media (max-width: 640px) { #ac-batch .acb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .acb-set .acb-topic { flex-basis: 100%; } }
#ac-batch .acb-st { margin: 0; gap: 4px; }
#ac-batch .acb-st button, #ac-batch .acb-st .rl-chip { padding: 3px 9px; font-size: 12px; min-height: 0; height: 26px; }
#ac-batch .acb-st select { height: 26px; font-size: 12px; padding: 0 6px; }
#ac-batch .acb-bar .btn-sm { height: 28px; font-size: 12px; padding: 0 10px; }

.ac-help { border-color: #e08a00; background: rgba(224,138,0,.12); }
.ac-help ul { margin: 6px 0 0 18px; padding: 0; }

/* «Залетевшие рилсы» (accounts.js viralHtml) */
.ac-viral { margin-top: 16px; }
.ac-viral .card-head { flex-wrap: wrap; gap: 8px 12px; }
.ac-vauto { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; cursor: pointer; }
.ac-vacc { padding: 6px 0 10px; border-top: 1px solid var(--border); }
.ac-vhead { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 4px 0; }
.ac-vrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) 110px minmax(0, 240px); gap: 10px; align-items: center; padding: 6px 0; }
.ac-vthumb { width: 44px; height: 58px; border-radius: 6px; overflow: hidden; background: var(--border); }
.ac-vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ac-vmain, .ac-vnum { display: flex; flex-direction: column; min-width: 0; }
.ac-vfile { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-vact { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.ac-vwhy { text-align: right; }
.ac-vnone { margin: 8px 0 0; }
.ac-sch-rep { margin-right: 4px; }
@media (max-width: 640px) { .ac-vrow { grid-template-columns: 44px minmax(0, 1fr) auto; } .ac-vact { grid-column: 2 / -1; justify-content: flex-start; } }

/* Accounts: phones without a SIM — internet through a donor's hotspot */
.ac-pairs { margin-top: 16px; }
.ac-pairs .card-head { flex-wrap: wrap; gap: 6px 12px; }
.ac-pair-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ac-pair-row:last-of-type { border-bottom: 0; }
.ac-pair-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.ac-pair-msg { flex: 1 1 100%; overflow-wrap: anywhere; }
.ac-pair-edit label { display: inline-flex; align-items: center; gap: 6px; }
.ac-pair-edit select, .ac-pair-edit input { max-width: 100%; }
.ac-pair-edit input { width: 150px; }
.ac-pair-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 6px; }
.ac-pair-actions .toolbar-end { margin-left: auto; display: inline-flex; gap: 8px; }

/* «Серии и перемешивание» (accounts.js, /api/media/series) */
.sr-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.sr-note { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; font-size: 13px; background: var(--surface-2); }
.sr-note.warn { border-color: var(--warn); background: var(--warn-soft); }
.sr-note.ok { border-color: var(--ok); background: var(--ok-soft); }
.sr-miss { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.sr-h { font-size: 14px; margin: 16px 0 8px; }
.sr-ser { border: 1px solid var(--border); border-left: 4px solid var(--sc, var(--border-strong)); border-radius: var(--radius); padding: 8px 10px; margin: 8px 0; }
.sr-ser-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.sr-add { cursor: pointer; font-size: 13px; }
.sr-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sr-dot-single { background: transparent; border: 2px solid var(--text-muted); }
.sr-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.sr-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sr-img { aspect-ratio: 9 / 16; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.sr-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-fn { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-move { width: 100%; font-size: 12px; max-width: 100%; }
.sr-order { margin: 0; padding-left: 34px; display: grid; gap: 2px; font-size: 13px; }
.sr-order li { padding: 2px 0; }
.sr-order li > * { vertical-align: middle; }
.sr-order li .sr-dot { margin-right: 6px; }
.sr-order li .sr-fn { display: inline-block; max-width: min(60vw, 520px); margin-right: 8px; }
.sr-plan { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.sr-plan-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 4px; }
@media (max-width: 520px) { .sr-tiles { grid-template-columns: repeat(3, 1fr); } .sr-top .segmented { width: 100%; } .sr-top .segmented button { flex: 1; padding: 0 6px; font-size: 12px; } }

/* the series window opens from the batch window: keep it on top */
#ac-series { z-index: 70; }

/* «Серии и перемешивание»: the queue as cards in publishing order */
.sr-queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-bottom: 14px; }
.sr-q { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 4px; border-radius: 8px; border: 2px solid var(--sc); background: var(--surface-2, transparent); }
.sr-q .sr-img { border-radius: 5px; }
.sr-qn { position: absolute; top: 8px; left: 8px; z-index: 1; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--sc); color: #fff; font: 600 12px/22px system-ui, sans-serif; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.sr-qs { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; min-width: 0; }
.sr-q .sr-fn { font-size: 11px; opacity: .75; }
.sr-qm { display: flex; gap: 3px; }
.sr-qm button { flex: 1; min-width: 0; padding: 3px 2px; font-size: 11px; border-radius: 5px; border: 1px solid var(--border, #444); background: transparent; color: inherit; cursor: pointer; white-space: nowrap; }
.sr-qm button.active { background: var(--sc); border-color: var(--sc); color: #fff; font-weight: 600; }

/* ---------- SIM data / balance warning (Accounts tab) ---------- */
.sim-box { margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.sim-banner { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 10px 12px; }
.sim-banner.red { border-color: var(--danger); background: var(--danger-soft); }
.sim-bh { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-strong); }
.sim-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text); }
.sim-line { display: flex; gap: 8px; align-items: baseline; }
.sim-line i, .sim-lv i { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ok); }
.sim-red i { background: var(--danger); }
.sim-yellow i { background: var(--warn); }
.sim-hidden { padding: 2px 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; cursor: pointer; font: inherit; }
.sim-all summary { cursor: pointer; color: var(--text-muted); font-size: 13px; user-select: none; }
.sim-all[open] summary { margin-bottom: 8px; }
.sim-tw { overflow-x: auto; margin-bottom: 6px; }
.sim-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.sim-t th { text-align: left; font-weight: 500; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.sim-t td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sim-t tr.sim-r-red td:first-child { color: var(--danger); }
.sim-t tr.sim-r-yellow td:first-child { color: var(--warn); }
.sim-lv { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sim-acts { white-space: nowrap; text-align: right; }
.sim-acts .btn + .btn { margin-left: 6px; }
.sim-edit input[type="text"], .sim-edit input[type="date"] { height: 30px; margin-bottom: 4px; min-width: 80px; }
.sim-edit label { display: flex; align-items: center; gap: 6px; }
.sim-dot-host { position: relative; }
.sim-dot { position: absolute; top: 8px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; pointer-events: none; max-width: none !important; }
.sim-dot.yellow { background: var(--warn); color: #000; }
.bottombar .sim-dot { top: 2px; right: 50%; margin-right: -22px; }

/* «Архив рилсов» (accounts.js renderArchive): full screen like «Пачка видео» */
#ac-archive.rl-overlay { padding: 0; align-items: stretch; background: var(--bg); }
#ac-archive .acb-card-wide { max-width: none; width: 100%; min-height: 100%; border-radius: 0; border: 0; display: flex; flex-direction: column; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
#ac-archive .card-head { position: sticky; top: 0; z-index: 2; background: var(--bg); flex-wrap: wrap; }
#ac-archive .rl-body { max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; }
.aca-note { margin: 0 0 8px; }
.aca-accs { margin-bottom: 10px; gap: 6px; }
.aca-accs .rl-chip { padding: 3px 9px; font-size: 12px; min-height: 0; height: 28px; }
.aca-accs .aca-gone { border-style: dashed; }
.aca-tag { font-size: 11px; color: var(--danger); }
.aca-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 8px; }
.aca-table td { padding: 6px 10px; }
.aca-table .aca-file { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aca-table .aca-date { white-space: nowrap; }
.aca-table .aca-code { margin-left: 6px; }
.aca-table .aca-act { text-align: right; white-space: nowrap; }
@media (max-width: 640px) { .aca-table .aca-file { max-width: 160px; } .aca-table .aca-code { display: none; } }

/* «Ограничения» (Accounts) */
.rs-table td { padding: 6px 10px; }
.rs-table .rs-file { display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.rs-table .rs-row { cursor: pointer; }
.rs-table .rs-row:hover td { background: var(--accent-soft); }
.rs-table .rs-row.open td { border-bottom-color: transparent; }
.rs-table .rs-dates { white-space: nowrap; }
.rs-table .pill { white-space: nowrap; }
.rs-hist td { padding-top: 0; }
.rs-item { padding: 6px 0; border-top: 1px dashed var(--border); }
.rs-item:first-child { border-top: 0; }
.rs-cap { margin-top: 2px; }
.rs-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.rs-steps li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rs-acc { margin-left: auto; height: 28px; font-size: 12px; }
@media (max-width: 640px) { .rs-table .rs-file { max-width: 140px; } }
