:root {
  --navy: #1e2140;
  --navy-light: #2a2e58;
  --bg: #f4f5f9;
  --white: #ffffff;
  --border: #e4e6ef;
  --text: #2b2d42;
  --text-muted: #8a8d9f;
  --green: #23b26d;
  --green-dark: #1a9a5c;
  --red: #e8543e;
  --blue: #3b7bf6;
  --yellow: #f5b942;
  --purple: #8a6bf0;
  --whatsapp: #25d366;
  --telegram: #2aabee;
  --instagram-a: #f58529;
  --instagram-b: #dd2a7b;
  --instagram-c: #8134af;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 40, 0.06), 0 1px 8px rgba(20, 22, 40, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
/* Sidebar — a real brand lockup + labeled nav, not just an icon rail */
.sidebar {
  width: 240px;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 4px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(207, 147, 26, 0.4);
}

.brand-text { min-width: 0; }

/* Customer media inside inbox chat bubbles */
.bubble-media { display: block; max-width: 240px; max-height: 300px; border-radius: 10px; margin-bottom: 4px; background: rgba(0, 0, 0, 0.06); }
.bubble-audio { display: block; width: 240px; max-width: 100%; margin-bottom: 4px; }
.bubble-file, .bubble-media-note { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.bubble-media-note { font-weight: 500; opacity: 0.85; }
.brand-name {
  color: white;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub {
  color: #8b8fb3;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar a.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: #9fa3c7;
  position: relative;
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-item-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar a.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar a.nav-item.active {
  background: rgba(35, 178, 109, 0.16);
  color: #fff;
}

.sidebar a.nav-item.active .nav-item-icon { color: var(--green); }

.sidebar a.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--green);
}

.sidebar .badge {
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar button.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

/* Collapse to a compact icon-only rail on narrow viewports — the sidebar's own responsive
   behaviour, independent of the page-level breakpoint below. */
@media (max-width: 900px) {
  .sidebar { width: 68px; padding: 16px 8px; align-items: center; }
  .brand-lockup { padding: 4px 0 16px; justify-content: center; }
  .brand-text, .nav-item-label { display: none; }
  .sidebar a.nav-item, .sidebar button.nav-item { justify-content: center; padding: 0; width: 44px; }
  .sidebar a.nav-item.active::before { left: -8px; }
  .main { margin-left: 68px !important; }
}

/* Main area */
.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar .search {
  flex: 1 1 auto;
  min-width: 60px;
  max-width: 340px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spacer { flex: 1 1 auto; min-width: 0; }

/* Every fixed-size topbar element (buttons, pills, badges) must never shrink or wrap its
   text — only .search and .spacer are allowed to give up space when the window is narrow. */
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: var(--white); border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-disabled {
  background: #f0f1f6;
  color: #c3c5d5;
  cursor: not-allowed;
}

.pipeline-summary {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.pipeline-summary b { color: var(--text); }

.content {
  flex: 1;
  overflow: auto;
  padding: 18px 20px;
}

/* Kanban */
.board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  height: 100%;
}

.column {
  background: transparent;
  width: 258px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.column-header {
  padding: 4px 6px 12px;
}

.column-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.column-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.column-drop {
  min-height: 60px;
  border-radius: var(--radius);
  padding: 2px;
  flex: 1;
  transition: background 0.15s;
}

.column-drop.drag-over {
  background: #e9ecf9;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  padding: 12px 12px 10px;
  cursor: grab;
  border-top: 3px solid var(--blue);
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
}

.card:active { cursor: grabbing; }
.card:hover { box-shadow: 0 4px 14px rgba(20,22,40,0.12); }
.card.dragging { opacity: 0.4; }

.card-delete {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer;
  opacity: 0; transition: opacity var(--transition-fast);
}
.card:hover .card-delete { opacity: 1; }
.card-edit {
  position: absolute; top: 8px; right: 36px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer;
  opacity: 0; transition: opacity var(--transition-fast);
}
.card:hover .card-edit { opacity: 1; }
.card-edit:hover { background: #eef1ff; color: var(--blue); }
.card .card-title { padding-right: 56px; }
.card-delete:hover { background: #fdecec; color: #b3372b; }

.card .card-title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 2px;
  padding-right: 22px;
}

.card .card-sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.card .card-slot {
  display: inline-block;
  color: var(--purple, #8a6bf0);
  background: rgba(138,107,240,0.1);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.card .card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card .card-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 20px;
  color: white;
}

.channel-whatsapp { background: var(--whatsapp); }
.channel-telegram { background: var(--telegram); }
.channel-instagram { background: linear-gradient(135deg, var(--instagram-a), var(--instagram-b), var(--instagram-c)); }

/* Inbox */
.inbox-shell {
  display: flex;
  height: 100%;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.conv-list {
  width: 300px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

/* Inbox: lock the page to the screen height so only the conversation list and the chat
   messages scroll — the header, reply box and top bar stay put. */
.page-inbox { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.page-inbox .app-shell { flex: 1; min-height: 0; }
.page-inbox .main { min-height: 0; }
.page-inbox .content { min-height: 0; overflow: hidden; }
.page-inbox .inbox-shell { height: 100%; }
.page-inbox .thread { min-height: 0; }
.page-inbox .thread-body { min-height: 0; }

.auth-error {
  background: #fdecec;
  color: #b3372b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}
html[data-theme="dark"] .auth-error { background: rgba(232, 84, 62, 0.15); color: #ff9a8a; }

.conv-list-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.conv-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
}

.conv-tab.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.conv-filters {
  display: flex;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}

.filter-chip.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.conv-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  gap: 10px;
}

.conv-item:hover { background: var(--bg); }
.conv-item.active { background: #eef1ff; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  position: relative;
}

.avatar .mini-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}

.conv-item-body { min-width: 0; flex: 1; }
.conv-item-top { display: flex; justify-content: space-between; align-items: baseline; }
.conv-name { font-weight: 700; font-size: 13px; }
.conv-time { font-size: 11px; color: var(--text-muted); }
.conv-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-unread {
  background: var(--green);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-top: 4px;
}

.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.thread-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.thread-header-info { flex: 1; }
.thread-header-name { font-weight: 700; font-size: 14px; }
.thread-header-sub { font-size: 12px; color: var(--text-muted); }

.lock-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: #b7bacb;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: not-allowed;
  position: relative;
  font-size: 15px;
}

.lock-btn .tooltip {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  background: var(--navy);
  color: white;
  font-size: 11.5px;
  padding: 8px 10px;
  border-radius: 6px;
  width: 210px;
  line-height: 1.4;
  z-index: 5;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.lock-btn:hover .tooltip { display: block; }

.thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fbfbfe;
}

.bubble {
  max-width: 62%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
}

.bubble-in {
  background: white;
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

.bubble-out {
  background: var(--green);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}

.bubble-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
  display: block;
}

.bubble-row { display: flex; align-items: flex-end; gap: 6px; }
.bubble-row.in { align-self: flex-start; }
.bubble-row.out { align-self: flex-end; flex-direction: row-reverse; }
.bubble-delete {
  opacity: 0; transition: opacity var(--transition-fast);
  border: none; background: var(--bg); color: var(--text-muted);
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px;
}
.bubble-row:hover .bubble-delete { opacity: 1; }
.bubble-delete:hover { background: #fdecec; color: #b3372b; }

.thread-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.thread-footer input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13px;
  background: var(--bg);
}

.archive-note {
  margin: 10px 16px 0;
  font-size: 11.5px;
  color: var(--text-muted);
  background: #f1f6ff;
  border: 1px solid #dbe7ff;
  padding: 8px 10px;
  border-radius: 8px;
}

/* Reports */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
}

.stat-sub {
  font-size: 11.5px;
  margin-top: 6px;
  font-weight: 600;
}

.stat-sub.up { color: var(--green); }

.panel {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 14px;
  margin: 0 0 16px;
}

.report-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}

.channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.channel-row:last-child { margin-bottom: 0; }

.channel-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  background: var(--bg);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
}

.channel-nums {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 96px;
  text-align: right;
}

.funnel-step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.funnel-bar {
  height: 34px;
  border-radius: 6px;
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: white;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.funnel-track {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.funnel-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.funnel-label {
  width: 150px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Client portal (salon) */
.portal-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #2a2e58 0%, #f4f5f9 260px);
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}

.portal-card {
  width: 100%;
  max-width: 420px;
}

.portal-brand {
  text-align: center;
  color: white;
  margin-bottom: 24px;
}

.portal-brand .logo {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  display: block;
  margin: 0 auto 14px;
  box-shadow: 0 8px 22px rgba(207, 147, 26, 0.45);
}

.portal-brand h1 { font-size: 17px; margin: 0 0 4px; }
.portal-brand p { font-size: 12.5px; opacity: 0.75; margin: 0; }

.portal-panel {
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(20,22,40,0.15);
  padding: 22px;
}

.portal-panel h2 { font-size: 15px; margin: 0 0 2px; }
.portal-panel .sub { font-size: 12.5px; color: var(--text-muted); margin: 0 0 18px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item input[type=checkbox] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
  flex-shrink: 0;
}

.checklist-info { flex: 1; }
.checklist-name { font-weight: 700; font-size: 13.5px; }
.checklist-name.done { text-decoration: line-through; color: var(--text-muted); }
.checklist-duration { font-size: 11.5px; color: var(--text-muted); }
.checklist-price { font-weight: 700; font-size: 13px; }

.portal-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 4px;
  font-weight: 800;
  font-size: 15px;
}

.portal-total span.muted { font-weight: 600; font-size: 12.5px; color: var(--text-muted); }

.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

.pay-field {
  margin-bottom: 12px;
}

.pay-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-muted);
}

.pay-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.pay-row { display: flex; gap: 10px; }
.pay-row .pay-field { flex: 1; }

.success-box {
  text-align: center;
  padding: 20px 0 6px;
}

.success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e6f9ef;
  color: var(--green);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.hidden { display: none !important; }

.demo-banner {
  background: #fff7e6;
  border-bottom: 1px solid #ffe4a8;
  color: #8a6414;
  font-size: 12px;
  padding: 7px 20px;
  text-align: center;
  font-weight: 600;
}

/* ==========================================================================
   Design upgrade: premium type, dark mode, motion, and unique widgets
   ========================================================================== */

:root {
  --font-sans: 'Poppins', 'Montserrat', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow-lift: 0 14px 32px rgba(20, 22, 40, 0.16);
  --transition-fast: 0.15s ease;
  --transition-med: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body, input, button { font-family: var(--font-sans); }

html[data-theme="dark"] {
  --navy: #12142a;
  --navy-light: #1c1f3d;
  --bg: #0e1020;
  --white: #181a30;
  --border: #262a4a;
  --text: #eef0fb;
  --text-muted: #9195b8;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .inbox-shell,
html[data-theme="dark"] .portal-panel,
html[data-theme="dark"] .nudge-card,
html[data-theme="dark"] .bell-panel,
html[data-theme="dark"] .cmdk-box,
html[data-theme="dark"] .topbar { background: var(--white); border-color: var(--border); }
html[data-theme="dark"] .search,
html[data-theme="dark"] .thread-footer input,
html[data-theme="dark"] .pay-field input,
html[data-theme="dark"] .sync-pill,
html[data-theme="dark"] .bell-btn { background: var(--navy-light); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .thread-body { background: #10122a; }
html[data-theme="dark"] .bubble-in { background: var(--white); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .column-drop.drag-over { background: #232750; }
html[data-theme="dark"] .loyalty-wrap { background: var(--navy-light); border-color: var(--border); }
html[data-theme="dark"] .loyalty-ring circle.bg { stroke: var(--border); }
html[data-theme="dark"] .portal-page { background: linear-gradient(180deg, #0a0b18 0%, var(--bg) 260px); }

body, .card, .panel, .stat-card, .topbar, .sidebar, .conv-item, .bubble, input, .nudge-card {
  transition: background var(--transition-med), color var(--transition-med), border-color var(--transition-med);
}

/* Entrance + interaction motion */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(35, 178, 109, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(35, 178, 109, 0); }
  100% { box-shadow: 0 0 0 0 rgba(35, 178, 109, 0); }
}
@keyframes highlightPulse {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 4px rgba(138, 107, 240, 0.45); }
}

.animate-in { animation: fadeInUp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.card.dropping { animation: popIn 0.3s ease; }
.card.highlight { animation: highlightPulse 1.4s ease 2; }

.card { transition: transform var(--transition-fast), box-shadow var(--transition-fast); }
.card:hover { transform: translateY(-2px); }

.btn { transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast); }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.btn:active:not(:disabled) { transform: translateY(0); }

.bar-fill, .funnel-bar { transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Topbar extras: live-sync pill + notification bell */
.topbar-extras { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.sync-pill {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  padding: 7px 13px; border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
/* First thing to go on a narrower window — it's ambient decoration, not a control. */
@media (max-width: 1300px) {
  .sync-pill { display: none; }
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulseDot 2s infinite; }

.bell-wrap { position: relative; flex-shrink: 0; }
.bell-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; color: var(--text-muted); position: relative;
}
.bell-btn .dot {
  position: absolute; top: 5px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--white);
}
.bell-panel {
  position: absolute; top: 46px; right: 0; width: 280px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lift);
  padding: 8px; z-index: 50; display: none; animation: popIn 0.18s ease;
}
.bell-panel.open { display: block; }
.bell-item { padding: 10px; border-radius: 8px; font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start; }
.bell-item:hover { background: var(--bg); }
.bell-item .ic { font-size: 14px; margin-top: 1px; }
.bell-item .txt b { display: block; font-size: 12.5px; }
.bell-item .txt span { color: var(--text-muted); font-size: 11px; }

/* Command palette (Ctrl/Cmd+K) */
.cmdk-overlay {
  position: fixed; inset: 0; background: rgba(15, 17, 32, 0.55);
  backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh; z-index: 500;
}
.cmdk-overlay.open { display: flex; }
.cmdk-box {
  width: 92%; max-width: 520px; background: var(--white);
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden; animation: popIn 0.16s ease;
}
.cmdk-input {
  width: 100%; border: none; padding: 16px 18px; font-size: 15px;
  outline: none; background: var(--white); color: var(--text);
  border-bottom: 1px solid var(--border);
}
.cmdk-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.cmdk-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.cmdk-item.active, .cmdk-item:hover { background: var(--bg); }
.cmdk-item .tag { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.cmdk-hint { padding: 10px 14px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border); display: flex; justify-content: space-between; }
kbd { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 10.5px; }

/* Toasts */
.toast-root { position: fixed; top: 16px; right: 16px; z-index: 600; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--navy); color: white; padding: 12px 16px;
  border-radius: 10px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lift); max-width: 320px;
  animation: toastIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.success { background: var(--green); }
.toast.leaving { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* Confetti */
.confetti-root { position: fixed; inset: 0; pointer-events: none; z-index: 700; overflow: hidden; }
.confetti-piece { position: absolute; width: 8px; height: 8px; opacity: 0.9; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(540deg); opacity: 0; } }

/* Smart nudges panel (Pipeline) — unique "AI assistant" strip, not part of the reference screenshot */
.nudge-row { display: flex; gap: 12px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.nudge-card {
  flex: 1 1 240px; min-width: 240px;
  background: linear-gradient(135deg, #ffffff, #f7f8ff);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow);
}
.nudge-card .tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--purple); margin-bottom: 6px; display: block; }
.nudge-card p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.4; }
.nudge-card button { border: none; background: var(--navy); color: white; padding: 6px 12px; border-radius: 8px; font-size: 11.5px; font-weight: 600; cursor: pointer; }

/* Loyalty ring (Client Portal) — unique salon-specific retention widget */
.loyalty-wrap { display: flex; align-items: center; gap: 14px; background: #f6f4ff; border: 1px solid #e7e1ff; border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; }
.loyalty-ring circle.bg { stroke: #e7e1ff; }
.loyalty-ring circle.fg { stroke: var(--purple); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.loyalty-text b { display: block; font-size: 13px; }
.loyalty-text span { font-size: 11.5px; color: var(--text-muted); }

.checklist-item input[type=checkbox] { transition: transform var(--transition-fast); }
.checklist-item input[type=checkbox]:checked { transform: scale(1.15); }

/* ==========================================================================
   Auth (login / forgot password)
   ========================================================================== */

.auth-shell { display: flex; min-height: 100vh; }

.auth-side {
  width: 42%;
  min-width: 320px;
  background: linear-gradient(160deg, #232653, var(--navy) 60%);
  color: white;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.auth-side-inner { max-width: 360px; }
.auth-feature {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; margin-bottom: 14px; opacity: 0.92;
}
.auth-feature span { flex-shrink: 0; }

.auth-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: var(--bg); }
.auth-form-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lift); padding: 30px; }
.auth-form-card h2 { margin: 0 0 4px; font-size: 19px; }
.auth-form-card .sub { font-size: 12.5px; color: var(--text-muted); margin: 0 0 20px; }

.auth-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 12.5px; }
.auth-row a { color: var(--blue); font-weight: 600; }
.auth-check { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }

.auth-demo-note { font-size: 11.5px; color: var(--text-muted); background: #f1f6ff; border: 1px solid #dbe7ff; padding: 8px 10px; border-radius: 8px; margin-top: 14px; line-height: 1.4; }
html[data-theme="dark"] .auth-demo-note { background: var(--navy-light); border-color: var(--border); }

.auth-demo-users { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.demo-user-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--white);
  border-radius: 8px; padding: 7px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; text-align: left; color: var(--text);
}
.demo-user-chip:hover { background: var(--bg); }
.demo-user-chip .role-tag { margin-left: auto; font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }

.mini-avatar {
  width: 22px; height: 22px; border-radius: 50%; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}

/* ==========================================================================
   Settings page: tabs, table, modal, toggle switches
   ========================================================================== */

.settings-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.settings-tab {
  border: 1px solid var(--border); background: var(--white);
  padding: 8px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--text-muted);
}
.settings-tab.active { background: var(--navy); color: white; border-color: var(--navy); }

.settings-pane { display: none; }
.settings-pane.active { display: block; }

.avatar-picker { display: flex; gap: 8px; margin-bottom: 18px; }
.avatar-swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.avatar-swatch.selected { border-color: var(--text); }

.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.settings-row-label b { display: block; font-size: 13px; }
.settings-row-label span { font-size: 12px; color: var(--text-muted); }

.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--border); border-radius: 20px; cursor: pointer;
  transition: background var(--transition-fast);
}
.switch .track::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::before { transform: translateX(18px); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table-person { display: flex; align-items: center; gap: 10px; }
.table-person span.name { font-weight: 600; display: block; }
.table-person span.email { font-size: 11.5px; color: var(--text-muted); }

.role-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.role-owner { background: #ede7ff; color: #6d43e0; }
.role-manager { background: #e2f0ff; color: #1a63d6; }
.role-staff { background: #fff2df; color: #b06d05; }
.role-custom { background: #e4f8ec; color: #17864f; }
html[data-theme="dark"] .role-owner { background: #2a2260; color: #c6b3ff; }
html[data-theme="dark"] .role-manager { background: #1c2c4d; color: #9cc4ff; }
html[data-theme="dark"] .role-staff { background: #3a2c14; color: #ffd28a; }
html[data-theme="dark"] .role-custom { background: #123322; color: #8ff0bc; }

.link-btn { border: none; background: none; color: var(--red); font-size: 12px; font-weight: 600; cursor: pointer; }
.link-btn:disabled { color: var(--text-muted); cursor: not-allowed; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,17,32,0.5); display: none; align-items: center; justify-content: center; z-index: 400; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal-box { width: 100%; max-width: 440px; background: var(--white); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); padding: 22px; animation: popIn 0.18s ease; max-height: 86vh; overflow-y: auto; }
.modal-box h3 { margin: 0 0 4px; font-size: 16px; }
.modal-box .sub { font-size: 12px; color: var(--text-muted); margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn { flex: 1; justify-content: center; }

.perm-check { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 12.5px; }
.perm-check input { width: 16px; height: 16px; accent-color: var(--green); flex-shrink: 0; }

.role-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
}
.role-card:last-child { margin-bottom: 0; }
.role-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.role-perms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
@media (max-width: 500px) { .role-perms-grid { grid-template-columns: 1fr; } }

/* Integrations */
.integration-card { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.integration-card:last-child { border-bottom: none; }
.integration-card .channel-icon { width: 40px; height: 40px; font-size: 17px; }
.integration-info { flex: 1; }
.integration-info b { display: block; font-size: 13.5px; }
.integration-info span { font-size: 12px; color: var(--text-muted); }
.status-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; text-transform: uppercase; margin-right: 10px; }
.status-connected { background: #e4f8ec; color: #17864f; }
.status-disconnected { background: #f0f1f6; color: #8a8d9f; }
html[data-theme="dark"] .status-connected { background: #123322; color: #8ff0bc; }
html[data-theme="dark"] .status-disconnected { background: var(--navy-light); color: var(--text-muted); }

/* Activity log timeline */
.timeline-item { display: flex; gap: 12px; padding: 10px 0; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--purple); margin-top: 6px; flex-shrink: 0; }
.timeline-item b { display: block; font-size: 13px; font-weight: 600; }
.timeline-item span { font-size: 11.5px; color: var(--text-muted); }
.timeline-item > div:nth-child(2) { flex: 1; min-width: 0; }
.log-restore-btn {
  align-self: flex-start; flex-shrink: 0; white-space: nowrap;
  border: 1px solid var(--border); background: var(--white); color: var(--blue);
  border-radius: 14px; padding: 3px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.log-restore-btn:hover { background: #eef1ff; border-color: var(--blue); }
.log-restore-btn:disabled { opacity: 0.5; cursor: default; }

/* User menu (topbar) */
.user-menu-wrap { position: relative; flex-shrink: 0; }
.user-menu-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--white); border-radius: 20px; padding: 5px 12px 5px 5px; cursor: pointer; }
.user-menu-btn .name { font-size: 12.5px; font-weight: 600; }
.user-menu-panel {
  position: absolute; top: 46px; right: 0; width: 210px;
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lift); padding: 8px; z-index: 50; display: none; animation: popIn 0.18s ease;
}
.user-menu-panel.open { display: block; }
.user-menu-item { padding: 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; display: block; color: var(--text); }
.user-menu-item:hover { background: var(--bg); }
.user-menu-item.danger { color: var(--red); }

@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* WhatsApp live-integration status */
.wa-status-banner {
  font-size: 12px; padding: 7px 20px; text-align: center; font-weight: 600;
}
.wa-status-banner.ok { background: #e4f8ec; color: #17864f; border-bottom: 1px solid #bfe9d1; }
.wa-status-banner.pending { background: #fdecec; color: #b3372b; border-bottom: 1px solid #f5c6c6; }
html[data-theme="dark"] .wa-status-banner.ok { background: #123322; color: #8ff0bc; border-color: var(--border); }
html[data-theme="dark"] .wa-status-banner.pending { background: #3a1c1c; color: #f5a3a3; border-color: var(--border); }

.live-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 700;
  color: var(--green); text-transform: uppercase; letter-spacing: 0.03em; margin-left: 6px;
}
.live-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulseDot 2s infinite; }

.btn-live {
  background: #e4f8ec; color: #17864f; border: 1px solid #bfe9d1;
}
.btn-live:hover { background: #d7f3e2; }
.btn-live .sync-dot { background: #17864f; }
html[data-theme="dark"] .btn-live { background: #123322; color: #8ff0bc; border-color: var(--border); }
html[data-theme="dark"] .btn-live .sync-dot { background: #8ff0bc; }

/* Compact circular icon button — matches the bell button's footprint, for secondary/utility
   topbar actions (like "reset demo data") that shouldn't compete for space with the primary CTA. */
.btn-icon-only {
  width: 38px; height: 38px; padding: 0; justify-content: center;
  background: var(--white); border: 1px solid var(--border); color: var(--text-muted);
  font-size: 16px;
}
.btn-icon-only:hover { background: var(--bg); color: var(--text); }

/* EN | RU language switch (header on signed-in pages, top corner on the sign-in pages) */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--white); margin-right: 8px; flex-shrink: 0; }
.lang-switch button { border: 0; background: transparent; color: var(--text-muted); font: 700 11.5px/1 inherit; padding: 7px 11px; cursor: pointer; letter-spacing: 0.04em; }
.lang-switch button.active { background: var(--green); color: #fff; }
.lang-switch button:not(.active):hover { color: var(--text); }
.lang-switch-float { position: fixed; top: 14px; right: 14px; z-index: 50; margin-right: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); }

/* Russian translation shown under a chat message */
.bubble-tr { margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(120, 124, 150, 0.4); font-size: 12.5px; font-style: italic; opacity: 0.9; }
.bubble-tr.tr-error { color: var(--red); font-style: normal; }

/* First-login guide */
.guide-box { max-width: 480px; text-align: left; }
.guide-icon { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.guide-body p { font-size: 13px; line-height: 1.6; margin: 0 0 10px; color: var(--text); }
.guide-dots { display: flex; gap: 6px; justify-content: center; margin: 14px 0 6px; }
.guide-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.guide-dots span.on { background: var(--green); width: 18px; border-radius: 4px; }
