/* ============================================================
   Bamsi Platform — Design System
   Matches the warm cream aesthetic from the screenshots
   ============================================================ */

:root {
  --bg: #FDF2EC;
  --white: #FFFFFF;
  --blue: #3B82F6;
  --blue-hover: #2563EB;
  --coral: #FB7185;
  --coral-hover: #F43F5E;
  --green: #22C55E;
  --gray-toggle: #D1D5DB;
  --text: #1C1C1E;
  --text-secondary: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: 20px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

a { color: inherit; text-decoration: none; }

/* ── Layout ── */
.page { padding: 28px 32px; max-width: 1100px; margin: 0 auto; }
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.assistant-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow);
  width: 180px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.assistant-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.10); }
.assistant-card .card-name { font-weight: 500; font-size: 13px; }
.assistant-card .card-footer { display: flex; justify-content: flex-end; }

/* ── Toggle switch ── */
.toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 19px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: #E8E6E6;
  border-radius: 14px;
  transition: background .2s ease;
  border: 1px solid rgba(0, 0, 0, 0.03);
}
.toggle-thumb {
  position: absolute;
  top: 0.72px;
  left: 0.43px;
  width: 37.14px;
  height: 17.56px;
  background: white;
  border-radius: 14px;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.toggle input:checked + .toggle-track { background: #32C82C; }
.toggle input:checked + .toggle-track + .toggle-thumb { transform: translateX(14.43px); }
.toggle--disabled { cursor: not-allowed; opacity: .45; pointer-events: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-hover); opacity: 1; }
.btn-danger { background: var(--coral); color: white; }
.btn-danger:hover { background: var(--coral-hover); opacity: 1; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); opacity: 1; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-create {
  background: var(--blue);
  color: white;
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-create:hover { background: var(--blue-hover); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  transition: border-color .15s;
  outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--blue);
}
.form-input.active, .form-textarea.active {
  border-color: var(--text-secondary);
}
.form-textarea { resize: vertical; min-height: 120px; }

/* Input with clear button */
.input-wrap { position: relative; }
.input-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  background: #DBDBDB;
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
  width: fit-content;
  padding-left: 8px;
  padding-right: 8px;
}
.tab-btn {
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: "Artegra Sans", var(--font);
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
  text-decoration: none;
  display: inline-block;
}
.tab-btn.active {
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding-left: 24px;
  padding-right: 24px;
}
.tab-btn:hover:not(.active) { color: var(--text); }

