/* business.css — the «Бизнес» panel (js/business.js), unified with the Qural Pro Studio design */

/* Header button with the count of things to do */
.biz-btn {
  position: relative; display: flex; align-items: center; gap: 6px; height: var(--control-md); padding: 0 10px;
  border-radius: var(--radius-md); border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font: inherit; font-size: var(--font-md); cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.biz-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.biz-btn svg { width: 16px; height: 16px; }
.biz-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full);
  background: var(--accent); color: var(--on-accent); font-size: var(--font-xs); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.biz-badge[hidden] { display: none; }
.menu-item .biz-badge { margin-left: auto; }
.biz-btn .biz-badge {
  position: absolute; top: -5px; right: -5px; z-index: 2; pointer-events: none;
  min-width: 20px; height: 20px; padding: 0 4px; line-height: 1;
  border: 2px solid var(--surface); box-shadow: 0 2px 5px rgba(20, 35, 29, .18);
}

/* Studio Panel Overlay & Shell */
.biz-panel {
  display: none; position: fixed; inset: 0; z-index: 1100;
  background: var(--overlay); padding: 0;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.biz-panel.open { display: block; }
.biz-panel__panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(var(--biz-window-width, 920px), calc(100vw - 32px)); height: min(var(--biz-window-height, 780px), calc(100dvh - 32px));
  min-width: min(420px, calc(100vw - 32px)); min-height: min(420px, calc(100dvh - 32px));
  display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-lg);
}
.biz-panel.is-maximized .biz-panel__panel { inset: 0; left: 0; top: 0; transform: none; width: 100%; height: 100dvh; max-width: none; max-height: none; border-radius: 0; }

/* Studio Header */
.biz-panel__head {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: 14px 16px 12px 18px; min-height: 62px; flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 100%);
}
.biz-mode-seg {
  flex: 0 0 auto;
  margin-right: 4px;
}
.biz-mode-seg[hidden] { display: none !important; }
@media (max-width: 680px) {
  .biz-mode-seg {
    order: 10;
    width: 100%;
    justify-content: stretch;
    margin-right: 0;
    margin-top: 4px;
  }
  .biz-mode-seg button {
    flex: 1;
    justify-content: center;
  }
}
.biz-panel__drag, .biz-panel__expand {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; border: 1px solid transparent; border-radius: var(--radius-md);
  background: transparent; color: var(--text-dim); cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.biz-panel__drag { cursor: grab; touch-action: none; margin-left: -4px; }
.biz-panel__drag:active { cursor: grabbing; }
.biz-panel__drag svg { width: 16px; height: 16px; fill: currentColor; }
.biz-panel__expand svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.biz-panel__drag:hover, .biz-panel__expand:hover, .biz-panel__close:hover { color: var(--accent); background: var(--accent-soft); border-color: rgba(16, 185, 129, .28); }
.biz-panel__drag:focus-visible, .biz-panel__expand:focus-visible, .biz-panel__close:focus-visible, .biz-panel__resize:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.biz-panel__back {
  width: 36px; height: 36px; margin-left: -4px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg); color: var(--text); font-size: var(--font-icon); line-height: 1; cursor: pointer;
}
.biz-panel__back:hover { border-color: var(--accent); color: var(--accent); }
.biz-panel__back[hidden] { display: none; }
.biz-panel__title { flex: 1; min-width: 0; font-size: var(--font-xl); font-weight: 700; color: var(--text); display: flex; flex-direction: column; }
.biz-panel__sum { font-size: var(--font-sm); color: var(--accent); font-weight: 600; margin-top: 2px; }
.biz-panel__sum:empty, .biz-panel__sum[hidden] { display: none; }
.biz-panel__close {
  width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid transparent; border-radius: var(--radius-md);
  background: transparent; color: var(--text-dim); font-size: var(--font-icon); cursor: pointer;
}

