:root {
  --bg: #0f1115;
  --card: #171a21;
  --line: #262b36;
  --text: #e6e9ef;
  --muted: #8a91a0;
  --accent: #3b82f6;
  --ok: #22c55e;
  --err: #ef4444;
  --chip: #222732;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, "SF Pro Text", Segoe UI, Roboto, sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 14px;   /* never cut off: actions drop below the nav if a window is too narrow */
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
  background: var(--bg); backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.actions { display: flex; align-items: center; gap: 12px; }
main { padding: 24px; max-width: 1200px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; margin-bottom: 20px;
}
.card h2 { font-size: 14px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
table.accounts { width: 100%; border-collapse: collapse; }
.accounts th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.accounts td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.accounts tr:last-child td { border-bottom: none; }
.accounts tr.row-err { background: rgba(239,68,68,.05); }
.flag { font-size: 20px; }
.name .label { font-weight: 600; }
.name .premium { color: #f5c542; margin-left: 4px; }
.slug { font-size: 11px; margin-top: 2px; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 24px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
select {
  background: var(--chip); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 8px; font-size: 12px; max-width: 190px;
}
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.badge.ok { background: rgba(34,197,94,.15); color: var(--ok); }
.badge.err { background: rgba(239,68,68,.15); color: var(--err); }
.badge.unk { background: var(--chip); color: var(--muted); }
.hbadge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.hbadge.h-ok { background: rgba(34,197,94,.15); color: var(--ok); }
.hbadge.h-limited { background: rgba(245,197,66,.16); color: #f5c542; }
.hbadge.h-logged_out { background: var(--chip); color: var(--muted); }
.hbadge.h-error { background: rgba(239,68,68,.15); color: var(--err); }
.hbadge.h-spamblock { background: rgba(239,68,68,.22); color: #ff6b6b; }
.hbadge.h-frozen { background: rgba(56,189,248,.16); color: #7dd3fc; }   /* заморожений — крижаний */
/* reactions emoji picker */
.emoji-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-btn { font-size: 20px; width: 46px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: transparent; cursor: pointer; line-height: 1; }
.emoji-btn:hover { border-color: var(--accent); }
.emoji-btn.on { border-color: var(--accent); background: rgba(59,130,246,.15); }
.btn {
  background: var(--chip); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: #3a4150; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2f6fd6; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.ghost { background: transparent; }
.inline { display: inline; margin: 0; }
.rowactions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; }
.link.danger { color: var(--err); }
.tgproxy { margin-left: 6px; }
.proxylist { list-style: none; padding: 0; margin: 0 0 14px; }
.proxylist li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.proxylist li:last-child { border-bottom: none; }
.proxy-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.proxy-toggle { border: none; font: inherit; cursor: pointer; }
.proxy-toggle:disabled { cursor: default; }
.proxy-accounts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pa-item { font-size: 12px; padding: 3px 9px; border-radius: 8px; background: var(--chip); border: 1px solid var(--line); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.pa-item:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--chip)); }
@keyframes cardFlash { 0% { box-shadow: 0 0 0 0 var(--accent); } 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.acard.flash { animation: cardFlash 1.4s ease; }
.proxy-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pcount {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: rgba(59,130,246,.15); color: var(--accent); white-space: nowrap;
}
.pcount.zero { background: var(--chip); color: var(--muted); }
.tag.tpl-ok { color: var(--ok); border-color: rgba(34,197,94,.4); }
/* proxy owner badge (admin view: tell your proxies from a teammate's) */
.owner-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap;
  background: var(--chip); color: var(--muted); border: 1px solid var(--line); }
.owner-badge.mine { background: rgba(34,197,94,.15); color: var(--ok); border-color: rgba(34,197,94,.4); }
.proxylist li.proxy-other { opacity: .82; }
/* users management modal */
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: none; }
.user-name { font-weight: 600; }
.user-tools { display: flex; gap: 6px; }
.dproxy { font-size: 13px; line-height: 1; cursor: default; }
.dproxy.on { filter: none; }
.dproxy.ready { opacity: .45; }
.dproxy.off { filter: grayscale(.1); cursor: pointer; }
.dproxy.off:hover { filter: none; transform: scale(1.15); }
.dproxy.busy { cursor: progress; }

/* per-channel reaction config: inline accordion — several channels open at once */
#r-chan-config { display: flex; flex-direction: column; gap: 8px; }
.cc-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cc-item.on { border-color: var(--accent, #4a7cff); box-shadow: 0 0 0 1px var(--accent, #4a7cff) inset; }
.cc-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; user-select: none; }
.cc-head:hover { background: rgba(255,255,255,.02); }
.cc-caret { color: var(--muted); font-size: 12px; width: 12px; flex: 0 0 auto; }
.cc-title { font-weight: 600; font-size: 14px; }
.cc-summary { margin-left: auto; font-size: 12px; color: var(--muted); }
.cc-item.cc-empty .cc-summary { color: #e0a63a; }
.cc-body { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.cc-body .emoji-grid { margin-top: 2px; }
.cc-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cc-detail-head .cc-pct-label { font-size: 12px; }
.cc-body .cc-pct {
  width: 76px; margin-bottom: 0; padding: 7px 8px; text-align: center; font-size: 14px;
  -moz-appearance: textfield; appearance: textfield;   /* drop the native spinner arrows */
}
.cc-body .cc-pct::-webkit-inner-spin-button,
.cc-body .cc-pct::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cc-detail-head .cc-fetch { margin-left: auto; }
/* custom emoji: show its base glyph + a small corner ✨ (instead of two crammed glyphs) */
.cc-body .emoji-btn.custom { position: relative; }
.cc-body .emoji-btn.custom::after {
  content: '✨'; position: absolute; right: 1px; bottom: 0; font-size: 9px; line-height: 1; opacity: .85;
}
.proxy-tools { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.pstatus { font-size: 12px; }
.pstatus.ok { color: var(--ok); }
.pstatus.err { color: var(--err); }
#check-all { margin-left: 10px; font-weight: 500; }
.card h2 { display: flex; align-items: center; }
/* selection counter next to a section title: "Акаунти · N вибрано" with even spacing
   (h2 is flex, which collapses the whitespace before the span → the bullet lives in CSS) */
.card h2 .count { font-weight: 500; text-transform: none; letter-spacing: 0; }
.card h2 .count::before { content: '·'; margin: 0 8px; opacity: .5; }
.addproxy { display: flex; gap: 8px; flex-wrap: wrap; }
.addproxy input {
  background: var(--chip); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.addproxy input[name=uri] { flex: 1; min-width: 280px; }
.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- status filter chips ---- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: #3a4150; }
.chip.active { border-color: var(--accent); background: rgba(59,130,246,.12); }
.chip b { font-weight: 700; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
/* «Додати акаунт» тепер сидить у ряду чипсів (Усі/Активні…), притиснута праворуч */
.chip-add { margin-left: auto; white-space: nowrap; }
.dot.all { background: var(--accent); }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }
.dot.unk { background: var(--muted); }
.dot.warn { background: #f5c542; }

/* ---- quick bar (search + actions) ---- */
.quickbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.search { position: relative; flex: 0 1 360px; }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .7; }
.search input {
  width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px 11px 40px; font-size: 14px;
}
.search input:focus { outline: none; border-color: var(--accent); }

/* uniform height for every quickbar control (buttons, search, sort icon) */
.quickbar .btn, .quickbar .search input, .quickbar .icon-btn { height: 38px; }
.quickbar .btn { display: inline-flex; align-items: center; white-space: nowrap; }

/* settings dropdown (Здоров'я / Ролі / Сповіщення / Бекап / Кошик) */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 190px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 2px;
}
.menu[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; white-space: nowrap;
  background: transparent; color: var(--text); border: 0; border-radius: 8px;
  padding: 9px 10px; font-size: 13px; cursor: pointer;
}
.menu-item:hover { background: var(--chip); }
/* compact sort control: just an icon; the <select> overlays it invisibly */
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; flex: none; background: transparent; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer;
}
.icon-btn:hover { border-color: #3a4150; }
.icon-btn select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }
.icon-btn-ico { font-size: 16px; pointer-events: none; }
/* trash sits alone at the far right */
.quickbar .trash-end { margin-left: auto; }

/* ---- account cards ---- */
.cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.acard {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; transition: border-color .15s, transform .05s;
}
.acard:hover { border-color: #3a4150; }
.acard.is-err { border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.04); }
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: var(--chip); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  position: relative; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avrefresh { cursor: pointer; }
.avrefresh:hover::before {
  content: "🖼"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 15px; background: rgba(0,0,0,.45); z-index: 2;
}
.avspin { display: none; }
.avrefresh.loading .avspin {
  display: block; position: absolute; top: 50%; left: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px; z-index: 3;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
.avrefresh.loading::after {
  content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 2;
}
.acard-body { flex: 1; min-width: 0; }
.acard-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acard-title .label { font-weight: 600; font-size: 15px; cursor: pointer; }
.acard-title .label:hover { text-decoration: underline; text-underline-offset: 2px; }
.acard-title .premium { color: #f5c542; }
.acard-sub { margin-top: 3px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acard-sub .sep { opacity: .5; }
.acard-meta { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: var(--chip); color: var(--text); border: 1px solid var(--line);
}
.tag.muted { color: var(--muted); }
.acard-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.acard-actions { display: flex; gap: 6px; align-items: center; }
.empty { text-align: center; color: var(--muted); padding: 32px; background: var(--card); border: 1px dashed var(--line); border-radius: 14px; }

/* duplicate badge + chip dot */
.badge.dup { background: rgba(245,197,66,.16); color: #f5c542; }
.dot.dup { background: #f5c542; }

/* role / group chip on a card */
.rolechip {
  font-size: 11px; padding: 2px 9px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px dashed var(--line); font: inherit; font-size: 11px;
}
.rolechip:hover { border-color: var(--accent); color: var(--text); }
.rolechip.set {
  border-style: solid; border-color: var(--line);
  background: var(--chip); color: var(--text); font-weight: 600;
}

/* group filter row */
.chips.groups { align-items: center; margin-top: -6px; }
.chips-label { color: var(--muted); font-size: 12px; margin-right: 2px; }
.gchip { padding: 5px 11px; font-size: 12px; }
.gchip.active { border-color: #a78bfa; background: rgba(139,92,246,.16); color: #a78bfa; }
.gchip b { font-weight: 700; opacity: .8; }
.gchip-wrap { display: inline-flex; align-items: center; gap: 4px; }
.role-color {
  width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  background: none; cursor: pointer; flex: none;
}
.role-color::-webkit-color-swatch-wrapper { padding: 2px; }
.role-color::-webkit-color-swatch { border: none; border-radius: 4px; }
.rc-icon { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 5px; line-height: 1; }
.rc-icon:hover { color: var(--text); }
.rc-del:hover, .rr-del:hover { color: var(--err); }

/* roles management modal */
.role-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.role-row:last-child { border-bottom: none; }
.rr-name { font-weight: 600; font-size: 14px; }
.rr-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.role-add { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* trash modal */
.trash-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.trash-row:last-child { border-bottom: none; }
.trash-flag { font-size: 18px; flex: none; width: 22px; text-align: center; }
.trash-info { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.trash-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-sub { font-size: 12px; }
.trash-restore { flex: none; }
.trash-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.tcount { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 20px; background: rgba(245,197,66,.18); color: #f5c542; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }

/* per-role colour tint on account cards */
.acard.roled {
  border-left: 3px solid var(--role-color);
  background: var(--role-grad, linear-gradient(90deg, color-mix(in srgb, var(--role-color) 24%, var(--card)) 0%, var(--card) 50%));
}
.acard.roled.selected { background: rgba(59,130,246,.10); }
.acard.roled .rolechip.set {
  background: var(--chip); color: var(--text);
  border-color: color-mix(in srgb, var(--role-color) 60%, var(--line));
}

/* spam-blocked accounts: a SOFT red tint + thin left accent (not an aggressive outline) */
.acard[data-health="spamblock"] {
  border-left: 3px solid rgba(239,68,68,.4);
  background: linear-gradient(100deg, rgba(239,68,68,.10), rgba(239,68,68,.02) 55%, var(--card));
}
/* frozen accounts: soft icy-blue tint + thin left accent, scattered with small snowflakes */
.acard[data-health="frozen"] {
  border-left: 3px solid rgba(125,211,252,.42);
  background:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='150'%20height='80'%3E%3Ctext%20x='14'%20y='26'%20font-size='13'%20fill='%23fff'%20opacity='.15'%3E❄%3C/text%3E%3Ctext%20x='80'%20y='58'%20font-size='10'%20fill='%23fff'%20opacity='.12'%3E❄%3C/text%3E%3Ctext%20x='122'%20y='20'%20font-size='12'%20fill='%23fff'%20opacity='.14'%3E❄%3C/text%3E%3Ctext%20x='46'%20y='69'%20font-size='9'%20fill='%23fff'%20opacity='.11'%3E❄%3C/text%3E%3Ctext%20x='104'%20y='63'%20font-size='11'%20fill='%23fff'%20opacity='.13'%3E❄%3C/text%3E%3Ctext%20x='136'%20y='46'%20font-size='8'%20fill='%23fff'%20opacity='.10'%3E❄%3C/text%3E%3Ctext%20x='30'%20y='47'%20font-size='8'%20fill='%23fff'%20opacity='.10'%3E❄%3C/text%3E%3C/svg%3E") repeat,
    linear-gradient(100deg, rgba(56,189,248,.15), rgba(37,99,235,.05) 60%, var(--card));
}

.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: 520px; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px;
  font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.4); z-index: 50;
}
.toast.ok { border-color: rgba(34,197,94,.5); }
.toast.err { border-color: rgba(239,68,68,.5); }

/* bottom progress bar for the cancellable 'Оновити все' job */
#refresh-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(680px, calc(100vw - 32px)); z-index: 55;
  transition: bottom .18s ease;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; box-shadow: 0 12px 34px rgba(0,0,0,.5);
}
#refresh-bar .rb-in { display: flex; align-items: center; gap: 14px; }
#refresh-bar .rb-txt { font-size: 13px; font-weight: 600; white-space: nowrap; }
#refresh-bar .rb-track {
  flex: 1; height: 8px; border-radius: 6px; background: var(--chip); overflow: hidden;
}
#refresh-bar .rb-fill {
  height: 100%; width: 0; background: var(--accent, #4a7cff);
  border-radius: 6px; transition: width .3s ease;
}
#refresh-bar .rb-cancel { flex: 0 0 auto; }

/* per-account actions dropdown */
.act-menu {
  position: fixed; z-index: 60; min-width: 210px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.5); display: flex; flex-direction: column;
  overflow-y: auto;   /* tall menu scrolls inside itself instead of overflowing the screen */
  overscroll-behavior: contain;  /* scrolling inside the menu doesn't scroll the page */
}
.act-menu button {
  text-align: left; background: none; border: none; color: var(--text); flex-shrink: 0;
  font: inherit; font-size: 13px; padding: 9px 12px; border-radius: 8px; cursor: pointer;
}
.act-menu button:hover { background: var(--chip); }
.act-menu button.danger { color: var(--err); }
.act-menu button.danger:hover { background: rgba(239,68,68,.12); }

/* 2FA cloud-password manager */
.twofa-hint {
  background: var(--chip); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}
/* password input with a show/hide eye */
.pw-wrap { position: relative; margin-bottom: 14px; }
.pw-wrap .wiz-input { margin-bottom: 0; padding-right: 42px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 6px; line-height: 1;
}
.pw-eye:hover { color: var(--text); }
.twofa-menu { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.twofa-menu .btn { width: 100%; justify-content: center; padding: 11px; }
.twofa-menu .btn.danger { color: var(--err); border-color: rgba(239,68,68,.4); }

/* styled role picker (single / bulk) with colour */
.rolepick-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 20px; }
.rolepick-item {
  display: inline-flex; align-items: center; gap: 8px; background: var(--chip);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  color: var(--text); cursor: pointer; font-size: 13px; font: inherit;
}
.rolepick-item:hover { border-color: var(--accent); }
.rolepick-item .rm-sw { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.rolepick-new { display: flex; gap: 8px; align-items: center; }
.rolepick-new .wiz-input { margin: 0; flex: 1; }
.rolepick-new input[type=color] {
  width: 46px; height: 42px; padding: 2px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--chip); cursor: pointer; flex: none;
}

/* role picker menu */
.role-menu { min-width: 180px; max-height: 320px; overflow-y: auto; }
.role-menu button { display: flex; align-items: center; gap: 9px; }
.country-menu { min-width: 190px; max-height: 60vh; overflow-y: auto; left: 0; right: auto; }
.country-menu .menu-item b { margin-left: auto; color: var(--muted); font-weight: 600; }
.rm-sw { width: 26px; height: 14px; border-radius: 4px; flex: none; border: 1px solid rgba(255,255,255,.15); }
.rm-sep { height: 1px; background: var(--line); margin: 5px 4px; }
/* gradient swatch inside the roles modal (multi-colour / flag roles) */
.rr-grad { width: 30px; height: 18px; border-radius: 5px; flex: none; border: 1px solid rgba(255,255,255,.15); cursor: default; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 70; padding: 20px;
}
.modal {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  width: 100%; max-width: 460px; max-height: 82vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px;
}
.modal-x { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 18px 20px; font-size: 13px; }

/* in-app confirm / alert / prompt (ui-dialogs.js) — replaces the grey system popups */
.dlg { max-width: 420px; }
.dlg-msg { padding: 22px 22px 4px; font-size: 14px; line-height: 1.5; color: var(--text); white-space: normal; }
.dlg-input { margin: 16px 22px 0; width: calc(100% - 44px); }
.dlg-btns { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 22px 20px; }
.dlg-btns .btn { min-width: 96px; justify-content: center; padding: 9px 16px; }
.btn.dlg-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.dlg-danger:hover { background: #dc2626; border-color: #dc2626; }
.dlg-overlay { z-index: 90; }   /* above other modals, so a confirm from inside one sits on top */

/* active-sessions manager rows */
.sess-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.sess-row.current { border-color: var(--accent); background: rgba(74,124,255,.06); }
.sess-row.previous { border-color: #d9822b; background: rgba(217,130,43,.09); }
.sess-prev { font-size: 11px; font-weight: 600; color: #d9822b; margin-left: 4px; white-space: nowrap; }
.sess-note { font-size: 12px; margin-bottom: 12px; line-height: 1.5; }
.sess-main { flex: 1; min-width: 0; }
.sess-dev { font-weight: 600; margin-bottom: 3px; }
.sess-sub { font-size: 12px; line-height: 1.5; word-break: break-word; }
.sess-actcol { flex: 0 0 auto; }
.sess-cur { font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; }
/* speed + time-estimate modal (Оновити все / Перевірити на спамблок) */
.modal.jobmode { max-width: 420px; }
.jm-info { margin-bottom: 14px; }
.jm-opt {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.jm-opt:hover { border-color: #3a4150; }
.jm-opt > input { accent-color: var(--accent); width: 16px; height: 16px; flex: 0 0 auto; }
.jm-opt .jm-t { flex: 1; }
.jm-opt .jm-eta { font-weight: 700; color: var(--accent); white-space: nowrap; }
.jm-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.jm-note { margin: 6px 2px 16px; line-height: 1.5; }
.jm-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* multi-select mode: a card becomes click-to-select (no need to aim at the checkbox) */
body.selmode .acard { cursor: pointer; }
table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv tr:last-child td { border-bottom: none; }
table.kv td:first-child { color: var(--muted); width: 38%; }
.spam-reply {
  margin-top: 12px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; white-space: pre-wrap; font-size: 12px; line-height: 1.5;
}

/* import sections */
.imp-title { font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
.imp-title .muted { font-weight: 400; }

/* import dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 30px 20px; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: rgba(59,130,246,.1); }
.dz-icon { font-size: 34px; }
.import-label {
  width: 100%; margin-top: 14px; background: var(--chip); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px;
}
.import-label:focus { outline: none; border-color: var(--accent); }
.import-status { margin-top: 12px; font-size: 12px; line-height: 1.5; }
.import-status.ok { color: var(--ok); }
.import-status.err { color: var(--err); }

/* bulk selection + sorting + hover polish */
.acard-check {
  flex: none; width: 17px; height: 17px; margin-right: -4px;
  accent-color: var(--accent); cursor: pointer;
}
.acard.selected { border-color: var(--accent); background: rgba(59,130,246,.07); }
.acard { transition: border-color .15s, background .15s, transform .08s, box-shadow .15s; }
.acard:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0,0,0,.28); }
.updated { color: var(--muted); font-size: 12px; }
.sort-select {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; cursor: pointer;
}
.sort-select:focus { outline: none; border-color: var(--accent); }

/* bulk actions bar */
/* soft dim behind the floating action pill */
#bulk-backdrop {
  position: fixed; left: 0; right: 0; bottom: 0; height: 160px; z-index: 54;
  background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,0));
  pointer-events: none;
}
#bulk-backdrop.hidden { display: none; }
.bulkbar {
  position: fixed; left: 16px; right: 16px; bottom: 18px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  z-index: 55; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--accent); border-radius: 16px;
  padding: 12px 18px; box-shadow: 0 12px 44px rgba(0,0,0,.55);
  animation: bulkIn .18s ease;
}
@keyframes bulkIn { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
/* the count doubles as the select-all / deselect-all toggle */
#bulk-count {
  font-size: 14px; font-weight: 700; padding: 0 12px; height: 38px; white-space: nowrap;
  background: var(--chip); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center;
}
#bulk-count:hover { border-color: var(--accent); }
/* trash sits at the end of the centred cluster, slightly separated */
#bulk-delete { margin-left: 6px; }
/* every control the same height */
.bulkbar .btn, .bulkbar .bulk-select { height: 38px; }
.bulkbar .btn { display: inline-flex; align-items: center; font-size: 13px; }
.bulk-gbtn { padding: 0 14px; }
.bulk-icon { width: 38px; justify-content: center; padding: 0; font-size: 15px; }  /* square icon-only */
.bulk-select {
  background: var(--chip); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; font-size: 13px; width: 120px; max-width: 120px;
}
@media (max-width: 640px) { .bulkbar { left: 8px; right: 8px; padding: 10px 12px; gap: 8px; } }

/* login-code monitor */
.codeitem {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
  background: rgba(34,197,94,.06);
}
.codeitem .code {
  font-size: 26px; font-weight: 700; letter-spacing: 4px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace; color: var(--ok);
  user-select: all;
}

/* top nav (manager / warmup) */
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.navlink { padding: 8px 8px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.navlink:hover { color: var(--text); text-decoration: none; }
.navlink.active { color: var(--accent); background: rgba(59,130,246,.12); }

/* warmup page: account picker */
.wacc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.wacc { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; min-width: 0; overflow: hidden; }
.wacc .wacc-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wacc .wacc-age { flex: 0 0 auto; }
.wacc.on { border-color: var(--accent); background: rgba(59,130,246,.08); }
.wacc-check { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 16px; }
.wacc-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wacc-age { flex: none; font-size: 11px; color: var(--muted); background: var(--chip); padding: 1px 6px; border-radius: 20px; white-space: nowrap; }
.wacc .wacc-proxy { flex: 0 1 auto; min-width: 0; margin-left: auto; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }

/* warmup page: modes + safety */
.wmode { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.wmode-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; }
.wmode-opt input { accent-color: var(--accent); margin-top: 2px; flex: none; }
.wtargets { margin-bottom: 0; }
.wsafe { margin-top: 18px; padding: 11px 14px; background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.3); border-radius: 10px; font-size: 12px; line-height: 1.5; }
.w-eta { margin-top: 16px; padding: 10px 13px; background: var(--chip); border-radius: 10px; font-size: 13px; color: var(--text); line-height: 1.5; }
.w-eta:empty { display: none; }
/* settings split into labelled sub-sections, separated by a hairline */
.wsub { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.wsub:first-of-type { padding-top: 0; margin-top: 0; border-top: none; }
.wsub-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }
.wgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; align-items: start; }
.wgrid-full { grid-column: 1 / -1; }
.wfull { width: 100%; }
/* block label with a hanging checkbox, so multi-line text wraps naturally (a flex
   container turned every bold/muted run into a separate item → broken wrapping) */
.wu-check { display: block; position: relative; padding-left: 26px; font-size: 13px; line-height: 1.5; cursor: pointer; }
.wu-check > input { position: absolute; left: 0; top: 0; accent-color: var(--accent); width: 15px; height: 15px; }
/* progressive-mode toggle: a self-contained flex box (hanging checkbox, wrapping text) */
.wu-prog { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.5; cursor: pointer;
  border: 1px solid rgba(59,130,246,.35); background: rgba(59,130,246,.06); border-radius: 10px; }
.wu-prog > input { position: static; margin: 2px 0 0; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.dur-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.dur { padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.dur.active { border-color: var(--accent); background: rgba(59,130,246,.15); color: var(--accent); font-weight: 600; }
.wact-bar { display: flex; gap: 8px; margin: 10px 0 12px; flex-wrap: wrap; }
.wact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.wact-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.wact-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.wact-group label { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; cursor: pointer; padding: 5px 0; line-height: 1.4; }
.wact-group input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; margin-top: 2px; }
/* a checkbox's sub-note goes on its OWN line under the label, not off to the side */
.wact-group label .muted { display: block; font-size: 12px; margin-top: 1px; }
.jt { color: var(--muted); margin-right: 6px; }
.lock2fa { font-size: 12px; }
/* плашка-фільтр «Чужа пошта» — того ж помаранчевого кольору, що й позначка на картці */
.chip.chip-mail { border-color: #f59e0b; }
.chip.chip-mail.active { background: color-mix(in srgb, #f59e0b 26%, transparent); }

/* ✉️ до акаунта прив'язана ЧУЖА пошта для входу — нею заходять без SMS, тому це попередження,
   а не просто позначка: помаранчеве, як «дублікат», і видно з першого погляду */
.badge.mailwarn {
  background: color-mix(in srgb, #f59e0b 22%, transparent);
  border: 1px solid #f59e0b; color: var(--text);
  font-weight: 600; cursor: pointer;
}
.badge.mailwarn:hover { background: color-mix(in srgb, #f59e0b 36%, transparent); }
/* розділювач у вікні пошти між «надіслати код» і «це моя пошта» */
.lm-sep { border-top: 1px solid var(--line); margin: 16px 0 12px; }
/* пароль 2FA стоїть, але в нас його немає — замочок «без ключа»: блідий і перекреслений */
.lock2fa.nokey { opacity: .45; filter: grayscale(1); }

/* unified warm-up log window */
.logwin {
  margin-top: 12px; max-height: 420px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 12px;
}
.lg-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 6px; border-radius: 6px; }
.lg-row:hover { background: rgba(255,255,255,.03); }
.lg-t { color: var(--muted); flex: none; width: 62px; }
.lg-acc { flex: none; background: rgba(139,92,246,.18); color: #c4b5fd; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.lg-msg { color: var(--text); word-break: break-word; }
.lg-row.err .lg-msg { color: var(--err); }
.logfoot { margin-top: 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }

/* warm-up modal */
.wu-textarea {
  width: 100%; background: var(--chip); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; resize: vertical;
  font-family: "SF Mono", ui-monospace, Menlo, monospace; margin-bottom: 14px;
}
.wu-textarea:focus { outline: none; border-color: var(--accent); }
.wu-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.wu-actions label { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; }
.wu-actions input { accent-color: var(--accent); width: 16px; height: 16px; }
.wu-row { display: flex; gap: 16px; margin-bottom: 16px; }
.wu-row > div { flex: 1; }

/* fleet jobs */
.jobs-modal { max-width: 560px; }
.jobcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.jobcard:last-child { margin-bottom: 0; }
.jobhead { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.jobhead .muted { margin-left: auto; font-size: 12px; }
.jobbar { height: 6px; background: var(--chip); border-radius: 6px; overflow: hidden; }
.jobbar-fill { height: 100%; background: var(--accent); transition: width .3s; }
.joblog { margin-top: 10px; max-height: 160px; overflow: auto; font-size: 12px; font-family: "SF Mono", ui-monospace, Menlo, monospace; }
.jl { padding: 2px 0; border-bottom: 1px solid var(--line); }
.jl.ok { color: var(--text); }
.jl.err { color: var(--err); }
.jl.warn { color: #f5c542; }   /* a flagged result (e.g. found spamblock) — attention, not an error */

/* add-account tabs (login / import) */
.add-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.add-tab {
  flex: 1; padding: 9px 8px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.add-tab.active { border-color: var(--accent); background: rgba(59,130,246,.12); color: var(--accent); font-weight: 600; }

/* login wizard */
.wiz-steps { display: flex; gap: 8px; margin-bottom: 18px; }
.ws {
  flex: 1; text-align: center; font-size: 12px; color: var(--muted);
  padding: 7px 4px; border: 1px solid var(--line); border-radius: 999px;
}
.ws.active { color: var(--accent); border-color: var(--accent); background: rgba(59,130,246,.12); font-weight: 600; }
.wiz-label { display: block; font-size: 12px; color: var(--muted); margin: 4px 0 6px; }
.wiz-input {
  width: 100%; margin-bottom: 14px; background: var(--chip); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 14px;
}
.wiz-input:focus { outline: none; border-color: var(--accent); }
.wiz-btn { width: 100%; padding: 11px; }
.wiz-alt { margin-top: 12px; text-align: center; font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  .acard { flex-wrap: wrap; }
  .acard-side { width: 100%; align-items: stretch; }
  .acard-actions { justify-content: flex-end; }
}

/* ---------- busy accounts + inline task progress ---------- */
/* A card locked by a running task: it gets a coloured outline, its per-account
   controls are disabled (but ▶ Desktop and the checkbox stay usable), and an
   inline progress strip is pinned to the bottom. */
.acard { position: relative; }
.acard { flex-wrap: wrap; }   /* let the live-progress panel sit on its own full-width row */
.acard.busy { border-color: rgba(59,130,246,.5); }
.acard.busy .proxy-select,
.acard.busy .act-menu-btn,
.acard.busy .rolechip,
.acard.busy .avrefresh { pointer-events: none; opacity: .4; }

.acard-progress {
  flex: 0 0 100%;                      /* own full-width row under the card content */
  background: var(--chip);             /* SOLID panel — no bleed-through onto neighbours */
  border: 1px solid rgba(59,130,246,.28);
  border-radius: 10px; padding: 8px 10px;
}
.ap-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ap-kind { font-weight: 600; white-space: nowrap; }
.ap-last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-log { font-size: 12px; cursor: pointer; }
.ap-stop { padding: 2px 8px; }
.ap-bar { height: 4px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.ap-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .6s linear; }
.acard-progress.indeterminate .ap-fill {
  width: 35%; animation: ap-slide 1.3s ease-in-out infinite;
}
@keyframes ap-slide {
  0% { margin-left: -35%; } 100% { margin-left: 100%; }
}
.ap-loglines { margin-top: 7px; max-height: 120px; overflow: auto; font-size: 11px; }
.ap-loglines .jl { padding: 1px 0; }
.ap-loglines .jl.err { color: var(--err); }
.ap-loglines .jl.sys { color: var(--muted); }

/* busy account in the warmup / announce / reactions picker */
.wacc.busy { opacity: .55; cursor: not-allowed; }
.wacc.busy input { cursor: not-allowed; pointer-events: none; }
.wacc-busy { flex: 0 0 auto; margin-left: 2px; font-size: 15px; line-height: 1; cursor: help; }

/* ---------- grouped bulk-actions menu ---------- */
.act-menu button .ami { display: inline-block; width: 20px; text-align: center; margin-right: 2px; }
.bulk-gbtn { white-space: nowrap; }

/* ---------- per-account job progress (warmup / reactions / announce) ---------- */
.jp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.jp-head b { font-size: 15px; }
.jp-head .muted { font-size: 13px; }
.jp-head .btn:first-of-type { margin-left: auto; }   /* stop-all / resume cluster to the right */
.jp-sys { font-size: 12px; margin: -4px 0 10px; }
/* several running jobs of one kind → each is its own panel, spaced apart */
.jp-panel + .jp-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.jp-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
/* full-width cards stacked one under another (like the old single window) */
.jp-grid { display: flex; flex-direction: column; gap: 10px; }
.jp-card {
  background: var(--chip); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px;
  transition: border-color .15s; cursor: pointer;   /* whole card toggles its log */
}
.jp-card:hover { border-color: #3a4150; }
.jp-card.jp-open { cursor: default; }
.jp-card.jp-run { border-color: rgba(59,130,246,.45); }
.jp-card.jp-run:hover { border-color: rgba(59,130,246,.7); }
.jp-card.jp-queue { opacity: .72; }
.jp-card.jp-done { opacity: .82; }
.jp-card.jp-stopped { border-color: rgba(239,68,68,.35); opacity: .8; }
/* акаунт зі збоєм — м'яка бурштинова рамка, щоб одразу впадав в око серед десятків карток */
.jp-card.jp-haserr { border-color: rgba(245,158,11,.5); opacity: 1; }
.jp-card.jp-haserr:hover { border-color: rgba(245,158,11,.8); }
.jp-warn { font-size: 12px; line-height: 1; }
.jp-card-head { display: flex; align-items: center; gap: 8px; }
.jp-name { font-weight: 600; font-size: 14px; }
.jp-count { font-size: 11px; }
.jp-st { font-size: 12px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.jp-card .jp-stop { padding: 2px 8px; margin-left: 2px; cursor: pointer; }
.jp-last { font-size: 12px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jp-last.jp-last-err { color: var(--err); }
/* expanded log — comfortable, scrolls INSIDE the card, full width, wraps long lines */
.jp-log {
  margin-top: 9px; max-height: 300px; overflow-y: auto; font-size: 12.5px; line-height: 1.55;
  border-top: 1px solid var(--line); padding-top: 8px; overscroll-behavior: contain; cursor: text;
}
.jp-log .jl { display: flex; gap: 10px; align-items: baseline; padding: 2px 0; }
.jp-log .jl.err { color: var(--err); }
.jp-log .jl.sys { color: var(--muted); }
.jp-log .jl-t { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums;
  font-family: "SF Mono", ui-monospace, Menlo, monospace; }
.jp-log .jl-m { flex: 1 1 auto; min-width: 0; word-break: break-word; }

/* ── Фільтр пікера акаунтів (прогрів/повідомлення/реакції) + індикація ролі ── */
.wf-bar { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 12px; }
.wf-search {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 11px; font: inherit; font-size: 13px; width: 100%;
}
.wf-search:focus { outline: none; border-color: var(--accent); }
.wf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-noroles .wf-chips { display: none; }   /* ролей нема — лишаємо тільки пошук */
.wf-chip {
  display: inline-flex; align-items: center;
  background: var(--card); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.wf-chip:hover { border-color: #3a4150; }
.wf-chip.on { border-color: var(--accent); background: rgba(59,130,246,.12); color: var(--text); }
.wf-chip.roled::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--role-color); margin-right: 6px; flex: none;
}
.wf-chip.roled.on { border-color: var(--role-color); background: color-mix(in srgb, var(--role-color) 16%, transparent); }

/* роль на рядку акаунта */
.wacc.roled { border-left: 3px solid var(--role-color); }
.wacc-role {
  flex: 0 0 auto; font-size: 11px; padding: 1px 8px; border-radius: 999px;
  white-space: nowrap; color: var(--text);
  background: color-mix(in srgb, var(--role-color, var(--muted)) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--role-color, var(--muted)) 55%, transparent);
}

.wf-hidden { display: none !important; }
.wf-empty { grid-column: 1 / -1; padding: 6px 2px; }

/* «Завершити інші сесії» disabled до 24 год + 📩 SMS-переавторизація на розлогінених картках */
.act-menu button.disabled { opacity: .4; cursor: not-allowed; }
.acard-actions .sms-reauth { background: color-mix(in srgb, #f59e0b 20%, transparent); border-color: #f59e0b; color: var(--text); padding: 3px 7px; }
.acard-actions .sms-reauth:hover { background: color-mix(in srgb, #f59e0b 34%, transparent); }
/* 🔑 нова сесія по коду (на живій картці) + 🧹 завершити старі сеанси (через 24 год після зміни) */
.acard-actions .code-reauth { background: color-mix(in srgb, #4a7cff 18%, transparent); border-color: #4a7cff; color: var(--text); padding: 3px 7px; }
.acard-actions .code-reauth:hover { background: color-mix(in srgb, #4a7cff 32%, transparent); }
.acard-actions .term-old { background: color-mix(in srgb, #22c55e 18%, transparent); border-color: #22c55e; color: var(--text); padding: 3px 7px; }
.acard-actions .term-old:hover { background: color-mix(in srgb, #22c55e 32%, transparent); }

/* поля редактора проксі */
.pe-lab { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.pe-lab .wiz-input { margin-top: 4px; }

/* split-button ⋮ item: leading emoji (.mi-alt) is a separately-clickable alternate action */
.act-menu button .mi-alt { display: inline-block; margin-right: 4px; padding: 0 5px; border-radius: 6px; cursor: pointer; }
.act-menu button .mi-alt:hover { background: color-mix(in srgb, var(--accent) 34%, transparent); transform: scale(1.12); }

/* нижня смуга прогресу для одиночних операцій (напр. «створюю нову сесію») — вигляд як refresh-bar,
   але з невизначеною (анімованою) заливкою */
#busy-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: min(680px, calc(100vw - 32px)); z-index: 55;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; box-shadow: 0 12px 34px rgba(0,0,0,.5);
  animation: bulkIn .18s ease; transition: bottom .18s ease;
}
#busy-bar .rb-in { display: flex; align-items: center; gap: 14px; }
#busy-bar .rb-txt { font-size: 13px; font-weight: 600; white-space: nowrap; }
#busy-bar .rb-track { flex: 1; height: 8px; border-radius: 6px; background: var(--chip); overflow: hidden; position: relative; }
#busy-bar .rb-fill { position: absolute; top: 0; height: 100%; width: 35%; background: var(--accent, #4a7cff); border-radius: 6px; animation: busySlide 1.15s ease-in-out infinite; }
#busy-bar.done .rb-fill { animation: none; left: 0; width: 100%; background: var(--ok, #22c55e); }
@keyframes busySlide { 0% { left: -38%; } 100% { left: 100%; } }
#busy-bar.err { border-color: var(--err, #ef4444); }
#busy-bar.err .rb-txt { color: var(--err, #ef4444); white-space: normal; }
#busy-bar.err .rb-track { display: none; }
#busy-bar .rb-x { flex: 0 0 auto; margin-left: auto; }

/* ---- Чати page (chats.html) ---- */
.c-summary { margin: 8px 0 16px; font-size: 14px; }
.c-summary .err, .err { color: var(--err); }
.c-cols { display: grid; grid-template-columns: 1fr; gap: 22px; }
.c-col { min-width: 0; }   /* let the column shrink to the window instead of forcing a wide row */
.c-col h3 { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 0 0 8px; font-weight: 600; }
.c-col h3 .muted { font-weight: 400; }
.c-selall { margin-left: auto; display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 400; cursor: pointer; }
.c-list { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-height: 380px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.12); }
.c-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.c-item:hover { background: rgba(255,255,255,.04); }
.c-item .c-item-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-item .c-item-uname { flex: 0 0 auto; color: var(--accent); font-size: 12px; }
.c-item .c-item-mem { flex: 0 0 auto; font-size: 12px; }
.c-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---- Чати page: aggregated-list extras ---- */
.c-item .c-item-cnt { flex: 0 0 auto; font-size: 12px; }
.c-missing { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