/* ── Navigation pills (main menu / landing page) ── */
.home-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 40px 20px;
  position: relative;
}
.home-profile-wrap {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 120;
}
.nav-pills { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.nav-pill {
  display: block;
  width: 300px;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  background: #F0E6E4;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
  border: none;
}
.nav-pill:hover { background: #E8D8D5; transform: scale(1.01); }
.nav-pill.active { background: var(--white); }

/* Stub: root can click but it's a future module */
.nav-pill-stub {
  opacity: 0.65;
}
.nav-pill-stub:hover { background: #E8D8D5; opacity: 0.8; transform: scale(1.005); }

/* Locked: visible to non-root but not clickable */
.nav-pill-locked {
  cursor: default;
  opacity: 0.45;
  user-select: none;
}
.nav-pill-locked:hover { background: #F0E6E4; transform: none; }

/* Home page bottom area: avatar + branding */
.home-bottom {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.home-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.home-logout {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
}
.home-logout:hover { color: var(--text); }

/* ── Page header with back button ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: none;
}
.back-btn:hover { color: var(--text); }

/* ── Action bar (save/cancel row) ── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #F3EBE9;
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:hover td { background: #FAF6F5; }

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}
.badge-new { background: #D1FAE5; color: #065F46; }
.badge-in_work { background: #DBEAFE; color: #1E40AF; }
.badge-call_needed { background: #FEF3C7; color: #92400E; }
.badge-recorded { background: #EDE9FE; color: #5B21B6; }
.badge-refused { background: #FEE2E2; color: #991B1B; }
.badge-repeated { background: #F0FDF4; color: #166534; }
.badge-archive { background: #F3F4F6; color: #6B7280; }

/* ── Channel cards ── */
.channel-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 32px;
}
.channel-grid--channels {
  grid-template-columns: repeat(3, minmax(180px, 220px));
}
.channel-grid--extras {
  grid-template-columns: minmax(180px, 220px) minmax(120px, 160px);
}
.channel-grid--notifications {
  grid-template-columns: repeat(3, minmax(180px, 220px));
}
@media (max-width: 760px) {
  .channel-grid { grid-template-columns: 1fr; }
}

.channel-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: none;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  min-height: 96px;
  position: relative;
  border: 1px solid rgba(0,0,0,0.04);
}
.channel-card:hover { background: #FAF6F5; }
.channel-name {
  font-family: "Artegra Sans", var(--font);
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 18px;
  padding-top: 2px;
}
.mini-channel-logo {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.mini-channel-logo-img {
  width: 18px;
  height: 18px;
  border-radius: 0;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.mini-channel-logo-img--plain {
  width: 22px;
  height: 22px;
  border-radius: 0;
  object-fit: contain;
  filter: none;
  margin-top: -1px;
}
.mini-channel-logo-img--vk {
  width: 26px;
  height: 26px;
  margin-top: -2px;
}
.mini-channel-logo-vk { background: #2787f5; }
.mini-channel-logo-tg { background: #2aabee; font-size: 10px; }
.mini-channel-logo-max { background: linear-gradient(135deg, #23b2ff, #7a3cff); }
.mini-channel-logo-avito { background: #111; }
.mini-channel-logo-site { background: #d9d9d9; color: #666; font-size: 10px; }

/* Toggle placement inside channel card */
.channel-card .toggle {
  position: absolute;
  right: 16px;
  bottom: 14px;
}

/* Add channels modal (opened from "+" card) */
.add-channels-modal {
  width: 560px;
  max-width: 96vw;
  border-radius: 22px;
  padding: 0;
  overflow: hidden;
}
.add-channels-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 26px 16px;
  border-bottom: 1px solid var(--border);
}
.add-channels-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.add-channels-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.add-channels-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #A0A0A0;
  cursor: pointer;
  padding: 0 2px;
}
.add-channel-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.add-channel-row:last-child { border-bottom: none; }
/* multi-line rows keep toggle at top */
.add-channel-row:has(.add-channel-desc) { align-items: flex-start; }
.add-channel-row:has(.add-channel-desc) .toggle { margin-top: 10px; }
.add-channel-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.add-channel-row:has(.add-channel-desc) .add-channel-left { align-items: flex-start; }
.add-channel-left > div {
  min-width: 0;
  flex: 1;
  text-align: left;
}
.add-channel-left > div > div:first-child {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.add-channel-row .toggle {
  flex-shrink: 0;
}
.add-channel-desc {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  font-weight: 400;
}
/* ── universal extras icon ── */
.add-channel-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  line-height: 1;
}
.add-channel-icon-imgwrap {
  padding: 0;
  background: #f5f5f5;
}
.add-channel-icon-img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}
/* colour tokens */
.add-channel-icon-vk     { background: #3b82f6; }
.add-channel-icon-tg     { background: #38bdf8; }
.add-channel-icon-max    { background: #f4d35e; color: #1f1f1f; }
.add-channel-icon-avito  { background: #f0f0f0; color: #9b9b9b; }
.add-channel-icon-site   { background: #f0f0f0; color: #9b9b9b; }
/* specific extras */
.add-channel-icon-crm    { background: #4069e5; font-size: 12px; letter-spacing: .5px; }
.add-channel-icon-sales  { background: #e8f0fe; color: #4069e5; }
.add-channel-icon-care   { background: #fde68a; color: #1f1f1f; }
.add-channel-icon-remind { background: #fee2e2; color: #dc2626; }
.add-channel-icon-analyt { background: #e0e7ff; color: #4338ca; }
.add-channel-icon-review { background: #fef9c3; color: #92400e; }
.add-channel-icon-staff  { background: #dcfce7; color: #166534; }
.add-channel-icon-owner  { background: #f3e8ff; color: #7c3aed; }

/* ── Section title ── */
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }

/* ── Chat (conversation viewer) ── */
.chat-wrap { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; }
.msg { display: flex; }
.msg.msg-user { justify-content: flex-end; }
.msg.msg-assistant { justify-content: flex-start; }
.msg-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.msg-user .msg-bubble { background: #3B82F6; color: white; border-bottom-right-radius: 4px; }
.msg-assistant .msg-bubble { background: var(--white); color: var(--text); border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.07); }
.msg-time { font-size: 10px; color: var(--text-secondary); margin-top: 3px; text-align: right; }

/* ── Payment page ── */
.payment-card { text-align: center; padding: 40px 30px; }
.payment-icon {
  width: 72px; height: 72px;
  background: #D1FAE5;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
}
.payment-title { font-size: 20px; font-weight: 700; margin-bottom: 24px; }
.payment-history { text-align: left; }
.payment-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}

/* ── Users list ── */
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #E0D4D0; display: flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: 14px;
  color: var(--text-secondary); flex-shrink: 0;
  overflow: hidden;
}
.user-info { flex: 1; }
.user-name { font-weight: 500; font-size: 13px; }
.user-role-label { font-size: 11px; color: var(--text-secondary); }

/* ── Modal / Overlay ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  width: 480px; max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
}
.modal-box h2 { margin-bottom: 20px; }

/* ── Dropdown with checkboxes ── */
.dropdown-wrap { position: relative; display: inline-block; }
.dropdown-trigger {
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--white);
  font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 8px 0; z-index: 50; min-width: 220px; display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item input[type="checkbox"] { accent-color: var(--blue); width: 14px; height: 14px; }

/* ── Inline channel form ── */
.channel-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px 20px;
  margin-top: 8px;
  display: none;
}
.channel-form.open { display: block; }

/* ── Dashboard stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; }
.stat-card { background: #ffffff; border-radius: 18px; padding: 20px 20px 18px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.stat-value { font-size: 38px; font-weight: 700; line-height: 1; color: #1A1A2E; }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 8px; font-weight: 400; }

/* ── Branding footer ── */
.branding { text-align: center; margin-top: 40px; font-size: 15px; font-weight: 700; color: #370B5B; letter-spacing: .5px; }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
}
.login-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 380px;
  box-shadow: var(--shadow);
}
.login-logo { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 28px; color: #370B5B; }
.login-error { color: var(--coral); font-size: 13px; margin-bottom: 12px; }

/* ── Top nav bar (platform pages) ── */
.topbar {
  display: flex; align-items: center; gap: 0;
  padding: 0 28px; height: 56px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-logo {
  font-size: 16px; font-weight: 700;
  margin-right: 24px; white-space: nowrap; flex-shrink: 0;
  color: #370B5B;
}
.topbar-nav {
  display: flex; align-items: center; gap: 2px;
  flex: 1; overflow-x: auto;
}
.topbar-link {
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  white-space: nowrap; transition: background .15s, color .15s;
}
.topbar-link:hover { background: var(--bg); color: var(--text); }
.topbar-link.active { background: var(--bg); color: var(--text); font-weight: 600; }
.topbar-right {
  display: flex; align-items: center; gap: 14px;
  margin-left: 16px; flex-shrink: 0;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.topbar-username { display: none; }
@media (min-width: 600px) { .topbar-username { display: inline; } }
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #370B5B; display: flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: 14px;
  color: #fff; flex-shrink: 0; cursor: pointer;
  overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Topbar avatar dropdown ── */
.topbar-profile-wrap:not(.home-profile-wrap) {
  position: relative;
}
.topbar-profile-dropdown {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.13);
  min-width: 180px;
  z-index: 200;
  padding: 8px 0;
}
.topbar-profile-wrap.open .topbar-profile-dropdown { display: block; }
.topbar-profile-dropdown a,
.topbar-profile-dropdown button {
  display: block; width: 100%;
  padding: 9px 16px; text-align: left;
  font-size: 13px; font-weight: 500;
  background: none; border: none; cursor: pointer;
  color: var(--text); white-space: nowrap;
}
.topbar-profile-dropdown a:hover,
.topbar-profile-dropdown button:hover { background: var(--bg); }
.topbar-profile-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.topbar-profile-name {
  padding: 10px 16px 6px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
}

/* ── Assistant detail page: 3-column topbar ── */
.asst-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.asst-topbar-left {
  display: flex; align-items: center; gap: 12px;
}
.asst-topbar-name {
  font-size: 16px; font-weight: 700; color: var(--text);
}
/* Center column: the tabs */
.asst-tabs {
  margin: 0;
}
/* Right column: align to the right */
.asst-topbar .topbar-right {
  justify-self: end;
  margin-left: 0;
}

/* "Add" placeholder card */
.channel-card-add {
  border: none;
  box-shadow: none;
  background: #F3E1DA;
  justify-content: center;
  align-items: center;
  font-size: 34px;
  color: #FFFFFF;
  min-height: 96px;
  width: auto;
  max-width: 160px;
  aspect-ratio: 1 / 1;
  justify-self: start;
}
.channel-card-add:hover { background: #EED5CC; }

/* ── Select (status dropdown in table) ── */
select.status-select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--white);
  cursor: pointer;
}

/* ── Clients table ── */
.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.clients-table thead th {
  padding: 10px 14px;
  font-weight: 600;
  color: #111;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  background: var(--white);
}
.clients-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background .12s;
}
.clients-table tbody tr:last-child { border-bottom: none; }
.clients-table tbody tr:hover { background: #fafafa; }
.clients-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  color: #333;
}
/* Search toggle button */
.clients-search-toggle {
  background: none; border: none; cursor: pointer;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background .15s;
}
.clients-search-toggle:hover { background: #f0f0f0; }
/* Clickable client name */
.client-name-link {
  cursor: pointer;
  font-weight: 500;
  color: #111;
}
.client-name-link:hover { text-decoration: underline; }
/* Status pill */
.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.status-pill:hover { opacity: .85; }
/* Status dropdown menu */
.status-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: 4px 0;
  min-width: 130px;
}
.status-menu-item {
  display: block;
  width: 100%;
  padding: 7px 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #333;
}
.status-menu-item:hover { background: #f5f5f5; }
.status-menu-item.active { font-weight: 700; color: #111; }
/* Comment cell with tooltip */
.comment-cell {
  position: relative;
  cursor: pointer;
}
.comment-text {
  font-size: 12px;
  color: #888;
}
.comment-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 300;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.13);
  padding: 10px 14px;
  font-size: 12px;
  color: #444;
  min-width: 200px;
  max-width: 280px;
  line-height: 1.5;
  white-space: normal;
  pointer-events: none;
}
.comment-cell:hover .comment-tooltip { display: block; }
/* Dialog action buttons */
.btn-open-conv {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid #ddd;
  background: var(--white);
  font-size: 12px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.btn-open-conv:hover { border-color: #aaa; background: #f5f5f5; }
.btn-conv-action {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-conv-action:hover { opacity: .8; }
.btn-pause  { background: #FEE2E2; color: #EF4444; }
.btn-play   { background: #D1FAE5; color: #22C55E; }
.btn-edit-circle { background: #F3F4F6; color: #6B7280; }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 48px 0;
  color: var(--text-secondary); font-size: 14px;
}

/* ── Profile card ── */
.profile-card { padding: 28px; }
.profile-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: #E0D4D0; display: flex; align-items: center;
  justify-content: center; font-size: 24px; font-weight: 700;
  color: var(--text-secondary); flex-shrink: 0; overflow: hidden;
}
.profile-name { font-size: 18px; font-weight: 700; }
.profile-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── Admin panel (root): KPI + chart + companies ── */
.admin-panel-page { max-width: 100%; }
.admin-panel-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.admin-kpi-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
}
.admin-kpi-purple .admin-kpi-label { background: #EDE9FE; color: #5B21B6; }
.admin-kpi-green .admin-kpi-label { background: #D1FAE5; color: #065F46; }
.admin-kpi-blue .admin-kpi-label { background: #DBEAFE; color: #1E40AF; }
.admin-kpi-value { font-size: 28px; font-weight: 700; }
.admin-chart-row { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.admin-chart-wrap { flex: 1; min-width: 280px; padding: 20px; }
.admin-chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-secondary); }
.admin-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 120px;
}
.admin-chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.admin-chart-bar {
  width: 100%;
  max-width: 48px;
  min-height: 4px;
  background: #8B5CF6;
  border-radius: 6px 6px 0 0;
  transition: height .2s;
}
.admin-chart-label { font-size: 11px; color: var(--text-secondary); }
.admin-create-wrap { flex-shrink: 0; }
.admin-companies { padding: 20px 24px; }
.admin-companies-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.admin-companies-title { font-size: 16px; font-weight: 600; margin: 0; }
.admin-companies-right { display: flex; align-items: center; gap: 12px; }
.admin-companies-payment-label { font-size: 13px; color: var(--text-secondary); }
.admin-companies-search {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 180px;
}
.admin-company-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid #F3EBE9;
}
.admin-company-row:last-child { border-bottom: none; }
.admin-company-name { flex: 1; font-weight: 500; font-size: 14px; }
.admin-company-payment { display: flex; align-items: center; gap: 10px; }
.admin-payment-badge { font-size: 13px; }
.admin-payment-paid { color: #059669; }
.admin-payment-unpaid { color: #DC2626; }
.admin-toggle-form { display: inline-block; margin: 0; }
.admin-company-payment .toggle { margin-left: 4px; }

/* ── Metrics KPI grid ── */
.metrics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 155px);
  gap: 14px;
}
.metrics-kpi-card {
  background: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  display: flex;
  flex-direction: column;
  width: 155px;
  height: 130px;
}
/* Цветная шапка — занимает всю ширину карточки, только верхние углы скруглены */
.metrics-kpi-label {
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  min-height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 0;          /* card overflow:hidden обрезает верх до 15px */
}
/* Область со значением */
.metrics-kpi-value {
  font-size: 36px; font-weight: 800; line-height: 1; color: #111111;
  padding: 14px 14px 0;
  letter-spacing: -0.5px;
}
.metrics-kpi-sub {
  font-size: 10px; color: var(--text-secondary);
  padding: 6px 14px 0;
  font-weight: 400;
}
.metrics-kpi-purple { background: #C4B5FD; color: #4C1D95; }
.metrics-kpi-green  { background: #4ADE80; color: #14532D; }
.metrics-kpi-blue   { background: #93C5FD; color: #1E3A8A; }
.metrics-kpi-red    { background: #FCA5A5; color: #7F1D1D; }
.metrics-kpi-amber  { background: #FDE68A; color: #78350F; }
.metrics-kpi-gray   { background: #E5E7EB; color: #374151; }

/* ── Conversation drawer: sticky header ── */
.conv-drawer-inner {
  display: flex; flex-direction: column; height: 100%;
}
.conv-drawer-header {
  flex-shrink: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  z-index: 1;
}
.conv-drawer-body {
  flex: 1;
  min-height: 0; /* critical: allows flex child to shrink below content size */
  overflow-y: auto;
  padding: 16px 20px 20px;
}
/* Close button in drawer header */
.conv-drawer-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background .15s;
}
.conv-drawer-close:hover { background: var(--bg); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .page { padding: 16px; }
  .nav-pill { width: 100%; }
  .tabs { flex-wrap: wrap; }
}

/* Clients table UX: keep all columns visible via horizontal scroll */
.card.table-wrap,
.clients-table-wrap,
div[style*="overflow-x:auto"]{
  max-width:100% !important;
  overflow-x:auto !important;
  overflow-y:visible !important;
}

.clients-table,
.card.table-wrap > table{
  width:max-content !important;
  min-width:1200px !important;
  table-layout:auto !important;
}

.clients-table th,
.clients-table td,
.card.table-wrap > table th,
.card.table-wrap > table td{
  white-space:nowrap !important;
  vertical-align:top !important;
}

.clients-table td:nth-child(4),
.card.table-wrap > table td:nth-child(3){
  white-space:normal !important;
  min-width:170px !important;
  max-width:260px !important;
}

.clients-table td:nth-child(8),
.card.table-wrap > table td:nth-child(8){
  white-space:normal !important;
  min-width:180px !important;
  max-width:320px !important;
}

/* Clients table UX v2: fit all columns without horizontal scroll */
.card.table-wrap{
  max-width:100% !important;
  overflow-x:hidden !important;
  overflow-y:visible !important;
}

.card.table-wrap > table{
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  table-layout:fixed !important;
}

.card.table-wrap > table th,
.card.table-wrap > table td{
  white-space:normal !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  vertical-align:top !important;
  word-break:break-word !important;
  overflow-wrap:anywhere !important;
  padding-left:8px !important;
  padding-right:8px !important;
}

/* Column widths: clients page */
.card.table-wrap > table th:nth-child(1),
.card.table-wrap > table td:nth-child(1){
  width:13% !important;
}

.card.table-wrap > table th:nth-child(2),
.card.table-wrap > table td:nth-child(2){
  width:13% !important;
  white-space:nowrap !important;
  font-size:12px !important;
}

.card.table-wrap > table th:nth-child(3),
.card.table-wrap > table td:nth-child(3){
  width:9% !important;
  font-size:11px !important;
}

.card.table-wrap > table th:nth-child(4),
.card.table-wrap > table td:nth-child(4){
  width:12% !important;
  font-size:12px !important;
}

.card.table-wrap > table th:nth-child(5),
.card.table-wrap > table td:nth-child(5),
.card.table-wrap > table th:nth-child(6),
.card.table-wrap > table td:nth-child(6){
  width:9% !important;
  white-space:nowrap !important;
  font-size:12px !important;
}

.card.table-wrap > table th:nth-child(7),
.card.table-wrap > table td:nth-child(7){
  width:10% !important;
}

.card.table-wrap > table th:nth-child(8),
.card.table-wrap > table td:nth-child(8){
  width:15% !important;
  font-size:12px !important;
}

.card.table-wrap > table th:nth-child(9),
.card.table-wrap > table td:nth-child(9){
  width:10% !important;
  text-align:right !important;
  white-space:nowrap !important;
}

.card.table-wrap > table .btn{
  padding:6px 10px !important;
  font-size:12px !important;
}

/* Clients page: fit all columns without horizontal scroll */
.clients-fit-wrap{
  width:100% !important;
  max-width:100% !important;
  overflow-x:hidden !important;
  overflow-y:visible !important;
  padding:14px !important;
}

.clients-fit-table{
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
}

.clients-fit-table th,
.clients-fit-table td{
  white-space:normal !important;
  overflow:hidden !important;
  text-overflow:clip !important;
  word-break:break-word !important;
  overflow-wrap:anywhere !important;
  vertical-align:top !important;
  padding:8px 6px !important;
  font-size:12px !important;
  line-height:1.25 !important;
}

/* Имя */
.clients-fit-table th:nth-child(1),
.clients-fit-table td:nth-child(1){
  width:13% !important;
}

/* Телефон */
.clients-fit-table th:nth-child(2),
.clients-fit-table td:nth-child(2){
  width:13% !important;
  font-size:11px !important;
}

/* ID */
.clients-fit-table th:nth-child(3),
.clients-fit-table td:nth-child(3){
  width:8% !important;
  font-size:10px !important;
}

/* Ассистент */
.clients-fit-table th:nth-child(4),
.clients-fit-table td:nth-child(4){
  width:12% !important;
  font-size:11px !important;
}

/* Первый контакт / Послед. контакт */
.clients-fit-table th:nth-child(5),
.clients-fit-table td:nth-child(5),
.clients-fit-table th:nth-child(6),
.clients-fit-table td:nth-child(6){
  width:9% !important;
  font-size:11px !important;
}

/* Статус */
.clients-fit-table th:nth-child(7),
.clients-fit-table td:nth-child(7){
  width:10% !important;
}

/* Комментарий */
.clients-fit-table th:nth-child(8),
.clients-fit-table td:nth-child(8){
  width:15% !important;
  font-size:11px !important;
}

/* Диалог */
.clients-fit-table th:nth-child(9),
.clients-fit-table td:nth-child(9){
  width:11% !important;
  text-align:right !important;
}

.clients-fit-table .status-badge{
  max-width:100% !important;
  white-space:normal !important;
  font-size:11px !important;
  line-height:1.15 !important;
  padding:5px 7px !important;
}

.clients-fit-table .btn{
  max-width:100% !important;
  padding:6px 8px !important;
  font-size:11px !important;
  white-space:nowrap !important;
}

/* Clients table: only reduce width of Имя, ID, Комментарий columns */
.clients-table th:nth-child(1),
.clients-table td:nth-child(1){
  width:120px !important;
  max-width:120px !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:105px !important;
  max-width:105px !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:120px !important;
  max-width:120px !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
}

/* Clients table v2: balanced width only for Имя, ID, Комментарий */
.clients-table th:nth-child(1),
.clients-table td:nth-child(1){
  width:180px !important;
  max-width:180px !important;
  white-space:normal !important;
  overflow-wrap:normal !important;
  word-break:normal !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:135px !important;
  max-width:135px !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:break-word !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:140px !important;
  max-width:140px !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
  word-break:break-word !important;
}

/* Clients table: ID column only, minus ~1cm */
.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:97px !important;
  max-width:97px !important;
}

/* Clients table: strict ID column width only */
.clients-table col.clients-id-col{
  width:97px !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:97px !important;
  min-width:97px !important;
  max-width:97px !important;
}

/* Clients table: ID column only, plus ~2mm */
.clients-table col.clients-id-col{
  width:105px !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:105px !important;
  min-width:105px !important;
  max-width:105px !important;
}

/* Clients table: ID column only, plus another ~2mm */
.clients-table col.clients-id-col{
  width:113px !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:113px !important;
  min-width:113px !important;
  max-width:113px !important;
}

/* Clients table: Comment column only, minus ~1cm */
.clients-table col.clients-comment-col{
  width:102px !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:102px !important;
  min-width:102px !important;
  max-width:102px !important;
}

/* Clients table: Comment column only, plus ~3mm */
.clients-table col.clients-comment-col{
  width:113px !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:113px !important;
  min-width:113px !important;
  max-width:113px !important;
}

/* Clients table: Comment column only, plus another ~2mm */
.clients-table col.clients-comment-col{
  width:121px !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:121px !important;
  min-width:121px !important;
  max-width:121px !important;
}

/* Clients tab: widen only the overall clients card/page area */
.page:has(.clients-table){
  max-width:1480px !important;
  width:calc(100vw - 90px) !important;
}

.card:has(.clients-table){
  max-width:1480px !important;
  width:100% !important;
}

/* Clients tab: reduce overall clients card/page width after 1480px was too wide */
.page:has(.clients-table){
  max-width:1320px !important;
  width:calc(100vw - 180px) !important;
}

.card:has(.clients-table){
  max-width:1320px !important;
  width:100% !important;
}

/* Clients tab: center table mass inside white card, do not change columns */
.card:has(.clients-table){
  padding-left:34px !important;
  padding-right:34px !important;
}

.card:has(.clients-table) .clients-table{
  margin-left:auto !important;
  margin-right:auto !important;
  width:100% !important;
}

/* Keep row/header lines extended across the centered table width */
.card:has(.clients-table) .clients-table th,
.card:has(.clients-table) .clients-table td{
  border-bottom-width:1px !important;
}

/* Clients tab: fix inner table alignment only, do not touch columns */
.card:has(.clients-table) .clients-table{
  width:calc(100% - 34px) !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

/* Clients tab: remove white side masking/clipping, keep current columns */
.card:has(.clients-table){
  padding-left:24px !important;
  padding-right:24px !important;
  overflow:visible !important;
}

.card:has(.clients-table) .clients-table{
  width:100% !important;
  margin-left:0 !important;
  margin-right:0 !important;
}

.card:has(.clients-table) .table-wrap,
.card:has(.clients-table) div[style*="overflow-x:auto"],
div:has(> .clients-table){
  overflow:visible !important;
}

/* Clients tab: extend horizontal row lines to the left edge only */
.card:has(.clients-table) .clients-table th:first-child,
.card:has(.clients-table) .clients-table td:first-child{
  padding-left:0 !important;
  position:relative !important;
}

.card:has(.clients-table) .clients-table th:first-child::before,
.card:has(.clients-table) .clients-table td:first-child::before{
  content:"" !important;
  position:absolute !important;
  left:-24px !important;
  right:0 !important;
  bottom:-1px !important;
  height:1px !important;
  background:#ece7e3 !important;
  pointer-events:none !important;
}

/* Clients tab filter: Входящие / Клиенты / Все */
.clients-view-switcher{
  display:flex;
  gap:8px;
  align-items:center;
  margin:10px 0 14px;
  flex-wrap:wrap;
}

.clients-view-switcher__item{
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:8px 12px;
  border:1px solid #e6ded6;
  border-radius:999px;
  background:#fff;
  color:#6f6258;
  text-decoration:none;
  font-size:13px;
  font-weight:600;
}

.clients-view-switcher__item span{
  display:inline-flex;
  min-width:22px;
  height:22px;
  padding:0 7px;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:#f3eee9;
  color:#7a6d62;
  font-size:12px;
}

.clients-view-switcher__item.is-active{
  border-color:#8f6b4a;
  background:#8f6b4a;
  color:#fff;
}

.clients-view-switcher__item.is-active span{
  background:rgba(255,255,255,.22);
  color:#fff;
}

/* Clients inner tabs: match main black/white segmented style */
.clients-view-switcher{
  display:inline-flex !important;
  gap:0 !important;
  align-items:center !important;
  margin:12px 0 20px !important;
  padding:4px !important;
  border-radius:999px !important;
  background:#d9d9d9 !important;
  border:0 !important;
  flex-wrap:nowrap !important;
}

.clients-view-switcher__item{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:8px !important;
  min-width:150px !important;
  padding:10px 18px !important;
  border:0 !important;
  border-radius:999px !important;
  background:transparent !important;
  color:#667085 !important;
  text-decoration:none !important;
  font-size:15px !important;
  font-weight:700 !important;
  line-height:1 !important;
  box-shadow:none !important;
}

.clients-view-switcher__item span{
  display:inline-flex !important;
  min-width:30px !important;
  height:30px !important;
  padding:0 9px !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius:999px !important;
  background:rgba(255,255,255,.55) !important;
  color:#6b625d !important;
  font-size:14px !important;
  font-weight:800 !important;
  line-height:1 !important;
}

.clients-view-switcher__item.is-active{
  background:#fff !important;
  color:#111827 !important;
  box-shadow:0 2px 8px rgba(15,23,42,.12) !important;
}

.clients-view-switcher__item.is-active span{
  background:#f1f1f1 !important;
  color:#111827 !important;
}

/* Clients inner tabs: compact size like main top navigation */
.clients-view-switcher{
  display:inline-flex !important;
  gap:0 !important;
  align-items:center !important;
  margin:10px 0 18px !important;
  padding:3px !important;
  border-radius:999px !important;
  background:#d9d9d9 !important;
  border:0 !important;
  flex-wrap:nowrap !important;
}

.clients-view-switcher__item{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:6px !important;
  min-width:112px !important;
  height:34px !important;
  padding:0 16px !important;
  border:0 !important;
  border-radius:999px !important;
  background:transparent !important;
  color:#667085 !important;
  text-decoration:none !important;
  font-size:13px !important;
  font-weight:700 !important;
  line-height:1 !important;
  box-shadow:none !important;
}

.clients-view-switcher__item span{
  display:inline-flex !important;
  min-width:24px !important;
  height:24px !important;
  padding:0 7px !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius:999px !important;
  background:rgba(255,255,255,.55) !important;
  color:#6b7280 !important;
  font-size:12px !important;
  font-weight:800 !important;
  line-height:1 !important;
}

.clients-view-switcher__item.is-active{
  background:#fff !important;
  color:#111827 !important;
  box-shadow:0 1px 5px rgba(15,23,42,.14) !important;
}

.clients-view-switcher__item.is-active span{
  background:#f1f1f1 !important;
  color:#111827 !important;
}

/* Clients inner tabs: font weight cleanup */
.clients-view-switcher__item{
  font-weight:400 !important;
}

.clients-view-switcher__item span{
  font-weight:400 !important;
}

.clients-view-switcher__item.is-active{
  font-weight:700 !important;
}

.clients-view-switcher__item.is-active span{
  font-weight:400 !important;
}

/* Clients tab: hide top title and move inner tabs/table up */
.card:has(.clients-view-switcher) > h2:first-child,
.card:has(.clients-view-switcher) > h3:first-child,
.card:has(.clients-view-switcher) > .card-title:first-child{
  display:none !important;
}

.card:has(.clients-view-switcher){
  padding-top:28px !important;
}

.clients-view-switcher{
  margin-top:0 !important;
  margin-bottom:18px !important;
}

/* Clients tab: exact card class after template patch */
.clients-tab-card{
  padding-top:24px !important;
}

.clients-tab-card .clients-view-switcher{
  margin-top:0 !important;
  margin-bottom:18px !important;
}

/* Clients tab: remove title space and move content up */
.clients-tab-card{
  padding-top:0 !important;
}

.clients-tab-card .clients-toolbar{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  padding:10px 18px 2px !important;
  min-height:30px !important;
}

.clients-tab-card .clients-view-switcher{
  margin-top:0 !important;
  margin-bottom:16px !important;
}

/* Clients tab: align inner tabs and search icon at the top */
.clients-tab-card{
  position:relative !important;
}

.clients-tab-card .clients-toolbar{
  position:absolute !important;
  top:28px !important;
  right:32px !important;
  z-index:5 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  width:auto !important;
  height:32px !important;
  min-height:0 !important;
  padding:0 !important;
  margin:0 !important;
}

.clients-tab-card .clients-toolbar > span{
  display:none !important;
}

.clients-tab-card .clients-search-toggle{
  width:32px !important;
  height:32px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin:0 !important;
}

.clients-tab-card .clients-view-switcher{
  margin-top:28px !important;
  margin-left:28px !important;
  margin-bottom:18px !important;
}

.clients-tab-card #client-search-bar{
  padding:72px 28px 12px !important;
}

/* Clients tab: exact toolbar positioning */
.clients-tab-card .clients-view-switcher{
  margin-top:9px !important;     /* подняли примерно на 5мм */
  margin-left:-10px !important;  /* выравнивание по слову "Имя" */
  margin-bottom:18px !important;
}

.clients-tab-card .clients-toolbar{
  top:9px !important;            /* верх лупы на уровне верха тулбара */
  right:32px !important;
}

.clients-tab-card .clients-search-toggle{
  margin-top:0 !important;
}

/* Clients tab: align search icon vertically with inner toolbar center */
.clients-tab-card .clients-toolbar{
  top:17px !important;
}

.clients-tab-card .clients-search-toggle{
  margin-top:0 !important;
}

/* Clients tab: exact topbar row, no absolute positioning */
.clients-tab-card .clients-toolbar{
  display:none !important;
}

.clients-topbar-row{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:16px !important;
  margin:9px 32px 18px -10px !important;
}

.clients-topbar-row .clients-view-switcher{
  margin:0 !important;
}

.clients-topbar-row .clients-search-toggle{
  position:static !important;
  width:32px !important;
  height:32px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin:0 !important;
  padding:0 !important;
  flex:0 0 32px !important;
}

/* Clients tab: search icon offset only */
.clients-topbar-row .clients-search-toggle{
  transform:translate(19px, -8px) !important;
}

/* Clients tab: search icon 2mm left from previous position */
.clients-topbar-row .clients-search-toggle{
  transform:translate(11px, -8px) !important;
}

/* Clients table: ID column only, plus final ~2mm */
.clients-table col.clients-id-col{
  width:121px !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:121px !important;
  min-width:121px !important;
  max-width:121px !important;
}

/* Client edit modal: anti-freeze / clickability fix */
#edit-modal.modal-overlay{
  position:fixed !important;
  inset:0 !important;
  z-index:99999 !important;
  pointer-events:auto !important;
  align-items:center !important;
  justify-content:center !important;
}

#edit-modal #edit-modal-box,
#edit-modal .modal-box{
  position:relative !important;
  z-index:100000 !important;
  pointer-events:auto !important;
  max-height:86vh !important;
  overflow-y:auto !important;
}

#edit-modal input,
#edit-modal textarea,
#edit-modal button,
#edit-modal form{
  pointer-events:auto !important;
}

/* Client edit modal: clean interaction lock */
body.client-edit-modal-open{
  overflow:hidden !important;
}

body.client-edit-modal-open #edit-modal{
  display:flex !important;
}

#edit-modal.modal-overlay{
  background:rgba(15,23,42,.42) !important;
  cursor:default !important;
}

#edit-modal .modal-box{
  cursor:default !important;
}

#edit-modal .modal-box *{
  pointer-events:auto !important;
}

/* Client edit modal: force real field interaction */
#edit-modal,
#edit-modal *{
  user-select:auto !important;
  -webkit-user-select:auto !important;
}

#edit-modal input,
#edit-modal textarea,
#edit-modal button,
#edit-modal select{
  position:relative !important;
  z-index:100001 !important;
  pointer-events:auto !important;
  touch-action:auto !important;
  -webkit-user-select:text !important;
  user-select:text !important;
}

#edit-modal button{
  user-select:none !important;
  -webkit-user-select:none !important;
}

/* Client edit modal: remove delayed-focus side effects */
body.client-edit-modal-open{
  overflow:auto !important;
}

body.client-edit-modal-open #edit-modal{
  display:none !important;
}

#edit-modal input,
#edit-modal textarea,
#edit-modal button,
#edit-modal select{
  pointer-events:auto !important;
  user-select:auto !important;
  -webkit-user-select:auto !important;
}

#edit-modal input,
#edit-modal textarea{
  cursor:text !important;
}

/* Client edit modal: instant field interaction only */
#edit-modal .client-edit-field{
  pointer-events:auto !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  cursor:text !important;
  touch-action:manipulation !important;
}

/* Client edit modal: native input behavior, no delayed custom focus */
#edit-modal .client-edit-field,
#edit-modal input.form-input,
#edit-modal textarea.form-textarea{
  pointer-events:auto !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  cursor:text !important;
  touch-action:auto !important;
  transition:border-color .12s ease, box-shadow .12s ease !important;
}

#edit-modal .client-edit-field:focus,
#edit-modal input.form-input:focus,
#edit-modal textarea.form-textarea:focus{
  outline:none !important;
}

/* Client edit modal: final native input reset */
#edit-modal input.form-input,
#edit-modal textarea.form-textarea{
  position:static !important;
  z-index:auto !important;
  pointer-events:auto !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  touch-action:auto !important;
  cursor:text !important;
}

/* Client edit modal: contenteditable fields instead of browser inputs */
#edit-modal .client-edit-textfield,
#edit-modal .client-edit-textarea{
  width:100% !important;
  box-sizing:border-box !important;
  border:1px solid #e0e4ea !important;
  border-radius:14px !important;
  background:#fff !important;
  color:#111827 !important;
  font-size:16px !important;
  line-height:1.35 !important;
  padding:13px 16px !important;
  outline:none !important;
  cursor:text !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  white-space:pre-wrap !important;
  overflow-wrap:anywhere !important;
}

#edit-modal .client-edit-textfield{
  min-height:52px !important;
}

#edit-modal .client-edit-textarea{
  min-height:110px !important;
}

#edit-modal .client-edit-textfield:focus,
#edit-modal .client-edit-textarea:focus{
  border-color:#3b82f6 !important;
  box-shadow:0 0 0 2px rgba(59,130,246,.18) !important;
}

#edit-modal .client-edit-textfield:empty::before,
#edit-modal .client-edit-textarea:empty::before{
  content:attr(data-placeholder);
  color:#777 !important;
  pointer-events:none !important;
}

/* Client edit modal: make contenteditable fields visually match old inputs */
#edit-modal .client-edit-textfield,
#edit-modal .client-edit-textarea{
  font-family:inherit !important;
  font-size:16px !important;
  font-weight:400 !important;
  line-height:1.35 !important;
  letter-spacing:0 !important;
  color:#111827 !important;
  padding:13px 16px !important;
}

#edit-modal .client-edit-textfield:empty::before,
#edit-modal .client-edit-textarea:empty::before{
  font-family:inherit !important;
  font-size:16px !important;
  font-weight:400 !important;
  color:#777 !important;
}

