@import url("/assets/css/apx-brand.css");

/* =========================================================
   APX LiveChat Multi-Tenant Professional Backoffice
   Comm100 Enterprise Parity & A1 Malta Signal Brand System
   ========================================================= */

:root {
  --sidebar-w: 250px;
  --topbar-h: 60px;
  --col-sessions-w: 310px;
  --col-crm-w: 320px;
  --gold-glow: 0 0 24px rgba(196, 163, 90, 0.12);
  --border-subtle: rgb(196 163 90 / 0.14);
  --border-strong: rgb(196 163 90 / 0.35);
  --bg-app: #05080f;
  --bg-surface: #0a101c;
  --bg-card: #101726;
  --bg-hover: #172235;
  --gold-accent: #c4a35a;
  --gold-hover: #d4b56a;
}

body {
  background-color: var(--bg-app);
  color: var(--apx-ink);
  font-family: var(--apx-font);
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: #1e2c40; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-accent); }

/* =========================================================
   1) LOGIN OVERLAY
   ========================================================= */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 25%, #0f182c 0%, #05080f 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), var(--gold-glow);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  width: 52px;
  height: 48px;
  margin: 0 auto 14px;
  filter: drop-shadow(0 2px 10px rgba(196, 163, 90, 0.3));
}

.login-title {
  font-family: var(--apx-display);
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
  margin: 0 0 6px;
}

.login-subtitle {
  color: var(--apx-mute);
  font-size: 13px;
  margin: 0;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--apx-mute);
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid #1e2c40;
  border-radius: var(--apx-radius);
  color: #fff;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: var(--gold-accent);
  box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.15);
}

.btn-primary-apx {
  background: linear-gradient(135deg, #c4a35a 0%, #a68438 100%);
  color: #05080f;
  font-family: var(--apx-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--apx-radius);
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary-apx:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-block { width: 100%; }

.login-alert {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--apx-radius);
  font-size: 13px;
  display: none;
}

.login-alert.error {
  display: block;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--apx-danger);
}

.login-hints {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--apx-faint);
  line-height: 1.6;
}

.login-hints code {
  color: var(--gold-accent);
  background: var(--bg-card);
  padding: 2px 5px;
  border-radius: 3px;
}

/* =========================================================
   2) TOPBAR & APP SHELL
   ========================================================= */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo-img { width: 30px; height: 28px; }

.brand-titles { display: flex; flex-direction: column; }

.brand-title {
  font-family: var(--apx-display);
  font-weight: 700;
  font-size: 16px;
  color: #ffffff;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--gold-accent);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.role-scope-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--gold-accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Status Selector (Operatör ve Client Admin için) */
.status-selector {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 3px 10px;
  gap: 7px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 6px currentColor;
}
.status-dot.online { background: #10b981; color: #10b981; }
.status-dot.away { background: #f59e0b; color: #f59e0b; }
.status-dot.busy { background: #ef4444; color: #ef4444; }
.status-dot.offline { background: #64748b; color: #64748b; }

.status-select-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.status-select-btn option { background: #0f1624; color: #fff; }

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--apx-radius);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--apx-mute);
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover {
  color: var(--gold-accent);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.icon-btn svg { width: 17px; height: 17px; fill: currentColor; }

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 3px 12px 3px 5px;
  border-radius: 20px;
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-accent), #a68438);
  color: #05080f;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info-text { display: flex; flex-direction: column; }
.user-name-text { font-size: 12.5px; font-weight: 600; color: #fff; line-height: 1.1; }
.user-role-text { font-size: 10.5px; color: var(--apx-mute); }

/* =========================================================
   3) SIDEBAR NAVIGATION
   ========================================================= */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--topbar-h));
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--apx-faint);
  font-weight: 700;
  padding: 10px 12px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: var(--apx-mute);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--apx-radius);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.nav-link svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex-shrink: 0;
}

.nav-link:hover {
  color: #fff;
  background: var(--bg-hover);
}

.nav-link.active {
  color: #fff;
  background: var(--bg-card);
  font-weight: 600;
  border-left: 3px solid var(--gold-accent);
}

.nav-link.active svg { fill: var(--gold-accent); }