/* Status strip & Tabs */
.biz-status-strip {
  display: flex; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; padding: 10px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.biz-status-strip:empty { display: none; }
.biz-tabs {
  display: flex; gap: 4px; padding: 6px 20px 0; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
  background: var(--bg); flex: 0 0 auto;
}
.biz-tabs::-webkit-scrollbar { height: 4px; }
.biz-tabs::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
.biz-tabs:empty { display: none; }
.biz-tab {
  flex: 0 0 auto; min-height: 40px; padding: 6px 14px 8px; border: none; border-bottom: 2px solid transparent;
  background: none; color: var(--text-dim); font: inherit; font-size: var(--font-md); font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: color .15s, border-color .15s;
}
.biz-tab:hover { color: var(--text); }
.biz-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.biz-tab b {
  margin-left: 6px; font-size: var(--font-xs); padding: 1px 6px; border-radius: var(--radius-full);
  background: var(--accent); color: var(--on-accent); font-weight: 700;
}

/* Filter Toolbar & Body */
.biz-panel__tools {
  display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; gap: 8px;
  max-height: min(24vh, 220px); overflow: auto; padding: 10px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.biz-panel__tools:empty { display: none; }
.biz-panel__body {
  flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 16px; background: var(--bg);
}
.biz-panel__resize {
  position: absolute; right: 2px; bottom: 2px; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 0 0 var(--radius-xl) 0;
  background: transparent; color: var(--text-dim); cursor: nwse-resize; touch-action: none;
}
.biz-panel__resize svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.biz-panel.is-maximized .biz-panel__drag, .biz-panel.is-maximized .biz-panel__resize { display: none; }

/* Controls, Chips, Inputs & Typography */
.biz-select {
  height: 34px; padding: 0 10px; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: var(--font-sm); outline: none;
}
.biz-select:focus { border-color: var(--accent); }
.biz-chip, .pro-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 32px; padding: 4px 12px; border-radius: var(--radius-full); border: 1px solid var(--border);
  background: var(--bg); color: var(--text-dim); font: inherit; font-size: var(--font-sm); font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s, color .15s;
}
.biz-chip:hover, .pro-chip:hover { color: var(--accent); border-color: var(--accent); }
.pro-chip.active,
.biz-chip.active { color: var(--c, var(--accent)); border-color: var(--c, var(--accent)); background: var(--accent-soft); font-weight: 600; }
.biz-chip b { font-weight: 700; margin-left: 3px; }
.biz-search {
  flex: 1 1 160px; min-width: 120px; height: 36px; padding: 0 11px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: var(--font-md); outline: none;
  transition: border-color .15s;
}
.biz-search:focus { border-color: var(--accent); }
.biz-link { border: none; background: none; color: var(--accent); font: inherit; font-size: var(--font-sm); font-weight: 500; cursor: pointer; text-decoration: underline; padding: 0 var(--space-1); }
.biz-section, .pro-section-title {
  font-size: var(--font-xs); font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .07em; margin-top: 4px;
}
.biz-fine { font-size: var(--font-sm); color: var(--text-dim); line-height: 1.5; }
.biz-quiet {
  color: var(--text-dim); font-size: var(--font-md); padding: 14px 16px;
  border-radius: var(--radius-lg); border: 1px dashed var(--border); background: var(--surface); text-align: center;
}
.biz-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--error-text); background: var(--error-bg); border: 1px solid var(--error-border); border-radius: var(--radius-md); padding: 10px 12px; font-size: var(--font-md); }
.biz-error .biz-chip { color: var(--error-text); border-color: var(--error-border); background: transparent; }

/* Subscription paused / grace days */
.biz-ent h3 { margin: 0 0 var(--space-2); color: var(--text); }
.biz-ent .biz-actions { justify-content: center; margin-top: var(--space-3); }
.biz-ent-banner { font-size: var(--font-md); color: var(--warning); background: var(--warning-soft, rgba(245,158,11,0.12)); border: 1px solid var(--warning); border-radius: var(--radius-md); padding: 8px 12px; line-height: 1.5; }
.biz-ent-banner a { color: var(--warning); font-weight: 600; }
.biz-empty {
  margin: auto; text-align: center; color: var(--text-dim); font-size: var(--font-base); line-height: 1.6;
  max-width: 440px; padding: 28px 20px; border-radius: var(--radius-lg);
  border: 1px dashed var(--border); background: var(--surface);
}
.biz-empty h3 { color: var(--text); font-size: var(--font-xl); font-weight: 600; margin: 0 0 6px; }
.biz-empty .biz-actions { justify-content: center; margin-top: 14px; }
.biz-empty .biz-fine { margin-top: 10px; }

