/*
 * AI Employee Platform — professional UI layer.
 * Loaded after every page stylesheet; all rules are scoped under
 * body.theme-app so they refine the original component styles.
 * Brand: navy #1e2673, pink #d41472.
 */

:root {
  --brand-navy: #1e2673;
  --brand-navy-dark: #161c58;
  --brand-pink: #d41472;
  --brand-pink-dark: #b80f62;
  --brand-pink-soft: #fde7f1;
  --brand-gradient: linear-gradient(135deg, #1e2673 0%, #6a1f78 55%, #d41472 100%);

  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6e8f0;
  --line-2: #eef0f6;
  --surface: #ffffff;
  --canvas: #f4f6fb;

  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #2563eb;
  --info-soft: #eff6ff;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(30, 38, 115, 0.08);
  --shadow-lg: 0 18px 48px rgba(30, 38, 115, 0.16);
  --ring: 0 0 0 4px rgba(212, 20, 114, 0.14);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Tamil", "Nirmala UI",
    "Noto Sans", Arial, sans-serif;
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

body.theme-app {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -0.005em;
}

.theme-app button,
.theme-app input,
.theme-app select,
.theme-app textarea {
  font-family: inherit;
}

.theme-app h1, .theme-app h2, .theme-app h3, .theme-app h4, .theme-app h5 {
  font-family: inherit;
  letter-spacing: -0.02em;
}

.theme-app ::selection { background: var(--brand-pink-soft); color: var(--ink); }

.theme-app :focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.theme-app *::-webkit-scrollbar { width: 10px; height: 10px; }
.theme-app *::-webkit-scrollbar-thumb { background: #cfd4e3; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.theme-app *::-webkit-scrollbar-thumb:hover { background: #b4bbd0; background-clip: padding-box; border: 2px solid transparent; }

/* ------------------------------------------------------------------ */
/* App shell: sidebar + main                                           */
/* ------------------------------------------------------------------ */

.theme-app .dashboard {
  display: flex;
  min-height: 100vh;
  background: var(--canvas);
}

.theme-app .sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  flex: 0 0 256px;
  width: 256px;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(212, 20, 114, 0.18) 0%, rgba(212, 20, 114, 0) 55%),
    linear-gradient(180deg, #1e2673 0%, #171d5c 100%);
  color: #fff;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.04) inset;
  overflow-y: auto;
  z-index: 20;
}

.theme-app .sidebar h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 6px 30px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #fff;
}

.theme-app .sidebar h2::before {
  content: "";
  flex: 0 0 38px;
  height: 38px;
  background: url("../images/brand-logo.png") center / contain no-repeat;
  filter: drop-shadow(0 4px 10px rgba(212, 20, 114, 0.45));
}

.theme-app .sidebar .admin-role {
  margin: -18px 6px 24px 56px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  background: none;
  padding: 0;
}

.theme-app .sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.theme-app .sidebar ul::before {
  content: "Menu";
  display: block;
  margin: 0 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.theme-app .sidebar ul li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.theme-app .sidebar ul li:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.theme-app .sidebar ul li.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.theme-app .sidebar ul li.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 9px;
  bottom: 9px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand-pink);
  box-shadow: 0 0 12px rgba(212, 20, 114, 0.8);
}

.theme-app .logout-btn {
  margin-top: auto;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.theme-app .logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.theme-app .logout-btn::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='m16 17 5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='m16 17 5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: 0.85;
}

.theme-app .logout-btn:hover {
  background: var(--brand-pink);
  border-color: var(--brand-pink);
  color: #fff;
}

.theme-app .main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 40px;
  background: var(--canvas);
}

/* Top bar */
.theme-app .topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 24px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}

.theme-app .topbar h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

.theme-app .topbar .page-description {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.theme-app .topbar-right,
.theme-app .topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-app .profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.theme-app .profile::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1'/%3E%3C/svg%3E") no-repeat center,
    var(--brand-gradient);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(212, 20, 114, 0.25);
}

/* ------------------------------------------------------------------ */
/* Cards / KPIs                                                        */
/* ------------------------------------------------------------------ */

