/* ============================================================
   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; }
/* Внутренний стек (bubble + time) ужимается строго до ширины бабла,
   чтобы время всегда было «прижато» к нужному краю и колонка справа
   не «гуляла» при сообщениях разной длины. */
.msg > div {
  display: inline-flex;
  flex-direction: column;
  max-width: 72%;
  min-width: 0;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.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; }
.msg-user .msg-time { text-align: right; }
.msg-assistant .msg-time { text-align: left; }

/* ── 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; }
}