.nav-badge {
  margin-left: auto;
  background: #e53e3e;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--apx-faint);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-footer .status-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* =========================================================
   4) CONTENT AREA & VIEWS
   ========================================================= */
.content-area {
  flex: 1;
  background: var(--bg-app);
  overflow-y: auto;
  position: relative;
}

.view-section {
  display: none;
  padding: 24px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

.view-section.active { display: block; }

.view-section.view-desk {
  padding: 0;
  max-width: none;
  height: 100%;
  overflow: hidden;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-head h1 {
  font-family: var(--apx-display);
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}

.page-head p {
  color: var(--apx-mute);
  font-size: 13px;
  margin: 0;
}

/* Metrics Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s;
}

.metric-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.metric-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--apx-mute);
  font-weight: 600;
  margin-bottom: 6px;
}

.metric-value {
  font-family: var(--apx-display);
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 4px;
}

.metric-value.gold { color: var(--gold-accent); }
.metric-sub { font-size: 11.5px; color: var(--apx-faint); }

/* =========================================================
   5) COMM100 OPERATOR DESK (3-COLUMN WORKSPACE)
   ========================================================= */
.operator-desk-layout {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* Col 1: Sessions & Queue */
.col-sessions {
  width: var(--col-sessions-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.col-sessions-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.session-tab-btn {
  flex: 1;
  padding: 11px 4px;
  background: transparent;
  border: none;
  color: var(--apx-mute);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.session-tab-btn:hover { color: #fff; }
.session-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--gold-accent);
  background: var(--bg-surface);
}

.tab-counter {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 10px;
}
.tab-counter.queue { background: #f59e0b; color: #05080f; font-weight: 700; }

.col-sessions-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.col-sessions-search input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: #fff;
  padding: 7px 10px;
  font-size: 12.5px;
  outline: none;
}
.col-sessions-search input:focus { border-color: var(--gold-accent); }

.sessions-scroll-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.session-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.session-card.active {
  background: #162235;
  border-color: var(--gold-accent);
  box-shadow: 0 0 12px rgba(196, 163, 90, 0.1);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.visitor-badge-name {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}

.department-tag {
  font-size: 10.5px;
  background: rgba(196, 163, 90, 0.12);
  color: var(--gold-accent);
  padding: 1px 6px;
  border-radius: 3px;
}

.card-preview-msg {
  font-size: 11.5px;
  color: var(--apx-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--apx-faint);
}

.btn-accept-queue {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
}

/* Col 2: Active Conversation & Sneak-Peek */
.col-conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  position: relative;
  overflow: hidden;
}

.conversation-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--apx-mute);
  padding: 20px;
  text-align: center;
}
.conversation-empty .icon { font-size: 42px; margin-bottom: 10px; opacity: 0.5; }

.conversation-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
}

.visitor-meta-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.visitor-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--gold-accent);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visitor-title-box h3 { margin: 0; font-size: 14px; color: #fff; }
.visitor-title-box span { font-size: 11px; color: var(--apx-mute); }

.conversation-actions { display: flex; align-items: center; gap: 7px; }

.desk-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--apx-radius);
  color: var(--apx-ink);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.desk-btn svg { width: 13px; height: 13px; fill: currentColor; }
.desk-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.desk-btn.danger { color: var(--apx-danger); border-color: rgba(248, 113, 113, 0.3); }
.desk-btn.danger:hover { background: rgba(248, 113, 113, 0.15); }

.message-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.msg-row.visitor { align-self: flex-start; }
.msg-row.agent { align-self: flex-end; }
.msg-row.whisper { align-self: stretch; max-width: 100%; }
.msg-row.system { align-self: center; max-width: 90%; text-align: center; }

.msg-bubble {
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.msg-row.visitor .msg-bubble {
  background: var(--bg-card);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 1px;
}

.msg-row.agent .msg-bubble {
  background: linear-gradient(135deg, #18253b 0%, #121c2c 100%);
  color: #fff;
  border: 1px solid var(--border-strong);
  border-bottom-right-radius: 1px;
}

.msg-row.whisper .msg-bubble {
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed #f59e0b;
  color: #fde68a;
  font-size: 12.5px;
}

.msg-row.system .msg-bubble {
  background: transparent;
  color: var(--apx-faint);
  font-size: 11.5px;
  padding: 3px 8px;
}

.msg-meta { font-size: 10px; color: var(--apx-faint); margin-top: 3px; }
.msg-row.agent .msg-meta { text-align: right; }

/* COMM100 SNEAK-PEEK (REAL-TIME KEYSTROKE PREVIEW) */
.sneak-peek-banner {
  background: rgba(196, 163, 90, 0.07);
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-subtle);
  padding: 7px 16px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  box-sizing: border-box;
}

.sneak-peek-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-accent);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.blinking-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: apx-blink 1.2s infinite;
}