#edit-modal .client-edit-textarea:empty::before{
  content:"" !important;
}

/* Client edit modal: contenteditable fields must look exactly like old form inputs */
#edit-modal .client-edit-textfield.form-input{
  display:flex !important;
  align-items:center !important;
  width:100% !important;
  box-sizing:border-box !important;
  min-height:0 !important;
  height:52px !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  overflow-wrap:normal !important;
  word-break:normal !important;
}

#edit-modal .client-edit-textarea.form-textarea{
  display:block !important;
  width:100% !important;
  box-sizing:border-box !important;
  min-height:104px !important;
  height:104px !important;
  white-space:pre-wrap !important;
  overflow-y:auto !important;
  overflow-wrap:anywhere !important;
}

/* placeholders for contenteditable, visually like old input placeholders */
#edit-modal .client-edit-textfield:empty::before,
#edit-modal .client-edit-textarea:empty::before{
  content:attr(data-placeholder) !important;
  color:#777 !important;
  font:inherit !important;
  pointer-events:none !important;
}

#edit-modal .client-edit-textarea:empty::before{
  content:"" !important;
}

/* remove previous hand-picked font overrides by forcing theme inheritance */
#edit-modal .client-edit-textfield,
#edit-modal .client-edit-textarea{
  font-family:inherit !important;
  font-size:inherit !important;
  font-weight:inherit !important;
  letter-spacing:inherit !important;
}

