/* WhatsApp-like Mini App — theme-aware (Telegram light/dark), no external assets. */
:root {
  --wa-green: #25d366;
  --wa-teal: #128c7e;
  --out-bubble: #d9fdd3;
  --in-bubble: #ffffff;
  --bg: #efeae2;
  --topbar: #075e54;
  --topbar-text: #ffffff;
  --text: #111b21;
  --sub: #667781;
  --divider: #e4ddd6;
  --tick-read: #53bdeb;
}
body.dark {
  --out-bubble: #005c4b;
  --in-bubble: #202c33;
  --bg: #0b141a;
  --topbar: #202c33;
  --text: #e9edef;
  --sub: #8696a0;
  --divider: #182229;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
#app {
  height: 100%;
  position: relative;
}
.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.view.active {
  display: flex;
}

/* Top bar */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: var(--topbar);
  color: var(--topbar-text);
}
.topbar-title {
  font-size: 18px;
  font-weight: 600;
}
.back {
  background: none;
  border: none;
  color: var(--topbar-text);
  font-size: 30px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.thread-peer {
  display: flex;
  flex-direction: column;
}
/* Header number is a button (tap to copy) — reset button chrome, keep it looking like plain text. */
.thread-name {
  font-size: 16px;
  font-weight: 600;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.12s;
}
.thread-name:active {
  opacity: 0.55;
}
.thread-sub {
  font-size: 12px;
  opacity: 0.8;
}
/* Thread load-failure state — a Повторить button instead of an eternal spinner. */
.thread-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.retry-btn {
  border: 0;
  border-radius: 20px;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  background: var(--wa-green);
  color: #04160c;
  cursor: pointer;
}
.retry-btn:active {
  opacity: 0.8;
}

/* Lists (profiles + chats) */
.list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.row:active {
  background: rgba(127, 127, 127, 0.12);
}
.avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--wa-teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  text-transform: uppercase;
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.row-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-time {
  font-size: 12px;
  color: var(--sub);
  flex: 0 0 auto;
}
.row-sub {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-badge {
  font-size: 11px;
  color: var(--sub);
}
.pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(37, 211, 102, 0.16);
  color: var(--wa-teal);
}
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--sub);
}

/* Thread */
.thread-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 8px 14px;
}
#thread-msgs {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.day {
  align-self: center;
  background: rgba(255, 255, 255, 0.75);
  color: var(--sub);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 8px;
  margin: 8px 0;
}
body.dark .day {
  background: rgba(32, 44, 51, 0.9);
}
.bubble {
  max-width: 82%;
  padding: 6px 9px 8px;
  border-radius: 8px;
  position: relative;
  font-size: 14.5px;
  line-height: 1.34;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}
.bubble.in {
  align-self: flex-start;
  background: var(--in-bubble);
  border-top-left-radius: 2px;
}
.bubble.out {
  align-self: flex-end;
  background: var(--out-bubble);
  border-top-right-radius: 2px;
}
.bubble img {
  max-width: min(180px, 58vw);
  max-height: 220px;
  width: auto;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 4px;
  cursor: pointer;
}
/* Tap a thumbnail → full-size overlay (tap anywhere to close). */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-out;
}
.meta {
  float: right;
  margin: 6px 0 -2px 8px;
  font-size: 11px;
  color: var(--sub);
  user-select: none;
}
.tick {
  color: var(--sub);
}
.tick.read {
  color: var(--tick-read);
}

/* Composer */
.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: var(--bg);
}
.composer input {
  flex: 1;
  border: none;
  border-radius: 22px;
  padding: 11px 15px;
  font-size: 15px;
  background: var(--in-bubble);
  color: var(--text);
  outline: none;
}
.composer button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--wa-green);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.composer button:disabled {
  opacity: 0.5;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 10;
}
.toast.show {
  opacity: 1;
}

/* ── Phase 2 ─────────────────────────────────────────────────────────────── */
/* Search bar (chats) */
.searchbar {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}
.searchbar input {
  width: 100%;
  border: none;
  outline: none;
  border-radius: 18px;
  padding: 9px 14px;
  font-size: 15px;
  background: var(--in-bubble);
  color: var(--text);
}