.theme-app .cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0 0 24px;
}

.theme-app .card {
  position: relative;
  min-height: 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}

.theme-app .card:hover {
  transform: translateY(-2px);
  border-color: #dfe2ee;
  box-shadow: var(--shadow-md);
}

.theme-app .card h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-transform: none;
}

.theme-app .card p {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.theme-app .card small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.theme-app .card small.expiry-date {
  display: inline-block;
  width: fit-content;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-pink-soft);
  color: var(--brand-pink-dark);
  font-weight: 600;
  font-size: 12px;
}

/* Lead temperature cards: colour accent on the left */
.theme-app .card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
}
.theme-app .card:has(.lead-hot-text)::after { background: #ef4444; }
.theme-app .card:has(.lead-warm-text)::after { background: #f59e0b; }
.theme-app .card:has(.lead-cold-text)::after { background: #3b82f6; }

.theme-app .lead-hot-text { color: #dc2626 !important; }
.theme-app .lead-warm-text { color: #d97706 !important; }
.theme-app .lead-cold-text { color: #2563eb !important; }

/* Talk-time usage bar (dashboard) */
.theme-app .usage-meter {
  margin-top: 14px;
  height: 8px;
  border-radius: 999px;
  background: var(--line-2);
  overflow: hidden;
}
.theme-app .usage-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.6s ease;
}
.theme-app .usage-meter.low span { background: linear-gradient(90deg, #f59e0b, #d97706); }
.theme-app .usage-meter.critical span { background: linear-gradient(90deg, #f43f5e, #dc2626); }

/* Admin KPI icon cards */
.theme-app .card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 20px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.theme-app .btn-basic-train,
.theme-app .btn-master-train,
.theme-app .btn-finish,
.theme-app .btn-save-master,
.theme-app .btn-save,
.theme-app .btn-add,
.theme-app .btn-fetch-url,
.theme-app .btn-start-chat,
.theme-app .view-btn,
.theme-app .report-btn,
.theme-app .copy-btn,
.theme-app .refresh-btn,
.theme-app .btn-add-qa,
.theme-app .btn-add-option,
.theme-app .btn-cancel,
.theme-app .btn-redo,
.theme-app .btn-change-type,
.theme-app .back-btn,
.theme-app .edit-btn,
.theme-app .delete-btn,
.theme-app .status-button,
.theme-app .remove-file-btn,
.theme-app .btn-clear-extracted {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.theme-app .btn-basic-train,
.theme-app .btn-master-train {
  height: 54px;
  border: none;
  font-size: 15px;
  box-shadow: 0 8px 20px rgba(30, 38, 115, 0.18);
}

.theme-app .btn-basic-train:hover,
.theme-app .btn-master-train:hover,
.theme-app .btn-finish:hover:not(:disabled),
.theme-app .btn-save-master:hover:not(:disabled),
.theme-app .btn-save:hover:not(:disabled),
.theme-app .btn-add:hover,
.theme-app .btn-start-chat:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(212, 20, 114, 0.25);
}

.theme-app .btn-basic-train:active,
.theme-app .btn-master-train:active,
.theme-app .btn-finish:active,
.theme-app .btn-save:active,
.theme-app .btn-start-chat:active {
  transform: translateY(0);
}

.theme-app button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
  box-shadow: none !important;
}

.theme-app .copy-btn {
  height: 36px;
  padding: 0 14px;
  border: none;
  background: var(--brand-navy);
  color: #fff;
  font-size: 13px;
}
.theme-app .copy-btn:hover { background: var(--brand-pink); }

.theme-app .view-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #dfe2f0;
  background: #fff;
  color: var(--brand-navy);
  font-size: 13px;
  white-space: nowrap;
}
.theme-app .view-btn:hover { border-color: var(--brand-navy); background: #f3f4fb; }

.theme-app .report-btn {
  height: 34px;
  padding: 0 14px;
  border: none;
  background: var(--brand-pink-soft);
  color: var(--brand-pink-dark);
  font-size: 13px;
  white-space: nowrap;
}
.theme-app .report-btn:hover:not(:disabled) { background: var(--brand-pink); color: #fff; }

.theme-app .refresh-btn {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  box-shadow: var(--shadow-xs);
}
.theme-app .refresh-btn:hover:not(:disabled) { border-color: var(--brand-navy); color: var(--brand-navy); }

.theme-app .back-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-navy);
  font-size: 18px;
  box-shadow: var(--shadow-xs);
}
.theme-app .back-btn:hover { border-color: var(--brand-navy); }

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */

.theme-app input[type="text"],
.theme-app input[type="email"],
.theme-app input[type="password"],
.theme-app input[type="tel"],
.theme-app input[type="url"],
.theme-app input[type="number"],
.theme-app select,
.theme-app textarea {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  border: 1px solid #d9dce8;
  border-radius: 10px;
  background-color: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.theme-app input[type="text"]:hover,
.theme-app input[type="email"]:hover,
.theme-app input[type="password"]:hover,
.theme-app input[type="tel"]:hover,
.theme-app input[type="url"]:hover,
.theme-app input[type="number"]:hover,
.theme-app select:hover,
.theme-app textarea:hover {
  border-color: #c2c7d8;
}

.theme-app input[type="text"]:focus,
.theme-app input[type="email"]:focus,
.theme-app input[type="password"]:focus,
.theme-app input[type="tel"]:focus,
.theme-app input[type="url"]:focus,
.theme-app input[type="number"]:focus,
.theme-app select:focus,
.theme-app textarea:focus {
  outline: none;
  border-color: var(--brand-pink);
  box-shadow: var(--ring);
}

.theme-app ::placeholder { color: var(--muted-2); opacity: 1; }

.theme-app input[type="checkbox"],
.theme-app input[type="radio"] {
  accent-color: var(--brand-pink);
}

/* Search boxes */
.theme-app .search-box input,
.theme-app .filters input {
  height: 42px;
  padding: 0 14px 0 40px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center;
  box-shadow: var(--shadow-xs);
}

.theme-app .filters select {
  height: 42px;
  padding: 0 36px 0 14px;
  box-shadow: var(--shadow-xs);
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.theme-app .table-wrapper,
.theme-app .payment-table-wrapper {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: auto;
  max-height: calc(100vh - 210px);
}

.theme-app .clients-table,
.theme-app .payment-table,
.theme-app .owners-box table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  background: var(--surface);
}

.theme-app .clients-table thead th,
.theme-app .payment-table thead th,
.theme-app .owners-box table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 16px;
  background: #f8f9fc;
  background-image: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.theme-app .clients-table tbody td,
.theme-app .payment-table tbody td,
.theme-app .owners-box table tbody td {
  padding: 14px 16px;
  color: var(--ink-2);
  vertical-align: middle;
  border-bottom: 1px solid var(--line-2);
  background: transparent;
}

.theme-app .clients-table tbody tr,
.theme-app .payment-table tbody tr,
.theme-app .owners-box table tbody tr {
  transition: background-color 0.12s ease;
}

.theme-app .clients-table tbody tr:hover td,
.theme-app .payment-table tbody tr:hover td,
.theme-app .owners-box table tbody tr:hover td {
  background: #fafbff;
}

.theme-app .clients-table tbody tr:last-child td,
.theme-app .payment-table tbody tr:last-child td,
.theme-app .owners-box table tbody tr:last-child td {
  border-bottom: none;
}

/* Long AI summaries: 3 lines, click to expand */
.theme-app .client-summary {
  min-width: 260px;
  max-width: 340px;
}

.theme-app .client-summary .summary-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.theme-app .client-summary .summary-text p,
.theme-app .mobile-card-value .summary-text p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.theme-app .client-summary .summary-text.expanded {
  display: block;
  -webkit-line-clamp: unset;
}

.theme-app .client-summary .summary-toggle {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-pink);
  cursor: pointer;
  user-select: none;
}

.theme-app .no-summary {
  color: var(--muted-2);
  font-style: normal;
  font-size: 13px;
}

/* Pills & badges */
.theme-app .score-badge,
.theme-app .lead-badge,
.theme-app .recommend-badge,
.theme-app .status-badge,
.theme-app .payment-status,
.theme-app .number-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.theme-app .client-avatar,
.theme-app .owner-avatar {
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(30, 38, 115, 0.2);
}

.theme-app .transaction-id {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink-2);
  background: #f3f4f8;
  padding: 3px 8px;
  border-radius: 6px;
}

.theme-app .action-btn {
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.theme-app .action-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Toolbars above tables */
.theme-app .clients-toolbar,
.theme-app .payment-toolbar,
.theme-app .owners-header,
.theme-app .payments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.theme-app .client-count {
  font-size: 14px;
  color: var(--muted);
}
.theme-app .client-count strong { color: var(--ink); }

.theme-app .payment-toolbar h2,
.theme-app .owners-header h3,
.theme-app .payments-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.theme-app .payment-toolbar p,
.theme-app .owners-header p,
.theme-app .payments-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.theme-app .owners-box,
.theme-app .payments-box,
.theme-app .payments-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.theme-app .owners-box .table-wrapper,
.theme-app .payments-box .payment-table-wrapper,
.theme-app .payments-section .payment-table-wrapper {
  box-shadow: none;
  max-height: none;
}

.theme-app .payment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.theme-app .payment-summary-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfe 100%);
}
.theme-app .payment-summary-card span {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.theme-app .payment-summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* Empty & loading states */
.theme-app .empty-box,
.theme-app .loading-box {
  padding: 48px 24px;
  border: 1px dashed #d6dae6;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}

.theme-app .error-message,
.theme-app .payment-error {
  padding: 12px 16px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: #b91c1c;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ------------------------------------------------------------------ */
/* Dashboard specifics                                                 */
/* ------------------------------------------------------------------ */

.theme-app .your-link-banner,
.theme-app .link-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 18px;
  padding: 14px 16px 14px 18px;
  border: 1px solid #f6c7dc;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, #fff5fa 0%, #ffffff 70%);
  box-shadow: var(--shadow-xs);
}

.theme-app .your-link-banner > span,
.theme-app .link-banner > span {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.theme-app .your-link-banner a,
.theme-app .link-banner a {
  flex: 1 1 260px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-pink-dark);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-app .your-link-banner a:hover,
.theme-app .link-banner a:hover { border-color: var(--brand-pink); }

.theme-app .train-trigger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}
.theme-app .train-trigger button { width: 100%; margin: 0; }

.theme-app .master-preview-banner,
.theme-app .ai-setup,
.theme-app .settings-box,
.theme-app .chat-container,
.theme-app .chat-view {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.theme-app .ai-setup { padding: 26px 28px; }

.theme-app .master-preview-content,
.theme-app .extracted-content {
  max-height: 280px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* Questionnaire */
.theme-app .section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-pink);
  border-radius: 10px;
  background: #f7f8fc;
  color: var(--brand-navy);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: none;
}
.theme-app .section-questions > .section-heading:first-child { margin-top: 4px; }

/* Yes / No toggle: explicit colours for both states */
.theme-app .q-yes-no button {
  min-width: 96px;
  height: 42px;
  padding: 0 18px;
  border: 1.5px solid #d9dce8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font-weight: 600;
}
.theme-app .q-yes-no button:hover {
  border-color: var(--brand-navy);
  color: var(--brand-navy);
}
.theme-app .q-yes-no button.selected {
  border-color: var(--brand-navy);
  background: var(--brand-navy);
  color: #fff;
  box-shadow: 0 6px 14px rgba(30, 38, 115, 0.22);
}

.theme-app .q-field {
  margin-bottom: 18px;
}
.theme-app .q-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.theme-app .q-input,
.theme-app .q-select,
.theme-app .q-time-select {
  min-height: 44px;
}

.theme-app .master-type-card {
  border-radius: var(--radius-lg);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.theme-app .master-type-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.theme-app .file-drop-zone {
  border-radius: var(--radius-lg);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.theme-app .file-drop-zone:hover {
  border-color: var(--brand-pink);
  background: #fff7fb;
}

/* Overlays */
.theme-app .translate-overlay,
.theme-app .modal-overlay {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.theme-app .modal-box,
.theme-app .translate-box {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: theme-pop 0.18s ease-out;
}

@keyframes theme-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* Questions list (basic questions) */
.theme-app .question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.theme-app .question-card:hover { border-color: #d7dbea; box-shadow: var(--shadow-md); }

/* Chats */
.theme-app .user-msg,
.theme-app .bot-msg {
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.55;
  box-shadow: var(--shadow-xs);
}
.theme-app .date-separator span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* SweetAlert2 dialogs */
.theme-app .swal2-popup {
  font-family: var(--font);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow-lg);
}
.theme-app .swal2-title { font-size: 22px; font-weight: 700; color: var(--ink); }
.theme-app .swal2-html-container { color: var(--ink-2); font-size: 15px; }
.theme-app .swal2-styled.swal2-confirm,
.theme-app .swal2-styled.swal2-cancel {
  border-radius: 10px !important;
  font-weight: 600;
  padding: 10px 22px;
}
.theme-app .swal2-styled:focus { box-shadow: var(--ring) !important; }
.theme-app .swal2-actions { gap: 8px; }

/* Toasts (login, logout, saved, deleted…) */
.theme-app .swal2-popup.swal2-toast {
  /* Informational only: clicks pass through to buttons underneath */
  pointer-events: none;
  width: min(380px, calc(100vw - 24px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
}
.theme-app .swal2-popup.swal2-toast .swal2-title { margin: 0 6px; font-size: 14.5px; font-weight: 700; }
.theme-app .swal2-popup.swal2-toast .swal2-html-container { margin: 2px 6px 0; padding: 0; font-size: 13px; color: var(--muted); text-align: left; }
.theme-app .swal2-popup.swal2-toast .swal2-timer-progress-bar { background: var(--brand-pink); opacity: 0.5; }
.theme-app .swal2-container.swal2-top-end { padding: 14px; }

@media (max-width: 480px) {
  .theme-app .swal2-popup:not(.swal2-toast) { width: calc(100vw - 32px); padding: 22px 18px 18px; }
  .theme-app .swal2-title { font-size: 19px; }
  .theme-app .swal2-actions { width: 100%; }
  .theme-app .swal2-actions .swal2-styled { flex: 1 1 0; margin: 0; }
  .theme-app .swal2-container.swal2-top-end { padding: 10px; }
}

/* ------------------------------------------------------------------ */
/* Auth pages: see auth.css                                            */
/* ------------------------------------------------------------------ */

.theme-public .public-chat-wrapper,
.theme-public .chat-wrapper {
  font-family: var(--font);
}

/* ------------------------------------------------------------------ */
/* Public customer chat                                                */
/* ------------------------------------------------------------------ */

.theme-public .public-chat-wrapper {
  font-family: var(--font);
}
.theme-public .chat-wrapper {
  box-shadow: 0 30px 80px rgba(8, 10, 40, 0.35);
}
.theme-public .form-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.theme-public .form-title::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  background: url("../images/brand-logo.png") center / contain no-repeat;
  filter: drop-shadow(0 8px 18px rgba(212, 20, 114, 0.35));
}
.theme-public .form-title::after {
  content: "Chat or talk with our AI assistant — it takes a few seconds to start.";
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}
.theme-public .guest-form input {
  height: 48px;
  border-radius: 12px;
}
.theme-public .btn-start-chat {
  height: 50px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(212, 20, 114, 0.28);
}
.theme-public .lang-card {
  border-radius: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.theme-public .lang-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-pink);
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

/*
 * One layout for every owner/admin page. The original page stylesheets use
 * different breakpoints (768px, 991px, 1100px) and centred, wrapping menus;
 * these rules set the layout explicitly so all pages behave the same.
 */

/* Tablet & desktop: left side navigation */
@media (min-width: 769px) {
  .theme-app .dashboard { flex-direction: row; }
  .theme-app .sidebar { text-align: left; }
  .theme-app .sidebar ul {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow: visible;
  }
  .theme-app .sidebar ul li { flex: 0 0 auto; width: auto; margin: 0; }
  .theme-app .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
}

@media (max-width: 1200px) {
  .theme-app .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 769px) and (max-width: 992px) {
  .theme-app .sidebar { flex-basis: 220px; width: 220px; padding: 20px 12px; }
  .theme-app .main { padding: 24px 20px 32px; }
}

/* Phone: compact top bar — brand + logout on one line, tabs in one row below */
@media (max-width: 768px) {
  .theme-app .dashboard { flex-direction: column; }

  .theme-app .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand logout"
      "nav   nav";
    align-items: center;
    gap: 12px;
    width: 100%;
    height: auto;
    flex: 0 0 auto;
    padding: 12px 14px 12px;
    text-align: left;
    overflow: visible;
  }

  .theme-app .sidebar h2 {
    grid-area: brand;
    justify-content: flex-start;
    margin: 0;
    min-width: 0;
    font-size: 16px;
    gap: 10px;
  }
  .theme-app .sidebar h2::before { flex: 0 0 32px; height: 32px; border-radius: 9px; font-size: 12px; }
  .theme-app .sidebar .admin-role { display: none; }

  .theme-app .logout-btn {
    grid-area: logout;
    width: auto;
    height: 36px;
    margin: 0;
    padding: 0 12px;
    font-size: 13px;
  }

  .theme-app .sidebar ul {
    grid-area: nav;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    margin: 0 -14px;
    padding: 0 14px 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .theme-app .sidebar ul::-webkit-scrollbar { display: none; }
  .theme-app .sidebar ul::before { display: none; }

  .theme-app .sidebar ul li {
    flex: 1 0 auto;          /* share the row evenly; scroll if they do not fit */
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 9px 14px;
    font-size: 13.5px;
    white-space: nowrap;
    text-align: center;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.06);
  }
  .theme-app .sidebar ul li.active { background: var(--brand-pink); color: #fff; box-shadow: none; }
  .theme-app .sidebar ul li.active::before { display: none; }

  .theme-app .main { padding: 18px 14px 28px; }

  /* Page header: title left, profile right */
  .theme-app .topbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    text-align: left;
  }
  .theme-app .topbar > h3,
  .theme-app .topbar > div:first-child { flex: 1 1 auto; min-width: 0; }
  .theme-app .topbar h3 { font-size: 19px; line-height: 1.25; }
  .theme-app .topbar-right,
  .theme-app .topbar-left { flex-wrap: wrap; gap: 8px; }
  .theme-app .profile { height: 36px; padding-right: 12px; font-size: 13px; }
  .theme-app .profile::before { width: 24px; height: 24px; background-size: 14px, cover; }

  .theme-app .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .theme-app .card { padding: 16px; }
  .theme-app .card p { font-size: 24px; }

  /* Owner dashboard KPIs: talk time full, 2 totals, then Hot / Warm / Cold in one row */
  .theme-page-dashboard .cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .theme-page-dashboard .cards .card { grid-column: span 2; }
  .theme-page-dashboard .cards .card:nth-child(1) { grid-column: 1 / -1; }
  .theme-page-dashboard .cards .card:nth-child(2),
  .theme-page-dashboard .cards .card:nth-child(3) { grid-column: span 3; }
  .theme-page-dashboard .cards .card:nth-child(n + 4) { padding: 14px 12px; }
  .theme-page-dashboard .cards .card:nth-child(n + 4) p { font-size: 22px; }

  .theme-app .ai-setup { padding: 18px 16px; }
  .theme-app .owners-box,
  .theme-app .payments-box,
  .theme-app .payments-section { padding: 16px; }
  .theme-app .table-wrapper,
  .theme-app .payment-table-wrapper { max-height: none; }
}

@media (max-width: 340px) {
  .theme-app .cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-app *,
  .theme-app *::before,
  .theme-app *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