/* Clients UI: hide nickname column/field if legacy markup remains */
.clients-table th.clients-nickname-col,
.clients-table td.clients-nickname-col,
.client-nickname-col,
.client-nickname-field,
[data-client-field="nickname"]{
  display:none !important;
}

/* Clients table after removing nickname column: narrower card and fixed full-width lines */
.page:has(.clients-table){
  max-width:1220px !important;
  width:calc(100vw - 260px) !important;
}

.card:has(.clients-table),
.clients-tab-card{
  max-width:1220px !important;
  width:100% !important;
}

.clients-table{
  width:100% !important;
  table-layout:fixed !important;
}

.clients-table th,
.clients-table td{
  border-bottom:1px solid #e5e7eb !important;
}

/* Clients table: final layout after nickname column removal */
.page:has(.clients-table){
  max-width:1260px !important;
  width:calc(100vw - 250px) !important;
}

.card:has(.clients-table),
.clients-tab-card{
  max-width:1260px !important;
  width:100% !important;
  overflow:hidden !important;
}

.clients-table{
  width:100% !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
}

/* 8 columns after removing nickname:
   1 Имя, 2 Телефон, 3 ID, 4 Первый контакт, 5 Посл. контакт,
   6 Статус, 7 Комментарий, 8 Диалог */