/* Hints and Week Metric Tiles */
.biz-hints { display: flex; flex-direction: column; gap: 8px; }
.biz-hint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px;
  border-radius: var(--radius-lg); background: var(--warning-bg); border: 1px solid var(--warning-border);
  color: var(--warning-text); font-size: var(--font-md); line-height: 1.45;
}
.biz-hint span { flex: 1 1 240px; }
.biz-hint .biz-chip { color: var(--warning-text); border-color: var(--warning-border); background: transparent; }
.biz-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.biz-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 13px 14px; display: flex; flex-direction: column; gap: 3px;
  transition: border-color .15s, transform .15s;
}
.biz-tile:hover { border-color: var(--border-strong, var(--accent)); transform: translateY(-1px); }
.biz-tile__v { font-size: var(--font-2xl); font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.biz-tile__l { font-size: var(--font-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }
.biz-delta { font-size: var(--font-xs); color: var(--text-dim); margin-top: 2px; }
.biz-delta.up { color: var(--success); font-weight: 600; }
.biz-delta.down { color: var(--warning-text); }

/* Sources & Rows */
.biz-sources {
  display: flex; flex-direction: column; gap: 8px; padding: 14px;
  border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface);
}
.biz-source { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 36px; align-items: center; gap: 10px; font-size: var(--font-md); }
.biz-source__label { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-source__bar { height: 8px; border-radius: var(--radius-full); background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.biz-source__bar i { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-full); }
.biz-source b { text-align: right; color: var(--text-dim); font-family: var(--mono); font-size: var(--font-sm); font-weight: 600; }
.biz-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); font-size: var(--font-md); overflow-wrap: anywhere;
}
.biz-row b { color: var(--text); font-weight: 600; white-space: nowrap; }