@keyframes apx-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

.sneak-peek-text {
  color: #e2e8f0;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Canned Suggestions Popup (Triggered by /) */
.canned-suggestions-popup {
  position: absolute;
  bottom: 74px;
  left: 18px;
  right: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.canned-suggestions-popup.show { display: block; }

.canned-popup-header {
  padding: 7px 12px;
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--gold-accent);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 700;
}

.canned-suggestion-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}
.canned-suggestion-item:hover { background: var(--bg-hover); color: #fff; }
.canned-suggestion-item .shortcut { font-weight: 700; color: var(--gold-accent); margin-right: 10px; }
.canned-suggestion-item .snippet { color: var(--apx-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 450px; }

/* Chat Input Bar */
.chat-input-bar-wrap {
  padding: 10px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.whisper-active-notice {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid #f59e0b;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 11.5px;
  color: #fde68a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.whisper-active-notice button {
  background: transparent;
  border: none;
  color: #f59e0b;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-textarea {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--apx-radius);
  color: #fff;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13.5px;
  resize: none;
  height: 38px;
  box-sizing: border-box;
  outline: none;
  line-height: 1.4;
}
.chat-textarea:focus { border-color: var(--gold-accent); }

.btn-desk-send {
  background: linear-gradient(135deg, var(--gold-accent), #a68438);
  color: #05080f;
  border: none;
  border-radius: var(--apx-radius);
  height: 38px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}
.btn-desk-send:hover { filter: brightness(1.1); }
.btn-desk-send svg { width: 14px; height: 14px; fill: currentColor; }

/* Col 3: Visitor CRM & Intelligence */
.col-crm {
  width: var(--col-crm-w);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.crm-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.crm-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.crm-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.crm-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-block-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold-accent);
  font-weight: 700;
}

.crm-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  line-height: 1.4;
}
.crm-row .k { color: var(--apx-mute); }
.crm-row .v { color: #fff; font-weight: 500; text-align: right; word-break: break-all; }
.crm-row .v.gold { color: var(--gold-accent); font-weight: 700; }

.crm-notes-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: #fff;
  padding: 7px 9px;
  font-size: 11.5px;
  resize: vertical;
  min-height: 55px;
  outline: none;
}

.crm-actions-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 6px;
}

/* =========================================================
   6) TABLES, CARDS & FORMS (CLIENT & PLATFORM)
   ========================================================= */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.table-toolbar {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.table-search-input {
  width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: #fff;
  padding: 7px 11px;
  font-size: 12.5px;
  outline: none;
}

.apx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.apx-table th {
  background: var(--bg-surface);
  color: var(--gold-accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.apx-table td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--apx-ink);
}

.apx-table tr:hover td { background: rgba(196, 163, 90, 0.03); }

.badge-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  display: inline-block;
}
.badge-pill.active { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-pill.passive { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-pill.admin { background: rgba(196, 163, 90, 0.18); color: var(--gold-accent); }
.badge-pill.agent { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

.shortcut-badge {
  font-family: var(--apx-mono);
  font-weight: 700;
  color: var(--gold-accent);
  background: rgba(196, 163, 90, 0.12);
  padding: 2px 7px;
  border-radius: 4px;
}

.api-key-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  max-width: 100%;
}

.code-mono {
  font-family: var(--apx-mono);
  font-size: 11.5px;
  color: var(--gold-accent);
  letter-spacing: 0.3px;
  word-break: break-all;
}

.btn-copy-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  color: var(--apx-mute);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-copy-mini:hover {
  color: #fff;
  border-color: var(--gold-accent);
  background: var(--bg-hover);
}

.table-action-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--apx-mute);
  padding: 4px 9px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s;
}

.table-action-btn:hover {
  color: #fff;
  border-color: var(--gold-accent);
  background: var(--bg-hover);
}

.table-action-btn.danger:hover {
  color: var(--apx-danger);
  border-color: var(--apx-danger);
  background: rgba(248, 113, 113, 0.1);
}

/* Settings Form & Live Widget Mockup */
.settings-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: start;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 22px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--apx-mute);
  margin-bottom: 5px;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 3px 7px;
}
.color-input-wrap input[type="color"] {
  border: none;
  background: transparent;
  width: 28px;
  height: 28px;
  cursor: pointer;
  padding: 0;
}
.color-input-wrap input[type="text"] {
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--apx-mono);
  font-size: 13px;
  outline: none;
  width: 80px;
}