/* Chat-row extras: pinned, unread badge, group avatar */
.avatar.grp {
  background: #6a7b86;
  font-size: 22px;
}
.row-end {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}
.pin {
  font-size: 12px;
  opacity: 0.7;
}
.unread {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--wa-green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.row.has-unread .row-name {
  font-weight: 700;
}
.row.has-unread .row-time {
  color: var(--wa-green);
}

/* «Избранное» filter chips */
.chat-filter {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 0 12px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}
.chat-filter .chip {
  border: 1px solid var(--divider);
  background: var(--in-bubble);
  color: var(--text);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.chat-filter .chip.active {
  background: var(--wa-green);
  border-color: var(--wa-green);
  color: #fff;
  font-weight: 600;
}
/* «пост» (confirmed booking) marker before the name */
.post-badge {
  font-size: 13px;
  margin-right: 3px;
}
/* per-row favorite star */
.row-star {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 2px;
  color: var(--sub, #8a8a8a);
}
.row-star.on {
  color: #f5b301;
}
/* thread-header favorite star */
.thread-star {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  margin-left: auto;
  color: #fff;
}
.thread-star.on {
  color: #f5b301;
}

/* Group sender label inside a bubble */
.author {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--wa-teal);
  margin-bottom: 2px;
}
body.dark .author {
  color: #53bdeb;
}

/* Voice + video players in bubbles */
.bubble audio.voice {
  display: block;
  width: 210px;
  max-width: 62vw;
  height: 40px;
  margin: 2px 0;
}
.bubble video.vid {
  display: block;
  max-width: 100%;
  border-radius: 6px;
  margin-bottom: 4px;
}
.bubble .txt {
  white-space: pre-wrap;
}

/* Composer media (+) button */
.composer-media {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--in-bubble);
  color: var(--sub);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* Media picker bottom sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: flex-end;
  z-index: 20;
}
.sheet-backdrop.open {
  display: flex;
}
.sheet {
  width: 100%;
  max-height: 70vh;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 8px 14px calc(env(safe-area-inset-bottom) + 16px);
  overflow-y: auto;
  animation: sheetUp 0.22s ease;
}
@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
.sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--sub);
  opacity: 0.4;
  margin: 6px auto 10px;
}
.sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.mg {
  margin-bottom: 14px;
}
.mg-t {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sub);
  margin-bottom: 8px;
}
.mg-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.mi {
  flex: 0 0 auto;
  width: 74px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mi img,
.mi .mi-ic {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--in-bubble);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.mi-lbl {
  font-size: 11px;
  color: var(--text);
  max-width: 74px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Profiles picker — pretty cards */
#view-profiles .topbar {
  background: linear-gradient(135deg, #1fae9a, #075e54);
  padding-bottom: 16px;
}
#view-profiles .topbar-title {
  font-size: 22px;
  font-weight: 700;
}
/* Cards pinned to the top (align-content:start) — without this the single implicit grid row
   stretches to fill the flex:1 container and the one card becomes a giant empty panel. */
#profiles-list {
  padding: 14px;
  display: grid;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 12px;
}
#profiles-list .row {
  border: none;
  border-radius: 18px;
  padding: 16px;
  background: var(--in-bubble);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1);
  gap: 14px;
  transition: transform 0.12s ease;
}
#profiles-list .row:active {
  transform: scale(0.98);
}
#profiles-list .avatar {
  width: 56px;
  height: 56px;
  font-size: 24px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  box-shadow: 0 3px 8px rgba(18, 140, 126, 0.45);
}
#profiles-list .row-name {
  font-size: 18px;
  font-weight: 700;
}
#profiles-list .row-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  margin-top: 3px;
}
.pdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.pdot.on {
  background: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}
.pdot.off {
  background: #8696a0;
}
.chev {
  flex: 0 0 auto;
  align-self: center;
  color: var(--sub);
  font-size: 26px;
  line-height: 1;
  opacity: 0.5;
}
#profiles-list .empty {
  padding-top: 90px;
  font-size: 15px;
}