.clients-table th:nth-child(1),
.clients-table td:nth-child(1){
  width:170px !important;
}

.clients-table th:nth-child(2),
.clients-table td:nth-child(2){
  width:130px !important;
}

.clients-table th:nth-child(3),
.clients-table td:nth-child(3){
  width:165px !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:125px !important;
}

.clients-table th:nth-child(5),
.clients-table td:nth-child(5){
  width:125px !important;
}

.clients-table th:nth-child(6),
.clients-table td:nth-child(6){
  width:130px !important;
}

.clients-table th:nth-child(7),
.clients-table td:nth-child(7){
  width:150px !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:185px !important;
  min-width:185px !important;
  max-width:185px !important;
}

.clients-table th,
.clients-table td{
  box-sizing:border-box !important;
  border-bottom:1px solid #e5e7eb !important;
}

.clients-table td:nth-child(8){
  overflow:hidden !important;
}

.clients-table td:nth-child(8) > *{
  max-width:100% !important;
}

/* Clients table: fix right cut after nickname removal */
.page:has(.clients-table){
  max-width:1180px !important;
  width:calc(100vw - 300px) !important;
}

.card:has(.clients-table),
.clients-tab-card{
  max-width:1180px !important;
  width:100% !important;
  overflow:visible !important;
}

.clients-table{
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
}

/* compact 8-column layout */
.clients-table th:nth-child(1),
.clients-table td:nth-child(1){
  width:165px !important;
}

.clients-table th:nth-child(2),
.clients-table td:nth-child(2){
  width:105px !important;
}

.clients-table th:nth-child(3),
.clients-table td:nth-child(3){
  width:145px !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4){
  width:115px !important;
}

.clients-table th:nth-child(5),
.clients-table td:nth-child(5){
  width:115px !important;
}

.clients-table th:nth-child(6),
.clients-table td:nth-child(6){
  width:115px !important;
}

.clients-table th:nth-child(7),
.clients-table td:nth-child(7){
  width:125px !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:155px !important;
  min-width:155px !important;
  max-width:155px !important;
  overflow:visible !important;
  white-space:nowrap !important;
}

.clients-table th,
.clients-table td{
  box-sizing:border-box !important;
  border-bottom:1px solid #e5e7eb !important;
}

.clients-table td:nth-child(8) .btn,
.clients-table td:nth-child(8) button,
.clients-table td:nth-child(8) a{
  flex-shrink:0 !important;
}

/* Clients table: add right breathing space and wrap last contact header */
.clients-table{
  width:calc(100% - 42px) !important;
  max-width:calc(100% - 42px) !important;
  margin-right:42px !important;
}

.clients-table th:nth-child(5){
  white-space:normal !important;
  line-height:1.15 !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:145px !important;
  min-width:145px !important;
  max-width:145px !important;
}

.clients-table td:nth-child(8){
  padding-right:8px !important;
}

/* Clients table: extend only horizontal row lines to the right edge */
.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  position:relative !important;
}

.clients-table th:nth-child(8)::after,
.clients-table td:nth-child(8)::after{
  content:"" !important;
  position:absolute !important;
  left:100% !important;
  bottom:-1px !important;
  width:42px !important;
  height:0 !important;
  border-bottom:1px solid #e5e7eb !important;
  pointer-events:none !important;
}

/* Clients table: extend horizontal row lines farther to the right edge */
.clients-table th:nth-child(8)::after,
.clients-table td:nth-child(8)::after{
  width:78px !important;
}

/* Clients table: cancel overdrawn right line tails */
.clients-table th:nth-child(8)::after,
.clients-table td:nth-child(8)::after{
  content:none !important;
  display:none !important;
  width:0 !important;
  border:0 !important;
}

/* Clients table: restore real full-width row lines inside white card */
.clients-table{
  width:100% !important;
  max-width:100% !important;
  margin-right:0 !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
}

.clients-table th,
.clients-table td{
  border-bottom:1px solid #e5e7eb !important;
}

/* Keep dialog controls away from the right edge without fake lines */
.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:165px !important;
  min-width:165px !important;
  max-width:165px !important;
  padding-right:24px !important;
  box-sizing:border-box !important;
  overflow:visible !important;
  white-space:nowrap !important;
}

/* Clients table: restore object/grid positions, only draw line tails */
.clients-table{
  width:calc(100% - 42px) !important;
  max-width:calc(100% - 42px) !important;
  margin-right:42px !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8){
  width:145px !important;
  min-width:145px !important;
  max-width:145px !important;
  padding-right:8px !important;
  box-sizing:border-box !important;
  overflow:visible !important;
  white-space:nowrap !important;
  position:relative !important;
}

/* Only the horizontal line tail, no column/object movement */
.clients-table th:nth-child(8)::after,
.clients-table td:nth-child(8)::after{
  content:"" !important;
  display:block !important;
  position:absolute !important;
  left:100% !important;
  bottom:-1px !important;
  width:58px !important;
  height:0 !important;
  border-bottom:1px solid #e5e7eb !important;
  pointer-events:none !important;
}

