/* ═══════════════════════════════════════════
   Agent Dashboard Styles
   ═══════════════════════════════════════════ */

.agent-body { background: var(--gray-100); overflow: hidden; }


/* Tickets loading bar */
.tickets-loading-bar { height: 3px; background: linear-gradient(90deg, #4F46E5 0%, #818CF8 50%, #4F46E5 100%); background-size: 200% 100%; animation: ticketsLoadingSlide 1.2s linear infinite; }
.tickets-loading-bar.hidden { display: none; }
@keyframes ticketsLoadingSlide { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ── Login Screen ── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--navy);
  background-image: radial-gradient(ellipse at 70% 20%, rgba(61,220,247,0.12) 0%, transparent 60%),
                    radial-gradient(ellipse at 20% 80%, rgba(59,130,246,0.15) 0%, transparent 50%);
}
.login-card {
  background: white; border-radius: 16px; padding: 2.5rem;
  width: 100%; max-width: 400px; box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo .logo-icon { height: 56px; width: auto; display: block; margin: 0 auto 1rem; }
.login-logo h1 { font-size: 1.25rem; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.login-logo p { color: var(--gray-400); font-size: 0.875rem; margin-top: 0.2rem; }
.login-hint { text-align: center; font-size: 0.8rem; color: var(--gray-400); margin-top: 1rem; }

/* ── App Shell ── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 248px; background: var(--navy); border-right: none;
  display: flex; flex-direction: column; height: 100vh; flex-shrink: 0;
}

/* Logo */
.sidebar-logo {
  padding: 1.1rem 1.1rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 0.65rem;
  text-decoration: none !important;
}
.sidebar-logo .logo-icon { height: 30px; width: 30px; flex-shrink: 0; background: #fff; border-radius: 8px; padding: 2px; } /* navy Q needs a light tile on the dark sidebar */
.sidebar-logo .logo-wordmark {
  font-size: 1rem; font-weight: 800; color: #fff; letter-spacing: -0.02em; line-height: 1;
}
.sidebar-logo .logo-wordmark span { color: var(--cyan); }

/* Workspace picker */
.sidebar-workspace {
  margin: 0.65rem 0.75rem 0;
  display: flex; align-items: center; gap: 0.6rem;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 9px; padding: 0.5rem 0.65rem; cursor: pointer;
  transition: background 0.15s;
}
.sidebar-workspace:hover { background: rgba(255,255,255,0.08); }
.ws-initial {
  width: 24px; height: 24px; border-radius: 6px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; flex-shrink: 0;
}
.ws-name { font-size: 0.8rem; font-weight: 700; color: #fff; }
.ws-plan { font-size: 0.67rem; color: var(--gray-500); margin-top: 1px; }
.ws-chevron { margin-left: auto; color: var(--gray-500); flex-shrink: 0; }

/* Nav section labels */
.nav-section-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.28); padding: 0.85rem 0.85rem 0.3rem;
}

/* Nav items */
.sidebar-nav { flex: 1; padding: 0.3rem 0.75rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.48rem 0.65rem;
  color: rgba(255,255,255,0.55); font-size: 0.825rem; font-weight: 500;
  border-radius: 7px; transition: all 0.15s; position: relative; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85); text-decoration: none; }
.nav-item.active { background: rgba(59,130,246,0.2); color: #93C5FD; font-weight: 600; }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 16px; flex-shrink: 0; }
.nav-icon svg { width: 16px; height: 16px; }
.nav-badge {
  margin-left: auto; border-radius: 999px; font-size: 0.68rem; font-weight: 800;
  padding: 0.1rem 0.45rem; min-width: 18px; text-align: center;
  background: var(--primary); color: white;
}
.nav-badge-cyan { background: var(--cyan); color: var(--navy); }
.nav-badge-red { background: #EF4444; color: white; }

/* Bell nav item — mobile only */
#bellNavItem { display: none; }
@media (max-width: 640px) { #bellNavItem { display: flex; } }

/* Sidebar footer — user info */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08); padding: 0.75rem;
  display: flex; align-items: center; gap: 0.65rem;
}
.agent-info { display: flex; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }
.agent-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: white; font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
  position: relative;
}
.agent-avatar .online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%; background: #10B981;
  border: 2px solid var(--navy);
}
.agent-details { flex: 1; min-width: 0; }
.agent-name { font-size: 0.8rem; font-weight: 700; color: #fff; }
.agent-status-toggle { display: flex; align-items: center; gap: 0.4rem; margin-top: 1px; }
.status-label { font-size: 0.7rem; font-weight: 600; }
.status-label.online { color: #10B981; }
.status-label.offline { color: var(--gray-500); }

/* Toggle switch */
.toggle-label { position: relative; display: inline-block; width: 28px; height: 16px; cursor: pointer; }
.toggle-label input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: rgba(255,255,255,0.2); border-radius: 999px; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: white; left: 2px; top: 2px; transition: 0.2s; box-shadow: var(--shadow-sm);
}
input:checked + .toggle-slider { background: #10B981; }
input:checked + .toggle-slider::before { transform: translateX(12px); }

/* ── Global Topbar ── */
.global-topbar {
  height: 60px; flex-shrink: 0;
  background: white; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  box-shadow: 0 1px 3px rgba(15,39,68,0.04);
}
.topbar-breadcrumb { font-size: 0.875rem; color: var(--gray-400); }
.topbar-breadcrumb strong { color: var(--navy); font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.topbar-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  border-radius: 9px; padding: 0.5rem 0.85rem; width: 220px;
}
.topbar-search input {
  border: none; background: none; outline: none;
  font-size: 0.825rem; color: var(--navy); width: 100%;
}
.topbar-search input::placeholder { color: var(--gray-400); }
.topbar-bell {
  position: relative; width: 36px; height: 36px; border-radius: 9px;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--gray-600);
}
.topbar-bell:hover { background: var(--gray-200); }
.topbar-bell .bell-dot {
  position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #EF4444; border: 2px solid white;
}
.topbar-new-btn {
  background: var(--primary); color: white; border: none;
  border-radius: 9px; padding: 0.5rem 1rem; font-size: 0.825rem;
  font-weight: 600; cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.topbar-new-btn:hover { background: var(--primary-dark); }

/* ── Content Area ── */
.content-area { flex: 1; overflow: hidden; display: flex; flex-direction: column; background: var(--gray-100); }
.views-container { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.view { flex: 1; padding: 1.5rem; background: #F1F5F9; }
.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.view-header h2 { font-size: 1.375rem; font-weight: 800; color: #0F2744; letter-spacing: -0.02em; margin: 0; }
.view-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ── Import View ── */
.import-steps { display:flex;align-items:center;gap:0;margin-bottom:2rem;background:white;border:1px solid var(--gray-200);border-radius:var(--radius-lg);padding:1rem 1.5rem;overflow-x:auto; }
.import-step { display:flex;align-items:center;gap:0.6rem;flex-shrink:0;font-size:0.875rem;color:var(--gray-400);font-weight:500; }
.import-step.active { color:var(--primary); }
.import-step.done { color:var(--success); }
.import-step-num { width:26px;height:26px;border-radius:50%;border:2px solid currentColor;display:flex;align-items:center;justify-content:center;font-size:0.75rem;font-weight:700;flex-shrink:0; }
.import-step.done .import-step-num { background:var(--success);color:white;border-color:var(--success); }
.import-step.active .import-step-num { background:var(--primary);color:white;border-color:var(--primary); }
.import-step-sep { flex:1;min-width:24px;height:2px;background:var(--gray-200);margin:0 0.5rem; }
.imp-platform-btn { border:2px solid var(--gray-200);border-radius:var(--radius);padding:1rem 0.75rem;background:white;cursor:pointer;text-align:center;transition:all 0.15s;display:flex;flex-direction:column;align-items:center;gap:0.4rem; }
.imp-platform-btn:hover,.imp-platform-btn.selected { border-color:var(--primary);background:#EEF2FF; }
.imp-platform-btn.selected { box-shadow:0 0 0 3px rgba(79,70,229,0.15); }
.imp-type-btn:hover,.imp-type-btn.selected { border-color:var(--primary) !important;background:#EEF2FF !important; }
#imp-dropZone:hover { border-color:var(--primary) !important;background:#EEF2FF !important; }

/* ── Dashboard Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: white; border: 1px solid #E8EDF3;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-lg); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm);
}
.stat-card.stat-open   { border-left-color: var(--primary); }
.stat-card.stat-progress { border-left-color: var(--warning); }
.stat-card.stat-resolved { border-left-color: var(--success); }
.stat-card.stat-danger  { border-left-color: var(--danger); }
.stat-card.stat-chat    { border-left-color: var(--cyan); }
.stat-value { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.15rem; color: var(--navy); letter-spacing: -0.02em; }
.stat-label { font-size: 0.775rem; color: var(--gray-400); font-weight: 500; }
.stat-delta { font-size: 0.72rem; font-weight: 600; margin-top: 0.35rem; color: var(--success); }
.stat-delta.down { color: var(--danger); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.recent-ticket-row {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0;
  border-bottom: 1px solid var(--gray-100); cursor: pointer; transition: background 0.1s;
  border-radius: 6px; padding: 0.6rem 0.5rem;
}
.recent-ticket-row:last-child { border-bottom: none; }
.recent-ticket-row:hover { background: var(--gray-50); }
.ticket-num-sm { font-family: monospace; font-size: 0.78rem; color: var(--gray-500); flex-shrink: 0; }
.recent-subject { flex: 1; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-sm { font-size: 0.78rem; color: var(--gray-400); flex-shrink: 0; }

/* ── Tickets Table ── */
.search-input {
  padding: 0.45rem 0.85rem; border: 1px solid #CBD5E1;
  border-radius: var(--radius); font-size: 0.875rem; width: 220px;
}
.search-input:focus { outline: none; border-color: var(--primary); }
.filter-select {
  padding: 0.45rem 0.75rem; border: 1px solid #CBD5E1;
  border-radius: 9px; font-size: 0.875rem; background: white; cursor: pointer;
}
.search-input { border-radius: 9px; }

.tickets-table-wrap { background: #fff; border-radius: 12px; border: 1px solid #E8EDF3; overflow: hidden; box-shadow: 0 1px 3px rgba(15,39,68,0.05); }
.tickets-table { width: 100%; border-collapse: collapse; background: white; }
.tickets-table thead { background: #F8FAFC; }
.tickets-table th { padding: 0.65rem 1rem; text-align: left; font-size: 0.72rem; font-weight: 700; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #E8EDF3; }
.tickets-table td { padding: 0.75rem 1rem; font-size: 0.875rem; border-bottom: 1px solid #F1F5F9; vertical-align: middle; color: #1E293B; }
.tickets-table tbody tr { cursor: pointer; transition: background 0.12s; }
.tickets-table tbody tr:hover { background: #F8FAFC; }
.tickets-table tbody tr:hover .ticket-arrow-cell { color: #3B82F6; }
.tickets-table tbody tr:last-child td { border-bottom: none; }

/* Ticket row: subject+meta column */
.ticket-main-col { min-width: 0; }
.ticket-subject-line { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ticket-priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ticket-subject-text { font-weight: 600; color: #0F2744; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.ticket-meta-row { display: flex; align-items: center; gap: 5px; padding-left: 16px; }
.ticket-meta-num { font-family: monospace; font-size: 0.75rem; color: #94A3B8; }
.ticket-meta-sep { color: #CBD5E1; font-size: 0.7rem; }
.ticket-meta-customer { font-size: 0.78rem; color: #64748B; }
.ticket-meta-time { font-size: 0.78rem; color: #94A3B8; }
.ticket-meta-source { font-size: 0.78rem; }
.ticket-assignee-cell { color: #475569; font-size: 0.82rem; white-space: nowrap; }
.ticket-sla-cell { white-space: nowrap; font-size: 0.8rem; }
.ticket-arrow-cell { color: #CBD5E1; font-size: 1.1rem; text-align: right; padding-right: 1rem !important; transition: color 0.1s; }

.empty-cell { text-align: center; color: var(--gray-400); padding: 2rem; font-style: italic; }
.pager { display: flex; gap: 0.4rem; justify-content: center; padding: 1rem 0; }

/* ── Ticket Detail ── */
.ticket-detail { background: white; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); overflow: hidden; }
.detail-header { padding: 1.25rem 1.5rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.detail-title-row { margin-bottom: 0.5rem; }
.detail-title-row .ticket-num { font-size: 0.8rem; color: var(--gray-400); display: block; margin-bottom: 0.2rem; }
.detail-title-row h2 { font-size: 1.1rem; }
.detail-meta-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.meta-item { font-size: 0.85rem; color: var(--gray-500); }
.detail-controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.detail-controls label { font-size: 0.85rem; font-weight: 500; color: var(--gray-600); display: flex; align-items: center; gap: 0.4rem; }
.detail-controls select { padding: 0.35rem 0.6rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: 0.85rem; background: white; }

.detail-messages { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; max-height: 380px; overflow-y: auto; border-bottom: 1px solid var(--gray-200); }
.detail-msg { padding: 0.85rem 1rem; border-radius: var(--radius); }
.detail-msg-customer { background: var(--primary-light); border-left: 3px solid var(--primary); }
.detail-msg-agent { background: var(--success-light); border-left: 3px solid var(--success); }
.detail-msg.is-private { background: #FFFBEB; border-left: 3px solid var(--warning); }
.msg-system-entry { background: var(--gray-100); text-align: center; font-size: 0.82rem; color: var(--gray-500); font-style: italic; padding: 0.5rem; }
.detail-msg-header { display: flex; justify-content: space-between; margin-bottom: 0.4rem; }
.detail-msg-header strong { font-size: 0.875rem; }
.msg-time { font-size: 0.78rem; color: var(--gray-400); }
.detail-msg-body { font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
.private-tag { display: inline-block; font-size: 0.72rem; font-weight: 600; color: var(--warning); background: var(--warning-light); border-radius: 4px; padding: 0.1rem 0.4rem; margin-bottom: 0.4rem; }

.detail-reply { padding: 1.25rem 1.5rem; }
.detail-reply h4 { font-size: 0.9rem; margin-bottom: 0.75rem; color: var(--gray-700); }
.detail-reply textarea {
  width: 100%; padding: 0.65rem 0.85rem; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); font-size: 0.875rem; resize: vertical; min-height: 100px;
  font-family: inherit;
}
.detail-reply textarea:focus { outline: none; border-color: var(--primary); }
.reply-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--gray-600); cursor: pointer; }

/* ── Live Chat ── */
/* #view-livechat overrides .view defaults so it fills content-area exactly without scrolling */
#view-livechat { display: flex; flex-direction: column; padding: 0.75rem; overflow: hidden; }
#view-livechat .view-header { flex-shrink: 0; margin-bottom: 0.5rem; }
.livechat-layout { display: grid; grid-template-columns: 300px 1fr; grid-template-rows: 1fr; gap: 0; flex: 1; min-height: 0; background: white; border-radius: 12px; border: 1px solid #E8EDF3; overflow: hidden; box-shadow: 0 1px 3px rgba(15,39,68,0.05); }
.chat-sessions-panel { border-right: 1px solid #E8EDF3; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.sessions-tab-bar { display: flex; border-bottom: 1px solid #E8EDF3; background: #F8FAFC; }
.sessions-tab { flex: 1; padding: 0.65rem; font-size: 0.75rem; font-weight: 700; background: none; border: none; cursor: pointer; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.03em; transition: all 0.15s; }
.sessions-tab.active { color: #3B82F6; border-bottom: 2px solid #3B82F6; background: white; }
.chat-sessions-list { flex: 1; overflow-y: auto; }
.sessions-empty { text-align: center; color: var(--gray-400); padding: 2rem; font-size: 0.875rem; font-style: italic; }
.session-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; cursor: pointer; border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
.session-item:hover { background: var(--gray-50); }
.session-item-active { background: var(--primary-light); }
.session-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.session-info { flex: 1; overflow: hidden; }
.session-name { font-weight: 600; font-size: 0.875rem; }
.session-preview { font-size: 0.78rem; color: var(--gray-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex-shrink: 0; }
.session-time { font-size: 0.72rem; color: var(--gray-400); }
.chat-queue-info { font-size: 0.85rem; color: var(--gray-500); font-weight: 600; }

/* Conversation area */
.chat-convo-panel { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.chat-convo-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-style: italic; }
/* #chatConvoActive is the real container — it must fill the panel and constrain its children */
#chatConvoActive { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.convo-header { padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.mobile-back-btn { display: none; }
.convo-email { font-size: 0.82rem; color: var(--gray-400); margin-left: 0.5rem; }
.convo-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Chat transfer dropdown */
.transfer-wrap { position: relative; }
.transfer-dropdown { position: absolute; top: calc(100% + 6px); right: 0; background: white; border: 1px solid #EBEFF3; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.1); min-width: 200px; z-index: 100; }
.transfer-dropdown-title { padding: 0.6rem 1rem; font-size: 0.75rem; font-weight: 700; color: #475867; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #EBEFF3; }
.transfer-agent-list { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; }
.transfer-agent-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1rem; cursor: pointer; font-size: 0.875rem; color: #12344D; transition: background .1s; }
.transfer-agent-item:hover { background: #F1F5F9; }
.transfer-agent-item .ta-dot { width: 8px; height: 8px; border-radius: 50%; background: #D1D5DB; flex-shrink: 0; }
.transfer-agent-item .ta-dot.online { background: #22C55E; }
.transfer-agent-item .ta-name { flex: 1; font-weight: 500; }
.transfer-agent-item .ta-status { font-size: 0.75rem; color: #9CA3AF; }
.convo-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.convo-msg { display: flex; }
.convo-msg-customer { justify-content: flex-start; }
.convo-msg-agent { justify-content: flex-end; }
.convo-bubble { max-width: 75%; padding: 0.6rem 0.9rem; border-radius: 12px; }
.convo-msg-customer .convo-bubble { background: var(--gray-100); border-bottom-left-radius: 4px; }
.convo-msg-agent .convo-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.convo-bubble-bot { background: #7C3AED !important; }
.bot-badge { display: inline-block; background: rgba(255,255,255,0.25); color: white; font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.35rem; border-radius: 4px; margin-right: 0.3rem; letter-spacing: 0.05em; vertical-align: middle; }
.convo-text { font-size: 0.9rem; word-wrap: break-word; white-space: pre-wrap; }
.convo-meta { font-size: 0.72rem; opacity: 0.65; margin-top: 0.2rem; }
.convo-msg-agent .convo-meta { text-align: right; }
.convo-system { text-align: center; font-size: 0.78rem; color: var(--gray-400); background: var(--gray-100); border-radius: 999px; padding: 0.25rem 0.85rem; align-self: center; }
.convo-input-area { padding: 0.75rem; border-top: 1px solid var(--gray-200); display: flex; gap: 0.6rem; align-items: flex-end; flex-shrink: 0; }
.convo-input-area textarea { flex: 1; padding: 0.6rem 0.85rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: 0.875rem; resize: none; font-family: inherit; max-height: 120px; overflow-y: auto; }
.attach-btn { display: flex; align-items: center; justify-content: center; width: 2rem; font-size: 1.2rem; cursor: pointer; opacity: 0.7; flex-shrink: 0; padding: 0; border: none; background: none; }
.attach-btn:hover { opacity: 1; }
.chat-file-msg { display: flex; align-items: center; gap: 0.5rem; }
.chat-file-msg img { max-width: 200px; max-height: 150px; border-radius: 6px; display: block; }
.chat-file-link { color: inherit; text-decoration: underline; font-size: 0.875rem; word-break: break-all; }
.convo-input-area textarea:focus { outline: none; border-color: var(--primary); }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
/* Business Hours — multi-slot layout */
.bh-day-block { border-bottom: 1px solid var(--gray-100); padding: 0.65rem 0; }
.bh-day-block:last-child { border-bottom: none; }
.bh-header-row { margin-bottom: 0.4rem; }
.bh-day-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.875rem; cursor: pointer; }
.bh-slot-list { display: flex; flex-direction: column; gap: 0.35rem; margin-left: 1.6rem; margin-bottom: 0.4rem; }
.bh-slot-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.bh-start, .bh-end { padding: 0.3rem 0.5rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: 0.85rem; }
.bh-start:disabled, .bh-end:disabled { opacity: 0.45; cursor: not-allowed; }
.bh-to { color: var(--gray-500); font-size: 0.8rem; }
.bh-remove-slot { background: none; border: none; color: var(--gray-400); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 0 0.2rem; border-radius: 4px; }
.bh-remove-slot:hover { color: #EF4444; background: #FEF2F2; }
.bh-add-slot { margin-left: 1.6rem; font-size: 0.78rem; padding: 0.25rem 0.6rem; color: var(--primary); border-color: var(--primary); }
.bh-add-slot:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── TICKETS VIEW HEADER ── */
#view-tickets { padding: 0; display: flex; flex-direction: column; }
#ticketListPane { padding: 1.25rem 1.5rem; flex: 1; }
#ticketListPane .pager { padding: 0.5rem 0; }
#ticketDetailPane { flex: 1; }
.tickets-view-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem; gap: 0.75rem;
  background: white; border-bottom: 1px solid var(--gray-200);
  margin-bottom: 0; flex-wrap: nowrap;
}
.tickets-view-header h2 { font-size: 1.375rem; font-weight: 800; color: #0F2744; letter-spacing: -0.02em; }
.tickets-header-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.tickets-filter-toggle { display: none; }
.tickets-filters-row {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.65rem 1.5rem; background: #FAFBFC;
  border-bottom: 1px solid var(--gray-200);
}
.tickets-filters-row .search-input { width: 220px; flex-shrink: 0; }

/* ── TICKET CARDS (mobile only) ── */
.ticket-cards { display: none; }
.ticket-card {
  background: white; border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 0.85rem 1rem; margin-bottom: 0.5rem; cursor: pointer;
  transition: box-shadow 0.15s;
}
.ticket-card:active { background: var(--gray-50); }
.ticket-card-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.ticket-card-num { font-family: monospace; font-size: 0.75rem; color: var(--gray-500); flex-shrink: 0; }
.ticket-card-subject { flex: 1; font-size: 0.9rem; font-weight: 600; color: #12344D; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-card-bottom { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ticket-card-meta { font-size: 0.75rem; color: var(--gray-400); }

/* ── RESPONSIVE: Tablet (≤900px) ── */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .logo-wordmark, .nav-label, .ws-name, .ws-plan, .ws-chevron, .agent-details, .sidebar-footer .btn,
  .nav-section-label, .sidebar-workspace { display: none; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .livechat-layout { grid-template-columns: 200px 1fr; }
  .fd-stats-row { grid-template-columns: repeat(3, 1fr); }
  .fd-ops-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fd-widgets-grid { grid-template-columns: 1fr; }
  .fd-chart-section { padding: 1rem 1.25rem; }
  .fdt-body { flex-direction: column; }
  .fdt-sidebar { width: 100%; border-left: none; border-top: 1px solid #EBEFF3; }
  .tickets-filters-row .search-input { width: 160px; }
}

/* ── RESPONSIVE: Mobile (≤640px) ── */
@media (max-width: 640px) {
  /* ── Base shell ── */
  html, body { height: 100%; overflow: hidden; max-width: 100vw; }
  .app-shell { flex-direction: column; height: 100%; overflow: hidden; max-width: 100vw; }
  .content-area { overflow-x: hidden; }

  /* ── Sidebar → bottom tab bar ── */
  .sidebar {
    width: 100%; height: 56px; min-height: 56px; flex-shrink: 0;
    flex-direction: row; align-items: center; order: 2;
    border-right: none; border-top: 1px solid rgba(255,255,255,0.1);
    background: var(--navy); padding: 0;
  }
  .sidebar-logo { display: none; }
  .sidebar-workspace { display: none; }
  .nav-section-label { display: none; }
  .sidebar-nav { flex-direction: row; flex: 1; justify-content: space-around; padding: 0; gap: 0; }
  .nav-item {
    flex-direction: column; padding: 0.35rem 0.5rem; gap: 1px;
    min-width: 52px; justify-content: center; min-height: 56px; border-radius: 0;
    color: rgba(255,255,255,0.45);
  }
  .nav-item.active { background: rgba(59,130,246,0.15); color: #93C5FD; border-radius: 0; }
  .nav-icon { font-size: 1.1rem; width: auto; }
  .nav-label { display: block !important; font-size: 0.6rem; }
  .nav-badge { position: absolute; top: 4px; right: 4px; margin: 0; }
  .sidebar-footer { display: none; }
  .global-topbar { display: none; }
  .content-area { order: 1; flex: 1; overflow-y: auto; min-height: 0; }

  /* ── Dashboard ── */
  #view-dashboard { padding: 0.75rem; gap: 0.85rem; overflow-x: hidden; }
  .fd-topbar { display: none; }
  .fd-stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
  .fd-stat-card { padding: 0.6rem 0.5rem; min-width: 0; }
  .fd-stat-icon { width: 22px; height: 22px; }
  .fd-stat-value { font-size: 1.3rem; }
  .fd-stat-label { font-size: 0.62rem; }
  .fd-chart-section { padding: 0.75rem; min-width: 0; overflow: hidden; }
  .fd-chart-area { width: 100%; overflow: hidden; }
  .fd-chart-area canvas { max-width: 100% !important; }
  .fd-ops-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
  .fd-ops-strip .fd-op-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .fd-op-card { min-height: 78px; padding: 0.65rem 0.7rem; min-width: 0; }
  .fd-op-value { font-size: 1.35rem; }
  .fd-op-label, .fd-op-sub { font-size: 0.65rem; }
  .fd-kpi-value { font-size: 1.1rem; }
  .fd-kpi { padding: 0.5rem 0.4rem; min-width: 0; }
  .fd-chart-kpis { flex-wrap: wrap; }
  .fd-chart-kpis .fd-kpi { flex: 1 1 calc(50% - 1px); border-bottom: 1px solid #EBEFF3; }
  .fd-widgets-grid { grid-template-columns: minmax(0, 1fr); gap: 0.85rem; }
  .fd-widget { min-height: unset; min-width: 0; overflow: hidden; }
  .fd-widget-row { flex-wrap: wrap; gap: 0.25rem; font-size: 0.82rem; padding: 0.6rem 1rem; }
  .fd-widget-table-header { padding: 0.4rem 1rem; font-size: 0.75rem; }
  .fd-widget-header { padding: 0.85rem 1rem; }
  .fd-widget-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ── Tickets view header & filters ── */
  .tickets-view-header { padding: 0.75rem 0.85rem 0.65rem; flex-wrap: wrap; gap: 0.4rem; }
  .tickets-view-header h2 { font-size: 1.05rem; }
  .tickets-header-actions { gap: 0.4rem; }
  .tickets-header-actions .btn { min-height: 36px; font-size: 0.8rem; padding: 0 0.7rem; }
  .tickets-filter-toggle { display: flex !important; align-items: center; gap: 0.3rem; }
  .tickets-filters-row {
    padding: 0.6rem 0.85rem;
    flex-direction: column; align-items: stretch; gap: 0.5rem;
    display: none;
  }
  .tickets-filters-row.open { display: flex; }
  .tickets-filters-row .search-input,
  .tickets-filters-row .filter-select { width: 100%; font-size: 0.875rem; min-height: 40px; box-sizing: border-box; }

  /* ── Ticket list: card view on mobile ── */
  .tickets-table-wrap { display: none; }
  #ticketListPane { padding: 0.75rem 0.85rem; }
  .ticket-cards { display: block; }

  /* ── Ticket detail ── */
  .fdt-toolbar { flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 0.85rem; }
  .fdt-toolbar-left { flex-wrap: wrap; }
  .fdt-subject-bar { padding: 0.75rem 0.85rem; }
  .fdt-subject { font-size: 1.1rem; }
  .fdt-body { flex-direction: column; }
  .fdt-sidebar { width: 100%; border-left: none; border-top: 1px solid #EBEFF3; padding: 0.85rem; }
  .fdt-thread { flex: 1; max-height: none; padding: 0.85rem; gap: 1rem; }
  .fdt-msg { gap: 0.6rem; }
  .fdt-msg-avatar { width: 32px; height: 32px; font-size: 0.8rem; flex-shrink: 0; }
  .fdt-editor-footer { flex-wrap: wrap; gap: 0.5rem; padding: 0.6rem 0.85rem; }
  .fdt-editor-actions { flex-wrap: wrap; gap: 0.5rem; }
  .fdt-editor-actions .btn { min-height: 40px; }
  .fdt-action-tabs { overflow-x: auto; }

  /* ── Live chat ── */
  #view-livechat { padding: 0; overflow: hidden; }
  #view-livechat .view-header { padding: 0.75rem 0.85rem; flex-shrink: 0; margin-bottom: 0; }
  .livechat-layout { grid-template-columns: 1fr; flex: 1; min-height: 0; }
  .chat-sessions-panel { display: flex; flex-direction: column; }
  .chat-convo-panel { display: none; }
  .livechat-layout.chat-open .chat-sessions-panel { display: none; }
  .livechat-layout.chat-open .chat-convo-panel { display: flex; flex: 1; min-height: 0; }
  .mobile-back-btn { display: flex !important; flex-shrink: 0; margin-right: 0.5rem; }
  .convo-header { flex-wrap: wrap; gap: 0.4rem; padding: 0.6rem 0.75rem; }
  .convo-actions { flex-wrap: wrap; gap: 0.4rem; }
  .convo-actions .btn { min-height: 36px; font-size: 0.78rem; padding: 0 0.55rem; }
  .convo-email { display: none; }
  .session-item { padding: 0.75rem 0.85rem; min-height: 60px; }
  .convo-input-area textarea { min-height: 44px; }

  /* ── Settings ── */
  .settings-tabs { overflow-x: auto; white-space: nowrap; padding: 0 0.75rem; }
  .settings-tab { padding: 0.75rem 1rem; min-height: 44px; }
  .settings-card { margin: 0.75rem; padding: 0.85rem; max-width: 100% !important; }
  .ai-usage-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-usage-table { display: block; overflow-x: auto; white-space: nowrap; }
  .bh-slot-row { flex-wrap: wrap; gap: 0.4rem; }
  .bh-start, .bh-end { min-height: 40px; }

  /* ── Modals ── */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box {
    width: 100% !important; max-width: 100% !important;
    border-radius: 16px 16px 0 0; margin: 0;
    max-height: 92vh; overflow-y: auto;
  }
  #composeModal .modal-box { max-height: 95vh; }
  .compose-editor .ql-editor { min-height: 120px; }
}

/* Hide reCAPTCHA badge globally once agent is logged in */
body.agent-logged-in .grecaptcha-badge { visibility: hidden !important; }

/* ── DASHBOARD LAYOUT ── */
#view-dashboard {
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.5rem; background: #F1F5F9; min-height: 100%; overflow-y: auto;
}

/* Greeting */
.db-header { margin-bottom: 0.25rem; }
.db-greeting { font-size: 1.4rem; font-weight: 800; color: #0F2744; letter-spacing: -0.02em; line-height: 1.2; }
.db-greeting-sub { font-size: 0.875rem; color: #94A3B8; margin-top: 4px; }

/* 4 metric cards */
.db-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.db-metric {
  background: #fff; border: 1px solid #E8EDF3; border-left: 3px solid #E8EDF3;
  border-radius: 12px; padding: 16px 18px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(15,39,68,0.05); transition: box-shadow .15s, transform .15s;
}
.db-metric:hover { box-shadow: 0 6px 18px rgba(15,39,68,0.1); transform: translateY(-1px); }
.db-metric-value { font-size: 1.85rem; font-weight: 800; color: #0F2744; letter-spacing: -0.02em; line-height: 1; }
.db-metric-label { font-size: 0.78rem; color: #94A3B8; font-weight: 500; margin-top: 5px; }
.db-metric-trend { font-size: 0.75rem; font-weight: 600; margin-top: 8px; min-height: 1em; }
.db-trend-good { color: #16A34A; }
.db-trend-bad { color: #DC2626; }
.db-metric-blue { border-left-color: #3B82F6; }
.db-metric-red { border-left-color: #EF4444; }
.db-metric-green { border-left-color: #10B981; }
.db-metric-amber { border-left-color: #F59E0B; }

/* 2-column body */
.db-body { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }

/* White cards */
.db-card {
  background: #fff; border: 1px solid #E8EDF3; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15,39,68,0.05); overflow: hidden;
}
.db-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #F1F5F9;
}
.db-card-title { font-size: 0.9rem; font-weight: 700; color: #0F2744; }
.db-card-sub { font-size: 0.75rem; color: #94A3B8; margin-top: 2px; }
.db-card-link {
  background: none; border: none; color: #3B82F6; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; font-family: inherit; padding: 0; text-decoration: none;
}
.db-card-link:hover { text-decoration: underline; }

/* Right column */
.db-right { display: flex; flex-direction: column; gap: 1rem; }

/* AI panel — dark navy */
.db-ai-panel {
  background: #0F2744; border-radius: 12px; padding: 18px;
  position: relative; overflow: hidden;
}
.db-ai-panel::before {
  content: ''; position: absolute; top: -30px; right: -20px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(61,220,247,0.25), transparent 70%);
  pointer-events: none;
}
.db-ai-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; position: relative; }
.db-ai-icon {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, #3DDCF7, #818CF8);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.db-ai-title { font-size: 0.875rem; font-weight: 700; color: #fff; }
.db-ai-row { display: flex; justify-content: space-between; font-size: 0.8rem; padding: 4px 0; position: relative; }
.db-ai-row span { color: #94A3B8; }
.db-ai-row strong { color: #fff; }
.db-ai-row strong.cyan { color: #3DDCF7; }
.db-ai-bar-wrap { height: 6px; background: rgba(255,255,255,0.12); border-radius: 99px; margin: 12px 0 6px; position: relative; }
.db-ai-bar-fill { height: 100%; background: linear-gradient(90deg, #3DDCF7, #818CF8); border-radius: 99px; transition: width .5s ease; }
.db-ai-bar-label { font-size: 0.7rem; color: #64748B; position: relative; }

/* 7-day bar chart */
.db-bar-chart { padding: 14px 18px 18px; }
.db-bars { display: flex; align-items: flex-end; gap: 5px; height: 76px; }
.db-bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.db-bar-fill { background: #3B82F6; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s ease; }
.db-bar-base { background: #BFDBFE; border-radius: 0 0 3px 3px; min-height: 2px; }
.db-bar-label { font-size: 0.6rem; color: #94A3B8; text-align: center; margin-top: 4px; }
.db-bar-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 0.7rem; color: #94A3B8; }
.db-bar-legend span { display: flex; align-items: center; gap: 4px; }
.db-bar-legend span::before { content: ''; width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.db-bar-legend .leg-today::before { background: #3B82F6; }
.db-bar-legend .leg-prev::before { background: #BFDBFE; }

/* Recent ticket rows (design style) */
.db-ticket-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 18px; border-bottom: 1px solid #F1F5F9;
  cursor: pointer; transition: background .1s;
}
.db-ticket-row:last-child { border-bottom: none; }
.db-ticket-row:hover { background: #F8FAFC; }
.db-ticket-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: #94A3B8; }
.db-ticket-dot.urgent { background: #EF4444; }
.db-ticket-dot.high { background: #F59E0B; }
.db-ticket-dot.medium { background: #3B82F6; }
.db-ticket-dot.low { background: #10B981; }
.db-ticket-body { flex: 1; min-width: 0; }
.db-ticket-subj { font-size: 0.84rem; font-weight: 600; color: #1E293B; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-ticket-meta { font-size: 0.75rem; color: #94A3B8; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-ticket-pill { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; flex-shrink: 0; margin-top: 1px; }
.db-ticket-pill.urgent { background: #FEE2E2; color: #B91C1C; }
.db-ticket-pill.high   { background: #FEF3C7; color: #92400E; }
.db-ticket-pill.medium { background: #DBEAFE; color: #1D4ED8; }
.db-ticket-pill.low    { background: #DCFCE7; color: #166534; }

/* Fallback: keep old fd- classes active for hidden-element JS compatibility */
.fd-widget-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid #EBEFF3; }
.fd-widget-title { font-size: 0.95rem; font-weight: 700; color: #12344D; }
.fd-widget-sub { font-size: 0.75rem; color: #475867; margin-top: 0.2rem; }
.fd-widget-link { font-size: 0.8rem; color: #2C5CC5; text-decoration: none; font-weight: 600; }
.fd-widget-link:hover { text-decoration: underline; }

/* ── WIDGET INTERNALS ── */
.fd-widget-table-header { display: flex; justify-content: space-between; padding: 0.5rem 1.25rem; font-size: 0.8rem; font-weight: 600; color: #475867; background: #FAFAFA; border-bottom: 1px solid #EBEFF3; }
.fd-widget-row { display: flex; justify-content: space-between; padding: 0.75rem 1.25rem; border-bottom: 1px solid #EBEFF3; font-size: 0.9rem; }
.fd-widget-row:last-child { border-bottom: none; }
.fd-empty-row { color: #9CA3AF; cursor: default; padding: 0.9rem 1.25rem; font-size: 0.88rem; }
.recent-ticket-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid #EBEFF3; }
.recent-ticket-row:last-child { border-bottom: none; }
.ticket-num-sm { font-family: monospace; font-size: 0.78rem; color: #475867; flex-shrink: 0; }
.recent-subject { flex: 1; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: #12344D; }
.meta-sm { font-size: 0.78rem; color: #475867; flex-shrink: 0; }
.fd-mini-badge { font-size: 0.65rem; flex-shrink: 0; }

.fd-metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: 0.5rem 0; }
.fd-metric { padding: 1rem 1.25rem; border-right: 1px solid #EBEFF3; border-bottom: 1px solid #EBEFF3; min-height: 76px; }
.fd-metric:nth-child(2n) { border-right: none; }
.fd-metric-value { font-size: 1.45rem; font-weight: 800; color: #12344D; line-height: 1; }
.fd-metric-label { margin-top: 0.35rem; font-size: 0.75rem; color: #6B7C8D; font-weight: 600; }

/* ── Shared ticket row (queue / top-priority / active-chats) ── */
.fd-recent-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid #EBEFF3; cursor: pointer; min-width: 0; }
.fd-recent-row:last-child { border-bottom: none; }
.fd-recent-num { font-family: monospace; font-size: 0.78rem; color: #475867; flex-shrink: 0; }
.fd-recent-subject { flex: 1; font-size: 0.875rem; font-weight: 600; color: #12344D; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-recent-time { font-size: 0.75rem; color: #6B7C8D; flex-shrink: 0; }

/* ── Unresolved-by-agent widget rows ── */
.fd-unresolved-row { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 1.25rem; border-bottom: 1px solid #EBEFF3; font-size: 0.9rem; }
.fd-unresolved-row:last-child { border-bottom: none; }
.fd-unresolved-row:hover { background: #F8FAFC; }
.fd-unresolved-agent { flex: 1; color: #12344D; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-unresolved-count { font-size: 0.9rem; font-weight: 700; color: #2C5CC5; flex-shrink: 0; background: #EEF2FF; border-radius: 12px; padding: 0.15rem 0.6rem; }

/* ── Active-chat session rows ── */
.fd-chat-row { display: flex; align-items: center; gap: 0.65rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid #EBEFF3; cursor: pointer; }
.fd-chat-row:last-child { border-bottom: none; }
.fd-chat-row:hover { background: #F8FAFC; }
.fd-chat-avatar { width: 30px; height: 30px; border-radius: 50%; background: #2C5CC5; color: white; font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fd-chat-name { flex: 1; font-size: 0.875rem; font-weight: 600; color: #12344D; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-chat-time { font-size: 0.75rem; color: #6B7C8D; flex-shrink: 0; }

.fd-risk-row, .fd-reply-row { padding: 0.85rem 1.25rem; border-bottom: 1px solid #EBEFF3; cursor: pointer; }
.fd-risk-row:hover, .fd-reply-row:hover, .fd-recent-row:hover { background: #F8FAFC; }
.fd-risk-main, .fd-reply-top { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.fd-risk-title, .fd-reply-subject { color: #12344D; font-weight: 700; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-risk-title { flex: 1; }
.fd-risk-meta { display: flex; align-items: center; gap: 0.65rem; margin-top: 0.4rem; color: #6B7C8D; font-size: 0.75rem; }
.fd-risk-label { color: #B91C1C; background: #FEF2F2; border-radius: 4px; padding: 0.15rem 0.4rem; font-weight: 700; }
.fd-reply-name { color: #475867; font-size: 0.78rem; font-weight: 700; }
.fd-reply-top .fd-recent-time { margin-left: auto; }
.fd-reply-preview { color: #6B7C8D; font-size: 0.78rem; line-height: 1.35; margin-top: 0.35rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── TODO ── */
.fd-todo-add { display: flex; align-items: center; padding: 0.75rem 1.25rem; border-bottom: 1px solid #EBEFF3; }
.fd-todo-plus { color: #2C5CC5; cursor: pointer; font-size: 1.2rem; margin-right: 0.5rem; }
.fd-todo-input { border: none; outline: none; flex: 1; font-size: 0.9rem; }
.fd-todo-list { flex: 1; overflow-y: auto; }
.fd-todo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: #475867; font-size: 0.9rem; padding: 2rem; }
.fd-todo-empty-icon { font-size: 2rem; color: #EBEFF3; margin-bottom: 0.5rem; }
.fd-todo-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid #EBEFF3; }
.fd-todo-item.done span:not(.fd-todo-delete) { text-decoration: line-through; color: #A0AEC0; }
.fd-todo-item span { flex: 1; font-size: 0.9rem; }
.fd-todo-delete { flex: 0 0 auto; color: #D84315; cursor: pointer; font-size: 0.8rem; display: none !important; }
.fd-todo-item:hover .fd-todo-delete { display: inline-block !important; }

/* ── TICKET VIEW UPDATES ── */
.fdt-toolbar, .fdt-subject-bar { padding: 1rem 1.5rem; border-bottom: 1px solid #EBEFF3; background: white; }
.fdt-subject { font-size: 1.4rem; font-weight: 700; color: #12344D; }
.fdt-body { display: flex; min-height: 0; flex: 1; overflow: hidden; background: #fff; }
.fdt-main { flex: 1; display: flex; flex-direction: column; background: #F4F7F6; min-width: 0; }
.fdt-sidebar { width: 320px; background: white; border-left: 1px solid #EBEFF3; overflow-y: auto; padding: 1.5rem; }
.fdt-sidebar-section-header { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; color: #475867; margin-bottom: 1rem; display: flex; justify-content: space-between; }
.fdt-edit-btn { background: none; border: none; color: #2C5CC5; font-weight: 600; cursor: pointer; text-transform: none; }
.fdt-edit-btn:hover { text-decoration: underline; }

.fdt-contact-avatar-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.fdt-contact-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; flex-shrink: 0; }
.fdt-contact-name { font-weight: 600; color: #12344D; }
.fdt-contact-email { font-size: 0.85rem; color: #475867; }

.fdt-thread { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }
.fdt-msg { display: flex; gap: 1rem; }
.fdt-msg-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; flex-shrink: 0; }
.fdt-msg-bubble { background: white; border: 1px solid #EBEFF3; border-radius: 8px; flex: 1; max-width: calc(100% - 60px); overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.fdt-msg-header { padding: 0.75rem 1.25rem; background: #FAFAFA; border-bottom: 1px solid #EBEFF3; display: flex; justify-content: space-between; align-items: baseline; }
.fdt-msg-sender { font-weight: 700; color: #12344D; }
.fdt-msg-time { font-size: 0.8rem; color: #475867; }
.fdt-msg-body { padding: 1.25rem; color: #12344D; font-size: 0.95rem; line-height: 1.5; max-height: 500px; overflow-y: auto; }
.fdt-msg-body img { max-width: 100%; height: auto; }
.fdt-msg-body.fdt-msg-html p { margin-bottom: 0.85em; }
.fdt-msg-body.fdt-msg-html p:last-child { margin-bottom: 0; }
/* List styling — global reset strips padding/margin so we restore it here.
   Also handle Quill 2.x internal format (ol with data-list="bullet" attrs). */
.fdt-msg-body ul, .fdt-msg-body ol { padding-left: 1.5rem; margin: 0.4em 0; }
.fdt-msg-body li { margin: 0.15em 0; }
.fdt-msg-body ul, .fdt-msg-body ul li { list-style-type: disc; }
.fdt-msg-body ol, .fdt-msg-body ol li:not([data-list]) { list-style-type: decimal; }
.fdt-msg-body li[data-list="bullet"] { list-style-type: disc; }
.fdt-msg-body li[data-list="ordered"] { list-style-type: decimal; }
.fdt-msg-body .ql-ui { display: none; }
.fdt-msg.fdt-msg-private .fdt-msg-bubble { background: #FFF9E6; border-color: #FDE68A; }
.fdt-msg.fdt-msg-private .fdt-msg-header { background: #FFF4CC; border-bottom-color: #FDE68A; }
.fdt-private-tag { background: #F59E0B; color: white; font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 4px; display: inline-block; margin: 0.5rem 1.25rem 0; text-transform: uppercase; }

/* ── System / activity messages ── */
.fdt-msg.fdt-msg-system {
  display: flex; justify-content: center; align-items: center;
  gap: 0; padding: 0.1rem 0;
}
.fdt-msg.fdt-msg-system span {
  background: #F0FDF4; border: 1px solid #86EFAC;
  color: #166534; font-size: 0.75rem; font-weight: 500;
  padding: 0.25rem 1rem; border-radius: 999px;
  text-align: center; font-style: italic;
}
/* Chat transcript system messages — full-width info box, not a pill */
.fdt-msg.fdt-msg-transcript {
  display: block; padding: 0;
}
.fdt-transcript-box {
  background: #F8FAFC; border: 1px solid #CBD5E1; border-left: 3px solid #94A3B8;
  border-radius: 6px; padding: 0.75rem 1rem;
  font-size: 0.8rem; color: #475569; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}

.fdt-editor { background: white; border-top: 1px solid #EBEFF3; }
.fdt-editor-header { display: flex; align-items: center; padding: 0.75rem 1.25rem; border-bottom: 1px solid #EBEFF3; font-size: 0.85rem; color: #475867; }
.btn-link-sm { background: none; border: none; color: #2C5CC5; cursor: pointer; font-size: 0.8rem; padding: 0; text-decoration: underline; }
.btn-link-sm:hover { color: #1A3E8A; }
.fdt-cc-row { display: flex; flex-direction: column; gap: 4px; padding: 0.5rem 1.25rem; border-bottom: 1px solid #EBEFF3; background: #FAFBFF; }
.fdt-cc-field { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.fdt-cc-field label { color: #6B7C8D; width: 32px; flex-shrink: 0; }
.fdt-cc-field input { flex: 1; border: none; outline: none; font-size: 0.82rem; background: transparent; color: #12344D; }
.fdt-quill-editor { min-height: 120px; border: none; }
.fdt-editor-footer { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.25rem; border-top: 1px solid #EBEFF3; background: #FAFAFA; }
.fdt-inline-props { border-top: 1px solid var(--gray-200); background: #FAFBFC; }
.fdt-inline-props-toggle { width: 100%; background: none; border: none; padding: .45rem 1rem; text-align: left; font-size: .8rem; color: #4F46E5; cursor: pointer; font-weight: 600; letter-spacing: .01em; }
.fdt-inline-props-toggle:hover { background: #EEF2FF; }
.fdt-inline-props-fields { display: flex; flex-wrap: wrap; gap: .65rem; padding: .65rem 1rem .75rem; border-top: 1px solid var(--gray-200); }
.fdt-inline-prop { display: flex; flex-direction: column; gap: .2rem; min-width: 120px; flex: 1; }
.fdt-inline-prop-tags { flex: 2; min-width: 200px; }
.fdt-inline-prop label { font-size: .72rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; }
.fdt-inline-prop select, .fdt-inline-prop input { font-size: .82rem; padding: .3rem .5rem; border: 1px solid var(--gray-300); border-radius: 5px; background: white; color: var(--gray-900); }

/* ── CONTACT FORM EXTENDED ── */
.fdt-contact-mini-info { overflow: hidden; }
.fdt-contact-mini-info .fdt-contact-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fdt-contact-mini-info .fdt-contact-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fdt-contact-extended {
  margin-top: 0.5rem;
  font-size: 0.85rem; color: #475867;
  background: #FAFAFA; border: 1px solid #EBEFF3;
  padding: 0.75rem; border-radius: 6px;
}
.fdt-cx-item { margin-bottom: 0.4rem; display: flex; }
.fdt-cx-lbl { font-weight: 600; color: #12344D; width: 85px; flex-shrink: 0; }
.fdt-cx-social { display: flex; gap: 0.35rem; margin-top: 0.8rem; padding-top: 0.5rem; border-top: 1px solid #EBEFF3; }
.fdt-cx-social span:empty { display: none; }

.fdt-sidebar-meta { margin-top: 1.5rem; border-top: 1px solid #EBEFF3; padding-top: 1rem; }
.fdt-meta-row { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.5rem; }
.fdt-meta-label { color: #475867; }
.fdt-meta-value { color: #12344D; font-weight: 500; }

.fdt-contact-form {
  background: #fff; border: 1px solid #EBEFF3; border-radius: 6px;
  padding: 1rem; margin-top: 0.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.fdt-contact-form .form-group-sm { margin-bottom: 0.75rem; }
.fdt-contact-form .form-group-sm label { font-size: 0.75rem; color: #475867; font-weight: 600; margin-bottom: 0.3rem; display: block; text-transform: uppercase; }
.fdt-input { width: 100%; padding: 0.5rem 0.6rem; font-size: 0.85rem; border: 1px solid #CFD7DF; border-radius: 4px; font-family: inherit; }
.fdt-input:focus { outline: none; border-color: #2C5CC5; }
.fdt-form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* ── MISSING TICKET VIEW & COMPONENT CSS ── */

/* Toolbar / Breadcrumb */
.fdt-toolbar { display: flex; justify-content: space-between; align-items: center; }
.fdt-toolbar-left { display: flex; align-items: center; gap: 0.5rem; }
.fdt-back-btn { background: #4F46E5; border: none; color: #fff; cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 0.35rem; font-weight: 600; padding: 0.4rem 0.9rem; border-radius: 6px; }
.fdt-back-btn:hover { background: #4338CA; color: #fff; }
.fdt-breadcrumb-sep { color: #CFD7DF; }
.fdt-ticket-num-chip { background: #F4F7F6; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.8rem; color: #475867; font-family: monospace; }
.fdt-action-tabs { display: flex; gap: 0.5rem; background: #F4F7F6; padding: 0.25rem; border-radius: 6px; }
.fdt-action-tab { background: transparent; border: none; padding: 0.4rem 1rem; border-radius: 4px; font-size: 0.85rem; font-weight: 600; color: #475867; cursor: pointer; display: flex; align-items: center; gap: 0.25rem; }
.fdt-action-tab.active { background: white; color: #12344D; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

/* Subject Bar */
.fdt-subject-bar { display: flex; justify-content: space-between; align-items: flex-start; }
.fdt-subject-info { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }

/* Editor */
.fdt-editor { display: flex; flex-direction: column; flex-shrink: 0; }
.fdt-editor-actions { display: flex; gap: 0.5rem; align-items: center; }
.fdt-private-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: #475867; cursor: pointer; margin: 0; }

/* Shortcuts ? button */
.btn-shortcut-hint { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #CBD5E1; background: #F8FAFC; color: #64748B; font-size: 0.75rem; font-weight: 700; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-shortcut-hint:hover { background: #E2E8F0; color: #1E293B; }

/* Keyboard shortcuts popup */
.shortcuts-popup { position: fixed; z-index: 9999; background: #fff; border: 1px solid #CBD5E1; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 0; min-width: 260px; }
.shortcuts-popup-header { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.9rem; border-bottom: 1px solid #E2E8F0; font-size: 0.82rem; font-weight: 600; color: #1E293B; }
.shortcuts-popup-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #94A3B8; line-height: 1; padding: 0 2px; }
.shortcuts-popup-close:hover { color: #1E293B; }
.shortcuts-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; padding: 0.65rem 0.9rem; }
.sc-key { font-family: monospace; font-size: 0.75rem; background: #F1F5F9; border: 1px solid #CBD5E1; border-radius: 4px; padding: 0.1rem 0.4rem; color: #334155; white-space: nowrap; align-self: center; }
.sc-desc { font-size: 0.8rem; color: #475569; align-self: center; }

/* Properties Sidebar */
.fdt-prop-group { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.fdt-prop-label { font-size: 0.75rem; font-weight: 600; color: #475867; text-transform: uppercase; letter-spacing: 0.05em; }
.fdt-prop-select { width: 100%; padding: 0.5rem; border: 1px solid #CFD7DF; border-radius: 4px; font-size: 0.85rem; color: #12344D; background: white; font-family: inherit; }
.fdt-prop-select:focus { outline: none; border-color: #2C5CC5; }
.fdt-tags-display { font-size: 0.85rem; color: #475867; font-style: italic; }
.fdt-prop-actions { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid #EBEFF3; }

/* ── MODALS (Resolve & Add Product) ── */
.resolve-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(18,52,77,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.resolve-modal-card { background: white; width: 450px; max-width: 90%; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; flex-direction: column; }
.resolve-modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #EBEFF3; }
.resolve-modal-header h2 { font-size: 1.25rem; font-weight: 700; color: #12344D; margin: 0 0 0.25rem; }
.resolve-modal-header p { font-size: 0.85rem; color: #475867; margin: 0; }
.resolve-modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.resolve-option-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.resolve-radio-btn { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 600; color: #12344D; cursor: pointer; margin: 0; }
.resolve-field { display: flex; flex-direction: column; gap: 0.35rem; }
.resolve-field label { font-size: 0.85rem; font-weight: 600; color: #475867; margin: 0; }
.resolve-input, .resolve-select { width: 100%; padding: 0.5rem; border: 1px solid #CFD7DF; border-radius: 4px; font-size: 0.85rem; color: #12344D; font-family: inherit; }
.resolve-input:focus, .resolve-select:focus { outline: none; border-color: #2C5CC5; }
.resolve-modal-footer { padding: 1.25rem 1.5rem; border-top: 1px solid #EBEFF3; display: flex; justify-content: flex-end; gap: 0.75rem; background: #FAFAFA; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }

/* ── SETTINGS VIEW ── */
#view-settings { padding: 0; display: flex; flex-direction: column; background: #F1F5F9; }
#view-settings > .view-header { background: white; padding: 1.25rem 1.5rem; margin-bottom: 0; border-bottom: 1px solid #E8EDF3; }

/* ── REPORTS VIEW ── */
#view-reports { padding: 0; background: #F1F5F9; }
#view-reports > .view-header { background: white; padding: 1.25rem 1.5rem; margin-bottom: 0; border-bottom: 1px solid #E8EDF3; }
#view-reports > div:last-child { padding: 1.5rem; }

/* ── SETTINGS TABS ── */
.settings-tabs { display: flex; gap: 0; border-bottom: 1px solid #E8EDF3; padding: 0 1.5rem; background: white; }
.settings-tab { padding: 0.85rem 1.25rem; font-size: 0.875rem; font-weight: 600; color: #94A3B8; background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.settings-tab.active { color: #3B82F6; border-bottom-color: #3B82F6; }
.settings-tab:hover:not(.active) { color: #0F2744; }
.settings-tab-content { display: block; }
.settings-tab-content.hidden { display: none; }

/* Settings cards — constrained width so forms don't stretch to viewport edges */
.settings-card { margin: 1.5rem; max-width: 860px; background: #fff; border: 1px solid #E8EDF3; border-radius: 12px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(15,39,68,0.05); }
#stab-account .settings-card { max-width: 480px; }
#stab-sla .settings-card    { max-width: 640px; }
#stab-ai-usage .settings-card { max-width: 1100px; }

.ai-usage-toolbar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #EBEFF3;
}
.ai-usage-toolbar label { font-size: 0.75rem; font-weight: 700; color: #475867; text-transform: uppercase; }
.ai-usage-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.ai-usage-metric { border: 1px solid #EBEFF3; border-radius: 8px; padding: 0.85rem 1rem; background: #FAFBFC; }
.ai-usage-value { font-size: 1.25rem; font-weight: 800; color: #12344D; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-usage-label { font-size: 0.72rem; font-weight: 700; color: #6B7C8D; text-transform: uppercase; margin-top: 0.25rem; }
.ai-usage-section { margin-top: 1.25rem; }
.ai-usage-section h4 { margin: 0 0 0.65rem; font-size: 0.9rem; color: #12344D; }
.ai-usage-table { border: 1px solid #EBEFF3; border-radius: 8px; overflow: hidden; }

/* AI budget (tokens per month) */
.ai-budget { border: 1px solid #DBE4F0; border-radius: 12px; padding: 1.1rem 1.2rem; background: linear-gradient(180deg, #F6F9FF, #fff); margin-bottom: 1.25rem; }
.ai-budget-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ai-budget-used { font-size: 1.35rem; font-weight: 800; color: #12344D; }
.ai-budget-used span { font-size: 0.9rem; font-weight: 600; color: #6B7C8D; }
.ai-budget-plan { font-size: 0.8rem; font-weight: 700; color: #2C5CC5; background: #EEF2FF; padding: 0.2rem 0.6rem; border-radius: 99px; }
.ai-budget-bar { height: 10px; background: #E8EDF3; border-radius: 99px; overflow: hidden; margin: 0.8rem 0 0.6rem; }
.ai-budget-bar > div { height: 100%; border-radius: 99px; background: #3B82F6; transition: width 0.4s; }
.ai-budget-bar.warn > div { background: #F59E0B; }
.ai-budget-bar.full > div { background: #EF4444; }
.ai-budget-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: #6B7C8D; }
.ai-budget-note { margin-top: 0.75rem; font-size: 0.85rem; padding: 0.6rem 0.8rem; border-radius: 8px; }
.ai-budget-note.warn { background: #FFFBEB; color: #92400E; }
.ai-budget-note.full { background: #FEF2F2; color: #991B1B; }
.plan-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin: 0.25rem 0 1rem; }
.plan-fact { border: 1px solid #EBEFF3; border-radius: 8px; padding: 0.75rem 0.9rem; background: #FAFBFC; }
.plan-fact b { display: block; font-size: 1.05rem; color: #12344D; }
.plan-fact span { font-size: 0.72rem; font-weight: 700; color: #6B7C8D; text-transform: uppercase; }
.ai-budget-banner { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.ai-budget-banner.full { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }

.notif-sound-option { display: flex; align-items: center; gap: 1rem; padding: 0.85rem 1rem; border: 1.5px solid #EBEFF3; border-radius: 8px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.notif-sound-option:has(input:checked) { border-color: #2C5CC5; background: #EEF2FF; }
.notif-sound-option:hover { border-color: #C7D2FE; background: #F8FAFF; }
.notif-sound-option input[type="radio"] { accent-color: #2C5CC5; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.notif-sound-info { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.notif-sound-name { font-size: 0.9rem; font-weight: 700; color: #12344D; display: flex; align-items: center; gap: 0.5rem; }
.notif-sound-desc { font-size: 0.8rem; color: #6B7C8D; }
.notif-sound-tag { font-size: 0.68rem; font-weight: 600; background: #DBEAFE; color: #1D4ED8; border-radius: 4px; padding: 0.1rem 0.4rem; }
.notif-tag-alert { background: #FEE2E2; color: #DC2626; }

/* Account form — button left-aligned on desktop, full-width on mobile */
#pwdForm { align-items: flex-start; }
#pwdForm .form-group { width: 100%; }
#pwdForm button[type="submit"] { width: auto; min-width: 160px; }

@media (max-width: 640px) {
  #pwdForm button[type="submit"] { width: 100%; }
}
.bh-timezone-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: #475867; }
.bh-tz-select { padding: 0.3rem 0.5rem; border: 1px solid #CFD7DF; border-radius: 4px; font-size: 0.85rem; color: #12344D; }

/* ── CHAT LOCATION BADGE ── */
.convo-location { display: inline-block; margin-left: 0.5rem; font-size: 0.8rem; color: #475867; background: #F1F5F9; padding: 0.15rem 0.5rem; border-radius: 20px; vertical-align: middle; cursor: default; }
.convo-ip { display: inline-block; margin-left: 0.4rem; font-size: 0.75rem; color: #8A9BAE; font-family: monospace; vertical-align: middle; }
.session-location { font-size: 0.75rem; color: #6B7C8D; margin-left: 4px; }

/* ── USER MANAGEMENT ── */
/* ── USERS VIEW ── */
#view-users { padding: 0; background: #F1F5F9; }
#view-users > .view-header { background: white; padding: 1.25rem 1.5rem; margin-bottom: 0; border-bottom: 1px solid #E8EDF3; }

.um-table-wrap { background: #fff; border-radius: 12px; border: 1px solid #E8EDF3; overflow: hidden; box-shadow: 0 1px 3px rgba(15,39,68,0.05); }
.um-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.um-table thead { background: #F8FAFC; }
.um-table th { text-align: left; padding: 0.65rem 1rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: #94A3B8; letter-spacing: 0.04em; border-bottom: 1px solid #E8EDF3; }
.um-table td { padding: 0.85rem 1rem; border-bottom: 1px solid #F1F5F9; color: #1E293B; vertical-align: middle; }
.um-table tbody tr:hover { background: #F8FAFC; }
.um-table tbody tr:last-child td { border-bottom: none; }
.um-agent-cell { display: flex; align-items: center; gap: 0.75rem; }
.um-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.875rem; font-weight: 700; color: white; flex-shrink: 0; }
.um-role-badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 20px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.um-role-admin { background: #EDE9FE; color: #6D28D9; }
.um-role-agent { background: #E0F2FE; color: #0369A1; }
.um-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.um-status-online { background: #22C55E; }
.um-status-offline { background: #D1D5DB; }
.um-actions { display: flex; gap: 0.5rem; }
.um-checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: white; border-radius: 14px; width: 460px; max-width: 95vw; box-shadow: 0 20px 60px rgba(15,39,68,.25); }
#cannedEditModal .modal-box { width: 620px; }
#cannedEditModal .ql-editor { min-height: 180px; font-size: 0.875rem; }
#cannedEditModal .ql-toolbar { border-radius: 4px 4px 0 0; }
#cannedEditModal .ql-container { border-radius: 0 0 4px 4px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid #EBEFF3; }
.modal-header h3 { margin: 0; font-size: 1rem; font-weight: 700; color: #12344D; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #6B7C8D; line-height: 1; padding: 0; }
.modal-close:hover { color: #12344D; }
.modal-box .form { padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 0.75rem; padding: 1rem 1.5rem 1.25rem; border-top: 1px solid #EBEFF3; margin-top: 0.5rem; }

/* ── OVERRIDING GLOBAL STYLES FOR CONSISTENCY ── */
.badge.status-open, .badge.status-waiting_on_customer, .badge.status-in_progress, .badge.status-pending, .badge.status-resolved, .badge.status-closed, .badge.status-closed { font-size: 0.72rem; padding: 0.2rem 0.5rem; font-weight: 700; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.02em; }
.badge.status-open { background: #E0F2FE; color: #0369A1; }
.badge.status-waiting_on_customer { background: #E0E7FF; color: #4338CA; }
.badge.status-in_progress { background: #DBEAFE; color: #1D4ED8; }
.badge.status-pending { background: #FEF3C7; color: #B45309; }
.badge.status-resolved { background: #DCFCE7; color: #15803D; }
.badge.status-closed { background: #F3F4F6; color: #374151; }
.badge.priority-low, .badge.priority-medium, .badge.priority-high, .badge.priority-urgent { font-size: 0.72rem; padding: 0.2rem 0.5rem; font-weight: 700; border-radius: 4px; text-transform: uppercase; }
.badge.priority-low { background: #E0F2FE; color: #0284C7; }
.badge.priority-medium { background: #FEF3C7; color: #D97706; }
.badge.priority-high { background: #FEE2E2; color: #DC2626; }
.badge.priority-urgent { background: #DC2626; color: white; }

/* ── SLA BADGES ── */
.sla-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 4px; white-space: nowrap; }
.sla-met   { background: #DCFCE7; color: #15803D; }
.sla-breach{ background: #FEE2E2; color: #DC2626; }
.sla-warn  { background: #FEF3C7; color: #B45309; animation: sla-pulse 1.2s ease-in-out infinite; }
.sla-ok    { background: #E0F2FE; color: #0369A1; }
@keyframes sla-pulse { 0%,100% { opacity:1; } 50% { opacity:.65; } }

/* ── CSAT WIDGET ── */
.csat-widget { padding: 0.5rem 0; }
.csat-score { font-size: 1.8rem; font-weight: 800; color: #12344D; margin-bottom: 0.25rem; }
.csat-sub { font-size: 0.8rem; color: #6B7C8D; margin-bottom: 0.75rem; }
.csat-bars { display: flex; flex-direction: column; gap: 4px; }
.csat-bar-row { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: #6B7C8D; }
.csat-bar-row > span:first-child { width: 20px; text-align: right; flex-shrink: 0; }
.csat-bar-row > span:last-child  { width: 30px; flex-shrink: 0; }
.csat-bar { flex: 1; background: #F3F4F6; border-radius: 4px; height: 8px; overflow: hidden; }
.csat-bar-fill { height: 100%; background: #F59E0B; border-radius: 4px; transition: width .4s; }

/* ── CANNED RESPONSES ── */
.canned-list { max-height: 320px; overflow-y: auto; }
.canned-item { display: flex; flex-direction: column; padding: 0.65rem 0.85rem; border: 1px solid #EBEFF3; border-radius: 6px; margin-bottom: 0.5rem; cursor: pointer; transition: background .15s, border-color .15s; }
.canned-item:hover { background: #F0F5FF; border-color: #2C5CC5; }
.canned-item-title, .canned-title { font-weight: 700; font-size: 0.85rem; color: #12344D; }
.canned-item-preview, .canned-preview { font-size: 0.8rem; color: #6B7C8D; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.canned-settings-item { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid #EBEFF3; }
.canned-settings-item:last-child { border-bottom: none; }
.canned-settings-title { font-weight: 600; font-size: 0.875rem; color: #12344D; }
.canned-modal-search { width: 100%; padding: 0.6rem 0.85rem; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 0.9rem; margin-bottom: 0.75rem; outline: none; }
.canned-modal-search:focus { border-color: #2C5CC5; }

/* ── MERGE TICKET ── */
.merge-search-results { margin-top: 0.5rem; border: 1px solid #E5E7EB; border-radius: 6px; overflow: hidden; max-height: 220px; overflow-y: auto; }
.merge-result-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.85rem; cursor: pointer; font-size: 0.875rem; border-bottom: 1px solid #F3F4F6; }
.merge-result-item:last-child { border-bottom: none; }
.merge-result-item:hover { background: #F0F5FF; }
.merge-no-results { padding: 0.75rem; text-align: center; color: #9CA3AF; font-size: 0.85rem; }

/* ── @MENTION DROPDOWN ── */
.mention-dropdown { position: absolute; bottom: calc(100% + 4px); left: 0; background: white; border: 1px solid #D1D5DB; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 220px; z-index: 500; overflow: hidden; }
.mention-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.85rem; cursor: pointer; font-size: 0.875rem; color: #12344D; }
.mention-item:hover { background: #F0F5FF; }
.mention-avatar { width: 26px; height: 26px; border-radius: 50%; background: #4F46E5; color: white; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }

/* ── BULK ACTION BAR (#2) ── */
.bulk-action-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.5rem; background: #EFF6FF; border-bottom: 1px solid #BFDBFE; font-size: 0.875rem; color: #1D4ED8; }
.bulk-action-bar #bulkCount { font-weight: 600; margin-right: 0.25rem; }
.btn-ghost { background: none; border: none; color: #6B7C8D; cursor: pointer; font-size: 0.875rem; padding: 0.3rem 0.6rem; border-radius: 4px; }
.btn-ghost:hover { background: #F3F4F6; }

/* ── TAGS CHIPS INPUT ── */
.fdt-tags-input-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid #D1D5DB; border-radius: 6px; background: white; cursor: text; min-height: 34px; }
.fdt-tags-input-wrap:focus-within { border-color: #2C5CC5; }
.fdt-tags-chips { display: contents; }
.fdt-tag-chip { display: inline-flex; align-items: center; gap: 3px; background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; border-radius: 4px; padding: 1px 6px; font-size: 0.78rem; font-weight: 500; }
.fdt-tag-remove { background: none; border: none; color: #6B7C8D; cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0 1px; }
.fdt-tag-remove:hover { color: #DC2626; }
.fdt-tag-text-input { border: none; outline: none; font-size: 0.82rem; min-width: 80px; flex: 1; padding: 2px; background: transparent; }

/* ── FILE ATTACHMENTS ── */
.fdt-attachment-list { padding: 0.5rem 1.25rem; display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid #EBEFF3; background: #FAFAFA; }
.att-staged { display: inline-flex; align-items: center; gap: 4px; background: #F3F4F6; border: 1px solid #D1D5DB; border-radius: 4px; padding: 2px 8px; font-size: 0.8rem; color: #374151; }
.att-staged-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-staged-remove { background: none; border: none; color: #9CA3AF; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 1px; }
.att-staged-remove:hover { color: #DC2626; }
.fdt-att-section { padding: 0.75rem 1.5rem 0; }
.fdt-att-header { font-size: 0.78rem; font-weight: 700; color: #6B7C8D; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.fdt-att-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #F9FAFB; border: 1px solid #E5E7EB; border-radius: 6px; font-size: 0.82rem; color: #12344D; text-decoration: none; margin: 0 6px 6px 0; transition: background .15s; }
.fdt-att-item:hover { background: #EFF6FF; border-color: #BFDBFE; }
.fdt-att-icon { font-size: 1rem; }
.fdt-att-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdt-att-size { color: #9CA3AF; font-size: 0.75rem; }

/* ── QUILL EDITOR FIXES (#10 lists, #11 line spacing) ── */
/* Fix bullet and numbered list rendering in both editor and rendered messages */
.ql-editor ol, .ql-editor ul,
.ticket-message ol, .ticket-message ul,
.msg-body ol, .msg-body ul {
  padding-left: 1.75em;
  margin: 0.4em 0;
}
.ql-editor li, .ticket-message li, .msg-body li { margin: 0.2em 0; }
.ql-editor ol > li, .ticket-message ol > li, .msg-body ol > li { list-style-type: decimal; }
.ql-editor ul > li, .ticket-message ul > li, .msg-body ul > li { list-style-type: disc; }
/* Quill uses data-list on <li> inside .ql-editor */
.ql-editor li[data-list="ordered"] { list-style-type: decimal; }
.ql-editor li[data-list="bullet"]  { list-style-type: disc; }
/* Line spacing: comfortable reading in messages */
.ql-editor p, .ticket-message p, .msg-body p { margin: 0; line-height: 1.6; }
.ql-editor p + p, .ticket-message p + p, .msg-body p + p { margin-top: 0.5em; }

/* ── Email Filters ── */
.ef-list { display: flex; flex-direction: column; gap: 6px; }
.ef-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; background: #F9FAFB; border: 1px solid #EBEFF3; border-radius: 6px; font-size: 0.85rem; }
.ef-row:empty::after { content: 'None configured'; color: #9CA3AF; font-style: italic; font-size: 0.82rem; }
.ef-value { flex: 1; font-weight: 500; color: #12344D; font-family: monospace; }
.ef-label { color: #6B7C8D; font-size: 0.8rem; }
.ef-badge { padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.ef-badge-drop { background: #FEE2E2; color: #DC2626; }
.ef-badge-sales { background: #DCFCE7; color: #16A34A; }
.ef-del { margin-left: auto; cursor: pointer; color: #9CA3AF; font-size: 1rem; line-height: 1; background: none; border: none; padding: 2px 6px; border-radius: 4px; }
.ef-del:hover { background: #FEE2E2; color: #DC2626; }

/* ── COMPOSE EMAIL MODAL ── */
#composeModal .modal-box { width: 600px; }
.compose-fields { padding: 1.25rem 1.5rem 0.5rem; display: flex; flex-direction: column; gap: 0; }
.compose-row { display: flex; align-items: center; border-bottom: 1px solid #EBEFF3; padding: 0.55rem 0; }
.compose-row-body { align-items: flex-start; flex-direction: column; border-bottom: none; padding-top: 0.75rem; }
.compose-label { width: 72px; font-size: 0.8rem; font-weight: 600; color: #6B7C8D; flex-shrink: 0; }
.compose-input { flex: 1; border: none; outline: none; font-size: 0.875rem; color: #12344D; background: transparent; }
.compose-input::placeholder { color: #B0BAC4; }
.compose-editor { width: 100%; border: 1px solid #D5DBE1; border-radius: 6px; overflow: hidden; margin-top: 0.25rem; }
.compose-editor .ql-toolbar { border: none; border-bottom: 1px solid #D5DBE1; padding: 6px 8px; background: #FAFAFA; }
.compose-editor .ql-toolbar .ql-formats { margin-right: 8px; }
.compose-editor .ql-container { border: none; font-size: 0.875rem; }
.compose-editor .ql-editor { min-height: 180px; padding: 0.75rem; }

/* ── MESSAGE ACTION BUTTONS (forward + delete) ── */
.fdt-msg-body-wrap { position: relative; }
.fdt-msg-actions { position: absolute; top: 6px; right: 6px; display: none; align-items: center; gap: 2px; }
.fdt-msg:hover .fdt-msg-actions { display: flex; }
.fdt-msg-delete, .fdt-msg-forward { background: none; border: none; cursor: pointer; color: #9CA3AF; font-size: 0.85rem; padding: 2px 6px; border-radius: 4px; line-height: 1; }
.fdt-msg-forward:hover { background: #EEF2FF; color: #4F46E5; }
.fdt-msg-delete:hover  { background: #FEE2E2; color: #DC2626; }


@media (max-width: 900px) {
  .fd-ops-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .fd-metric-grid { grid-template-columns: 1fr; }
  .fd-metric { border-right: none; }
}

/* ── PUSH NOTIFICATION BANNER ── */
.push-banner {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  background: #EEF2FF; border-bottom: 1px solid #C7D2FE;
  padding: 0.6rem 1.25rem; font-size: 0.875rem; color: #3730A3;
}
.push-banner span { flex: 1; min-width: 0; }

/* ── TRIAL BANNER ── */
.trial-banner {
  display: flex; align-items: center; gap: 0.7rem;
  background: linear-gradient(90deg, #FFFBEB 0%, #FEF3C7 100%);
  border-bottom: 1px solid #FDE68A;
  padding: 0.7rem 1.5rem; font-size: 0.875rem; color: #92400E; font-weight: 500;
}
.trial-banner-ic { font-size: 1.05rem; line-height: 1; flex-shrink: 0; }
.trial-banner #trialBannerText { flex: 1; min-width: 0; }
.trial-banner-btn {
  flex-shrink: 0; background: #92400E; color: #fff; text-decoration: none;
  font-weight: 600; font-size: 0.8rem; padding: 0.42rem 0.95rem; border-radius: 7px;
  transition: background .15s;
}
.trial-banner-btn:hover { background: #78350F; }
.trial-banner-x {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: #92400E; opacity: 0.55; font-size: 0.85rem; padding: 4px 6px; line-height: 1;
  transition: opacity .15s;
}
.trial-banner-x:hover { opacity: 1; }
.trial-banner.urgent {
  background: linear-gradient(90deg, #FEF2F2 0%, #FEE2E2 100%);
  border-color: #FCA5A5; color: #991B1B;
}
.trial-banner.urgent .trial-banner-ic, .trial-banner.urgent .trial-banner-x { color: #991B1B; }
.trial-banner.urgent .trial-banner-btn { background: #B91C1C; }
.trial-banner.urgent .trial-banner-btn:hover { background: #991B1B; }
.trial-banner.hidden { display: none; }

/* ── ONBOARDING STEPS ── */
.onboarding-steps { display: flex; flex-direction: column; gap: 1rem; }
.ob-step {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 1rem; border: 1px solid var(--gray-200); border-radius: var(--radius);
  background: var(--gray-50);
}
.ob-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.ob-step-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.ob-step-desc { font-size: 0.82rem; color: var(--gray-500); }

/* ── COLLISION DETECTION BANNER ── */
.fdt-collision-banner {
  background: #FFFBEB; border-bottom: 1px solid #FDE68A;
  color: #92400E; font-size: 0.82rem; font-weight: 500;
  padding: 0.45rem 1.25rem; display: flex; align-items: center; gap: 0.5rem;
}
.fdt-collision-banner.hidden { display: none; }

/* ── MERGE MODAL SEARCH RESULTS ── */
.merge-search-results { margin-top: 0.5rem; border: 1px solid var(--gray-200); border-radius: 6px; overflow: hidden; max-height: 220px; overflow-y: auto; }
.merge-result-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.85rem; cursor: pointer; border-bottom: 1px solid var(--gray-100); font-size: 0.875rem; }
.merge-result-item:last-child { border-bottom: none; }
.merge-result-item:hover { background: #EEF2FF; }
.merge-result-num { font-weight: 600; color: #4F46E5; min-width: 72px; font-size: 0.8rem; }
.merge-result-subject { flex: 1; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.merge-result-customer { color: var(--gray-500); font-size: 0.78rem; white-space: nowrap; }
.merge-no-results { padding: 0.75rem 0.85rem; color: var(--gray-500); font-size: 0.875rem; font-style: italic; }

/* ── DASHBOARD RESPONSIVE ── */
@media (max-width: 1100px) {
  .db-body { grid-template-columns: 1fr; }
  .db-right { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .db-metrics { grid-template-columns: repeat(2, 1fr); }
  .db-right { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  #view-dashboard { padding: 0.75rem; gap: 0.75rem; }
  .db-metrics { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .db-metric { padding: 12px 14px; }
  .db-metric-value { font-size: 1.5rem; }
  .db-body { gap: 0.75rem; }
  .db-ticket-row { padding: 10px 14px; }
  .db-card-head { padding: 12px 14px; }
}

/* ── Ticket thread: each message is a card (name left, time right) ── */
.fdt-msg-body-wrap.fdt-msg-bubble { min-width: 0; }
.fdt-msg-header { gap: 0.75rem; flex-wrap: wrap; }
/* Touch screens have no hover: keep forward/delete visible, above the header */
@media (hover: none) {
  .fdt-msg-actions { display: flex; position: static; justify-content: flex-end; padding: 0.25rem 0.5rem 0; }
  .fdt-msg-delete, .fdt-msg-forward { min-width: 36px; min-height: 32px; }
}

/* ── "More" tab + sheet (phones only) ── */
.nav-more, .nav-more-sheet { display: none; }
@media (max-width: 640px) {
  .sidebar-nav .nav-item[data-view="users"],
  .sidebar-nav .nav-item[data-view="reports"],
  .sidebar-nav .nav-item[data-view="import"],
  .sidebar-nav .nav-item[data-view="settings"] { display: none; }
  .sidebar-nav .nav-item, .nav-more { flex: 1 1 0; min-width: 0; }
  .nav-more {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-height: 56px; padding: 0.35rem 0.25rem; background: none; border: none; border-radius: 0;
    color: rgba(255,255,255,0.45); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .nav-more .nav-label { display: block; font-size: 0.6rem; }
  .nav-more.active, .nav-more[aria-expanded="true"] { background: rgba(59,130,246,0.15); color: #93C5FD; }
  .nav-more-sheet:not([hidden]) { display: block; position: fixed; left: 0; right: 0; top: 0; bottom: 56px; z-index: 900; }
  .nav-more-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.45); }
  .nav-more-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - 24px); overflow-y: auto;
    background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -12px 32px rgba(15,39,68,0.2);
    padding: 0.35rem 0 0.5rem; animation: navMoreUp 0.18s ease-out;
  }
  .nav-more-agent { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid #EEF2F6; }
  .nav-more-agent .agent-avatar { width: 40px; height: 40px; font-size: 0.95rem; }
  .nav-more-agent-text { flex: 1; min-width: 0; }
  .nav-more-name { font-weight: 700; color: #0F2744; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-more-status { font-size: 0.78rem; color: #64748B; }
  .nav-more-switch {
    position: relative; width: 48px; height: 28px; flex-shrink: 0; border: none; border-radius: 999px;
    background: #CBD5E1; cursor: pointer; transition: background 0.2s; padding: 0;
  }
  .nav-more-switch span {
    position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s;
  }
  .nav-more-switch[aria-checked="true"] { background: #10B981; }
  .nav-more-switch[aria-checked="true"] span { transform: translateX(20px); }
  .nav-more-list { padding: 0.35rem 0; }
  .nav-more-list button, .nav-more-logout {
    display: flex; align-items: center; gap: 0.85rem; width: 100%; min-height: 52px; padding: 0 1.25rem;
    background: none; border: none; font: inherit; font-size: 0.95rem; font-weight: 600; color: #0F2744;
    text-align: left; cursor: pointer;
  }
  .nav-more-list .nav-icon, .nav-more-logout .nav-icon { width: 22px; color: #64748B; }
  .nav-more-list .nav-icon svg, .nav-more-logout .nav-icon svg { width: 20px; height: 20px; }
  .nav-more-list button.active { color: #2563EB; background: #EFF6FF; }
  .nav-more-list button.active .nav-icon { color: #2563EB; }
  .nav-more-logout { color: #DC2626; border-top: 1px solid #EEF2F6; }
  .nav-more-logout .nav-icon { color: #DC2626; }
  [data-theme="dark"] .nav-more-panel { background: #161B22; box-shadow: 0 -12px 32px rgba(0,0,0,0.5); }
  [data-theme="dark"] .nav-more-agent, [data-theme="dark"] .nav-more-logout { border-color: #30363D; }
  [data-theme="dark"] .nav-more-name, [data-theme="dark"] .nav-more-list button { color: #E6EDF3; }
  [data-theme="dark"] .nav-more-list button.active { background: rgba(56,139,253,0.15); color: #58A6FF; }
  [data-theme="dark"] .nav-more-logout, [data-theme="dark"] .nav-more-logout .nav-icon { color: #F87171; }

  /* Users: one card per agent instead of a five-column table */
  #view-users > div:not(.view-header) { padding: 0.75rem !important; }
  #view-users .um-table thead { display: none; }
  #view-users .um-table, #view-users .um-table tbody, #view-users .um-table tr, #view-users .um-table td { display: block; width: 100%; }
  #view-users .um-table tr { padding: 0.85rem 1rem; border-bottom: 1px solid #F1F5F9; }
  #view-users .um-table tbody tr:last-child { border-bottom: none; }
  #view-users .um-table td { padding: 0.15rem 0; border: none; }
  #view-users .um-table td:nth-child(2) { color: #64748B; font-size: 0.85rem; overflow-wrap: anywhere; }
  #view-users .um-table td:nth-child(3), #view-users .um-table td:nth-child(4) { display: inline-flex; align-items: center; width: auto; margin: 0.35rem 0.75rem 0 0; }
  #view-users .um-actions { flex-wrap: wrap; margin-top: 0.6rem; }
  #view-users .view-header { flex-wrap: wrap; gap: 0.5rem; }
  #view-users .view-header h2 { flex: 1 1 100%; }

  /* Form fields big enough to tap */
  .settings-card input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),
  .settings-card select, .modal-box input:not([type=checkbox]):not([type=radio]):not([type=color]), .modal-box select { min-height: 40px; }
}
/* Long unbroken text in a plain-text message wraps instead of scrolling sideways */
.fdt-msg-body:not(.fdt-msg-html) { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  /* Reports: one column, and nothing wider than the screen */
  #view-reports > div[style*="display:grid"] { grid-template-columns: minmax(0, 1fr); }
  #view-reports [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
  #view-reports .card { min-width: 0; overflow-x: auto; }
  .bh-timezone-row { flex-wrap: wrap; }
  .bh-tz-select { max-width: 100%; min-width: 0; }
}
@keyframes navMoreUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .nav-more-panel { animation: none; } }

/* ── Touch: comfortable tap targets ── */
@media (max-width: 640px), (pointer: coarse) {
  .btn, .btn-sm { min-height: 36px; }
  .modal-close { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .bh-remove-slot, .ef-del, .trial-banner-x { min-width: 36px; min-height: 36px; }
  .bh-add-slot, .sla-input, .bh-tz-select { min-height: 36px; }
  .db-card-link { min-height: 36px; padding: 0 0.25rem; }
  .fdt-back-btn, .fdt-action-tab { min-height: 38px; }
  .ql-toolbar button { width: 34px !important; height: 34px !important; }
  .sidebar-nav .nav-item { min-height: 40px; }
  #mentionBell, #logoutBtn { min-width: 36px; min-height: 36px; align-items: center; justify-content: center; }
  .topbar-new-btn, .topbar-bell { min-height: 36px; }
  .topbar-search { min-height: 36px; }
  .bh-start, .bh-end { min-height: 36px; }
  #selectAllTickets, .ticket-cb { width: 18px; height: 18px; }
  #ticketPager .btn { min-width: 36px; }
  .topbar-search input { min-height: 32px; }
}

/* Business hours: keep start, "to", end and × on one line on phones */
@media (max-width: 640px) {
  .bh-slot-list { margin-left: 0; }
  .bh-slot-row { flex-wrap: nowrap; gap: 0.35rem; }
  .bh-start, .bh-end { flex: 1 1 0; min-width: 0; padding: 0.3rem 0.3rem; font-size: 0.8rem; }
  .bh-remove-slot { flex: none; }
}