/* ── cohesive polish ─────────────────────────────────────────────────────── */
.row {
  padding: 11px 14px;
}
.avatar {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.unread {
  box-shadow: 0 1px 3px rgba(37, 211, 102, 0.4);
}
.bubble {
  box-shadow: 0 1px 1.5px rgba(11, 20, 26, 0.16);
}
.searchbar input:focus {
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.35);
}
.composer-media:active,
.composer button:active {
  transform: scale(0.92);
}
.composer-media,
.composer button {
  transition: transform 0.1s ease;
}
.mi:active {
  transform: scale(0.94);
}
.mi {
  transition: transform 0.1s ease;
}
/* Bubble tails — WhatsApp-style little corner cut */
.bubble.in::before,
.bubble.out::before {
  content: '';
  position: absolute;
  top: 0;
  width: 8px;
  height: 8px;
}
.bubble.in::before {
  left: -6px;
  background: radial-gradient(circle at bottom right, transparent 8px, var(--in-bubble) 0);
}
.bubble.out::before {
  right: -6px;
  background: radial-gradient(circle at bottom left, transparent 8px, var(--out-bubble) 0);
}

/* ── Management (profiles control · editor · media · greeting) ──────────────── */
.topbar {
  justify-content: space-between;
}
.tb-action {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: var(--topbar-text);
  font-size: 15px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 14px;
  cursor: pointer;
}
.tb-action:active {
  transform: scale(0.94);
}
#prof-add {
  font-size: 22px;
  padding: 2px 12px;
  line-height: 1;
}

/* Profile card: status dot colours + gear */
.pdot.pause {
  background: #f0ad4e;
  box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.2);
}
.pdot.start {
  background: #53bdeb;
  box-shadow: 0 0 0 3px rgba(83, 189, 235, 0.25);
}
.gear {
  flex: 0 0 auto;
  align-self: center;
  background: none;
  border: none;
  color: var(--sub);
  font-size: 22px;
  padding: 6px;
  cursor: pointer;
  border-radius: 10px;
}
.gear:active {
  background: rgba(127, 127, 127, 0.15);
}
#profiles-list .row-main.open-chats {
  cursor: pointer;
}

/* Profile actions sheet */
.pmenu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pmenu-btn {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  background: var(--in-bubble);
  color: var(--text);
  cursor: pointer;
}
.pmenu-btn:active {
  transform: scale(0.99);
  background: rgba(127, 127, 127, 0.12);
}
.pmenu-btn.danger {
  color: #e74c3c;
}
.pmenu-sep {
  height: 1px;
  background: var(--divider);
  margin: 4px 0;
}

/* Forms (editor · media · greeting) */
.form-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(env(safe-area-inset-bottom) + 24px);
}
.fgroup {
  background: var(--in-bubble);
  border-radius: 14px;
  padding: 6px 14px 12px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.fgroup-t {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sub);
  padding: 10px 0 4px;
}
.frow {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
}
.frow:last-child {
  border-bottom: none;
}
.frow > span {
  font-size: 13px;
  color: var(--sub);
}
.frow input[type='text'],
.frow textarea {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  padding: 2px 0;
  width: 100%;
  resize: vertical;
}
.frow.switch {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.frow.switch > span {
  font-size: 15px;
  color: var(--text);
}
.frow.switch input[type='checkbox'] {
  width: 46px;
  height: 28px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--divider);
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex: 0 0 auto;
}
.frow.switch input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.frow.switch input[type='checkbox']:checked {
  background: var(--wa-green);
}
.frow.switch input[type='checkbox']:checked::after {
  transform: translateX(18px);
}