.text-input, .select-input, .textarea-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: #fff;
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
}
.text-input:focus, .select-input:focus, .textarea-input:focus { border-color: var(--gold-accent); }

/* Switch Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.toggle-label strong { display: block; font-size: 13px; color: #fff; }
.toggle-label span { font-size: 11.5px; color: var(--apx-faint); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #1e2c40; transition: .25s; border-radius: 22px;
}
.slider:before {
  position: absolute; content: ""; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background-color: white; transition: .25s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--gold-accent); }
input:checked + .slider:before { transform: translateX(18px); }

/* Live Widget Mockup Window */
.mockup-window {
  width: 340px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-strong);
  background: #0d1424;
}
.mockup-header {
  padding: 14px;
  background: #8B3FDC;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mockup-header-title { font-weight: 700; font-size: 14px; }
.mockup-header-sub { font-size: 10.5px; opacity: 0.9; }

.mockup-body {
  padding: 14px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #080d16;
}
.mockup-bubble-bot {
  background: #141d2d;
  color: #fff;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  max-width: 85%;
  line-height: 1.4;
}
.mockup-bubble-user {
  background: #FF7A00;
  color: #fff;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  max-width: 80%;
  align-self: flex-end;
}
.mockup-input-bar {
  padding: 10px;
  background: #0d1424;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 7px;
}
.mockup-input-fake {
  flex: 1;
  background: #152033;
  border-radius: 4px;
  height: 30px;
  padding: 0 9px;
  font-size: 11.5px;
  color: var(--apx-mute);
  display: flex;
  align-items: center;
}
.mockup-send-fake {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: #8B3FDC;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
}

/* Code Snippet Box */
.code-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 18px;
}
.code-card h3 { margin: 0 0 5px; font-size: 15px; color: #fff; }
.code-card p { color: var(--apx-mute); font-size: 12.5px; margin: 0 0 12px; }

.code-box {
  background: #060911;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 14px;
  position: relative;
  font-family: var(--apx-mono);
  font-size: 12.5px;
  color: #93c5fd;
  white-space: pre-wrap;
  word-break: break-all;
}
.btn-copy-code {
  position: absolute;
  top: 9px;
  right: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--gold-accent);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
}
.btn-copy-code:hover { background: var(--bg-hover); border-color: var(--gold-accent); }

/* =========================================================
   7) MODALS & TOAST
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), var(--gold-glow);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-card.large { max-width: 760px; }

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15px; color: #fff; font-weight: 700; }

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--apx-mute);
  font-size: 20px;
  cursor: pointer;
}
.modal-close-btn:hover { color: #fff; }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-plain {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--apx-mute);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.btn-plain:hover { color: #fff; background: var(--bg-card); }

.btn-modal-primary {
  background: linear-gradient(135deg, var(--gold-accent), #a68438);
  border: none;
  color: #05080f;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.btn-modal-primary:hover { filter: brightness(1.1); }

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 999999;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--gold-accent);
  color: #fff;
  padding: 11px 16px;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  animation: toast-in 0.25s ease;
}
.toast.error { border-left-color: var(--apx-danger); }
.toast.success { border-left-color: var(--apx-ok); }

@keyframes toast-in {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