/* Clients table: final tiny extension of right line tails only */
.clients-table th:nth-child(8)::after,
.clients-table td:nth-child(8)::after{
  width:66px !important;
}

/* Clients search: floating overlay, does not break table/grid */
.clients-tab-card{
  position:relative !important;
}

#client-search-bar{
  position:absolute !important;
  top:116px !important;
  left:72px !important;
  right:210px !important; /* примерно 2 см не доходит до правого тулбара/лупы */
  z-index:30 !important;
  display:none;
  padding:0 !important;
  margin:0 !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  transform:translateY(-4px) !important;
  opacity:0 !important;
  transition:opacity .12s ease, transform .12s ease !important;
}

#client-search-bar.is-open{
  opacity:1 !important;
  transform:translateY(0) !important;
}

#client-search-bar form{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  width:100% !important;
  margin:0 !important;
  padding:0 !important;
}

#client-search-bar input,
#client-search-input{
  height:38px !important;
  width:100% !important;
  flex:1 1 auto !important;
  border:2px solid #3b82f6 !important;
  border-radius:10px !important;
  background:#fff !important;
  padding:0 14px !important;
  font-size:14px !important;
  line-height:38px !important;
  box-shadow:0 4px 14px rgba(15,23,42,.08) !important;
  outline:none !important;
}

#client-search-bar button{
  height:38px !important;
  padding:0 18px !important;
  border-radius:999px !important;
  flex:0 0 auto !important;
}

/* Search result should not visually collapse the whole client card */
.clients-tab-card .clients-table{
  transition:none !important;
}

.clients-tab-card tbody tr{
  transition:none !important;
}

/* Clients search: compact live overlay near topbar, no button, no grid break */
.clients-tab-card{
  position:relative !important;
}

#client-search-bar{
  position:absolute !important;
  top:31px !important;
  left:360px !important;
  right:156px !important;
  z-index:40 !important;
  display:none !important;
  padding:0 !important;
  margin:0 !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  opacity:0 !important;
  transform:translateY(-2px) !important;
  transition:opacity .08s ease, transform .08s ease !important;
}

#client-search-bar.is-open{
  display:block !important;
  opacity:1 !important;
  transform:translateY(0) !important;
}

#client-search-input{
  width:100% !important;
  height:34px !important;
  box-sizing:border-box !important;
  border:1px solid #d1d5db !important;
  border-radius:999px !important;
  background:#f3f4f6 !important;
  color:#111827 !important;
  padding:0 16px !important;
  font-size:13px !important;
  font-weight:400 !important;
  line-height:34px !important;
  outline:none !important;
  box-shadow:none !important;
}

#client-search-input:focus{
  border-color:#c7cbd1 !important;
  background:#fff !important;
  box-shadow:0 1px 5px rgba(15,23,42,.10) !important;
}

#client-search-input::placeholder{
  color:#6b7280 !important;
}

/* old form search reset if browser cached old markup */
#client-search-bar form,
#client-search-bar button{
  display:none !important;
}

/* live search should not animate/collapse rows roughly */
.clients-table tbody tr{
  transition:none !important;
}

/* Clients search final: centered on toolbar row, no layout shift */
.clients-tab-card{
  position:relative !important;
}

#client-search-bar{
  position:absolute !important;
  top:31px !important;
  left:380px !important;
  right:122px !important;
  z-index:60 !important;
  display:block !important;
  padding:0 !important;
  margin:0 !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  opacity:0 !important;
  transform:translateY(-2px) !important;
  pointer-events:none !important;
  transition:opacity .08s ease, transform .08s ease !important;
}

#client-search-bar.is-open{
  opacity:1 !important;
  transform:translateY(0) !important;
  pointer-events:auto !important;
}

#client-search-input{
  width:100% !important;
  height:34px !important;
  box-sizing:border-box !important;
  border:1px solid #d1d5db !important;
  border-radius:999px !important;
  background:#f3f4f6 !important;
  color:#111827 !important;
  padding:0 16px !important;
  font-size:13px !important;
  font-weight:400 !important;
  line-height:34px !important;
  outline:none !important;
  box-shadow:none !important;
}

#client-search-input:focus{
  border-color:#c7cbd1 !important;
  background:#fff !important;
  box-shadow:0 1px 5px rgba(15,23,42,.10) !important;
}

#client-search-input::placeholder{
  color:#6b7280 !important;
}

/* remove old search form/button visually if cached */
#client-search-bar form,
#client-search-bar button{
  display:none !important;
}

/* Clients search: toolbar-like position and shape */
#client-search-bar{
  position:absolute !important;
  top:31px !important;
  left:430px !important;
  right:118px !important;
  z-index:60 !important;
  display:block !important;
  padding:3px !important;
  margin:0 !important;
  background:#d9d9d9 !important;
  border:0 !important;
  border-radius:999px !important;
  box-shadow:none !important;
  opacity:0 !important;
  transform:none !important;
  pointer-events:none !important;
  transition:opacity .06s ease !important;
}

#client-search-bar.is-open{
  opacity:1 !important;
  pointer-events:auto !important;
}

#client-search-input{
  display:flex !important;
  align-items:center !important;
  width:100% !important;
  height:34px !important;
  box-sizing:border-box !important;
  border:0 !important;
  border-radius:999px !important;
  background:#fff !important;
  color:#111827 !important;
  padding:0 16px !important;
  font-family:inherit !important;
  font-size:13px !important;
  font-weight:400 !important;
  line-height:34px !important;
  outline:none !important;
  box-shadow:0 1px 5px rgba(15,23,42,.14) !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  cursor:text !important;
}

#client-search-input:empty::before{
  content:attr(data-placeholder) !important;
  color:#6b7280 !important;
  pointer-events:none !important;
}

#client-search-input:focus{
  background:#fff !important;
  box-shadow:0 1px 5px rgba(15,23,42,.14) !important;
}

/* Clients search: exact compact toolbar size, no giant bubble */
#client-search-bar{
  position:absolute !important;
  top:31px !important;
  left:430px !important;
  right:126px !important;
  z-index:60 !important;

  display:block !important;
  height:40px !important;
  min-height:40px !important;
  max-height:40px !important;

  padding:3px !important;
  margin:0 !important;
  box-sizing:border-box !important;

  background:#d9d9d9 !important;
  border:0 !important;
  border-radius:999px !important;
  box-shadow:none !important;

  opacity:0 !important;
  pointer-events:none !important;
  overflow:hidden !important;
  transform:none !important;
  transition:opacity .06s ease !important;
}

#client-search-bar.is-open{
  opacity:1 !important;
  pointer-events:auto !important;
}

#client-search-input{
  display:flex !important;
  align-items:center !important;

  width:100% !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;

  box-sizing:border-box !important;
  border:0 !important;
  border-radius:999px !important;
  background:#fff !important;

  padding:0 16px !important;
  margin:0 !important;

  color:#111827 !important;
  font-family:inherit !important;
  font-size:13px !important;
  font-weight:400 !important;
  line-height:34px !important;

  outline:none !important;
  box-shadow:0 1px 5px rgba(15,23,42,.14) !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  cursor:text !important;
}

#client-search-input:empty::before{
  content:attr(data-placeholder) !important;
  color:#6b7280 !important;
  pointer-events:none !important;
}

#client-search-input:focus{
  background:#fff !important;
  box-shadow:0 1px 5px rgba(15,23,42,.14) !important;
}

/* Clients search: premium compact overlay, override all old heavy rules */
.clients-tab-card #client-search-bar{
  position:absolute !important;

  /* same horizontal row as inner toolbar */
  top:31px !important;
  left:430px !important;
  right:118px !important;

  z-index:80 !important;

  display:block !important;
  height:40px !important;
  min-height:40px !important;
  max-height:40px !important;

  padding:3px !important;
  margin:0 !important;
  box-sizing:border-box !important;

  background:#d9d9d9 !important;
  border:0 !important;
  border-radius:999px !important;
  box-shadow:none !important;

  opacity:0 !important;
  pointer-events:none !important;
  overflow:hidden !important;

  transform:scale(.985) !important;
  transform-origin:right center !important;
  transition:opacity .08s ease, transform .08s ease !important;
}

.clients-tab-card #client-search-bar.is-open{
  opacity:1 !important;
  pointer-events:auto !important;
  transform:scale(1) !important;
}

.clients-tab-card #client-search-input{
  display:flex !important;
  align-items:center !important;

  width:100% !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;

  padding:0 16px !important;
  margin:0 !important;
  box-sizing:border-box !important;

  background:#fff !important;
  border:0 !important;
  border-radius:999px !important;

  color:#111827 !important;
  font-family:inherit !important;
  font-size:13px !important;
  font-weight:400 !important;
  line-height:34px !important;

  outline:none !important;
  box-shadow:0 1px 5px rgba(15,23,42,.14) !important;

  white-space:nowrap !important;
  overflow:hidden !important;
  cursor:text !important;
}

.clients-tab-card #client-search-input:empty::before{
  content:attr(data-placeholder) !important;
  color:#6b7280 !important;
  pointer-events:none !important;
}

.clients-tab-card #client-search-input:focus{
  background:#fff !important;
  box-shadow:0 1px 5px rgba(15,23,42,.14) !important;
}

/* hard kill old search form/button layout */
.clients-tab-card #client-search-bar form,
.clients-tab-card #client-search-bar button{
  display:none !important;
}

/* Clients search: move only position, 2mm down and 1cm right */
.clients-tab-card #client-search-bar{
  top:39px !important;
  left:468px !important;
  right:80px !important;
}

/* Clients search: move only 1mm up */
.clients-tab-card #client-search-bar{
  top:35px !important;
}