/* Upload buttons + media grid */
.up-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 2px;
}
.up-btn,
.add-step {
  border: 1px dashed var(--wa-teal);
  background: rgba(37, 211, 102, 0.08);
  color: var(--wa-teal);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
}
.up-btn:active,
.add-step:active {
  transform: scale(0.96);
}
.mm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 0;
}
.mm-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mm-item img,
.mm-item .mi-ic {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.mm-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #e74c3c;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Greeting steps */
.gsteps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gstep {
  background: var(--in-bubble);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.gstep-h {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gstep-icon {
  font-size: 18px;
}
.gstep-label {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}
.gstep-ord {
  display: flex;
  gap: 4px;
}
.gstep-ord button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.gstep-ord .danger {
  color: #e74c3c;
}
.gstep-txt {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  padding: 8px;
  resize: vertical;
  outline: none;
}
.gstep-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--sub);
}

/* ── Desktop-app look for the management section (owner: "стилистика как в аппке на ПК") ──
   Scoped to .view.desk: override the theme vars so every form/card/input inside re-skins to the
   desktop palette automatically. The WhatsApp chat mirror (profiles/chats/thread) is untouched. */
.view.desk {
  --bg: #0a0a0a;
  --in-bubble: #1a1a1a;
  --divider: #2a2a2a;
  --text: #e1e1e1;
  --sub: #8a8a8a;
  --wa-green: #22c55e;
  --wa-teal: #22c55e;
  background: #0a0a0a;
  color: #e1e1e1; /* descendants without an explicit color inherit light text (e.g. .gstep-label) */
}
.desk-bar {
  background: #111 !important;
  border-bottom: 1px solid #242424;
  background-image: none !important;
}
.desk-bar .topbar-title {
  color: #e1e1e1;
}
.desk-bar .back {
  color: #e1e1e1;
}
.desk-bar .tb-action {
  background: #222;
  color: #e1e1e1;
}

/* Manage list — desktop profile cards */
.desk-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: grid;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 12px;
  background: #0a0a0a;
}
.desk-list .empty {
  color: #8a8a8a;
}
.dcard {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color 0.2s;
}
.dcard.running {
  border-color: #22c55e;
  box-shadow:
    0 0 0 1px #22c55e,
    0 0 18px rgba(34, 197, 94, 0.14);
}
.dcard.paused {
  border-color: #eab308;
}
.dcard.starting {
  border-color: #38bdf8;
}
.dcard.error {
  border-color: #ef4444;
}
.dcard-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dcard-name {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: #e1e1e1;
}
.dcard-menu {
  background: none;
  border: none;
  color: #8a8a8a;
  font-size: 24px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.dcard-sub {
  color: #8a8a8a;
  font-size: 13px;
  margin: 6px 0 14px 18px;
}
.dcard-foot {
  display: flex;
  gap: 8px;
}

/* Status dots — desktop palette */
.view.desk .pdot,
.dcard .pdot {
  width: 10px;
  height: 10px;
}
.view.desk .pdot.on,
.dcard .pdot.on {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}
.view.desk .pdot.pause,
.dcard .pdot.pause {
  background: #eab308;
  box-shadow: 0 0 6px #eab308;
}
.view.desk .pdot.start,
.dcard .pdot.start {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}
.view.desk .pdot.off,
.dcard .pdot.off {
  background: #555;
  box-shadow: none;
}
.view.desk .pdot.err,
.dcard .pdot.err {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

/* Buttons — desktop */
.btn-sm {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.btn-sm:active {
  transform: scale(0.97);
}
.btn-sm:disabled {
  opacity: 0.5;
}
.btn-primary {
  background: #22c55e;
  color: #06210f;
}
.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}
.btn-warning {
  background: rgba(234, 179, 8, 0.14);
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.4);
}
.btn-secondary {
  background: #222;
  color: #9a9a9a;
}

/* Profile-actions sheet — desktop dark (only this sheet; the chat media picker keeps WA style) */
#pmenu-sheet .sheet {
  background: #111;
}
#pmenu-sheet .sheet-title {
  color: #e1e1e1;
}
.pmenu-btn {
  background: #1a1a1a;
  color: #e1e1e1;
}

/* ── Owner admin panel (owner 2026-07-18): WhatsApp board + roles editor ── */
.admin-nav {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
}
.admin-tab {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--divider);
  background: var(--bg-card, #17212b);
  color: var(--text);
  font-size: 14px;
}
.admin-tab:active {
  opacity: 0.7;
}
.wa-slot:empty {
  display: none;
}
.wa-connect {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.wa-num {
  flex: 1;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--divider);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.wa-code {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text);
}
.wa-code b {
  letter-spacing: 2px;
  font-size: 18px;
}
.wa-hint {
  color: var(--sub);
  font-size: 12px;
  margin: 6px 0;
}
.wa-code-big {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent, #22c55e);
  text-align: center;
  padding: 12px 8px;
  margin-bottom: 4px;
  background: var(--bg);
  border: 1px dashed var(--divider);
  border-radius: 10px;
  user-select: all;
}
.wa-newcode {
  margin-top: 6px;
  width: 100%;
}
.wa-numrow {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 8px 0 2px;
  padding: 8px 10px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 15px;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: left;
}
.wa-numrow:active {
  background: var(--bg-hover, rgba(127, 127, 127, 0.12));
}
.wa-copyhint {
  margin-left: auto;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--sub);
}
/* Roles editor (owner 2026-07-23): people, not ids. One card per person — avatar, name, @username, the id
   in small type, the role as a segmented control, and (for an operator) their girls as tappable chips. */