/* Studio Cards (Records, Clients, Reviews, Templates) */
.biz-card, .biz-tpl, .biz-review, .pro-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s;
}
.biz-card:hover, .biz-tpl:hover, .pro-card:hover { border-color: var(--border-strong, var(--accent)); }
.pro-card { justify-content: space-between; }
.pro-card--accent,
.biz-card.is-new {
  border-color: rgba(16, 185, 129, .4);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 70%);
}
.biz-card__main { display: block; width: 100%; text-align: left; border: none; background: transparent; color: var(--text); font: inherit; cursor: pointer; padding: 0; }
.biz-card__head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.biz-card__title { flex: 1; min-width: 0; font-size: var(--font-base); font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.biz-status {
  font-size: var(--font-xs); font-family: var(--mono); padding: 2px 8px; border-radius: var(--radius-sm);
  white-space: nowrap; border: 1px solid var(--c, var(--border)); background: var(--bg); color: var(--c, var(--text-dim));
}
.biz-why { font-size: var(--font-xs); padding: 2px 8px; border-radius: var(--radius-sm); background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-text); white-space: nowrap; }
.biz-card__sub { margin-top: 4px; font-size: var(--font-sm); color: var(--text); opacity: 0.9; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.biz-card__meta { margin-top: 4px; font-size: var(--font-xs); font-family: var(--mono); color: var(--text-dim); overflow-wrap: anywhere; }
.biz-test { color: var(--warning-text); }
.biz-actions, .pro-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pro-btn,
.biz-actions a, .biz-actions button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 12px;
  border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font: inherit; font-size: var(--font-sm); font-weight: 500; text-decoration: none; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.biz-actions a:hover, .biz-actions button:hover, .pro-btn:hover { border-color: var(--accent); color: var(--accent); }
.pro-btn--primary,
.biz-actions .biz-wa {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600;
}
.pro-btn--primary:hover,
.biz-actions .biz-wa:hover { background: var(--accent-hover, var(--accent)); color: var(--on-accent); }

/* WhatsApp template dropdown menu */
.biz-wa-wrap { position: relative; display: inline-flex; align-items: center; }
.biz-wa-wrap > .biz-wa { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.biz-wa-more {
  border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important;
  border-left: 1px solid rgba(255,255,255,.22) !important; padding: 0 8px !important;
  background: var(--accent) !important; border-color: var(--accent) !important; color: var(--on-accent) !important;
}
.biz-wa-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 40; min-width: 220px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.biz-wa-menu[hidden] { display: none; }
.biz-wa-menu__head { font-size: var(--font-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); padding: 4px 8px; }
.biz-wa-item {
  width: 100%; justify-content: flex-start !important; text-align: left;
  border: none !important; background: transparent !important; padding: 6px 8px !important; min-height: 30px !important;
}
.biz-wa-item:hover { background: var(--accent-soft) !important; color: var(--accent) !important; }
.biz-wa-item--dim { color: var(--text-dim) !important; border-top: 1px solid var(--border) !important; border-radius: 0 !important; margin-top: 2px; padding-top: 8px !important; }

/* One record, one client detail view */
.biz-detail { display: flex; flex-direction: column; gap: 14px; }
.biz-detail__head {
  display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface);
}
.biz-detail__id { font-family: var(--mono); color: var(--text-dim); font-size: var(--font-md); }
.biz-detail__title { font-size: var(--font-xl); font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.biz-name { flex: 1; min-width: 160px; font: inherit; font-size: var(--font-xl); font-weight: 700; color: var(--text); background: transparent; border: none; border-bottom: 1px dashed var(--border); outline: none; padding: 2px 0; }
.biz-name:focus { border-bottom-color: var(--accent); }
.biz-fields {
  display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: var(--font-md);
  padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); margin: 0;
}
.biz-fields dt { color: var(--text-dim); font-size: var(--font-sm); }
.biz-fields dd { margin: 0; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.biz-fields dd a { color: var(--accent); }
.biz-statuses, .biz-remind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.biz-remind b { color: var(--text); }
.biz-date { height: 34px; padding: 0 10px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: var(--font-sm); color-scheme: light; }
:root[data-theme="dark"] .biz-date { color-scheme: dark; }
.biz-note, .biz-tags {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: var(--font-md); line-height: 1.5; outline: none; box-sizing: border-box;
}
.biz-note { min-height: 72px; resize: vertical; }
.biz-note:focus, .biz-tags:focus { border-color: var(--accent); }
.biz-note-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.biz-saved { font-size: var(--font-sm); color: var(--accent); font-weight: 500; }
.biz-history {
  list-style: none; padding: 12px 14px; margin: 0; font-size: var(--font-sm); color: var(--text-dim);
  display: flex; flex-direction: column; gap: 6px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface);
}
.biz-history b { color: var(--text); font-weight: 600; }

/* Card in the chat: a new record came in */
.biz-msg {
  align-self: stretch; background: var(--surface); border: 1px solid rgba(16, 185, 129, .35); border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg); padding: 12px 14px; margin: var(--space-1) 0; font-size: var(--font-md); animation: msgIn 0.15s ease-out;
}
.biz-msg__head { color: var(--text-dim); font-size: var(--font-sm); }
.biz-msg__head b { color: var(--text); font-weight: 600; }
.biz-msg__title { margin-top: 2px; font-size: var(--font-lg); font-weight: 600; overflow-wrap: anywhere; }
.biz-msg__sub { color: var(--text); opacity: 0.85; line-height: 1.45; overflow-wrap: anywhere; }
.biz-msg__open { flex: 0 0 auto; }

@media (max-width: 767px) {
  .biz-btn__label { display: none; }
  .biz-btn { padding: 0 var(--space-2); }
  .biz-panel__panel, .biz-panel.is-maximized .biz-panel__panel { inset: 0; left: 0; top: 0; transform: none; width: 100%; height: 100dvh; min-width: 0; min-height: 0; max-height: none; border-radius: 0; }
  .biz-panel__head { padding-top: calc(10px + var(--sat)); }
  .biz-panel__drag, .biz-panel__resize, .biz-panel__expand { display: none; }
  .biz-panel__body { padding: var(--space-3) var(--space-3) calc(16px + var(--sab)); }
  .biz-fields { grid-template-columns: 1fr; gap: 2px; }
  .biz-fields dt { margin-top: 6px; }
  .biz-tiles { grid-template-columns: 1fr 1fr; }
}