/* Clients search icon: move only 1mm down */
.clients-topbar-row .clients-search-toggle{
  transform:translate(11px, -4px) !important;
}

/* Client card: appointment history */
#edit-modal .client-history-block{
  margin:16px 0 14px !important;
  padding:14px !important;
  border:1px solid #e5e7eb !important;
  border-radius:16px !important;
  background:#f9fafb !important;
}

#edit-modal .client-history-title{
  margin-bottom:10px !important;
  color:#111827 !important;
  font-size:14px !important;
  font-weight:700 !important;
}

#edit-modal .client-history-empty{
  color:#6b7280 !important;
  font-size:13px !important;
}

#edit-modal .client-history-list{
  display:flex !important;
  flex-direction:column !important;
  gap:8px !important;
}

#edit-modal .client-history-item{
  padding:10px 12px !important;
  border-radius:12px !important;
  background:#fff !important;
  border:1px solid #edf0f3 !important;
}

#edit-modal .client-history-main{
  display:flex !important;
  justify-content:space-between !important;
  gap:12px !important;
  align-items:flex-start !important;
}

#edit-modal .client-history-date{
  color:#374151 !important;
  font-size:13px !important;
  font-weight:600 !important;
  white-space:nowrap !important;
}

#edit-modal .client-history-service{
  color:#111827 !important;
  font-size:13px !important;
  font-weight:700 !important;
  text-align:right !important;
}

#edit-modal .client-history-meta{
  display:flex !important;
  flex-wrap:wrap !important;
  gap:6px !important;
  margin-top:7px !important;
}

#edit-modal .client-history-meta span{
  display:inline-flex !important;
  align-items:center !important;
  min-height:22px !important;
  padding:0 8px !important;
  border-radius:999px !important;
  background:#f3f4f6 !important;
  color:#4b5563 !important;
  font-size:12px !important;
  font-weight:600 !important;
}

#edit-modal .client-history-comment{
  margin-top:7px !important;
  color:#6b7280 !important;
  font-size:12px !important;
  line-height:1.35 !important;
}

#edit-modal .client-history-more{
  margin-top:10px !important;
  color:#6b7280 !important;
  font-size:12px !important;
}

/* Client card: readonly ID field and compact inactive comment */
#edit-modal .client-edit-id-field{
  color:#4b5563 !important;
  background:#f9fafb !important;
  cursor:default !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
  font-size:13px !important;
}

#edit-modal .client-edit-comment-compact{
  min-height:72px !important;
  height:72px !important;
  transition:height .12s ease, min-height .12s ease, box-shadow .12s ease !important;
}

#edit-modal .client-edit-comment-compact:focus{
  min-height:128px !important;
  height:128px !important;
}

/* Client card: subtle technical ID footnote */
#edit-modal .client-edit-footer-row{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:16px !important;
  margin-top:8px !important;
}

#edit-modal .client-edit-id-note{
  color:#9ca3af !important;
  font-size:11px !important;
  font-weight:400 !important;
  line-height:1 !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
}

#edit-modal .client-edit-actions{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:10px !important;
}

/* Client card: full technical ID on delete row */
#edit-modal .client-edit-delete-row{
  margin-top:16px !important;
  padding-top:16px !important;
  border-top:1px solid var(--border) !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:16px !important;
}

#edit-modal .client-edit-delete-row .client-edit-id-note{
  max-width:70% !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  color:#9ca3af !important;
  font-size:11px !important;
  font-weight:400 !important;
  line-height:1 !important;
  user-select:text !important;
  -webkit-user-select:text !important;
}

/* Client card: remove technical ID from UX */
#edit-modal .client-edit-delete-row{
  justify-content:flex-end !important;
}

#edit-modal .client-edit-id-note{
  display:none !important;
}

/* Client card: comment is one-line until focused */
#edit-modal .client-edit-comment-compact,
#edit-modal .client-edit-textarea[data-client-field="comment"]{
  min-height:46px !important;
  height:46px !important;
  max-height:46px !important;
  padding-top:12px !important;
  padding-bottom:10px !important;
  overflow:hidden !important;
  white-space:nowrap !important;
}

#edit-modal .client-edit-comment-compact:focus,
#edit-modal .client-edit-textarea[data-client-field="comment"]:focus{
  min-height:118px !important;
  height:118px !important;
  max-height:118px !important;
  overflow-y:auto !important;
  white-space:pre-wrap !important;
}


/* Clients table: final right edge and hover repair */
.clients-tab-card .clients-table,
.clients-table{
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  margin:0 !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
  border-spacing:0 !important;
}

/* No old artificial right tails */
.clients-tab-card .clients-table th::after,
.clients-tab-card .clients-table td::after,
.clients-table th::after,
.clients-table td::after{
  content:none !important;
  display:none !important;
  width:0 !important;
  border:0 !important;
}

/* Lines go to the table edge */
.clients-tab-card .clients-table th,
.clients-tab-card .clients-table td,
.clients-table th,
.clients-table td{
  border-bottom:1px solid var(--border) !important;
}

/* Hover must not be chopped: paint cells themselves */
.clients-tab-card .clients-table tbody tr:hover td,
.clients-table tbody tr:hover td{
  background:#f3f4f6 !important;
}

/* 7 columns after Status removal */
.clients-tab-card .clients-table th:nth-child(1),
.clients-tab-card .clients-table td:nth-child(1),
.clients-table th:nth-child(1),
.clients-table td:nth-child(1){ width:18% !important; }

.clients-tab-card .clients-table th:nth-child(2),
.clients-tab-card .clients-table td:nth-child(2),
.clients-table th:nth-child(2),
.clients-table td:nth-child(2){ width:12% !important; }

.clients-tab-card .clients-table th:nth-child(3),
.clients-tab-card .clients-table td:nth-child(3),
.clients-table th:nth-child(3),
.clients-table td:nth-child(3){ width:17% !important; }

.clients-tab-card .clients-table th:nth-child(4),
.clients-tab-card .clients-table td:nth-child(4),
.clients-table th:nth-child(4),
.clients-table td:nth-child(4){ width:11.5% !important; }

.clients-tab-card .clients-table th:nth-child(5),
.clients-tab-card .clients-table td:nth-child(5),
.clients-table th:nth-child(5),
.clients-table td:nth-child(5){
  width:11.5% !important;
  white-space:normal !important;
  line-height:1.15 !important;
}

.clients-tab-card .clients-table th:nth-child(6),
.clients-tab-card .clients-table td:nth-child(6),
.clients-table th:nth-child(6),
.clients-table td:nth-child(6){ width:12% !important; }

.clients-tab-card .clients-table th:nth-child(7),
.clients-tab-card .clients-table td:nth-child(7),
.clients-table th:nth-child(7),
.clients-table td:nth-child(7){
  width:18% !important;
  padding-right:0 !important;
  overflow:visible !important;
  white-space:nowrap !important;
}

/* Dialog controls stay round */
.clients-tab-card .clients-table td:nth-child(7) form button,
.clients-table td:nth-child(7) form button{
  width:28px !important;
  height:28px !important;
  min-width:28px !important;
  max-width:28px !important;
  min-height:28px !important;
  max-height:28px !important;
  padding:0 !important;
  border-radius:999px !important;
  aspect-ratio:1 / 1 !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  flex:0 0 28px !important;
  box-sizing:border-box !important;
}

/* Clients search toggle clear mode */
.clients-search-toggle.is-clear-mode{
  font-size:28px !important;
  line-height:1 !important;
  font-weight:500 !important;
}

/* Clients search clear icon: compact X, original magnifier restored by JS */
.clients-search-toggle.is-clear-mode{
  font-size:22px !important;
  line-height:1 !important;
  font-weight:400 !important;
  color:#6b7280 !important;
  transform:translate(11px, -4px) !important;
}

/* Client modal: incoming-to-client hint */
.client-incoming-hint{
  margin-top:12px !important;
  padding:10px 12px !important;
  border-radius:14px !important;
  background:#f3f4f6 !important;
  color:#4b5563 !important;
  font-size:13px !important;
  line-height:1.35 !important;
}

/* === CLIENT DOWNLOAD ICON: EXACT TOOLBAR POSITION === */

.clients-topbar-row {
  display: flex;
  align-items: center;
}

.clients-view-switcher {
  flex: 0 0 auto;
}

.clients-download-button {
  width: 48px;
  height: 48px;
  margin-left: 48px;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;

  color: #cccccc;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
}

.clients-download-button:hover {
  color: #a9a9a9;
  background: transparent;
}

.clients-download-button:active {
  color: #929292;
}

.clients-download-button:focus-visible {
  outline: 2px solid #bdbdbd;
  outline-offset: 3px;
}

.clients-download-button svg {
  display: block;
}

.clients-search-toggle {
  margin-left: auto;
}

/* === END CLIENT DOWNLOAD ICON === */

/* === STRICT CLIENT DOWNLOAD ICON POSITION === */