.sec-title {
  padding: 14px 14px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: 0.3px;
}
.ocard {
  margin: 8px 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--card, rgba(127, 127, 127, 0.08));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ocard.pending {
  border: 1px solid var(--accent, #2ea6ff);
}
.ocard-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.oav {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: var(--accent, #2ea6ff);
}
.ocard-main {
  min-width: 0;
  flex: 1;
}
.oname {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.osub {
  font-size: 12px;
  color: var(--sub);
  font-family: ui-monospace, monospace;
}
.ocard-del {
  background: rgba(127, 127, 127, 0.14);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--sub);
}
.ocard-del:active {
  background: rgba(238, 51, 85, 0.18);
  color: #e35;
}
/* Inputs had NO styling at all, so the browser painted them white on a dark screen (owner 2026-07-23:
   «белые поля сделать покрасивее и удобнее»). 16px font is deliberate: anything smaller makes iOS zoom
   the page on focus. Fixes the profile + greeting editors too — same class. */
.form-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(127, 127, 127, 0.14);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.form-input::placeholder {
  color: var(--sub);
  opacity: 0.75;
}
.form-input:focus {
  border-color: var(--accent, #2ea6ff);
  background: rgba(127, 127, 127, 0.2);
}
.form-input:disabled {
  opacity: 0.55;
}
textarea.form-input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.4;
}
/* Somebody is waiting for access → the tab says so, so a first-time request can't go unnoticed. */
.admin-tab.has-badge {
  background: var(--accent, #2ea6ff);
  color: #fff;
  font-weight: 700;
}
.ocard-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.seg {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.14);
}
.seg-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 9px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.seg-btn.on {
  background: var(--accent, #2ea6ff);
  color: #fff;
}
.ohint {
  font-size: 12px;
  color: var(--sub);
}
.gchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gchip {
  border: 1px solid var(--divider, rgba(127, 127, 127, 0.3));
  background: none;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.gchip.on {
  background: var(--accent, #2ea6ff);
  border-color: transparent;
  color: #fff;
}
.olabel {
  font-size: 14px;
}
/* Parked girls: same card, visually muted so the working ones stay the focus. */
.dcard.archived {
  opacity: 0.62;
}

/* Bookings board «Буки» (owner 2026-07-23). Flat, time-sorted rows: the big clock on the left is the
   scanning anchor ("кто ближайший"), the кадр rides as a tag on the right. */
/* «Буки» is the button the owner reaches for most, so it reads as the primary action in the bar:
   solid accent fill + white text instead of the flat grey chip it blended into (owner 2026-07-23). */
.tb-btn {
  background: var(--accent, #2ea6ff);
  border: none;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}
.tb-btn:active {
  transform: scale(0.96);
  opacity: 0.85;
}
.today-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 4px;
  -webkit-overflow-scrolling: touch;
}
.today-tab {
  flex: 0 0 auto;
  background: rgba(127, 127, 127, 0.14);
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.today-tab.active {
  background: var(--accent, #2ea6ff);
  color: #fff;
  font-weight: 700;
}
.today-tab-n {
  opacity: 0.7;
  font-size: 12px;
}
.today-day {
  padding: 14px 16px 6px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}
.today-day-n {
  font-weight: 600;
  font-size: 13px;
  color: var(--sub);
}
.today-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--divider);
}
.today-row.is-next {
  background: rgba(46, 166, 255, 0.09);
  border-left: 3px solid var(--accent, #2ea6ff);
  padding-left: 13px;
}
.today-time {
  flex: 0 0 auto;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.today-time b {
  font-size: 17px;
  color: var(--text);
}
.today-until {
  font-size: 11px;
  color: var(--sub);
  margin-top: 2px;
}
.today-info {
  flex: 1;
  min-width: 0;
}
.today-l1 {
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.today-ph {
  color: var(--sub);
  text-decoration: underline dotted;
  cursor: pointer;
}
.today-l2 {
  font-size: 13px;
  color: var(--sub);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.today-warn {
  color: #e35;
}
.today-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.today-kadr {
  font-size: 11px;
  color: var(--sub);
  background: rgba(127, 127, 127, 0.14);
  border-radius: 999px;
  padding: 2px 8px;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-acts {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.today-acts button {
  background: rgba(127, 127, 127, 0.14);
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
}
.today-acts .today-dismiss {
  color: #e35;
}