/* Посещения: bars by day, pages table */
.biz-bars {
  display: flex; align-items: flex-end; gap: 3px; height: 96px; padding: 12px 12px 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--surface);
}
.biz-bars i { flex: 1; min-width: 2px; background: var(--accent); opacity: 0.78; border-radius: var(--radius-xs) var(--radius-xs) 0 0; transition: opacity .15s; }
.biz-bars i:hover { opacity: 1; }
.biz-bars__axis {
  display: flex; justify-content: space-between; font-size: var(--font-xs); font-family: var(--mono); color: var(--text-dim);
  padding: 6px 12px; border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: var(--surface);
}
.biz-table { display: flex; flex-direction: column; font-size: var(--font-md); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.biz-tr { display: grid; grid-template-columns: minmax(90px, 1fr) 56px 64px 76px 48px 48px; gap: 6px; padding: 9px 12px; align-items: center; border-top: 1px solid var(--border); }
.biz-tr:first-child { border-top: none; }
.biz-th { background: var(--bg); color: var(--text-dim); font-size: var(--font-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.biz-tr span { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: var(--font-sm); }
.biz-tr span:first-child { text-align: left; overflow: hidden; text-overflow: ellipsis; font-family: inherit; font-size: var(--font-md); font-weight: 500; }
.biz-tr b { color: var(--warning-text); }
@media (max-width: 767px) {
  .biz-tr { grid-template-columns: minmax(70px, 1fr) 44px 56px 64px 40px 40px; gap: var(--space-1); padding: 7px 8px; font-size: var(--font-sm); }
}

/* Blocks on «Сегодня» & Setup Checklist */
.biz-block { display: flex; flex-direction: column; gap: 8px; }
.biz-block__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.biz-hide { border: none; background: none; color: var(--text-dim); font: inherit; font-size: var(--font-xs); cursor: pointer; opacity: 0; padding: 2px 6px; border-radius: var(--radius-sm); }
.biz-block:hover .biz-hide, .biz-hide:focus-visible { opacity: 0.85; }
.biz-hide:hover { background: var(--surface); color: var(--text); }
@media (hover: none) { .biz-hide { opacity: 0.6; } }
.biz-checklist {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.biz-checklist ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.biz-checklist__progress { display: flex; align-items: center; gap: 10px; font-size: var(--font-xs); font-family: var(--mono); color: var(--text-dim); height: 10px; }
.biz-checklist__progress i { flex: 1; height: 6px; border-radius: var(--radius-full); background: var(--accent); display: block; max-width: 100%; }
.biz-step {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--font-md);
  min-height: 36px; padding: 6px 10px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg);
}
.biz-step__mark {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.biz-step.done { opacity: 0.72; }
.biz-step.done .biz-step__mark { border-color: var(--accent); background: var(--accent-soft); }
.biz-step.done .biz-step__title { color: var(--text-dim); text-decoration: line-through; }
.biz-step.soon { opacity: 0.6; }
.biz-step__title { flex: 1 1 200px; font-weight: 500; }
.biz-soon { font-size: var(--font-xs); color: var(--text-dim); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 1px 8px; }

/* Подключения: one card per service */
.biz-int {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s;
}
.biz-int:hover { border-color: var(--border-strong, var(--accent)); }
.biz-int.on {
  border-color: rgba(16, 185, 129, .38);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 70%);
}
.biz-int__head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.biz-int__title { flex: 1; min-width: 0; font-size: var(--font-base); font-weight: 600; color: var(--text); }
.biz-int__where { font-size: var(--font-sm); color: var(--text-dim); line-height: 1.45; }
.biz-int__row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: 2px; }
.biz-int__input { flex: 1 1 200px; }
textarea.biz-int__input { min-height: 56px; flex-basis: 100%; }
.biz-int__val { flex: 1; min-width: 0; font-size: var(--font-sm); font-family: var(--mono); overflow-wrap: anywhere; }
.biz-int__val a { color: var(--accent); }
.biz-code { font-family: var(--mono); font-size: var(--font-xl); letter-spacing: 0.12em; color: var(--text); }

/* Visitor card & page versions */
.biz-visitor { font-size: var(--font-md); line-height: 1.55; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; overflow-wrap: anywhere; }
.biz-vers { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 10px 14px; }
.biz-vers summary { cursor: pointer; color: var(--text); font-size: var(--font-md); font-weight: 500; }
.biz-vers .biz-table { margin-top: var(--space-2); }
.biz-table--versions .biz-tr { grid-template-columns: minmax(120px, 1.4fr) 56px 64px 76px 48px 52px; }
.biz-table--versions small { color: var(--text-dim); }

/* Данные компании (Настройки) */
.biz-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 12px;
  padding: 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface);
}
.biz-field { display: flex; flex-direction: column; gap: 5px; font-size: var(--font-xs); color: var(--text-dim); }
.biz-field input { width: 100%; }
.biz-days {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px;
  padding: 12px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface);
}
.biz-day { display: flex; flex-direction: column; gap: 4px; font-size: var(--font-xs); color: var(--text-dim); }
.biz-day input { width: 100%; padding: 6px 8px; }
.biz-saved--error { color: var(--error-text); }
.biz-tpl__lang { display: flex; flex-direction: column; gap: 4px; font-size: var(--font-xs); font-family: var(--mono); color: var(--text-dim); margin-top: 4px; }

