@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&family=Manrope:wght@600;700;800&display=swap');

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface2: #f1f2f7;
  --text: #191a24;
  --muted: #767887;
  --border: #e5e6ed;
  --brand: #3D3A8F;
  --brand-light: color-mix(in srgb, var(--brand, #3D3A8F) 12%, #ffffff);
  --brand-hover: color-mix(in srgb, var(--brand, #3D3A8F) 85%, #000000);
  --brand-glow: color-mix(in srgb, var(--brand, #3D3A8F) 28%, transparent);
  --accent: #F2B84B;
  --success: #167c5a;
  --danger: #c84848;
  --shadow: 0 10px 35px rgba(31,32,54,.06);
  --shadow-sm: 0 2px 8px rgba(25,27,50,.04);
  --shadow-lg: 0 16px 48px rgba(25,27,50,.12);
  --sidebar-w: 260px;
}

/* Live human handoff and operator console */
.live-chat-state,
.conversation-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
    background: #eef2ff;
    color: #4338ca;
}
.conversation-status { padding: 4px 9px; }
.live-state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
}
.live-chat-state.status-requested,
.conversation-status.status-requested { background: #fff7ed; color: #c2410c; }
.live-chat-state.status-active,
.conversation-status.status-active { background: #ecfdf5; color: #047857; }
.live-operator-panel {
    border-top: 1px solid #e2e8f0;
    padding: 14px 16px 16px;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.live-operator-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.live-operator-actions select { min-width: 170px; width: auto; }
.live-action-separator { width: 1px; height: 28px; background: #e2e8f0; margin: 0 2px; }
.live-reply-form { display: flex; align-items: flex-end; gap: 10px; }
.live-reply-form textarea {
    flex: 1;
    resize: vertical;
    min-height: 48px;
    max-height: 150px;
}
.live-operator-feedback { min-height: 18px; margin: 7px 0 0; color: #64748b; font-size: 12px; }
.admin-chat .human-message { border: none; box-shadow: none; }
.admin-chat .human-message > div { border: 1px solid #e2e8f0; }
#chatPresence.is-human { font-weight: 650; }
#chatPresence.is-human i { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16); }

@media (max-width: 720px) {
    .live-reply-form { align-items: stretch; flex-direction: column; }
    .live-reply-form .btn { width: 100%; }
    .live-action-separator { display: none; }
    .live-operator-actions > * { flex: 1 1 auto; }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: clip;
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Modern sleek scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cfd1df;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a9abbd;
}

button, input, select, textarea {
  font: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
h1, h2, h3, h4 {
  font-family: 'Manrope', sans-serif;
  margin: 0;
}
p {
  color: var(--muted);
  line-height: 1.6;
}

/* App Shell & Sticky Sidebar */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 22px 16px;
  background: #171726;
  color: #eee;
  display: flex;
  flex-direction: column;
  z-index: 95;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
}

.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg,#6a65db,#3d3a8f);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-family: 'Manrope';
  box-shadow: inset 0 0 0 1px #ffffff18;
}
.brand-logo-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.public-logo-img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(61,58,143,0.25);
  flex-shrink: 0;
}
.auth-logo-img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
  flex-shrink: 0;
}
.bot-icon-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  flex-shrink: 0;
  margin: 0 auto 10px;
}
.share-card .bot-icon-img {
  display: block;
  margin: 0 auto 12px;
}
.brand b {
  display: block;
  font-size: 14px;
}
.brand small {
  display: block;
  color: #9d9daf;
  font-size: 11px;
  margin-top: 2px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 24px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 11px;
  color: #9d9db0;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .18s ease;
  border: 0;
  outline: none;
}
.sidebar nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}
.sidebar nav a.active {
  background: rgba(255,255,255,0.13);
  color: #ffffff;
  font-weight: 600;
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
  stroke: currentColor;
  opacity: 0.75;
  transition: opacity .18s, transform .18s;
}
.sidebar nav a:hover .nav-icon {
  opacity: 1;
  transform: scale(1.06);
}
.sidebar nav a.active .nav-icon {
  opacity: 1;
  color: #a7a2ff;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid #ffffff12;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
}
.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #ffffff15;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.sidebar-user strong, .sidebar-user small {
  display: block;
  font-size: 12px;
}
.sidebar-user small {
  color: #90909e;
  margin-top: 2px;
}
.sidebar-user button {
  color: #fff;
}

/* Main Area & Sticky Topbar */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  background: rgba(246, 247, 251, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(229, 230, 237, 0.9);
}
.topbar h1 {
  font-size: 25px;
  letter-spacing: -.5px;
}
.topbar p {
  margin: 3px 0 0;
  font-size: 13px;
}
.mobile-menu {
  display: none;
}
.content {
  padding: 24px 32px 60px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  flex: 1 0 auto;
}

/* Buttons & Core Controls */
.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .18s ease;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn.primary {
  background: var(--brand);
  color: #fff;
}
.btn.primary:hover {
  background: var(--brand-hover, color-mix(in srgb, var(--brand) 85%, #000000));
  transform: translateY(-1px);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--brand, #3D3A8F) 28%, transparent);
}
.btn.secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: #343542;
}
.btn.secondary:hover {
  background: #f4f5fa;
  border-color: #d1d3e2;
}
.btn.light {
  background: #fff;
  color: #272451;
}
.btn.wide {
  width: 100%;
}
.btn.sm {
  padding: 6px 12px;
  font-size: 12px;
}
.icon-link {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.danger, .error-text {
  color: var(--danger) !important;
}

/* Cards & Grid Systems */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  word-break: break-word;
}
.card h2 {
  font-size: 18px;
}
.card h3 {
  font-size: 15px;
  margin: 20px 0 10px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.card-head p {
  margin: 4px 0 0;
  font-size: 13px;
}
.card-head > a {
  font-size: 12px;
  color: var(--brand);
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 17px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card small, .stat-card span {
  display: block;
  color: var(--muted);
}
.stat-card strong {
  display: block;
  font: 800 31px 'Manrope';
  letter-spacing: -1.2px;
  margin: 8px 0;
}
.stat-card span {
  font-size: 11px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}
.gradient-card {
  background: linear-gradient(135deg,#302d79,#514ca2);
  color: white;
  border: 0;
}
.gradient-card h2 {
  font-size: 25px;
  max-width: 500px;
  margin-top: 8px;
}
.gradient-card p {
  color: #ddddf0;
  max-width: 540px;
}
.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 800;
  color: #9692ff;
}

.readiness {
  margin: 20px 0;
}
.readiness div, .list-metrics div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  font-size: 13px;
}
.readiness div:last-child, .list-metrics div:last-child {
  border: 0;
}

/* Tables & Wrappers */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th {
  text-align: left;
  color: #8a8b99;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px;
  border-bottom: 1px solid #eeeeF3;
  font-size: 13.5px;
  vertical-align: top;
}
td small {
  color: #8b8d99;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 35px;
}
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
}
.status.online {
  background: #e9f7f1;
  color: #177658;
}
.status.offline {
  background: #f1f1f4;
  color: #777987;
}
.status.bad {
  background: #fff0f0;
  color: #b94040;
}
.status.pending {
  background: #fff7df;
  color: #99751f;
}

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}
.bot-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  box-shadow: var(--shadow);
}
.bot-card h2 {
  font-size: 17px;
  margin: 8px 0 0;
}
.bot-card p {
  font-size: 12.5px;
  margin: 6px 0;
}
.bot-icon, .public-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font: 800 18px 'Manrope';
}
.bot-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #8b8d99;
  margin-top: 12px;
}
.bot-actions {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.bot-actions .danger {
  margin-left: auto;
}

/* Forms & Inputs */
.form-card {
  padding: 0;
  overflow: hidden;
}
.form-section {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  padding: 26px;
  border-bottom: 1px solid var(--border);
}
.form-section > div:first-child p {
  font-size: 12.5px;
  margin: 7px 0;
}
.form-grid {
  display: grid;
  gap: 14px;
}
.form-grid.two {
  grid-template-columns: 1fr 1fr;
}
.span-2 {
  grid-column: 1/-1;
}
label {
  display: grid;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: #555766;
}
input, textarea, select {
  width: 100%;
  border: 1px solid #dfe0e7;
  background: #fff;
  border-radius: 10px;
  padding: 11px 13px;
  color: #222;
  outline: none;
  transition: all .15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: #817ddb;
  box-shadow: 0 0 0 3px rgba(129,125,219,0.18);
}
textarea {
  resize: vertical;
}
input[type="radio"], input[type="checkbox"] {
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  margin: 0 !important;
  accent-color: #2563eb !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 50% !important;
  background: #fff !important;
  display: inline-block !important;
}
input[type="checkbox"] {
  border-radius: 5px !important;
}
.check {
  display: flex !important;
  gap: 12px !important;
  align-items: center !important;
  background: #f8fafc !important;
  padding: 14px 18px !important;
  border-radius: 12px !important;
  border: 1.5px solid #e2e8f0 !important;
  transition: all .2s ease !important;
  cursor: pointer !important;
}
.check:hover {
  border-color: #cbd5e1 !important;
  background: #f1f5f9 !important;
}
.check:has(input:checked) {
  border-color: #93c5fd !important;
  background: #eff6ff !important;
}
.check input {
  width: 18px !important;
  height: 18px !important;
}

/* Modern Radio Card Component */
.radio-card-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.radio-card {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  padding: 14px 16px !important;
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
  text-align: left !important;
}
.radio-card:hover {
  border-color: #93c5fd !important;
  background: #f8fafc !important;
  transform: translateY(-1px);
}
.radio-card.active, .radio-card:has(input[type="radio"]:checked) {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 1px #2563eb, 0 4px 14px rgba(37, 99, 235, 0.08) !important;
}
.radio-card input[type="radio"] {
  margin-top: 2px !important;
  flex-shrink: 0 !important;
}
.radio-card-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  flex: 1 !important;
}
.radio-card-title {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  line-height: 1.3 !important;
}
.radio-card-desc {
  font-size: 12px !important;
  line-height: 1.45 !important;
  color: #64748b !important;
  font-weight: 400 !important;
}
.radio-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: #dbeafe;
  color: #1d4ed8;
  letter-spacing: 0.02em;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 18px 26px;
  background: #fafafd;
}
.upload-card form {
  display: grid;
  gap: 12px;
}
.dropzone {
  border: 1px dashed #b9b9cb;
  background: #fafafe;
  min-height: 150px;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.dropzone span {
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}
.dropzone input {
  width: auto;
  border: 0;
  margin-top: 12px;
}
.hidden {
  display: none !important;
}
.actions {
  white-space: nowrap;
}
.actions a {
  font-size: 12px;
  font-weight: 700;
  margin-right: 10px;
}
.click-row {
  cursor: pointer;
}
.click-row:hover td {
  background: #fafafe;
}

/* Conversation & Message Styles */
.conversation-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 280px;
  gap: 18px;
}
.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.message {
  max-width: 78%;
  font-size: 13px;
}
.message > div {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  line-height: 1.55;
}
.message.user {
  margin-left: auto;
}
.message.user > div {
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
}
.message small {
  display: block;
  color: #9596a2;
  font-size: 10px;
  margin: 5px 5px;
}