.clients-topbar-row {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

.clients-topbar-row > .clients-view-switcher {
  flex: 0 0 auto !important;
}

.clients-topbar-row > .clients-download-button {
  width: 52px !important;
  height: 52px !important;

  margin-left: 42px !important;
  margin-right: 0 !important;

  padding: 0 !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 52px !important;

  color: #cccccc !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

.clients-topbar-row > .clients-download-button svg {
  width: 40px !important;
  height: 40px !important;
  display: block !important;
}

.clients-topbar-row > .clients-download-button:hover {
  color: #aaaaaa !important;
  background: transparent !important;
}

.clients-topbar-row > .clients-search-toggle {
  margin-left: auto !important;
}

/* === END STRICT CLIENT DOWNLOAD ICON POSITION === */

/* Уменьшение значка в 2 раза и сдвиг влево примерно на 1 см */
.clients-topbar-row > .clients-download-button {
  margin-left: 4px !important;
}

.clients-topbar-row > .clients-download-button svg {
  width: 20px !important;
  height: 20px !important;
}

.clients-topbar-row > .clients-download-button {
  transform: translateX(-26px) !important;
}


/* === CRM EXTRA SERVICE BADGE STYLES === */

.crm-calendar__appointment {
  position: absolute;
}

.crm-calendar__extra-service-badge {
  position: absolute;
  top: 50%;
  right: 14px;
  z-index: 3;

  width: 30px;
  height: 30px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  transform: translateY(-50%);

  color: currentColor;
  opacity: 0.72;

  background: transparent;
  border: 0;
  pointer-events: none;
}

.crm-calendar__extra-service-badge svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* === END CRM EXTRA SERVICE BADGE STYLES === */


/* === CRM EXTRA SERVICE TOOLTIP STYLES === */

.crm-calendar__extra-service-badge {
  pointer-events: auto;
  cursor: default;
}

.crm-calendar__extra-service-badge::after {
  content: attr(data-tooltip);

  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;

  width: max-content;
  max-width: 260px;
  padding: 7px 10px;

  color: #ffffff;
  background: rgba(35, 35, 40, 0.94);
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);

  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;

  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);

  transition:
    opacity 0.14s ease,
    visibility 0.14s ease,
    transform 0.14s ease;

  pointer-events: none;
}

.crm-calendar__extra-service-badge:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* === END CRM EXTRA SERVICE TOOLTIP STYLES === */

/* === EXTRA SERVICE SHORT CARD LAYOUT FIX === */

/* Старую подсказку внутри карточки отключаем. */
.crm-calendar__extra-service-badge::after {
  display: none !important;
}

/* Подарок всегда остаётся крайним справа. */
.crm-calendar__appointment--has-extra-service
.crm-calendar__extra-service-badge {
  right: 14px !important;
}

/* Статус сдвигается левее только у карточек с подарком. */
.crm-calendar__appointment--has-extra-service
.crm-calendar__appointment-status,
.crm-calendar__appointment--has-extra-service
.crm-calendar__appointment-status-badge,
.crm-calendar__appointment--has-extra-service
.crm-calendar__status {
  right: 58px !important;
}

/* Tooltip находится вне карточки, поэтому не обрезается. */
.crm-calendar__extra-service-tooltip {
  position: fixed;
  z-index: 99999;

  width: max-content;
  max-width: calc(100vw - 16px);
  padding: 7px 10px;

  color: #ffffff;
  background: rgba(35, 35, 40, 0.94);
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);

  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;

  pointer-events: none;
}

/* === END EXTRA SERVICE SHORT CARD LAYOUT FIX === */

/* === EXTRA SERVICE: SHORT CARDS ONLY === */

/*
 * Карточки дольше 60 минут остаются как раньше:
 * подарок по вертикальному центру, статус в обычном положении.
 */
.crm-calendar__appointment--has-extra-service:not(
  .crm-calendar__appointment--short-extra-service
) .crm-calendar__extra-service-badge {
  top: 50% !important;
  right: 14px !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
}

.crm-calendar__appointment--has-extra-service:not(
  .crm-calendar__appointment--short-extra-service
) .crm-calendar__appointment-status,
.crm-calendar__appointment--has-extra-service:not(
  .crm-calendar__appointment--short-extra-service
) .crm-calendar__appointment-status-badge,
.crm-calendar__appointment--has-extra-service:not(
  .crm-calendar__appointment--short-extra-service
) .crm-calendar__status {
  right: 14px !important;
}

/*
 * Только карточки 60 минут и меньше:
 * подарок справа крайний и на одном уровне со статусом.
 */
.crm-calendar__appointment--short-extra-service
.crm-calendar__extra-service-badge {
  top: auto !important;
  right: 14px !important;
  bottom: 22px !important;
  transform: none !important;
}

.crm-calendar__appointment--short-extra-service
.crm-calendar__appointment-status,
.crm-calendar__appointment--short-extra-service
.crm-calendar__appointment-status-badge,
.crm-calendar__appointment--short-extra-service
.crm-calendar__status {
  right: 58px !important;
}

/* === END EXTRA SERVICE: SHORT CARDS ONLY === */

/* === SHORT EXTRA SERVICE: ALIGN WITH STATUS === */

/*
 * Только для карточек длительностью 60 минут и меньше.
 * Подарок остаётся крайним справа и получает вертикальный центр статуса.
 */
.crm-calendar__appointment--short-extra-service
.crm-calendar__extra-service-badge {
  top: var(--crm-extra-service-top, 50%) !important;
  right: 14px !important;
  bottom: auto !important;
  transform: none !important;
}

/* Статус остаётся левее подарка. */
.crm-calendar__appointment--short-extra-service
.crm-calendar__appointment-status,
.crm-calendar__appointment--short-extra-service
.crm-calendar__appointment-status-badge,
.crm-calendar__appointment--short-extra-service
.crm-calendar__status {
  right: 58px !important;
}

/* === END SHORT EXTRA SERVICE: ALIGN WITH STATUS === */


/* === CLIENT APPOINTMENT RECEIPT UI === */

.client-history-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.client-history-receipt {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding-top: 22px;
}

.client-history-receipt-input {
  display: none !important;
}

.client-history-receipt-button {
  width: 34px;
  height: 34px;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: #8d929c;
  background: #f6f7f9;
  border: 1px solid rgba(25, 30, 40, 0.10);
  border-radius: 8px;

  overflow: hidden;
  cursor: pointer;

  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    opacity 0.15s ease;
}

.client-history-receipt-button:hover {
  color: #505661;
  background: #eef0f4;
  border-color: rgba(25, 30, 40, 0.18);
}

.client-history-receipt-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.client-history-receipt-button.has-receipt {
  background: #ffffff;
}

.client-history-receipt-button.has-receipt img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.client-history-receipt-button.is-loading {
  opacity: 0.45;
  pointer-events: none;
}

.client-receipt-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;

  display: none;
  align-items: center;
  justify-content: center;

  padding: 28px;
  background: rgba(20, 23, 30, 0.68);
  backdrop-filter: blur(3px);
}

.client-receipt-preview-modal.is-open {
  display: flex;
}

.client-receipt-preview-dialog {
  position: relative;

  width: min(880px, 92vw);
  height: min(760px, 88vh);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;

  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.client-receipt-preview-image {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

.client-receipt-preview-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;

  width: 34px;
  height: 34px;

  color: #30343b;
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  border-radius: 50%;

  font-size: 27px;
  line-height: 1;

  cursor: pointer;
}

/* === END CLIENT APPOINTMENT RECEIPT UI === */


/* === CLIENT RECEIPT DELETE BUTTON === */

.client-receipt-preview-delete {
  position: absolute;
  right: 18px;
  bottom: 16px;

  min-width: 118px;
  height: 38px;
  padding: 0 16px;

  color: #b42318;
  background: #ffffff;
  border: 1px solid rgba(180, 35, 24, 0.22);
  border-radius: 8px;

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;

  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.client-receipt-preview-delete:hover {
  background: #fff4f2;
  border-color: rgba(180, 35, 24, 0.36);
}

.client-receipt-preview-delete:disabled {
  opacity: 0.5;
  cursor: default;
}

/* === END CLIENT RECEIPT DELETE BUTTON === */

/* === COMPACT CARD: KEEP GUESTS, HIDE PHONE === */

.crm-calendar__appointment {
  container-type: inline-size;
}

/*
 * На узкой карточке телефон скрывается первым,
 * а количество гостей остаётся видимым.
 */
@container (max-width: 290px) {
  .crm-calendar__appointment-phone,
  .crm-calendar__appointment-client-phone,
  .crm-calendar__phone {
    display: none !important;
  }

  .crm-calendar__appointment-guests,
  .crm-calendar__appointment-guests-count,
  .crm-calendar__guests {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Поддержка уже существующих compact-классов календаря. */
.crm-calendar__appointment.is-compact
.crm-calendar__appointment-phone,
.crm-calendar__appointment--compact
.crm-calendar__appointment-phone,
.crm-calendar__appointment.compact
.crm-calendar__appointment-phone {
  display: none !important;
}

.crm-calendar__appointment.is-compact
.crm-calendar__appointment-guests,
.crm-calendar__appointment--compact
.crm-calendar__appointment-guests,
.crm-calendar__appointment.compact
.crm-calendar__appointment-guests {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* === END COMPACT CARD: KEEP GUESTS, HIDE PHONE === */


/* === COMPACT CARD REAL GUESTS FIX === */

.crm-calendar__appointment-service {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.crm-calendar__appointment-service-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-calendar__appointment-guests {
  flex: 0 0 auto;
  white-space: nowrap;
}

.crm-calendar__appointment-guests::before {
  content: "· ";
}

/*
 * Только у карточек длительностью 60 минут и меньше:
 * телефон скрываем, количество гостей сохраняем.
 */
.crm-calendar__appointment--compact
.crm-calendar__appointment-phone {
  display: none !important;
}

.crm-calendar__appointment--compact
.crm-calendar__appointment-service {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.crm-calendar__appointment--compact
.crm-calendar__appointment-guests {
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* На очень узкой карточке скрывается название услуги, но не гости. */
@container (max-width: 190px) {
  .crm-calendar__appointment--compact
  .crm-calendar__appointment-service-name {
    display: none !important;
  }

  .crm-calendar__appointment--compact
  .crm-calendar__appointment-guests::before {
    content: "";
  }
}

/* === END COMPACT CARD REAL GUESTS FIX === */