/* Тепловая карта */
.biz-heat__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.biz-heat__sep { flex: 0 0 1px; height: 18px; background: var(--border); margin: 0 4px; }
.biz-heat__stage { position: relative; flex: none; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; }
.biz-heat__stage[data-loading="1"] { opacity: 0.6; }
.biz-heat__box { position: relative; overflow: hidden; }
.biz-heat__wrap { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.biz-heat__frame { display: block; border: 0; background: #fff; }
.biz-heat__none { position: sticky; bottom: 0; margin: 0; padding: 8px 12px; font-size: var(--font-sm); color: var(--text-dim); background: var(--surface); border-top: 1px solid var(--border); }

/* Telegram recipients */
.biz-tg-list { display: flex; flex-direction: column; gap: 6px; }
.biz-tg-item { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); }
.biz-tg-item--wait { border-style: dashed; }
.biz-tg-item__main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.biz-tg-item__main b { font-weight: 600; font-size: var(--font-md); color: var(--text); }
.biz-tg-item__acts { display: flex; gap: 6px; flex-wrap: wrap; }
.biz-tg-link { font-family: var(--mono); font-size: var(--font-xs); color: var(--text-dim); overflow-wrap: anywhere; }
.biz-tg-add { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-top: 4px; }
a.biz-chip { display: inline-flex; align-items: center; text-decoration: none; }
.biz-chip--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.biz-chip--primary:hover { background: var(--accent-hover, var(--accent)); border-color: var(--accent); color: var(--on-accent); }
@media (max-width: 600px) { .biz-tg-item__acts .biz-chip, .biz-tg-add .biz-chip { min-height: var(--control-lg); } }

/* --- 2.20: one scale, one set of controls for Бизнес and Pro --- */
/* Inside the window text starts at 12px: the owner reads it on a phone. */
.biz-panel { --font-xs: 12px; --font-sm: 13px; --font-md: 14px; --font-base: 15px; }
.biz-mode-seg button { min-height: var(--control-md); padding: 0 16px; font-size: var(--font-md); }

/* Loading: grey cards in the shape of what is coming */
.biz-skel { display: flex; flex-direction: column; gap: 10px; }
.biz-skel__card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.biz-skel__card i { display: block; height: 12px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--raise-3) 0%, var(--raise-1) 50%, var(--raise-3) 100%); background-size: 200% 100%; animation: bizSkel 1.2s ease-in-out infinite; }
.biz-skel__card i:nth-child(1) { width: 45%; height: 14px; }
.biz-skel__card i:nth-child(2) { width: 80%; }
.biz-skel__card i:nth-child(3) { width: 30%; }
@keyframes bizSkel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Folded section (Подключения → «Для маркетолога») */
.biz-more { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.biz-more > summary { cursor: pointer; font-size: var(--font-md); font-weight: 600; color: var(--text); }
.biz-more[open] > summary { margin-bottom: 4px; }
.biz-more .biz-int { background: var(--bg); }

/* Template substitutions as buttons */
.biz-tpl__tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--font-xs); color: var(--text-dim); }
.biz-chip--sm { min-height: 28px; padding: 2px 10px; font-size: var(--font-xs); }