.profile-card dl, .settings-list {
  display: grid;
  gap: 0;
}
.profile-card dt, .settings-list dt {
  font-size: 10px;
  color: #90919e;
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-top: 14px;
}
.profile-card dd, .settings-list dd {
  margin: 4px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px !important;
}
.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}
.share-card {
  text-align: center;
}
.share-card .bot-icon {
  margin: 0 auto 12px;
}
.copy-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.copy-field input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: #f8f9fd;
  color: #1a1b29;
}
.copy-field .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 10px 20px;
  min-width: 80px;
}
.qr-wrap {
  margin: 20px auto;
  display: grid;
  justify-content: center;
  gap: 8px;
}
.qr-wrap img {
  width: 220px;
  height: 220px;
  border-radius: 15px;
  border: 1px solid var(--border);
}
.qr-wrap small {
  color: var(--muted);
}
.share-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}
pre {
  background: #171726;
  color: #e9e9f4;
  border-radius: 13px;
  padding: 17px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.65;
}
.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.checklist div {
  padding: 12px;
  border-radius: 10px;
  background: #f6f7fa;
  font-size: 12px;
}
.bar-chart {
  height: 200px;
  display: flex;
  gap: 8px;
  align-items: end;
  padding-top: 25px;
}
.bar-chart > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  justify-content: end;
  height: 100%;
}
.bar-chart span {
  width: 65%;
  min-width: 7px;
  max-width: 30px;
  background: linear-gradient(#7771dc,#403b91);
  border-radius: 5px 5px 2px 2px;
}
.bar-chart small {
  font-size: 9px;
  color: #9899a5;
  white-space: nowrap;
}
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.5;
}
.alert.success {
  background: #eaf7f1;
  color: #166f52;
}
.alert.error {
  background: #fff0f0;
  color: #a73f3f;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #171726;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.muted {
  color: var(--muted);
}

/* Auth Pages */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at 15% 10%,#e9e8ff,transparent 30%),radial-gradient(circle at 85% 90%,#fff1d4,transparent 28%),#f8f8fb;
  padding: 20px;
}
.auth-card {
  width: min(440px, 100%);
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 34px;
  box-shadow: 0 30px 80px rgba(48,45,121,0.12);
}
.auth-brand {
  margin-bottom: 30px;
}
.auth-card h1 {
  font-size: 27px;
}
.auth-card > p {
  margin: 8px 0 25px;
}
.auth-card .muted {
  display: block;
  margin-top: 15px;
  text-align: center;
}
.auth-card code {
  font-size: 11px;
}

/* ============================================================
   Public Chat — Premium Shell
   ============================================================ */
.public-chat-body {
  background:
    radial-gradient(ellipse at 15% 0%, rgba(99,102,241,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 100%, rgba(245,158,11,0.08) 0%, transparent 45%),
    #f0f1f8;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.public-shell {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: var(--chat-bg, linear-gradient(160deg, #f7f8fd 0%, #f0f2fa 100%));
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px rgba(99,102,241,0.07),
    0 20px 60px rgba(30,32,60,0.12),
    0 4px 16px rgba(30,32,60,0.06);
  position: relative;
  overflow: hidden;
  border-radius: 0;
}
@media (min-height: 700px) and (min-width: 700px) {
  .public-shell {
    border-radius: 20px;
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    max-height: 820px;
  }
}

/* Header */
.public-head {
  min-height: 64px;
  border-bottom: 1px solid rgba(99,102,241,0.08);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--header-bg, rgba(255,255,255,0.96));
  color: var(--header-text, #181926);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  flex-shrink: 0;
}
.public-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(61,58,143,0.18);
  flex-shrink: 0;
}
.public-head b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: inherit;
  letter-spacing: -0.02em;
}
.public-head span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #8b8da0;
  font-size: 11.5px;
  margin-top: 2px;
  font-weight: 500;
}
.public-head i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.22);
  animation: pulse-online 2s infinite;
}
@keyframes pulse-online {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.22); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0.08); }
}

