@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: #ecebfa;
  --brand-hover: #4e4ab5;
  --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;
}

*, *::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: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  flex-shrink: 0;
}
.public-logo-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(61,58,143,0.25));
  flex-shrink: 0;
}
.auth-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(61,58,143,0.2));
  flex-shrink: 0;
}
.bot-icon-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.12));
  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);
  transform: translateY(-1px);
  box-shadow: 0 7px 20px rgba(61,58,143,0.25);
}
.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);
}
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;
  padding: 5px 9px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 800;
}
.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;
}
.check {
  display: flex;
  gap: 9px;
  align-items: center;
  background: #f7f7fa;
  padding: 11px 12px;
  border-radius: 10px;
}
.check input {
  width: 16px;
  height: 16px;
}
.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: #f2f2f6;
  line-height: 1.55;
}
.message.user {
  margin-left: auto;
}
.message.user > div {
  background: var(--brand);
  color: #fff;
}
.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 */
.public-chat-body {
  background: radial-gradient(circle at 10% 5%,#eeeef8,transparent 40%),radial-gradient(circle at 90% 95%,#fff6e8,transparent 35%),#f4f5fa;
  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: 960px;
  margin: 0 auto;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  box-shadow: 0 12px 60px rgba(28,29,54,0.08);
  position: relative;
  border-left: 1px solid #e9eaf2;
  border-right: 1px solid #e9eaf2;
  overflow: hidden;
}
.public-head {
  min-height: 70px;
  border-bottom: 1px solid #eaebf2;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  flex-shrink: 0;
}
.public-logo {
  background: var(--brand);
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  font: 800 18px 'Manrope',sans-serif;
  box-shadow: 0 4px 12px rgba(61,58,143,0.25);
}
.public-head b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #181926;
}
.public-head span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #7c7d8e;
  font-size: 11px;
  margin-top: 2px;
  font-weight: 500;
}
.public-head i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1db978;
  box-shadow: 0 0 0 2px #d4f7e6;
}
.public-messages {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px clamp(14px, 4vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: linear-gradient(180deg,#fafbfe 0%,#f5f6fa 100%);
  flex: 1;
}
.chat-msg {
  max-width: min(780px,88%);
  font-size: 14px;
  line-height: 1.65;
  animation: fadeInMsg .25s ease-out;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg > div {
  padding: 15px 18px;
  background: #ffffff;
  border: 1px solid #e6e8f2;
  border-radius: 4px 18px 18px 18px;
  color: #212232;
  box-shadow: 0 2px 10px rgba(20,22,44,0.03);
  overflow-wrap: anywhere;
  word-break: normal;
}
.chat-msg.user {
  align-self: flex-end;
}
.chat-msg.user > div {
  background: linear-gradient(135deg,var(--brand),#504cb5);
  color: #fff;
  border: 0;
  border-radius: 18px 4px 18px 18px;
  box-shadow: 0 6px 20px rgba(61,58,143,0.22);
}
.chat-msg.user p {
  color: #fff;
}
.chat-msg p {
  margin: 0 0 10px;
  line-height: 1.65;
  color: inherit;
}
.chat-msg p:last-child {
  margin-bottom: 0;
}
.chat-msg ul, .chat-msg ol {
  margin: 8px 0 10px 20px;
  padding: 0;
}
.chat-msg li {
  margin: 5px 0;
  line-height: 1.55;
}
.chat-msg h1, .chat-msg h2, .chat-msg h3, .chat-msg h4 {
  margin: 14px 0 6px;
  color: inherit;
  font-size: 15px;
  font-weight: 700;
}
.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 strong {
  font-weight: 700;
  color: inherit;
}
.chat-msg em {
  font-style: italic;
}
.chat-msg a {
  color: var(--brand);
  text-decoration: underline;
  font-weight: 600;
}
.chat-msg .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
  border-radius: 12px;
  border: 1px solid #e0e2ed;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  max-width: 100%;
}
.chat-msg table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 480px;
  font-size: 13px;
  table-layout: auto;
  word-break: normal;
}
.chat-msg th {
  background: #f3f4fa;
  color: #2c2e40;
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid #dedfe8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.chat-msg td {
  padding: 10px 14px;
  border-bottom: 1px solid #ebedf5;
  color: #2c2d3c;
  vertical-align: top;
  word-break: normal;
  overflow-wrap: normal;
  line-height: 1.5;
}
.chat-msg tr:last-child td {
  border-bottom: 0;
}
.chat-msg tr:nth-child(even) td {
  background: #fafafc;
}
.chat-msg tr:hover td {
  background: #f4f5fd;
}
.chat-msg code {
  background: #eff0f7;
  padding: 3px 6px;
  border-radius: 5px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #353648;
}
.chat-msg pre {
  background: #161726;
  color: #ececf7;
  padding: 12px 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.6;
}
.chat-msg pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #585b73;
  background: rgba(240, 243, 252, 0.95);
  padding: 4px 12px;
  border-radius: 20px;
  margin-top: 8px;
  font-weight: 600;
  border: 1px solid #dce0ee;
  box-shadow: 0 1px 4px rgba(20, 24, 44, 0.03);
  transition: all .15s ease;
}
.source-pill:hover {
  background: #e8ecf8;
  color: var(--brand, #3d3a8f);
  border-color: #c9d0eb;
}
.source-pill svg {
  color: var(--brand, #3d3a8f);
  flex-shrink: 0;
}
.source-pill i {
  font-style: normal;
  font-size: 12px;
}
.quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.quick-list button {
  border: 1px solid #dadbe8;
  border-radius: 999px;
  background: #fff;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #3e4052;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.quick-list button:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #f7f7fd;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(61,58,143,0.12);
}
.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);
}
.public-compose #send, .contact-btn {
  border: 0;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.public-compose #send:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(61,58,143,0.3);
}
.public-compose textarea {
  flex: 1;
  border: 1.5px solid #e1e4f0;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  resize: none !important;
  max-height: 130px;
  min-height: 46px;
  line-height: 1.45;
  outline: none;
  background: #fafbfe;
  color: #191b29;
  transition: border-color .15s, background .15s, box-shadow .15s;
  overflow-x: hidden !important;
  overflow-y: hidden;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE 10+ */
}
.public-compose textarea::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.public-compose textarea:focus {
  border-color: var(--brand, #3d3a8f);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(61,58,143,0.12);
}
.public-compose #send {
  width: 44px;
  height: 46px;
  border-radius: 14px;
  border: 0;
  background: var(--brand, #3d3a8f);
  color: white;
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .15s, box-shadow .15s;
}
.public-compose #send:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(61,58,143,0.3);
}
.public-compose #send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.contact-btn {
  width: 44px;
  height: 46px;
  background: #f0f2f9;
  color: #43465e;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e5f0;
  cursor: pointer;
  transition: all .15s ease;
  flex-shrink: 0;
}
.contact-btn:hover {
  background: #e4e7f5;
  color: var(--brand, #3d3a8f);
  border-color: #c9cdf0;
  transform: translateY(-1px);
}
.powered {
  text-align: center;
  font-size: 10.5px;
  line-height: 1.5;
  color: #9b9caa;
  padding: 0 12px 10px;
  background: #fff;
}
.typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b8da0;
  margin: 0 2px;
  animation: blink 1.2s 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: rgba(61,58,143,0.08);
  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 {
  background: #ffffff;
  border-color: var(--brand, #3d3a8f);
  box-shadow: 0 0 0 3.5px rgba(61,58,143,0.12);
  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: linear-gradient(135deg, #f8f9ff 0%, #edf1fd 100%);
  border: 1.5px solid #dce2f8;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(61, 58, 143, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all .2s ease;
}
.chat-lead-card:hover {
  border-color: #c5cef5;
  box-shadow: 0 8px 24px rgba(61, 58, 143, 0.1);
  transform: translateY(-1px);
}
.chat-lead-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(61, 58, 143, 0.1);
  color: var(--brand, #3d3a8f);
  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: linear-gradient(135deg, var(--brand, #3d3a8f) 0%, #4d49ad 100%) !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 rgba(61, 58, 143, 0.28);
  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: linear-gradient(135deg, #322f7a 0%, #3e3a96 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 7px 20px rgba(61, 58, 143, 0.36);
  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);
}

/* Fallback class for legacy banner */
.chat-form-banner {
  margin-top: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #f8f9ff 0%, #edf1fd 100%);
  border: 1.5px solid #dce2f8;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(61, 58, 143, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.chat-form-btn {
  background: linear-gradient(135deg, var(--brand, #3d3a8f) 0%, #4d49ad 100%);
  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 rgba(61,58,143,0.25);
  transition: all .15s ease;
}
.chat-form-btn:hover {
  background: #312e75;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(61,58,143,0.32);
}

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

/* 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;
}
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.perm-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e4e5f0;
  border-radius: 9px;
  cursor: pointer;
  transition: all .15s;
}
.perm-check-item:hover {
  border-color: var(--brand);
  background: #fafaff;
}
.perm-check-item input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--brand);
}
.perm-check-item div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.perm-check-item div b {
  font-size: 12.5px;
  color: #1c1d2c;
}
.perm-check-item div small {
  font-size: 11px;
  color: #78798c;
}
.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.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;
  }
}

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