/* «Ещё» exists only in the phone's bottom bar */
.biz-tab--more { display: none; }

@media (max-width: 767px) {
  /* The tabs become a bar at the bottom, by the thumb: Сегодня, Заявки,
     Клиенты, Ещё; «Ещё» unfolds the rest above the bar. */
  .biz-tabs {
    order: 20; flex-wrap: nowrap; gap: 0; padding: 0 0 var(--sab); overflow: visible;
    border-top: 1px solid var(--border); border-bottom: none; background: var(--surface);
  }
  .biz-tab { flex: 1 1 0; min-width: 0; min-height: 54px; padding: 6px 4px; border-bottom: none; border-top: 2px solid transparent; font-size: var(--font-sm); text-align: center; overflow: hidden; text-overflow: ellipsis; }
  .biz-tab.active { border-top-color: var(--accent); }
  .biz-tab b { margin-left: 3px; }
  .biz-tab--sec { display: none; }
  .biz-tab--more { display: block; }
  .biz-tabs.more-open { flex-wrap: wrap; box-shadow: var(--shadow-up); }
  .biz-tabs.more-open .biz-tab--sec { display: block; flex: 1 1 100%; order: -1; min-height: 50px; padding: 0 20px; text-align: left; border-top: 1px solid var(--border); font-size: var(--font-base); }
  .biz-tabs.more-open .biz-tab--sec.active { border-top-color: var(--border); color: var(--accent); }
  .biz-panel__body { padding-bottom: 16px; }
  .biz-panel__tools { padding: 10px var(--space-3); }
  .biz-status-strip { padding: 8px var(--space-3); }
  .biz-mode-seg { margin-top: 2px; }
}

/* Touch screens: every control at least 44px high */
@media (pointer: coarse) {
  .biz-panel .biz-chip, .biz-panel .biz-actions a, .biz-panel .biz-actions button, .biz-panel .biz-select, .biz-panel .biz-search,
  .biz-panel .biz-date, .biz-panel .pro-btn, .biz-panel .pro-chip, .biz-panel .pro-input, .biz-panel .pro-seg button { min-height: var(--control-lg); }
  .biz-panel .biz-select, .biz-panel .biz-date { height: var(--control-lg); }
  .biz-panel .biz-wa-item { min-height: var(--control-lg) !important; }
  .biz-panel .biz-chip--sm { min-height: var(--control-md); }
  .biz-panel__back, .biz-panel__close { width: var(--control-lg); height: var(--control-lg); }
  .biz-hide { min-height: var(--control-md); padding: 0 10px; }
}