/* Messages area — Guaranteed Full Height Background */
.public-messages {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px clamp(16px, 4vw, 38px) 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--chat-bg, linear-gradient(160deg, #f7f8fd 0%, #f0f2fa 100%));
  background-image: var(--chat-pattern, none), var(--chat-bg, linear-gradient(160deg, #f7f8fd 0%, #f0f2fa 100%));
  background-repeat: repeat, no-repeat;
  background-size: var(--chat-pattern-size, auto), cover;
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
  width: 100%;
  scroll-behavior: smooth;
}

/* Background Patterns */
.theme-pattern-whatsapp {
  --chat-pattern: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' opacity='0.08'%3E%3Cpath d='M20 20h10v10H20zM60 40h15v5H60zM90 15h12v12H90zM15 80h8v15h-8zM75 75h14v14H75zM40 95h16v6H40zM100 90h10v10h-10z' fill='%23000000'/%3E%3Ccircle cx='45' cy='25' r='5' fill='%23000000'/%3E%3Ccircle cx='105' cy='55' r='4' fill='%23000000'/%3E%3Ccircle cx='25' cy='55' r='3' fill='%23000000'/%3E%3Ccircle cx='60' cy='105' r='4' fill='%23000000'/%3E%3C/svg%3E");
  --chat-pattern-size: 120px 120px;
}
.theme-pattern-dots {
  --chat-pattern: radial-gradient(rgba(0, 0, 0, 0.08) 1.5px, transparent 1.5px);
  --chat-pattern-size: 18px 18px;
}
.theme-pattern-grid {
  --chat-pattern: linear-gradient(to right, rgba(0, 0, 0, 0.04) 1px, transparent 1px), linear-gradient(to bottom, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  --chat-pattern-size: 20px 20px, 20px 20px;
}

/* ============================================================
   Chat Messages — Premium Bubble Styling
   ============================================================ */
.chat-msg {
  max-width: min(800px, 90%);
  font-size: 14.5px;
  line-height: 1.72;
  letter-spacing: -0.01em;
  animation: fadeInMsg .28s cubic-bezier(.22,.68,0,1.2);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Base bubble --- */
.chat-msg .msg-bubble,
.chat-msg > div:not(.source-pill):not(.quick-list):not(.chat-lead-card) {
  padding: 14px 18px;
  background: var(--bot-bubble-bg, #ffffff);
  border: 1px solid var(--bot-bubble-border, rgba(226, 232, 240, 0.9));
  border-radius: 3px 18px 18px 18px;
  color: var(--bot-bubble-text, #1e293b);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 4px 20px -4px rgba(15, 23, 42, 0.08);
  overflow-wrap: break-word;
  word-break: normal;
  position: relative;
  transition: box-shadow .2s ease;
  max-width: 100%;
}
.chat-msg.assistant .msg-bubble {
  background: var(--bot-bubble-bg, #ffffff);
  border-color: var(--bot-bubble-border, rgba(226, 232, 240, 0.9));
  color: var(--bot-bubble-text, #1e293b);
  border-radius: 3px 18px 18px 18px;
}

/* --- User bubble --- */
.chat-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-msg.user .msg-bubble,
.chat-msg.user > div:not(.source-pill) {
  background: var(--user-bubble-bg, var(--brand, #3d3a8f));
  color: var(--user-bubble-text, #ffffff);
  border: 0;
  border-radius: 18px 3px 18px 18px;
  box-shadow: 0 4px 18px color-mix(in srgb, var(--brand, #3d3a8f) 22%, transparent), 0 1px 4px color-mix(in srgb, var(--brand, #3d3a8f) 12%, transparent);
}
.chat-msg.user p { color: inherit; }

/* --- Typography inside bubbles --- */
.chat-msg p {
  margin: 0 0 11px;
  line-height: 1.72;
  color: inherit;
}
.chat-msg p:last-child { margin-bottom: 0; }

/* Headings */
.chat-msg h1, .chat-msg h2, .chat-msg h3, .chat-msg h4 {
  margin: 16px 0 6px;
  font-family: 'Manrope', sans-serif;
  color: #0f172a;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.chat-msg h1 { font-size: 17px; }
.chat-msg h2 { font-size: 15.5px; padding-bottom: 5px; border-bottom: 1.5px solid #f1f5f9; }
.chat-msg h3 { font-size: 14.5px; }
.chat-msg h4 { font-size: 13.5px; color: #334155; }
.chat-msg h1:first-child,
.chat-msg h2:first-child,
.chat-msg h3:first-child,
.chat-msg h4:first-child { margin-top: 0; }
.chat-msg.user h1, .chat-msg.user h2,
.chat-msg.user h3, .chat-msg.user h4 { color: #ffffff; border-color: rgba(255,255,255,0.2); }

/* Bold / Italic */
.chat-msg strong, .chat-msg b {
  font-weight: 700;
  color: #0f172a;
}
.chat-msg.user strong, .chat-msg.user b { color: #ffffff; }
.chat-msg em, .chat-msg i { font-style: italic; color: #475569; }
.chat-msg.user em, .chat-msg.user i { color: rgba(255,255,255,0.82); }

/* Links */
.chat-msg a {
  color: var(--brand, #4f46e5);
  text-decoration: none;
  border-bottom: 1.5px solid color-mix(in srgb, var(--brand, #4f46e5) 35%, transparent);
  font-weight: 600;
  transition: border-color .15s, opacity .15s;
}
.chat-msg a:hover { border-bottom-color: var(--brand, #4f46e5); opacity: 0.8; }
.chat-msg.user a { color: #ffffff; border-bottom-color: rgba(255,255,255,0.55); }

/* Lists */
.chat-msg ul, .chat-msg ol {
  margin: 8px 0 12px 0;
  padding-left: 20px;
}
.chat-msg ul { list-style: none; padding-left: 4px; }
.chat-msg ul li {
  padding-left: 20px;
  position: relative;
}
.chat-msg ul li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand, #4f46e5);
  opacity: 0.7;
}
.chat-msg.user ul li::before { background: rgba(255,255,255,0.75); }
.chat-msg ol li { padding-left: 4px; }
.chat-msg li {
  margin: 5px 0;
  line-height: 1.66;
  color: inherit;
}

/* Nested lists */
.chat-msg ul ul, .chat-msg ol ol,
.chat-msg ul ol, .chat-msg ol ul {
  margin: 4px 0 4px 16px;
}

/* Horizontal rule */
.chat-msg hr {
  border: none;
  border-top: 1.5px solid #e2e8f0;
  margin: 14px 0;
}

/* Blockquote */
.chat-msg blockquote {
  margin: 10px 0;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #475569;
  font-size: 13.5px;
  font-style: italic;
}

/* Inline code */
.chat-msg code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  color: #6d28d9;
  border: 1px solid #e2e8f0;
  letter-spacing: 0;
}
.chat-msg.user code {
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  border-color: rgba(255,255,255,0.25);
}

/* Code blocks */
.chat-msg pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12.5px;
  line-height: 1.65;
  border: 1px solid #1e293b;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  position: relative;
}
.chat-msg pre code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

/* Tables — Premium Responsive Tabular Styling */
.chat-msg .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  max-width: 100%;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
}
.chat-msg .table-wrap::-webkit-scrollbar {
  height: 6px;
}
.chat-msg .table-wrap::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 4px;
}
.chat-msg .table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.chat-msg .table-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.chat-msg table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 380px;
  font-size: 12.5px;
  line-height: 1.5;
  table-layout: auto;
  word-break: normal !important;
  overflow-wrap: normal !important;
  word-wrap: normal !important;
  hyphens: none !important;
  -webkit-hyphens: none !important;
}
.chat-msg th,
.chat-msg td {
  word-break: normal !important;
  overflow-wrap: normal !important;
  word-wrap: normal !important;
  hyphens: none !important;
  -webkit-hyphens: none !important;
}
.chat-msg th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: left;
  padding: 11px 15px;
  border-bottom: 2px solid #e2e8f0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.chat-msg td {
  padding: 11px 15px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
  line-height: 1.55;
  white-space: normal;
  min-width: 90px;
}
.chat-msg td:first-child,
.chat-msg th:first-child {
  font-weight: 600;
  color: #0f172a;
  min-width: 120px;
  white-space: nowrap;
}
.chat-msg tr:last-child td { border-bottom: 0; }
.chat-msg tr:nth-child(even) td { background: #fafbfc; }
.chat-msg tr:hover td { background: #f1f5f9; }

/* ============================================================
   Source Pill — Clean, Ellipsis Truncated
   ============================================================ */
.source-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc !important;
  padding: 4px 11px !important;
  border-radius: 9999px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  transition: all .15s ease;
  width: fit-content !important;
  max-width: min(100%, 360px) !important;
  animation: fadeInMsg .2s ease-out;
  margin-top: 3px !important;
  box-sizing: border-box;
}
.source-pill svg {
  color: var(--brand, #4f46e5);
  flex-shrink: 0;
  opacity: 0.9;
}
.source-pill .source-text,
.source-pill .source-link,
.source-pill span,
.source-pill a {
  color: #64748b !important;
  text-decoration: none !important;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  border-bottom: none !important;
  font-weight: 600;
}
.source-pill:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: color-mix(in srgb, var(--brand, #4f46e5) 35%, #cbd5e1) !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--brand, #4f46e5) 12%, rgba(15,23,42,0.06)) !important;
}
.source-pill:hover a,
.source-pill:hover .source-link,
.source-pill:hover span {
  color: #0f172a !important;
}

/* ============================================================
   Message Tools (Custom Compact Micro Copy Pill)
   ============================================================ */
.msg-tools {
  display: flex;
  justify-content: flex-start;
  margin-top: 6px;
  gap: 4px;
  opacity: 0.6;
  transition: opacity .18s ease;
}
.chat-msg.assistant:hover .msg-tools,
.msg-tools:focus-within {
  opacity: 1;
}
.msg-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  padding: 1.5px 6.5px;
  height: 19px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: inherit;
  background: color-mix(in srgb, currentColor 6%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  user-select: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  line-height: 1;
}
.msg-tool-btn svg {
  flex-shrink: 0;
  opacity: 0.8;
  transition: transform .15s ease;
}
.msg-tool-btn:hover {
  background: color-mix(in srgb, currentColor 12%, transparent);
  border-color: color-mix(in srgb, currentColor 26%, transparent);
  opacity: 1;
  transform: translateY(-0.5px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.msg-tool-btn:hover svg {
  transform: scale(1.08);
}
.msg-tool-btn:active {
  transform: translateY(0);
}
.msg-tool-btn.copied {
  background: color-mix(in srgb, #10b981 16%, transparent) !important;
  color: #059669 !important;
  border-color: color-mix(in srgb, #10b981 35%, transparent) !important;
  opacity: 1 !important;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.15) !important;
}
.quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  max-width: 100%;
}
.quick-list button {
  border: 1px solid #dadbe8;
  border-radius: 999px;
  background: #fff;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  color: #3e4052;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  text-align: left;
  max-width: 100%;
  word-break: normal;
  overflow-wrap: break-word;
}
.quick-list button:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, #ffffff);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 15%, transparent);
}
.public-compose {
  display: grid;
  grid-template-columns: 42px 1fr 46px;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #e9eaf2;
  background: #fff;
  align-items: end;
  flex-shrink: 0;
}
.public-compose textarea {
  min-height: 46px;
  max-height: 130px;
  border-radius: 15px;
  background: #f7f8fb;
  padding: 12px 16px;
  border: 1px solid #dfe1eb;
  color: #181926;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.public-compose textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(61,58,143,0.12);
}
/* ============================================================
   Compose Bar — Premium Floating Design
   ============================================================ */
.public-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(99,102,241,0.07);
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.public-compose.without-contact {
  grid-template-columns: 1fr 46px;
}
.public-compose textarea {
  flex: 1;
  border: 1.5px solid #e1e4f0;
  border-radius: 20px;
  padding: 12px 18px;
  font-size: 14px;
  font-family: inherit;
  resize: none !important;
  max-height: 130px;
  min-height: 46px;
  line-height: 1.5;
  outline: none;
  background: #f5f6fc;
  color: #191b29;
  transition: border-color .2s, background .2s, box-shadow .2s;
  overflow-x: hidden !important;
  overflow-y: hidden;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.public-compose textarea::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}
.public-compose textarea:focus {
  border-color: var(--brand, #3d3a8f);
  background: #fff;
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand, #3d3a8f) 14%, transparent);
}
.public-compose textarea::placeholder {
  color: #a8aabf;
}
.public-compose #send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--brand, #3d3a8f);
  color: white;
  font-size: 17px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .15s, box-shadow .2s, background .15s;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand, #3d3a8f) 28%, transparent);
}
.public-compose #send:hover:not(:disabled) {
  background: color-mix(in srgb, var(--brand, #3d3a8f) 85%, #000);
  transform: scale(1.06) translateY(-1px);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand, #3d3a8f) 38%, transparent);
}
.public-compose #send:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}
.contact-btn {
  width: 46px;
  height: 46px;
  background: #f0f2fa;
  color: #4f5270;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #e0e3f2;
  cursor: pointer;
  transition: all .18s ease;
  flex-shrink: 0;
}
.contact-btn:hover {
  background: var(--brand, #3d3a8f);
  color: #fff;
  border-color: var(--brand, #3d3a8f);
  transform: scale(1.06) translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand, #3d3a8f) 28%, transparent);
}

/* Powered footer */
.powered {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #8e92a8;
  padding: 4px 12px 7px;
  background: rgba(255, 255, 255, 0.98);
  margin-top: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  user-select: none;
}
.powered strong {
  font-weight: 700;
  color: var(--brand, #3d3a8f);
  letter-spacing: -0.01em;
}

/* Typing indicator */
.chat-msg.typing {
  padding: 0;
}
.chat-msg.typing > div {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid rgba(226,232,240,0.9);
  border-radius: 3px 18px 18px 18px;
  box-shadow: 0 2px 12px rgba(15,23,42,0.06);
  width: fit-content;
}
.typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand, #3d3a8f);
  opacity: 0.35;
  animation: blink 1.3s ease infinite;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink {
  0%, 80%, 100% { opacity: .25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* Lead Registration Modal & Backdrop */
.lead-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 30, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  animation: fadeInBackdrop .2s ease-out;
}
@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lead-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 32px));
  max-height: min(88vh, calc(100dvh - 36px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border: 1px solid #dcdff2;
  border-radius: 20px;
  padding: 24px 24px 20px;
  box-shadow: 0 28px 75px rgba(27,27,47,0.25), 0 8px 24px rgba(0,0,0,0.08);
  z-index: 100;
  animation: leadModalIn .22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes leadModalIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.lead-head {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 18px;
  padding-right: 32px;
}
.lead-head-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand, #3d3a8f) 12%, transparent);
  color: var(--brand, #3d3a8f);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lead-head h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: #1a1b2b;
  margin: 0 0 3px;
  letter-spacing: -0.2px;
}
.lead-head p {
  font-size: 12.5px;
  color: #6a6c80;
  margin: 0;
  line-height: 1.45;
}

.grid-2-lead {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 460px) {
  .grid-2-lead {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.lead-panel label {
  font-size: 12.5px;
  font-weight: 600;
  color: #3b3d52;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  text-align: left;
}
.lead-panel .label-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
  color: #2e3146;
}
.lead-panel .req {
  color: #e53e3e;
  font-weight: 700;
  font-size: 13px;
  display: inline-block;
  margin-left: 2px;
}

.lead-panel input, .lead-panel textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 10px 13px;
  border: 1.5px solid #dce0ee;
  border-radius: 11px;
  background: #fafbfe;
  color: #1a1b2b;
  font-family: inherit;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.lead-panel textarea {
  resize: vertical;
  min-height: 62px;
  max-height: 140px;
}
.lead-panel input:focus, .lead-panel textarea:focus, .lead-panel select:focus {
  background: #ffffff;
  border-color: var(--brand, #3d3a8f);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand, #3d3a8f) 14%, transparent);
  outline: none;
}

.lead-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 2px;
}
.lead-actions .btn {
  min-height: 42px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.lead-close {
  position: absolute;
  right: 14px;
  top: 14px;
  background: #f0f2f8;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  color: #5d6076;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
  z-index: 10;
}
.lead-close:hover {
  background: #e2e5f0;
  color: #181926;
  transform: scale(1.05);
}

/* Custom Registration Callout Card in Chat */
.chat-lead-card {
  margin-top: 14px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1.5px solid color-mix(in srgb, var(--brand, #3d3a8f) 18%, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--brand, #3d3a8f) 8%, rgba(0, 0, 0, 0.04));
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all .2s ease;
}
.chat-lead-card:hover {
  border-color: color-mix(in srgb, var(--brand, #3d3a8f) 35%, #cbd5e1);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand, #3d3a8f) 14%, rgba(0, 0, 0, 0.06));
  transform: translateY(-1px);
}
.chat-lead-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--brand, #3d3a8f) 12%, transparent);
  color: var(--brand, #3d3a8f);
  border: 1px solid color-mix(in srgb, var(--brand, #3d3a8f) 20%, transparent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 999px;
}
.chat-lead-badge svg {
  color: var(--brand, #3d3a8f);
  flex-shrink: 0;
}
.chat-lead-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.chat-lead-card-text {
  flex: 1;
  min-width: 200px;
}
.chat-lead-card-text h4 {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: #1a1b2e;
  letter-spacing: -0.2px;
}
.chat-lead-card-text p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: #5d6179;
}
.chat-lead-btn {
  background: var(--brand, #3d3a8f) !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 11px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand, #3d3a8f) 32%, transparent);
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  font-family: inherit;
  white-space: nowrap;
}
.chat-lead-btn:hover {
  background: color-mix(in srgb, var(--brand, #3d3a8f) 85%, #000) !important;
  transform: translateY(-2px);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--brand, #3d3a8f) 42%, transparent);
  color: #ffffff !important;
}
.chat-lead-btn:active {
  transform: translateY(0);
}
.chat-lead-btn .arrow {
  transition: transform .18s ease;
}
.chat-lead-btn:hover .arrow {
  transform: translateX(3px);
}

/* Completed / Submitted State for Registration Form Card */
.chat-lead-card.is-completed,
.chat-lead-card.is-done {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
  border-color: #86efac !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.1) !important;
}
.chat-lead-card.is-completed:hover,
.chat-lead-card.is-done:hover {
  border-color: #4ade80 !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15) !important;
  transform: none;
}
.chat-lead-card.is-completed .chat-lead-badge,
.chat-lead-card.is-done .chat-lead-badge {
  background: rgba(16, 185, 129, 0.16) !important;
  color: #047857 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}
.chat-lead-card.is-completed .chat-lead-badge svg,
.chat-lead-card.is-done .chat-lead-badge svg {
  color: #047857 !important;
}
.chat-lead-card.is-completed .chat-lead-card-text h4,
.chat-lead-card.is-done .chat-lead-card-text h4 {
  color: #064e3b !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-lead-card.is-completed .chat-lead-card-text p,
.chat-lead-card.is-done .chat-lead-card-text p {
  color: #047857 !important;
}
.chat-lead-btn.is-completed,
.chat-lead-btn.is-done {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3) !important;
  cursor: default !important;
}
.chat-lead-btn.is-completed:hover,
.chat-lead-btn.is-done:hover {
  transform: none !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3) !important;
}
.chat-lead-card.is-completed .chat-lead-card-footer-edit,
.chat-lead-card.is-done .chat-lead-card-footer-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: #047857;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-top: 5px;
  font-weight: 600;
}
.chat-lead-card.is-completed .chat-lead-card-footer-edit:hover,
.chat-lead-card.is-done .chat-lead-card-footer-edit:hover {
  color: #065f46;
}

/* Fallback class for legacy banner */
.chat-form-banner {
  margin-top: 14px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1.5px solid color-mix(in srgb, var(--brand, #3d3a8f) 18%, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--brand, #3d3a8f) 8%, rgba(0, 0, 0, 0.04));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.chat-form-btn {
  background: var(--brand, #3d3a8f);
  color: #fff;
  border: 0;
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand, #3d3a8f) 25%, transparent);
  transition: all .15s ease;
}
.chat-form-btn:hover {
  background: color-mix(in srgb, var(--brand, #3d3a8f) 85%, #000);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand, #3d3a8f) 35%, transparent);
}

/* AI Providers Page */
.provider-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f7f7ff 100%);
  margin-bottom: 20px;
}
.provider-hero h2 {
  font-size: 23px;
  margin-top: 7px;
}
.provider-hero p {
  max-width: 760px;
  margin-bottom: 0;
}
.route-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.route-flow span {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.route-flow b {
  color: #9a9ba7;
}
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.provider-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  height: 100%;
}
.provider-top {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: start;
}
.provider-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  font: 800 16px 'Manrope';
  background: #333;
}
.provider-logo.groq {
  background: linear-gradient(135deg,#ef6b42,#bd3f1f);
}
.provider-logo.gemini {
  background: linear-gradient(135deg,#6d7eff,#8757c7);
}
.provider-logo.openrouter {
  background: linear-gradient(135deg,#252632,#525565);
}
.provider-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: space-between;
}
.provider-title-row h2 {
  font-size: 16.5px;
}
.provider-top p {
  font-size: 11.5px;
  margin: 5px 0 0;
  line-height: 1.45;
}
.provider-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 18px;
  flex: 1;
}
.provider-form label small {
  font-weight: 400;
  color: var(--muted);
  line-height: 1.4;
}
.toggle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: #f7f7fa;
  border-radius: 12px;
  padding: 11px 12px;
}
.toggle-line span {
  display: grid;
  gap: 2px;
}
.toggle-line b {
  font-size: 12px;
}
.toggle-line input {
  width: 38px;
  height: 20px;
  accent-color: var(--brand);
}
.advanced-provider {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
}
.advanced-provider summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  color: #686a78;
}
.advanced-provider label {
  margin-top: 10px;
}
.provider-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.provider-stats span {
  background: #f7f7fa;
  border-radius: 10px;
  padding: 9px;
  font-size: 9px;
  color: var(--muted);
}
.provider-stats b {
  display: block;
  color: var(--text);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.provider-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}
.provider-actions .btn {
  padding: 8px 13px;
  font-size: 11.5px;
}
.provider-test-result {
  margin-top: 14px;
  padding: 10px 11px;
  border-radius: 11px;
  display: grid;
  gap: 3px;
}
.provider-test-result.ok {
  background: #edf8f3;
  color: #176a50;
}
.provider-test-result.bad {
  background: #fff0f0;
  color: #9d3f3f;
}
.provider-test-result strong {
  font-size: 11px;
}
.provider-test-result span, .provider-test-result small {
  font-size: 9px;
  overflow-wrap: anywhere;
}
.mini-error {
  font-size: 9px;
  color: var(--danger);
  background: #fff7f7;
  border-radius: 9px;
  padding: 8px;
  overflow-wrap: anywhere;
}
.recommend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.recommend-grid > div {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f7f7fa;
  border-radius: 13px;
  padding: 12px 14px;
}
.recommend-grid > div > strong {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.recommend-grid span, .recommend-grid b, .recommend-grid small {
  display: block;
}
.recommend-grid b {
  font-size: 12px;
}
.recommend-grid small {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* Pagination & Table Toolbars */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.table-toolbar .search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.table-toolbar .search-form input {
  height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  flex: 1 1 180px;
  min-width: 160px;
}
.table-toolbar .search-form select, .table-toolbar .search-form .custom-select-wrap {
  height: 40px;
  width: auto;
  min-width: 145px;
  max-width: 200px;
  flex: 0 1 auto;
}
.table-toolbar .search-form .btn {
  height: 40px;
  padding: 0 16px;
  white-space: nowrap;
}
.table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-icon-close {
  background: #f0f1f8;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: #6b6d80;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .15s;
}
.btn-icon-close:hover {
  background: #fee;
  color: var(--danger);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: #fafafd;
  border-radius: 0 0 18px 18px;
}
.card .pagination-bar {
  margin: 18px -24px -24px;
  padding: 16px 24px;
}
.pagination-info {
  font-size: 13px;
  color: var(--muted);
}
.pagination-info strong {
  color: var(--text);
  font-weight: 700;
}
.pagination-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid #dfe0ea;
  background: #fff;
  color: #353648;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  user-select: none;
}
.page-btn:hover:not(.disabled):not(.active) {
  background: #f0f1fa;
  border-color: #b9b7e8;
  color: var(--brand);
  transform: translateY(-1px);
}
.page-btn.active {
  background: linear-gradient(135deg,var(--brand),#544fc4);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(61,58,143,0.25);
}
.page-btn.disabled {
  opacity: 0.42;
  cursor: not-allowed;
  border-color: #e4e5ee;
  background: #f7f7fa;
  color: #8d8e9c;
}
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 34px;
  color: #9b9cb0;
  font-size: 14px;
  font-weight: 700;
}

/* Custom Select Dropdowns */
.custom-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.custom-select-wrap {
  position: relative;
  display: inline-block;
  min-width: 150px;
  user-select: none;
  font-family: inherit;
}
.custom-select-wrap.wide-select, .form-grid .custom-select-wrap, label .custom-select-wrap {
  width: 100%;
  display: block;
  max-width: 100%;
}
label .custom-select-wrap {
  margin-top: 6px;
}
.custom-select-trigger {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 36px 0 14px;
  background: #ffffff;
  border: 1px solid #dfe0e8;
  border-radius: 10px;
  color: #1a1b29;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: all .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  outline: none;
}
.form-grid .custom-select-trigger, label .custom-select-trigger {
  height: 44px;
  min-height: 44px;
}
.custom-select-trigger:hover {
  border-color: #b7b6e3;
  background: #fafbfe;
}
.custom-select-trigger:focus-visible, .custom-select-wrap.is-open .custom-select-trigger {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3.5px rgba(61,58,143,0.14);
}
.custom-select-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.custom-select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b7d90;
  pointer-events: none;
  transition: transform .2s ease, color .18s ease;
}
.custom-select-chevron svg {
  width: 14px;
  height: 14px;
}
.custom-select-wrap.is-open .custom-select-chevron {
  transform: translateY(-50%) rotate(180deg);
  color: var(--brand);
}
.custom-select-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid #dcdfe8;
  border-radius: 13px;
  box-shadow: 0 16px 48px rgba(25,27,50,0.16), 0 2px 8px rgba(0,0,0,0.04);
  padding: 6px;
  z-index: 1050;
  max-height: 280px;
  overflow-y: auto;
  animation: dropdownFade .18s cubic-bezier(0.16,1,0.3,1);
}
.custom-select-wrap.dropup .custom-select-menu {
  top: auto;
  bottom: calc(100% + 5px);
  animation: dropupFade .18s cubic-bezier(0.16,1,0.3,1);
}
.custom-select-wrap.is-open .custom-select-menu {
  display: block;
}
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dropupFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.custom-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: #272838;
  cursor: pointer;
  transition: all .14s ease;
}
.custom-select-item:hover {
  background: #f3f4fd;
  color: var(--brand);
}
.custom-select-item.is-selected {
  background: #efeeff;
  color: var(--brand);
  font-weight: 700;
}
.custom-select-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--brand);
  flex-shrink: 0;
}
.custom-select-check svg {
  width: 14px;
  height: 14px;
}

/* Status Pill Custom Dropdown */
.status-select-wrap {
  min-width: 125px !important;
  width: auto !important;
  display: inline-block;
  vertical-align: middle;
}
.status-select-wrap .custom-select-trigger {
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 28px 0 11px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
}
.status-select-wrap .custom-select-trigger.status-new {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #bfdbfe !important;
}
.status-select-wrap .custom-select-trigger.status-contacted {
  background: #fefce8 !important;
  color: #a16207 !important;
  border-color: #fef08a !important;
}
.status-select-wrap .custom-select-trigger.status-qualified {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border-color: #bbf7d0 !important;
}
.status-select-wrap .custom-select-trigger.status-converted {
  background: #faf5ff !important;
  color: #7e22ce !important;
  border-color: #e9d5ff !important;
}
.status-select-wrap .custom-select-trigger.status-closed {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
}
.status-select-wrap .custom-select-trigger.status-archived {
  background: #fff1f2 !important;
  color: #be123c !important;
  border-color: #fecdd3 !important;
}
.custom-select-item.status-item-new::before,
.custom-select-item.status-item-contacted::before,
.custom-select-item.status-item-qualified::before,
.custom-select-item.status-item-converted::before,
.custom-select-item.status-item-closed::before,
.custom-select-item.status-item-archived::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}
.custom-select-item.status-item-new::before { background: #3b82f6; }
.custom-select-item.status-item-contacted::before { background: #eab308; }
.custom-select-item.status-item-qualified::before { background: #22c55e; }
.custom-select-item.status-item-converted::before { background: #a855f7; }
.custom-select-item.status-item-closed::before { background: #94a3b8; }
.custom-select-item.status-item-archived::before { background: #f43f5e; }

/* Lead Detail Modal Premium Styling */
.lead-modal-card {
  max-width: 600px;
  width: 100%;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.9);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
}
.lead-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}
.lead-modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lead-modal-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
  color: var(--brand, #3d3a8f);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lead-modal-title {
  margin: 0;
  font-size: 17.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.2px;
}
.lead-modal-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: #64748b;
}
.lead-modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
}
.lead-modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
  transform: rotate(90deg);
}
.lead-modal-body {
  padding: 20px 22px;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.lead-profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
}
.lead-profile-hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.lead-profile-avatar {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(61, 58, 143, 0.2);
  flex-shrink: 0;
}
.lead-profile-name {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
  text-transform: capitalize;
}
.lead-profile-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 12px;
  color: #64748b;
}
.lead-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  border: 1px solid transparent;
  flex-shrink: 0;
}
.lead-status-badge.status-new { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.lead-status-badge.status-contacted { background: #fefce8; color: #a16207; border-color: #fef08a; }
.lead-status-badge.status-qualified { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.lead-status-badge.status-converted { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.lead-status-badge.status-closed { background: #f1f5f9; color: #64748b; border-color: #cbd5e1; }
.lead-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lead-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 500px) {
  .lead-info-grid { grid-template-columns: 1fr; }
}
.lead-info-tile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.lead-info-tile:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.lead-info-tile.full-width {
  grid-column: 1 / -1;
}
.lead-info-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.lead-info-tile-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.lead-info-tile-value {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
}
.lead-info-tile-link {
  color: #2563eb;
  text-decoration: none;
  transition: color .15s ease;
}
.lead-info-tile-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}
.lead-copy-icon-btn {
  border: 0;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all .15s ease;
}
.lead-copy-icon-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.lead-note-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 13px 16px;
}
.lead-note-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
  white-space: pre-wrap;
}
.lead-conv-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.lead-conv-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lead-conv-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #ffffff;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.15);
  flex-shrink: 0;
}
.lead-conv-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #166534;
  margin: 0;
}
.lead-conv-desc {
  font-size: 12px;
  color: #15803d;
  margin: 2px 0 0;
}
.lead-modal-foot {
  padding: 14px 22px;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Custom Dropzone & File Pickers */
.custom-file-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.custom-dropzone {
  position: relative;
  border: 2px dashed #cfd0e3;
  background: linear-gradient(180deg,#fafbfe 0%,#f4f5fc 100%);
  border-radius: 18px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
  margin-top: 6px;
}
.custom-dropzone:hover {
  border-color: #9d99e2;
  background: #f1f0fc;
}
.custom-dropzone.is-dragover {
  border-color: var(--brand);
  background: #ebe9fb;
  box-shadow: 0 0 0 4px rgba(61,58,143,0.15);
  transform: scale(1.005);
}
.custom-dropzone-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: #ffffff;
  color: var(--brand);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(61,58,143,0.12);
  margin-bottom: 6px;
  transition: transform .2s ease;
}
.custom-dropzone:hover .custom-dropzone-icon {
  transform: translateY(-2px);
}
.custom-dropzone-title {
  font-size: 14px;
  font-weight: 700;
  color: #1c1d2e;
}
.custom-dropzone-title .browse-link {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.custom-dropzone-subtitle {
  font-size: 12px;
  color: #7b7c8e;
  font-weight: 500;
  max-width: 480px;
  line-height: 1.45;
}
.custom-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  width: 100%;
  justify-content: center;
}
.custom-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #dcdfe8;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #27283c;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  animation: fadeInMsg .2s ease;
}
.custom-file-chip svg {
  color: var(--brand);
  flex-shrink: 0;
}
.custom-file-chip .file-size {
  color: #8c8d9e;
  font-size: 11px;
  font-weight: 500;
}
.custom-file-chip .remove-file-btn {
  background: none;
  border: 0;
  padding: 0;
  width: 18px;
  height: 18px;
  color: #9d9eaf;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: all .15s ease;
  margin-left: 4px;
}
.custom-file-chip .remove-file-btn:hover {
  background: #fee;
  color: var(--danger);
}

.custom-file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px dashed #cfd0e1;
  background: #fafbfe;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all .18s ease;
}
.custom-file-picker:hover {
  border-color: var(--brand);
  background: #f4f3ff;
}
.custom-file-picker.is-dragover {
  border-color: var(--brand);
  background: #edeaff;
  box-shadow: 0 0 0 3px rgba(61,58,143,0.14);
}
.custom-file-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #d8dae6;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #2c2e40;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.custom-file-picker-name {
  font-size: 12.5px;
  color: #7b7c8e;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.custom-file-picker.has-file .custom-file-picker-name {
  color: #1b1c2b;
  font-weight: 600;
}
.custom-file-clear {
  background: none;
  border: 0;
  padding: 4px 6px;
  color: #8c8ea0;
  cursor: pointer;
  border-radius: 6px;
  display: none;
  font-size: 13px;
}
.custom-file-picker.has-file .custom-file-clear {
  display: grid;
  place-items: center;
}
.custom-file-clear:hover {
  color: var(--danger);
  background: #fff0f0;
}

/* Native select fallback */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23707286' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
}

.inline-form {
  display: inline-flex;
  margin: 0;
  align-items: center;
}
.bot-actions .inline-form {
  margin-left: auto;
}
.preset-bot-label {
  padding: 20px 26px;
}
.form-card > .form-grid {
  padding: 20px 26px;
}
.public-compose.without-contact {
  grid-template-columns: minmax(0,1fr) 46px;
}
.public-messages, .grid-2 > *, .form-grid > *, .provider-card, .share-card {
  min-width: 0;
}
.card, .bot-card {
  overflow-wrap: anywhere;
}
.lead-panel {
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
}
.public-compose {
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
:focus-visible {
  outline: 3px solid #817ddb;
  outline-offset: 3px;
}

/* Export & Import Components */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
}
.export-btn svg {
  color: var(--brand);
  transition: transform .15s;
}
.export-btn:hover svg {
  transform: translateY(1px);
}
.import-card {
  margin-bottom: 20px;
  border: 1px solid #dcdde8;
  box-shadow: 0 8px 24px rgba(25,27,50,0.06);
  animation: dropdownFade .2s cubic-bezier(0.16,1,0.3,1);
}
.import-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eeeff6;
}
.template-downloads {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.template-label {
  font-size: 12px;
  font-weight: 600;
  color: #707286;
}
.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: #f0efff;
  color: var(--brand);
  border: 1px solid #d4d1fb;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  transition: all .15s;
}
.chip-link:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(61,58,143,0.22);
}
.file-input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1.5px dashed #cfd0df;
  border-radius: 10px;
  background: #fafbfe;
  cursor: pointer;
  transition: all .18s;
  font-size: 13px;
}
.file-input:hover {
  border-color: var(--brand);
  background: #f4f3ff;
}
.hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #75778a;
}
.hint code {
  background: #eeeff8;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: #3d3a8f;
}

/* User & Permission Management */
.mb-24 {
  margin-bottom: 24px;
}
.text-gold {
  color: #d97706 !important;
}
.text-success {
  color: #059669 !important;
}
.text-muted {
  color: #76778b !important;
  font-size: 12px;
}
.font-semibold {
  font-weight: 600;
}
.gold-avatar {
  background: linear-gradient(135deg,#d97706,#f59e0b,#3d3a8f) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(217,119,6,0.35);
}
.user-row-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  background: #e9e8fa;
  color: var(--brand);
  flex-shrink: 0;
}
.self-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.role-super-admin {
  background: linear-gradient(135deg,#fef3c7,#fde68a);
  color: #92400e;
  border: 1px solid #fcd34d;
  box-shadow: 0 2px 6px rgba(217,119,6,0.15);
}
.role-admin {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}
.role-editor {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.role-viewer {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.role-custom {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.user-manage-card {
  margin-bottom: 24px;
  border: 1px solid #dadbe8;
  box-shadow: 0 12px 32px rgba(25,27,50,0.08);
  animation: dropdownFade .2s cubic-bezier(0.16,1,0.3,1);
}
.permissions-section {
  background: #f8f9fd;
  border: 1px solid #e2e3ee;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 8px 0;
}
.permissions-header {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bot-scope-section {
  background: #f8f9fd;
  border: 1px solid #e2e3ee;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 6px 0 12px;
}
.bot-scope-radios {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.bot-scope-radio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #ffffff;
  border: 1.5px solid #e2e4ef;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  transition: all .15s ease;
  flex: 1;
  min-width: 200px;
}
.bot-scope-radio-card:hover {
  border-color: var(--brand);
  background: #fafaff;
}
.bot-scope-radio-card input[type="radio"]:checked + .radio-content {
  color: var(--brand);
}
.bot-scope-radio-card input[type="radio"] {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
}
.bot-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e4ef;
  border-radius: 10px;
  max-height: 220px;
  overflow-y: auto;
}
.bot-check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #eaebf2;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.bot-check-card:hover {
  border-color: var(--brand);
  background: #f0f0ff;
}
.bot-check-card input[type="checkbox"] {
  accent-color: var(--brand);
}
.bot-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.bot-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
}
.bot-scope-badge.all {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.bot-scope-badge.specific {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.perm-matrix-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}
.perm-matrix-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 12.5px;
}
.perm-matrix-table th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: center;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.perm-matrix-table th.col-module {
  text-align: left;
  min-width: 200px;
}
.perm-matrix-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.perm-matrix-table tr:hover {
  background: #f8fafc;
}
.perm-radio-cell {
  text-align: center;
  white-space: nowrap;
  min-width: 105px;
}
.perm-radio-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all .12s;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.perm-radio-pill:hover {
  background: #f1f5f9;
}
.perm-radio-pill input[type="radio"] {
  cursor: pointer;
  accent-color: var(--brand);
}
.perm-level-none input[type="radio"]:checked {
  accent-color: #ef4444;
}
.perm-level-read input[type="radio"]:checked {
  accent-color: #0284c7;
}
.perm-level-write input[type="radio"]:checked {
  accent-color: #f59e0b;
}
.perm-level-full input[type="radio"]:checked {
  accent-color: #10b981;
}
.perm-preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.perm-preset-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #dcdfe8;
  background: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
}
.perm-preset-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}
.perm-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}

.password-input-group {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.password-input-group input {
  flex: 1;
}
.password-gen-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.password-gen-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.bot-scope-radios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.bot-scope-radio-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  margin: 0 !important;
}
.bot-scope-radio-card:hover {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
}
.bot-scope-radio-card:has(input:checked) {
  border-color: #4f46e5 !important;
  background: #f5f3ff !important;
}
.bot-scope-radio-card input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  padding: 0 !important;
  margin: 2px 0 0 0 !important;
  border: 1.5px solid #cbd5e1 !important;
  accent-color: #4f46e5 !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}
.bot-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.bot-check-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 9px 12px !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}
.bot-check-card:hover {
  border-color: #818cf8 !important;
  background: #ffffff !important;
}
.bot-check-card:has(input:checked) {
  border-color: #4f46e5 !important;
  background: #eef2ff !important;
}
.bot-check-card input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 4px !important;
  background: #fff !important;
  cursor: pointer !important;
  accent-color: #4f46e5 !important;
  flex-shrink: 0 !important;
}
.bot-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.bot-check-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}
.bot-check-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.bot-check-slug {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.perm-head-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.perm-head-label svg {
  flex-shrink: 0;
}
.custom-perms-details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 6px;
}
.custom-perms-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.custom-perms-badge {
  font-size: 11px;
  font-weight: 600;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 8px;
  border-radius: 99px;
}

.actions-cell {
  white-space: nowrap;
}
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
}
.btn-action.edit {
  background: #f0efff;
  color: var(--brand);
  border-color: #dcd9fb;
}
.btn-action.edit:hover {
  background: var(--brand);
  color: #fff;
}
.btn-action.handover {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.btn-action.handover:hover {
  background: #047857;
  color: #ffffff;
}
.btn-action.toggle {
  background: #f4f5f8;
  color: #47495b;
  border-color: #dfe0e9;
}
.btn-action.toggle:hover {
  background: #e6e7ee;
  color: #1d1e2c;
}
.sidebar-user .text-gold {
  color: #fbbf24 !important;
}

/* ==========================================================
   Responsive Breakpoints for All Screens & Viewports
   ========================================================== */

@media (max-width: 1100px) {
  .topbar {
    padding: 16px 24px;
  }
  .content {
    padding: 20px 24px 50px;
  }
  .form-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .provider-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .route-flow {
    justify-content: flex-start;
  }
  .conversation-layout {
    grid-template-columns: 1fr;
  }
  .profile-card {
    order: -1;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    width: 100%;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    height: 100dvh;
    max-height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease;
    z-index: 1000;
  }
  .nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 30, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }
  .nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .nav-open {
    overflow: hidden !important;
  }
  .mobile-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: #fff;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    color: var(--text);
  }
  .topbar {
    padding: 14px 18px;
    gap: 12px;
  }
  .topbar h1 {
    font-size: 20px;
  }
  .topbar p {
    display: none;
  }
  .topbar .btn.primary {
    font-size: 0;
    padding: 8px 12px;
  }
  .topbar .btn.primary::after {
    content: '+';
    font-size: 20px;
    line-height: 1;
  }
  .content {
    padding: 16px 16px 40px;
  }
  .form-grid.two {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: auto;
  }
}

@media (max-width: 680px) {
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .table-toolbar .search-form {
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .table-toolbar .search-form input,
  .table-toolbar .search-form select,
  .table-toolbar .search-form .custom-select-wrap {
    width: 100%;
    max-width: 100%;
  }
  .pagination-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
  .pagination-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .share-actions {
    flex-direction: column;
  }
  .provider-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .provider-actions .btn {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-card strong {
    font-size: 24px;
  }
  .card {
    padding: 16px;
    border-radius: 15px;
  }
  .card-head {
    flex-direction: column;
    gap: 8px;
  }
  .auth-card {
    padding: 24px 18px;
  }
  .bot-card {
    grid-template-columns: 42px 1fr;
  }
  .bot-icon {
    width: 42px;
    height: 42px;
  }
  .public-head {
    padding: 12px 16px;
  }
  .public-messages {
    padding: 16px 12px;
  }
  .chat-msg {
    max-width: 92%;
  }
  .lead-panel {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 24px);
    padding: 20px 18px 16px;
    border-radius: 18px;
  }
  .grid-2-lead {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .lead-head {
    margin-bottom: 14px;
    padding-right: 28px;
  }
  .lead-head h3 {
    font-size: 15.5px;
  }
  .lead-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .lead-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

/* Mobile Anti-Zoom Enforcements (16px minimum font size for form inputs on iOS Safari) */
@media screen and (max-width: 768px) {
  input, select, textarea, button, .custom-select-trigger, .custom-select-label, .custom-file-picker {
    font-size: 16px !important;
  }
  input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], textarea, select {
    font-size: 16px !important;
  }
  .public-shell {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-left: 0;
    border-right: 0;
  }
}

/* ==========================================================================
   Custom Registration Forms & Multi-Bot Lead Center Styles
   ========================================================================== */
.bot-filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.bot-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.bot-tab-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}

.bot-tab-pill.active {
  background: #1e1b4b;
  border-color: #312e81;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(30, 27, 75, 0.25);
}

.bot-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bot-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.bot-tab-pill.active .bot-tab-badge {
  background: #3730a3;
  color: #ffffff;
}

.bot-tab-badge.has-leads {
  background: #dbeafe;
  color: #1d4ed8;
}

.bot-tab-pill.active .bot-tab-badge.has-leads {
  background: #4338ca;
  color: #ffffff;
}

.bot-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.bot-lead-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.bot-lead-badge:hover {
  background: #ddd6fe;
  color: #4c1d95;
  transform: translateY(-1px);
}

.status-badge-select {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-transform: capitalize;
  appearance: auto;
  -webkit-appearance: auto;
}

.status-badge-select.status-new {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.status-badge-select.status-contacted {
  background: #fefce8;
  color: #a16207;
  border-color: #fef08a;
}

.status-badge-select.status-qualified {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.status-badge-select.status-converted {
  background: #faf5ff;
  color: #7e22ce;
  border-color: #e9d5ff;
}

.status-badge-select.status-closed {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}

.preset-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-pill {
  padding: 8px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.preset-pill.active {
  background: #3D3A8F;
  border-color: #3D3A8F;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(61, 58, 143, 0.3);
}

.field-builder-row.is-enabled {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  transition: opacity 0.2s ease;
}

.modal-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Custom Form Builder & Multi-Form Management Styles */
.sub-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 99px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
  text-decoration: none;
}

.sub-tab-pill:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.sub-tab-pill.active {
  background: #3D3A8F;
  color: #ffffff;
  border-color: #3D3A8F;
  box-shadow: 0 2px 6px rgba(61, 58, 143, 0.25);
}

.sub-tab-pill.active .badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.form-builder-layout {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 24px !important;
  align-items: start !important;
  width: 100% !important;
}

@media (max-width: 992px) {
  .form-builder-layout {
    grid-template-columns: 1fr !important;
  }
}

.builder-palette-panel {
  position: sticky;
  top: 20px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.builder-palette-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  margin-top: 14px;
}

.palette-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 14px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  cursor: grab !important;
  user-select: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
  min-height: 58px !important;
}

.palette-item:hover {
  background: #f8faff !important;
  border-color: #6366f1 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.12) !important;
}

.palette-item:active {
  cursor: grabbing !important;
}

.palette-icon-badge {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.palette-item:hover .palette-icon-badge {
  background: #e0e7ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.palette-text-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.palette-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.palette-hint {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.palette-item:hover .palette-name {
  color: #4338ca;
}

.palette-item:hover .palette-hint {
  color: #6366f1;
}

.palette-add {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-left: auto;
  flex-shrink: 0;
}

.palette-item:hover .palette-add {
  background: #6366f1;
  color: #ffffff;
  transform: scale(1.1);
}

.btn.secondary.btn-danger-hover:hover {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #dc2626 !important;
}

/* Forms Management Grid & Cards */
.forms-management-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}

@media (max-width: 640px) {
  .forms-management-grid {
    grid-template-columns: 1fr;
  }
}

.form-manage-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.form-manage-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.bot-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.fields-summary-header {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.field-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
  line-height: 1.3;
  transition: all 0.15s ease;
}

.field-chip svg {
  color: #6366f1;
  flex-shrink: 0;
}

.field-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.field-chip.more-chip {
  background: #f1f5f9;
  color: #64748b;
  font-weight: 600;
  border-style: dashed;
}

.triggers-summary-box {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.triggers-summary-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.triggers-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.trigger-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 600;
}

.form-card-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.submissions-badge-link {
  text-decoration: none;
  font-size: 12.5px;
  color: #4338ca;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: #eef2ff;
  transition: all 0.15s ease;
}

.submissions-badge-link:hover {
  background: #e0e7ff;
  color: #3730a3;
}

.icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.icon-btn:hover {
  border-color: #6366f1;
  color: #4338ca;
  background: #f8faff;
  transform: translateY(-1px);
}

.icon-btn.danger:hover {
  border-color: #fca5a5;
  color: #dc2626;
  background: #fef2f2;
  transform: translateY(-1px);
}

.builder-canvas-panel {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.canvas-field-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.canvas-field-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.canvas-field-card.dragging {
  opacity: 0.5;
  background: #f8fafc;
  border: 2px dashed #6366f1;
}

.canvas-field-card.drag-over {
  border-top: 3px solid #6366f1;
}

.canvas-field-handle {
  cursor: grab;
  color: #94a3b8;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.canvas-field-handle:hover {
  background: #f1f5f9;
  color: #475569;
}

.canvas-field-handle:active {
  cursor: grabbing;
}

.option-pill-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

/* Chat Header Forms Dropdown */
.header-forms-dropdown {
  position: relative;
}

.header-forms-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  min-width: 220px;
  z-index: 1000;
  padding: 6px;
  display: none;
}

.header-forms-menu.show {
  display: block;
  animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-form-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #1e293b;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease;
  cursor: pointer;
  text-decoration: none;
}

.header-form-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* ==========================================================================
   IN-CHAT COMPULSORY LEAD CAPTURE & APPOINTMENT SCHEDULER (CALENDAR)
   ========================================================================== */

.inchat-card-wrap {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  max-width: 100%;
}

.inchat-lead-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  animation: inchatCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 4px;
}

@keyframes inchatCardPop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.inchat-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 14px;
  background: linear-gradient(180deg, #fafbfe 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

.inchat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand, #3D3A8F);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--brand, #3D3A8F) 25%, transparent);
}

.inchat-card-title {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.inchat-card-subtitle {
  margin: 0;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.45;
}

.inchat-form-body {
  padding: 16px 18px 18px;
}

.inchat-field-row {
  margin-bottom: 12px;
}

.inchat-field-row label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inchat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.inchat-input-wrap:focus-within {
  background: #ffffff;
  border-color: var(--brand, #3D3A8F);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #3D3A8F) 14%, transparent);
}

.inchat-input-wrap input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 13.5px;
  color: #0f172a;
  outline: none;
}

.inchat-fields-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .inchat-fields-split {
    grid-template-columns: 1fr;
  }
}

.inchat-error-text {
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

.inchat-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand, #3D3A8F);
  color: #ffffff;
  border: none;
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand, #3D3A8F) 28%, transparent);
}

.inchat-submit-btn:hover {
  background: color-mix(in srgb, var(--brand, #3D3A8F) 85%, #000);
  transform: translateY(-1px);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--brand, #3D3A8F) 38%, transparent);
}

.inchat-submit-btn:active {
  transform: translateY(0);
}

.inchat-lead-success {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 16px;
}

.inchat-success-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

.inchat-lead-success strong {
  display: block;
  font-size: 14px;
  color: #15803d;
  margin-bottom: 2px;
}

.inchat-lead-success p {
  margin: 0;
  font-size: 12.5px;
  color: #166534;
}

/* Appointment Prompt Card */
.inchat-appt-prompt {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.06);
  animation: inchatCardPop 0.3s ease;
}

.inchat-appt-prompt-text {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.inchat-badge-icon {
  font-size: 26px;
  line-height: 1;
}

.inchat-appt-prompt-text h4 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px;
}

.inchat-appt-prompt-text p {
  margin: 0;
  font-size: 13px;
  color: #475569;
}

.inchat-appt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inchat-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--brand, #3D3A8F);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand, #3D3A8F) 25%, transparent);
  transition: all 0.15s ease;
}

.inchat-btn-primary:hover {
  background: color-mix(in srgb, var(--brand, #3D3A8F) 85%, #000);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand, #3D3A8F) 35%, transparent);
}

.inchat-btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inchat-btn-ghost:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* In-Chat Action & Confirmation Cards */
.inchat-confirm-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 24px -4px rgba(0, 0, 0, 0.08);
  animation: inchatCardPop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 100%;
}

.inchat-confirm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fafbfe;
  border-bottom: 1px solid #f1f5f9;
}

.inchat-confirm-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inchat-confirm-icon.danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecdd3;
}

.inchat-confirm-icon.primary {
  background: #eff6ff;
  color: #3b82f6;
  border: 1px solid #dbeafe;
}

.inchat-confirm-text h4 {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.inchat-confirm-text p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.inchat-confirm-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  margin-top: 2px;
}

.inchat-confirm-meta svg {
  color: #64748b;
  flex-shrink: 0;
}

.inchat-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 16px 14px;
  background: #ffffff;
}

.inchat-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  border: none;
  line-height: 1;
  text-decoration: none;
  box-sizing: border-box;
}

.inchat-confirm-btn svg {
  flex-shrink: 0;
}

.inchat-confirm-btn.danger {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1px solid #b91c1c !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.28);
}

.inchat-confirm-btn.danger * {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

.inchat-confirm-btn.danger:hover:not(:disabled) {
  background: #b91c1c !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.38);
}

.inchat-confirm-btn.keep {
  background: #f8fafc !important;
  color: #1e293b !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.inchat-confirm-btn.keep * {
  color: #1e293b !important;
  stroke: #1e293b !important;
}

.inchat-confirm-btn.keep:hover:not(:disabled) {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  transform: translateY(-1px);
}

.inchat-confirm-btn:disabled {
  cursor: not-allowed;
}

.inchat-confirm-btn.is-selected {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.inchat-confirm-btn.is-dimmed {
  opacity: 0.45 !important;
  transform: none !important;
}

/* Calendar In-Chat Scheduler */
.apple-cal-card {
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.1);
  animation: inchatCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-cal-header {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
}

.apple-cal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: color-mix(in srgb, var(--brand, #3D3A8F) 12%, transparent);
  color: var(--brand, #3D3A8F);
  border: 1px solid color-mix(in srgb, var(--brand, #3D3A8F) 20%, transparent);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.apple-cal-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand, #3D3A8F);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.7; }
}

.apple-cal-header h3 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.apple-cal-header p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.apple-cal-step {
  padding: 12px 18px;
  border-bottom: 1px solid #f1f5f9;
}

.apple-cal-step-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  margin-bottom: 8px;
}

.apple-cal-date-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.apple-cal-date-pills .date-pill {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.apple-cal-date-pills .date-pill.active {
  background: var(--brand, #3D3A8F);
  color: #ffffff;
  border-color: var(--brand, #3D3A8F);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand, #3D3A8F) 25%, transparent);
}

.apple-date-input {
  display: none;
}

/* Custom Apple Mini Calendar Popover/Expander */
.apple-cal-date-pills .date-pill.custom-date-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.apple-custom-cal-popup {
  margin-top: 10px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
  animation: appleCalSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes appleCalSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.apple-cal-pop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.apple-cal-month-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.apple-cal-nav-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  transition: all 0.15s ease;
}

.apple-cal-nav-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.apple-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.apple-cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.apple-cal-day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  user-select: none;
}

.apple-cal-day-cell:hover:not(:disabled):not(.is-selected) {
  background: #f1f5f9;
  color: #0f172a;
}

.apple-cal-day-cell.is-today:not(.is-selected)::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand, #3b82f6);
}

.apple-cal-day-cell.is-selected {
  background: var(--brand, #3D3A8F) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand, #3D3A8F) 35%, transparent) !important;
}

.apple-cal-day-cell:disabled,
.apple-cal-day-cell.is-past {
  color: #cbd5e1 !important;
  cursor: not-allowed !important;
  opacity: 0.4;
}

.apple-cal-day-cell.is-diff-month {
  color: #cbd5e1;
  opacity: 0.3;
}

.apple-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding: 2px;
}

.apple-slot-pill {
  padding: 8px 4px;
  text-align: center;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #1e293b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.apple-slot-pill:hover:not(:disabled) {
  border-color: var(--brand, #3D3A8F);
  background: color-mix(in srgb, var(--brand, #3D3A8F) 6%, #ffffff);
}

.apple-slot-pill.active {
  background: var(--brand, #3D3A8F);
  color: #ffffff;
  border-color: var(--brand, #3D3A8F);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--brand, #3D3A8F) 28%, transparent);
}

.apple-slot-pill.is-booked {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: 0.6;
}

.apple-slot-loading,
.apple-no-slots,
.apple-slot-error {
  grid-column: 1 / -1;
  padding: 12px;
  text-align: center;
  font-size: 12.5px;
  color: #64748b;
  background: #f8fafc;
  border-radius: 8px;
}

.apple-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 480px) {
  .apple-fields-grid {
    grid-template-columns: 1fr;
  }
}

.apple-fields-grid input {
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12.5px;
  color: #0f172a;
  outline: none;
}

.apple-fields-grid input:focus {
  background: #ffffff;
  border-color: var(--brand, #3D3A8F);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand, #3D3A8F) 14%, transparent);
}

.apple-cal-footer {
  padding: 14px 18px;
  background: #fafbfe;
  border-top: 1px solid #e2e8f0;
}

.apple-confirm-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.28);
  transition: all 0.15s ease;
}

.apple-confirm-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* Apple Confirmed Ticket */
.apple-confirmed-ticket {
  background: #ffffff;
  border: 1.5px solid #86efac;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 30px -6px rgba(5, 150, 105, 0.15);
  animation: inchatCardPop 0.35s ease;
  transition: all 0.3s ease;
}

.apple-confirmed-ticket.is-cancelled {
  border-color: #fca5a5;
  box-shadow: 0 12px 30px -6px rgba(239, 68, 68, 0.12);
}

.apple-ticket-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  transition: background 0.3s ease;
}

.apple-confirmed-ticket.is-cancelled .apple-ticket-top {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.apple-check-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.apple-confirmed-ticket.is-cancelled .apple-check-circle {
  background: rgba(255, 255, 255, 0.25);
}

.apple-ticket-top h4 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.apple-ticket-top p {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

.apple-ticket-details {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.apple-ticket-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}

.apple-ticket-label {
  color: #64748b;
  font-size: 12px;
}

.apple-ticket-val {
  color: #0f172a;
  font-weight: 600;
  text-align: right;
}

.apple-synced-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #065f46;
  font-size: 12px;
  font-weight: 600;
}

.apple-calendar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 18px 16px;
  background: #ffffff;
}

.apple-cal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.apple-cal-btn.google {
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.apple-cal-btn.google:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.apple-cal-btn.apple {
  background: #0f172a;
  color: #ffffff;
  border: 1.5px solid #0f172a;
}

.apple-cal-btn.apple:hover {
  background: #1e293b;
}

/* ==========================================================================
   ADMIN PANEL: CALENDAR EXPERIENCE (/admin/appointments)
   ========================================================================== */

.apple-admin-calendar-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  margin-top: 10px;
}

@media (max-width: 1024px) {
  .apple-admin-calendar-shell {
    grid-template-columns: 1fr;
  }
}

/* Sidebar in Calendar */
.apple-cal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.apple-sidebar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.apple-mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.apple-mini-cal-head strong {
  font-size: 13.5px;
  color: #0f172a;
}

.apple-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
  font-size: 11px;
}

.apple-mini-day-hdr {
  font-weight: 700;
  color: #94a3b8;
  padding-bottom: 4px;
}

.apple-mini-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #334155;
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
}

.apple-mini-cell:hover {
  background: #f1f5f9;
}

.apple-mini-cell.is-today {
  background: #ef4444;
  color: #ffffff;
  font-weight: 700;
}

.apple-mini-cell.is-selected {
  background: var(--brand, #3D3A8F);
  color: #ffffff;
  font-weight: 700;
}

.apple-mini-cell.has-events::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.apple-cal-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
  color: #334155;
}

.apple-cal-filter-item:hover {
  background: #f8fafc;
}

.apple-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Main Calendar Grid */
.apple-cal-main-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.apple-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  flex-wrap: wrap;
  gap: 12px;
}

.apple-cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.apple-cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
}

.apple-cal-nav-btn:hover {
  background: #f1f5f9;
}

.apple-cal-today-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.apple-cal-today-btn:hover {
  background: #f1f5f9;
}

.apple-cal-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-left: 8px;
}

.apple-view-segmented {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.apple-seg-btn {
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.apple-seg-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Month Grid */
.apple-month-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.apple-month-table th {
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  background: #fafbfe;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
}

.apple-month-table td {
  height: 110px;
  vertical-align: top;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  padding: 6px;
  position: relative;
  transition: background 0.12s;
}

.apple-month-table td:hover {
  background: #fafbfe;
}

.apple-month-table td.is-diff-month {
  background: #fafafa;
  opacity: 0.55;
}

.apple-day-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.apple-day-number.is-today {
  background: #ef4444;
  color: #ffffff;
  font-weight: 700;
}

.apple-event-pill {
  display: block;
  margin-bottom: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.08);
  color: #1e3a8a;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
}

.apple-event-pill:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

.apple-event-pill.status-confirmed {
  border-color: rgba(5, 150, 105, 0.25);
  background: rgba(5, 150, 105, 0.1);
  color: #064e3b;
}

.apple-event-pill.status-completed {
  border-color: rgba(100, 116, 139, 0.25);
  background: rgba(100, 116, 139, 0.1);
  color: #334155;
}

.apple-event-pill.status-cancelled {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.1);
  color: #7f1d1d;
  text-decoration: line-through;
}

/* Event Inspector Modal */
.apple-inspector-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn 0.18s ease;
}

.apple-inspector-card {
  background: #ffffff;
  border-radius: 20px;
  max-width: 520px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.25);
  animation: scaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* Apple Event Inspector Modal Components */
.apple-insp-topbar {
  padding: 16px 20px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.apple-insp-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.apple-insp-bot-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: #eff6ff;
  color: #2563eb;
  letter-spacing: 0.02em;
}
.apple-insp-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: capitalize;
}
.apple-insp-status-pill.status-confirmed {
  background: #e9f7f1;
  color: #15803d;
}
.apple-insp-status-pill.status-completed {
  background: #f0fdf4;
  color: #166534;
}
.apple-insp-status-pill.status-cancelled {
  background: #fef2f2;
  color: #dc2626;
}
.apple-insp-close-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  transition: all 0.15s ease;
}
.apple-insp-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.apple-insp-hero {
  padding: 10px 20px 14px 20px;
}
.apple-insp-hero h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}
.apple-insp-subtitle {
  font-size: 12.5px;
  color: #64748b;
  margin-top: 3px;
}

.apple-inspector-body {
  padding: 0 20px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Apple Date & Time Card */
.apple-insp-datetime-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
}
.apple-insp-cal-icon {
  width: 48px;
  height: 52px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  text-align: center;
}
.cal-icon-month {
  background: #ff3b30;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 0;
  text-transform: uppercase;
}
.cal-icon-day {
  font-size: 21px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}
.apple-insp-datetime-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.apple-insp-date-primary {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
}
.apple-insp-time-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
  font-weight: 600;
}
.apple-insp-tz {
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 400;
}

/* Attendee Profile Card */
.apple-insp-attendee-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
}
.apple-insp-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
.apple-insp-attendee-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow: hidden;
}
.apple-insp-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.apple-insp-contact-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.apple-insp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  transition: all 0.15s ease;
}
.apple-insp-chip:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #0f172a;
}
.apple-insp-chip.email:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}
.apple-insp-chip.phone:hover {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}

/* Notes Card */
.apple-insp-notes-card {
  padding: 12px 14px;
  background: #fffbeb;
  border-radius: 12px;
  border: 1px solid #fef08a;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.apple-insp-notes-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.apple-insp-notes-content {
  font-size: 13px;
  color: #78350f;
  line-height: 1.45;
}

/* Two-Column Status & Google Calendar Meta Box */
.apple-insp-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.apple-insp-meta-box {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.apple-insp-meta-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}
.apple-insp-select {
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  width: 100%;
}
.apple-insp-gcal-badge {
  font-size: 12.5px;
  line-height: 1.35;
}

/* Action Buttons */
.apple-inspector-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
}
.apple-insp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1.5px solid transparent;
}
.apple-insp-btn.secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}
.apple-insp-btn.secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}
.apple-insp-btn.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.apple-insp-btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.apple-insp-btn-delete {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.apple-insp-btn-delete:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* Apple Inspector Form Components & iOS Switch */
.apple-inspector-actions.space-between {
  justify-content: space-between;
}
.apple-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  transition: all 0.15s ease;
}
.apple-toggle-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.apple-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.apple-toggle-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.apple-toggle-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

/* iOS Style Switch */
.apple-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}
.apple-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.apple-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 999px;
}
.apple-switch-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.apple-switch input:checked + .apple-switch-slider {
  background-color: #2563eb;
}
.apple-switch input:focus + .apple-switch-slider {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.apple-switch input:checked + .apple-switch-slider:before {
  transform: translateX(20px);
}

/* Apple Form Fields */
.apple-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.apple-form-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.apple-form-input,
.apple-form-select,
.apple-form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: #0f172a;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  box-sizing: border-box;
  transition: all 0.15s ease;
  font-family: inherit;
}
.apple-form-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}
.apple-form-input:focus,
.apple-form-select:focus,
.apple-form-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.apple-form-hint {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}
.apple-key-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.apple-key-status.active {
  background: #e9f7f1;
  color: #15803d;
}
.apple-key-status.missing {
  background: #fef3c7;
  color: #92400e;
}
.apple-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Widget Iframe Optimized Mode */
body.widget-mode {
  background: transparent;
}
body.widget-mode .public-head {
  display: none !important;
}
body.widget-mode .public-shell {
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border: none !important;
  background: var(--chat-bg, #f7f8fd);
  display: flex !important;
  flex-direction: column !important;
}
body.widget-mode .public-messages {
  padding: 14px 16px;
  background: var(--chat-bg, #f7f8fd);
  background-image: var(--chat-pattern, none), var(--chat-bg, #f7f8fd);
  background-repeat: repeat, no-repeat;
  background-size: var(--chat-pattern-size, auto), cover;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  height: 100% !important;
}
body.widget-mode .public-compose {
  padding: 10px 14px 12px;
}
body.widget-mode .powered {
  display: flex !important;
  font-size: 10.5px;
  padding: 3px 12px 6px;
  background: rgba(255, 255, 255, 0.98);
}

/* Admin Widget Bubble Customization & Live Preview */
.widget-preview-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.widget-preview-stage {
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
  height: 160px;
  position: relative;
  overflow: hidden;
  background-image: radial-gradient(#e2e8f0 1.5px, transparent 1.5px);
  background-size: 16px 16px;
}
.widget-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.widget-type-card {
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  user-select: none;
}
.widget-type-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.widget-type-card.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #2563eb;
}
.widget-type-card input[type="radio"] {
  display: none;
}
.widget-type-preview-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
}
.widget-type-card span {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}

/* Modern Toggle Switch & Source Citations Component */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 999px;
  transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.toggle-switch input:checked + .toggle-slider {
  background-color: #2563eb;
}
.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-card {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 16px 18px !important;
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 14px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  user-select: none !important;
  margin-bottom: 0 !important;
}
.toggle-card:hover {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02) !important;
}
.toggle-card.active,
.toggle-card:has(input:checked) {
  border-color: #93c5fd !important;
  background: #f0f7ff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06) !important;
}

/* Quick Source Toggle Badge on Bot Cards & Toolbar */
.source-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  transition: all 0.18s ease;
  line-height: 1.3;
  user-select: none;
}
.source-status-badge:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #334155;
  transform: translateY(-1px);
}
.source-status-badge.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.source-status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.source-status-badge.active .dot {
  background: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* ==========================================================================
   Universal Custom Dialogs, Confirmations, Alerts & Prompts
   ========================================================================== */

.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
  box-sizing: border-box;
}

.custom-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.custom-dialog-card {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.05);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  padding: 24px;
  box-sizing: border-box;
}

.custom-modal-backdrop.is-open .custom-dialog-card {
  transform: scale(1) translateY(0);
}

.custom-dialog-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.custom-dialog-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.custom-dialog-icon-wrap.icon-danger {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fee2e2;
}

.custom-dialog-icon-wrap.icon-warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fef3c7;
}

.custom-dialog-icon-wrap.icon-info,
.custom-dialog-icon-wrap.icon-primary {
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #e0e7ff;
}

.custom-dialog-icon-wrap.icon-success {
  background: #f0fdf4;
  color: #10b981;
  border: 1px solid #dcfce7;
}

.custom-dialog-titles {
  flex: 1;
  min-width: 0;
}

.custom-dialog-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
  letter-spacing: -0.015em;
  line-height: 1.35;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-dialog-message {
  font-size: 13.5px;
  color: #64748b;
  margin: 0;
  line-height: 1.55;
  word-break: break-word;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-dialog-body {
  margin-top: 14px;
}

.custom-dialog-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.custom-dialog-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.custom-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.custom-dialog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  user-select: none;
}

.custom-dialog-btn:active {
  transform: scale(0.97);
}

.custom-dialog-btn--cancel {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}

.custom-dialog-btn--cancel:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #94a3b8;
}

.custom-dialog-btn--primary {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4338ca;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.custom-dialog-btn--primary:hover {
  background: #4338ca;
  border-color: #3730a3;
}

.custom-dialog-btn--danger {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.2);
}

.custom-dialog-btn--danger:hover {
  background: #dc2626;
  border-color: #b91c1c;
}