/* The panel's own confirm (js/dialog.js) */
.q-dialog { width: min(420px, calc(100vw - 32px)); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.q-dialog::backdrop { background: var(--overlay); }
.q-dialog__form { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.q-dialog__title { margin: 0; font-size: var(--font-2xl); font-weight: 700; }
.q-dialog__text { margin: 0; font-size: var(--font-base); color: var(--text-dim); line-height: 1.5; }
.q-dialog__value { width: 100%; min-height: var(--control-lg); padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: var(--mono); font-size: var(--font-md); }
.q-dialog__acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.q-dialog__acts .btn { min-height: var(--control-lg); padding: 0 18px; font-size: var(--font-base); }
.q-dialog__danger { background: var(--error); border-color: var(--error); color: #fff; }
.q-dialog__danger:hover { background: var(--error); border-color: var(--error); color: #fff; filter: brightness(1.08); }
:root[data-theme="dark"] .q-dialog__danger { color: #2a0f0c; }

/* --- 2.21: money, refusal reasons, a record typed in, Excel --- */
.biz-money { color: var(--text); font-family: inherit; font-weight: 600; }
.biz-amount { flex: 0 1 160px; min-width: 120px; }
.biz-hint--ok { background: var(--success-soft); border-color: var(--success-dim); color: var(--text); }
.biz-hint--ok .biz-wa-wrap { flex: 0 0 auto; }
.biz-field--wide { grid-column: 1 / -1; }
.biz-field .biz-note { min-height: 64px; }
.biz-field { font-size: var(--font-sm); }
@media (max-width: 767px) {
  /* «Посещения» → Страницы: a card per page, every number with its label */
  .biz-table:not(.biz-table--versions) .biz-th { display: none; }
  .biz-table:not(.biz-table--versions) .biz-tr { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 8px; padding: 10px 12px; }
  .biz-table:not(.biz-table--versions) .biz-tr span:first-child { grid-column: 1 / -1; white-space: normal; font-weight: 600; }
  .biz-table:not(.biz-table--versions) .biz-tr span[data-l] { text-align: left; display: flex; flex-direction: column; gap: 1px; font-size: var(--font-md); }
  .biz-table:not(.biz-table--versions) .biz-tr span[data-l]::before { content: attr(data-l); font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif; font-size: var(--font-xs); color: var(--text-dim); }
}
.biz-field .biz-search { flex: none; width: 100%; height: var(--control-md); }
/* Blocks in the window body never shrink: a long table scrolls with the rest */
.biz-panel__body > * { flex-shrink: 0; }
.biz-hint--ok .biz-actions { margin-top: 0; }

/* --- 2.22: the calendar --- */
.biz-cal__label { flex: 1 1 140px; font-size: var(--font-md); font-weight: 600; color: var(--text); }
.biz-visits { display: flex; flex-direction: column; gap: 6px; }
.biz-visits__day { font-size: var(--font-sm); font-weight: 600; color: var(--text-dim); margin-top: 4px; }
.biz-visits__row { display: flex; flex-direction: column; gap: 4px; }
.biz-visit {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; text-align: left;
  min-height: 48px; padding: 8px 12px; border: 1px solid var(--border); border-left: 4px solid var(--c, var(--accent));
  border-radius: var(--radius-md); background: var(--surface); color: var(--text); font: inherit; font-size: var(--font-md); cursor: pointer;
}
.biz-visit:hover { border-color: var(--accent); border-left-color: var(--c, var(--accent)); }
.biz-visit__time { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.biz-visit__who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.biz-visit__who small { color: var(--text-dim); font-weight: 400; margin-left: 4px; }
.biz-visit--compact { grid-template-columns: auto 1fr; min-height: 36px; padding: 4px 8px; font-size: var(--font-sm); gap: 6px; }
.biz-visit-tag { color: var(--text); font-family: inherit; font-weight: 600; }
.biz-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.biz-slots .biz-chip { font-family: var(--mono); min-width: 64px; }
.biz-ved { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.biz-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.biz-week__day { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); min-height: 120px; }
.biz-week__day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft-2); }
.biz-week__head { border: none; background: none; padding: 2px; font: inherit; font-size: var(--font-sm); font-weight: 600; color: var(--text); text-align: left; cursor: pointer; }
.biz-week__head:hover { color: var(--accent); }
.biz-week__free { margin-top: auto; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: none; padding: 4px; font: inherit; font-size: var(--font-xs); color: var(--accent); cursor: pointer; }
.biz-week__off { margin-top: auto; font-size: var(--font-xs); color: var(--text-dim); }
.biz-svcs { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.biz-svc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.biz-svc > .biz-search { flex: 1 1 200px; }
.biz-svc__n { display: inline-flex; align-items: center; gap: 4px; font-size: var(--font-sm); color: var(--text-dim); }
.biz-svc__n .biz-search { flex: 0 0 84px; min-width: 0; width: 84px; }
@media (max-width: 767px) {
  .biz-week { grid-template-columns: 1fr; }
  .biz-week__day { min-height: 0; }
  .biz-visit { grid-template-columns: auto 1fr; }
  .biz-visit .biz-status { display: none; }
}
