/* CXConnect - Static Prototype Styles */

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

:root {
  --accent: #4F6BED;
  --accent-light: #EEF1FD;
  --accent-dark: #3652C9;
  --bg: #F5F6FA;
  --page-bg: #EBF4FC;
  --surface: #FFFFFF;
  --sidebar-bg: #1A1D2E;
  --sidebar-text: #A0A8C0;
  --sidebar-active: #4F6BED;
  --white: #FFFFFF;
  --border: #E4E7EF;
  --text-primary: #1A1D2E;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.5px;
}

.logo-text {
  color: white;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-sub {
  color: var(--sidebar-text);
  font-size: 11px;
  margin-top: 1px;
}

.sidebar-section {
  padding: 20px 12px 8px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(160,168,192,0.5);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #D1D5E8;
}

.nav-item.active {
  background: rgba(79,107,237,0.2);
  color: white;
}

.nav-item.active .nav-icon {
  color: var(--accent);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sidebar-user:hover {
  background: rgba(255,255,255,0.05);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  color: white;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: var(--sidebar-text);
  font-size: 11px;
}

/* ── Main Layout ───────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ────────────────────────────────────── */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  width: 220px;
}

.header-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all 0.15s;
  position: relative;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid white;
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F6BED, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  border: 2px solid var(--border);
}

/* ── Content Area ──────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.module {
  display: none;
  height: 100%;
}

.module.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.module-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.module-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-icon {
  font-size: 14px;
}

/* ── Cards ─────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
}

.card-body {
  padding: 20px;
}

/* ── Stats Row ─────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -1px;
  color: var(--text-primary);
}

.stat-change {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Tables ────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

tbody tr:hover {
  background: var(--accent-light);
}

tbody tr.selected {
  background: var(--accent-light);
}

/* ── Badges / Tags ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-open { background: #EEF1FD; color: var(--accent); }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-resolved { background: #D1FAE5; color: #065F46; }
.badge-closed { background: #F3F4F6; color: #6B7280; }
.badge-high { background: #FEE2E2; color: #991B1B; }
.badge-medium { background: #FEF3C7; color: #92400E; }
.badge-low { background: #D1FAE5; color: #065F46; }
.badge-paid { background: #D1FAE5; color: #065F46; }
.badge-unpaid { background: #FEE2E2; color: #991B1B; }
.badge-overdue { background: #FEE2E2; color: #991B1B; }
.badge-draft { background: #F3F4F6; color: #6B7280; }
.badge-active { background: #D1FAE5; color: #065F46; }
.badge-inactive { background: #F3F4F6; color: #6B7280; }
.badge-prospect { background: #EEF1FD; color: var(--accent); }
.badge-confirmed { background: #D1FAE5; color: #065F46; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }

/* ── Split View ────────────────────────────────── */
.split-view {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.split-list {
  flex: 0 0 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.list-scroll {
  flex: 1;
  overflow-y: auto;
}

/* ── Ticket List Items ─────────────────────────── */
.ticket-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.ticket-item:hover {
  background: var(--accent-light);
}

.ticket-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}

.ticket-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ticket-id {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.ticket-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Detail Panel ──────────────────────────────── */
.detail-panel {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.detail-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
  padding: 40px;
  text-align: center;
}

.detail-placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

.detail-top {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.detail-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.detail-body {
  padding: 24px;
  flex: 1;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.7;
}

/* ── Timeline / Comments ───────────────────────── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  display: flex;
  gap: 12px;
}

.timeline-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.timeline-content {
  flex: 1;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-name {
  font-size: 13px;
  font-weight: 700;
}

.timeline-time {
  font-size: 12px;
  color: var(--text-muted);
}

.timeline-msg {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--bg);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
}

/* ── AI Chat Module ────────────────────────────── */
#module-chat {
  height: 100%;
  min-height: 0;
}

.chat-layout {
  display: flex;
  gap: 0;
  flex: 1;
  height: 100%;
  min-height: 0;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.chat-sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #FAFBFC;
}

.chat-sidebar-header {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-sidebar-title {
  font-size: 14px;
  font-weight: 700;
}

.chat-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.chat-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: white;
}

.chat-search-input:focus {
  border-color: var(--accent);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.chat-item:hover {
  background: white;
}

.chat-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
  position: relative;
}

.chat-avatar-status {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid white;
}

.status-online { background: var(--success); }
.status-away { background: var(--warning); }
.status-offline { background: var(--text-muted); }

.chat-item-info {
  flex: 1;
  min-width: 0;
}

.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.chat-item-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-item-time {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-item-preview {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-unread {
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* Chat Window */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-win-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
}

.chat-win-info {
  flex: 1;
}

.chat-win-name {
  font-size: 15px;
  font-weight: 700;
}

.chat-win-status {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-light);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(79,107,237,0.2);
}

.ai-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.ai-dot.pulsing {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.human-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #D1FAE5;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #065F46;
  border: 1px solid rgba(16,185,129,0.2);
}

.chat-win-actions {
  display: flex;
  gap: 8px;
}

/* Messages Area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #F9FAFB;
}

.msg-row {
  display: flex;
  gap: 10px;
  max-width: 75%;
}

.msg-row.client {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-row.agent {
  align-self: flex-start;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  align-self: flex-end;
}

.msg-bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 100%;
}

.msg-row.agent .msg-bubble {
  background: white;
  color: var(--text-primary);
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.msg-row.client .msg-bubble {
  background: var(--accent);
  color: white;
  border-radius: 16px 4px 16px 16px;
}

.msg-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.msg-row.client .msg-meta {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.ai-badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 10px;
  align-self: flex-start;
  align-items: flex-end;
}

.typing-bubble {
  background: white;
  border-radius: 4px 16px 16px 16px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Message Input */
.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: white;
}

.chat-input-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.toolbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s;
}

.toolbar-btn:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 18px;
  font-size: 13.5px;
  outline: none;
  resize: none;
  font-family: inherit;
  max-height: 120px;
  line-height: 1.5;
  background: var(--bg);
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: var(--accent);
  background: white;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.15s;
}

.send-btn:hover {
  background: var(--accent-dark);
}

/* Handoff Banner */
.handoff-banner {
  margin: 0 20px 0;
  padding: 10px 16px;
  background: linear-gradient(90deg, #EEF1FD, #F0F4FF);
  border: 1px solid rgba(79,107,237,0.2);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── Billing Module ─────────────────────────────── */
.invoice-detail {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px;
}

.invoice-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.invoice-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-num {
  text-align: right;
}

.invoice-num-label {
  font-size: 13px;
  color: var(--text-muted);
}

.invoice-num-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.party-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.party-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.party-info {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.invoice-items table {
  width: 100%;
}

.invoice-total {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.invoice-total-box {
  width: 260px;
  border-top: 2px solid var(--border);
  padding-top: 16px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  color: var(--text-secondary);
}

.total-row.grand {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Booking Module ─────────────────────────────── */
.booking-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

.calendar-grid {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.calendar-month {
  font-size: 15px;
  font-weight: 700;
}

.cal-arrow {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.cal-arrow:hover {
  background: var(--bg);
}

.cal-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}

.cal-day-label {
  padding: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

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

.cal-day {
  padding: 10px;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
  min-height: 52px;
  border: 1px solid transparent;
  position: relative;
  transition: all 0.1s;
}

.cal-day:hover {
  background: var(--accent-light);
  border-color: rgba(79,107,237,0.2);
}

.cal-day.other-month {
  color: var(--text-muted);
}

.cal-day.today {
  font-weight: 700;
  color: var(--accent);
}

.cal-day.has-booking::after {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  margin: 3px auto 0;
}

.cal-day.selected {
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
}

.cal-day.selected::after {
  background: white;
}

.booking-list-section {
  margin-top: 20px;
}

.booking-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.booking-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.booking-item:last-child {
  border-bottom: none;
}

.booking-time {
  min-width: 80px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.booking-time-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.booking-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.booking-info {
  flex: 1;
}

.booking-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 2px;
}

.booking-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Booking Form */
.booking-form-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: sticky;
  top: 0;
}

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

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  color: var(--text-primary);
  background: white;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--accent);
}

select.form-control {
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── CRM Module ─────────────────────────────────── */
.crm-layout {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.crm-list {
  flex: 0 0 440px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crm-detail {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.contact-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-item:hover {
  background: var(--accent-light);
}

.contact-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}

.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 2px;
}

.contact-company {
  font-size: 12px;
  color: var(--text-muted);
}

.contact-detail-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex: 1;
  overflow-y: auto;
}

.contact-detail-hero {
  padding: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
  color: white;
  display: flex;
  gap: 20px;
  align-items: center;
}

.contact-detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.3);
}

.contact-detail-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.contact-detail-title {
  font-size: 13px;
  opacity: 0.85;
}

.contact-detail-body {
  padding: 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-field {
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.detail-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.detail-field-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-top: 4px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* ── Utilities ──────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-auto { margin-top: auto; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* scrollbar styling */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* ── Responsive tweaks ─────────────────────────── */
@media (max-width: 1100px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .booking-layout {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════
   BILLING MODULE — EXTENDED
   ═══════════════════════════════════════════════════ */

/* ── Billing Tabs ───────────────────────────────── */
.billing-tabs-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  padding: 0 4px;
}

.billing-tab {
  padding: 13px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  user-select: none;
}

.billing-tab:hover {
  color: var(--text-primary);
  background: rgba(79,107,237,0.04);
}

.billing-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Invoice Filter Bar ─────────────────────────── */
.billing-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: #FAFBFC;
  flex-shrink: 0;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  min-width: 180px;
  transition: border-color 0.15s;
}

.filter-search:focus-within {
  border-color: var(--accent);
}

.filter-search input {
  border: none;
  outline: none;
  font-size: 13px;
  background: transparent;
  width: 100%;
  color: var(--text-primary);
}

.filter-search input::placeholder { color: var(--text-muted); }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.filter-chip.chip-overdue.active {
  border-color: var(--danger);
  color: var(--danger);
  background: #FEE2E2;
}

.filter-chip.chip-paid.active {
  border-color: var(--success);
  color: #065F46;
  background: #D1FAE5;
}

.filter-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Invoice History Table ──────────────────────── */
.invoice-history-table tbody tr { cursor: pointer; }
.invoice-history-table tbody tr:hover td { background: var(--accent-light); }
.invoice-history-table tbody tr.selected td { background: var(--accent-light); }

.client-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.client-cell-info { min-width: 0; }

.client-cell-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.client-cell-email {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.age-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.age-ok     { background: #D1FAE5; color: #065F46; }
.age-warn   { background: #FEF3C7; color: #92400E; }
.age-danger { background: #FEE2E2; color: #991B1B; }
.age-neutral{ background: #F3F4F6; color: #6B7280; }

.row-actions { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; justify-content: flex-end; opacity: 1; }

.row-action-btn {
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.1s;
}

.row-action-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ── Invoice Detail Toolbar ─────────────────────── */
.inv-detail-toolbar {
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FAFBFC;
  flex-shrink: 0;
}

.inv-detail-status-bar {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Create Invoice Layout ──────────────────────── */
.create-invoice-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 24px;
  align-items: start;
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.create-form-panel { min-width: 0; }

.create-preview-panel { position: sticky; top: 0; }

.preview-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 0 2px;
}

/* ── Form Section Title ─────────────────────────── */
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin: 22px 0 14px;
}

/* ── Line Items Editor ──────────────────────────── */
.li-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 10px;
}

.li-thead {
  display: grid;
  grid-template-columns: 1fr 72px 110px 110px 38px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--border);
}

.li-thead-cell {
  padding: 9px 11px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.li-thead-cell.right { text-align: right; }

.li-row {
  display: grid;
  grid-template-columns: 1fr 72px 110px 110px 38px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.li-row:last-child { border-bottom: none; }
.li-row:hover { background: #FAFBFC; }
.li-row:focus-within { background: #EEF1FD; }

.li-cell {
  border-right: 1px solid var(--border);
  display: flex;
  align-items: stretch;
}

.li-cell:last-child { border-right: none; }

.li-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 10px 11px;
  font-size: 13.5px;
  font-family: inherit;
  background: transparent;
  color: var(--text-primary);
}

.li-input::placeholder { color: var(--text-muted); }
.li-input.right { text-align: right; }

.li-total-cell {
  padding: 10px 11px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  width: 100%;
  align-self: center;
}

.li-del-btn {
  width: 38px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.1s;
  line-height: 1;
  flex-shrink: 0;
}

.li-del-btn:hover { color: var(--danger); }

.li-add-row {
  padding: 9px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-align: center;
  border-top: 1px solid var(--border);
  transition: background 0.1s;
  user-select: none;
}
.li-add-row:hover { background: #EEF1FD; }

/* ── Create Totals ──────────────────────────────── */
.create-totals {
  margin-top: 18px;
  margin-left: auto;
  width: 290px;
  border-top: 2px solid var(--border);
  padding-top: 14px;
}

.ct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  gap: 10px;
}

.ct-row label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: default;
}

.ct-row select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  font-size: 12px;
  outline: none;
  background: white;
  cursor: pointer;
  color: var(--text-primary);
}

.ct-row.grand {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  padding-top: 12px;
  margin-top: 8px;
  border-top: 2px solid var(--border);
}

/* ── Invoice Form Actions ───────────────────────── */
.invoice-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 20px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}

/* ── Invoice Live Preview ───────────────────────── */
.inv-preview {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
}

.inv-preview-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.inv-preview-parties {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.inv-preview-dates {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.inv-prow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #F3F4F6;
  gap: 8px;
}

.inv-prow:last-child { border-bottom: none; }

.inv-pdesc {
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.inv-pamt { font-weight: 700; color: var(--text-primary); flex-shrink: 0; font-size: 12px; }

.inv-ptotals { border-top: 2px solid var(--border); padding-top: 10px; }

.inv-ptrow {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 0;
}

.inv-ptrow.grand {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.inv-pnotes {
  margin-top: 12px;
  padding: 9px 11px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  font-style: italic;
  line-height: 1.5;
}

/* ── Email Preview Chrome ───────────────────────── */
.email-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.email-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.email-chrome-bg {
  background: #D4D8E2;
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.email-header-bar {
  background: white;
  border: 1px solid #C8CCd4;
  border-bottom: 2px solid #E1E4EC;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 14px 20px 4px;
}

.email-meta-row {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  padding: 5px 0;
  border-bottom: 1px solid #F0F1F5;
  align-items: baseline;
}

.email-meta-row:last-child { border-bottom: none; margin-bottom: 6px; }

.email-meta-lbl {
  font-weight: 700;
  color: var(--text-muted);
  width: 58px;
  flex-shrink: 0;
  font-size: 11.5px;
}

.email-body-frame {
  background: #F4F5F8;
  border: 1px solid #C8CCD4;
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 28px 20px;
  overflow-x: auto;
}

/* ── Settings ─────────────────────────────────────────────────────────── */

.settings-tabs-bar { display:flex;gap:0;border-bottom:2px solid var(--border);margin-bottom:0;background:var(--surface);flex-shrink:0; }
.settings-tab { padding:12px 20px;font-size:13px;font-weight:500;color:var(--text-secondary);cursor:pointer;border-bottom:2.5px solid transparent;margin-bottom:-2px;transition:color .15s,border-color .15s;display:flex;align-items:center;gap:6px; }
.settings-tab:hover { color:var(--accent); }
.settings-tab.active { color:var(--accent);border-bottom-color:var(--accent);font-weight:600; }

.settings-body { overflow-y:auto;padding:28px 32px;background:var(--bg);flex:1; }
.settings-section { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);margin-bottom:20px; }
.settings-section-header { padding:16px 22px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between; }
.settings-section-title { font-size:14px;font-weight:700;color:var(--text); }
.settings-section-sub { font-size:12px;color:var(--text-muted);margin-top:2px; }
.settings-section-body { padding:22px; }

.avatar-upload-row { display:flex;align-items:center;gap:20px;margin-bottom:24px; }
.avatar-upload-el { position:relative;width:72px;height:72px;border-radius:50%;cursor:pointer;flex-shrink:0; }
.avatar-upload-img { width:72px;height:72px;border-radius:50%;background:linear-gradient(135deg,#4F6BED,#7C3AED);display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700;color:white; }
.avatar-upload-overlay { position:absolute;inset:0;border-radius:50%;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s;font-size:18px;color:white; }
.avatar-upload-el:hover .avatar-upload-overlay { opacity:1; }

.toggle-row { display:flex;align-items:flex-start;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--border); }
.toggle-row:last-child { border-bottom:none;padding-bottom:0; }
.toggle-label-wrap { flex:1;padding-right:16px; }
.toggle-label { font-size:13.5px;font-weight:500;color:var(--text);margin-bottom:2px; }
.toggle-sublabel { font-size:12px;color:var(--text-muted); }
.toggle-switch { position:relative;width:42px;height:24px;flex-shrink:0; }
.toggle-switch input { opacity:0;width:0;height:0;position:absolute; }
.toggle-slider { position:absolute;inset:0;background:#D1D5DB;border-radius:24px;cursor:pointer;transition:background .2s; }
.toggle-slider::before { content:'';position:absolute;left:3px;top:3px;width:18px;height:18px;background:white;border-radius:50%;transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider { background:var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform:translateX(18px); }

.session-item { display:flex;align-items:center;gap:14px;padding:14px 0;border-bottom:1px solid var(--border); }
.session-item:last-child { border-bottom:none;padding-bottom:0; }
.session-icon { width:40px;height:40px;background:var(--bg);border:1px solid var(--border);border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0; }
.session-info { flex:1; }
.session-device { font-size:13.5px;font-weight:600;color:var(--text);margin-bottom:3px; }
.session-location { font-size:12px;color:var(--text-muted); }
.session-current { display:inline-block;background:#D1FAE5;color:#065F46;padding:2px 8px;border-radius:20px;font-size:10.5px;font-weight:600;margin-left:8px; }

.team-member-row { display:flex;align-items:center;gap:14px;padding:14px 0;border-bottom:1px solid var(--border); }
.team-member-row:last-child { border-bottom:none; }
.team-member-info { flex:1; }
.team-member-name { font-size:13.5px;font-weight:600;color:var(--text);margin-bottom:2px; }
.team-member-role { font-size:12px;color:var(--text-muted); }
.team-member-email { font-size:12px;color:var(--text-secondary);min-width:180px; }

.color-swatch-row { display:flex;gap:10px;flex-wrap:wrap;margin-top:8px; }
.color-swatch { width:32px;height:32px;border-radius:8px;cursor:pointer;border:2.5px solid transparent;transition:transform .15s,box-shadow .15s;position:relative; }
.color-swatch:hover { transform:scale(1.12); }
.color-swatch.selected { box-shadow:0 0 0 2px white,0 0 0 4px var(--accent); }
.color-swatch.selected::after { content:'✓';position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:white;font-size:14px;font-weight:700; }

.twofa-status { display:flex;align-items:center;gap:10px;padding:12px 16px;border-radius:8px;margin-bottom:16px;font-size:13px;font-weight:500; }
.twofa-status.enabled { background:#D1FAE5;color:#065F46;border:1px solid #A7F3D0; }
.twofa-status.disabled { background:#FEF3C7;color:#92400E;border:1px solid #FDE68A; }

/* ── Analytics ─────────────────────────────────────────────────────────── */

.analytics-period-bar { display:flex;align-items:center;gap:6px;margin-bottom:20px; }
.period-label { font-size:12px;color:var(--text-muted);margin-right:4px; }
.period-btn { padding:6px 14px;border:1.5px solid var(--border);border-radius:6px;font-size:12.5px;font-weight:500;color:var(--text-secondary);background:var(--surface);cursor:pointer;transition:all .15s; }
.period-btn:hover { border-color:var(--accent);color:var(--accent); }
.period-btn.active { background:var(--accent);border-color:var(--accent);color:white;font-weight:600; }

.analytics-kpi-row { display:grid;grid-template-columns:repeat(5,1fr);gap:14px;margin-bottom:18px; }
.kpi-card { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px 20px; }
.kpi-label { font-size:11px;font-weight:500;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;margin-bottom:10px; }
.kpi-value { font-size:26px;font-weight:800;color:var(--text);letter-spacing:-.5px;margin-bottom:6px; }
.kpi-trend { display:flex;align-items:center;gap:4px;font-size:12px;font-weight:500; }
.kpi-trend.up { color:var(--success); }
.kpi-trend.down { color:var(--danger); }
.kpi-trend.flat { color:var(--text-muted); }

.analytics-charts-row { display:grid;grid-template-columns:2fr 1fr;gap:16px;margin-bottom:16px; }
.analytics-charts-row-2 { display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px; }

.chart-card { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px; }
.chart-card-header { display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:18px; }
.chart-card-title { font-size:14px;font-weight:700;color:var(--text);margin-bottom:2px; }
.chart-card-sub { font-size:11.5px;color:var(--text-muted); }
.chart-total { font-size:22px;font-weight:800;color:var(--text); }

.chart-svg { width:100%;overflow:visible; }
.chart-grid-line { stroke:#F3F4F6;stroke-width:1; }
.chart-axis-label { font-size:11px;fill:#9CA3AF;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.chart-line { fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round; }

.donut-wrap { display:flex;align-items:center;gap:20px; }
.donut { width:130px;height:130px;border-radius:50%;flex-shrink:0;position:relative; }
.donut::after { content:'';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:76px;height:76px;background:var(--surface);border-radius:50%; }
.donut-center { position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:1;text-align:center;pointer-events:none; }
.donut-center-value { font-size:20px;font-weight:800;color:var(--text);line-height:1; }
.donut-center-label { font-size:9px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px; }
.donut-legend { flex:1; }
.donut-legend-item { display:flex;align-items:center;gap:8px;margin-bottom:8px;font-size:12.5px; }
.donut-legend-dot { width:10px;height:10px;border-radius:3px;flex-shrink:0; }
.donut-legend-label { flex:1;color:var(--text-secondary); }
.donut-legend-val { font-weight:700;color:var(--text); }
.donut-legend-pct { color:var(--text-muted);font-size:11px;min-width:32px;text-align:right; }

.h-bar-section { margin-bottom:14px; }
.h-bar-label-row { display:flex;justify-content:space-between;font-size:12.5px;margin-bottom:6px; }
.h-bar-label { color:var(--text-secondary);font-weight:500; }
.h-bar-pct { font-weight:700;color:var(--text); }
.h-bar-track { height:10px;background:#F3F4F6;border-radius:10px;overflow:hidden; }
.h-bar-fill { height:100%;border-radius:10px; }

/* ── Integrations ─────────────────────────────────────────────────────── */

.integ-category-section { margin-bottom:28px; }
.integ-category-title { font-size:12px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.8px;margin-bottom:14px;padding-bottom:8px;border-bottom:1px solid var(--border); }
.integ-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:14px; }

.integ-card { background:var(--surface);border:1.5px solid var(--border);border-radius:var(--radius);padding:20px;display:flex;flex-direction:column;transition:border-color .15s,box-shadow .15s; }
.integ-card:hover { border-color:rgba(79,107,237,.3);box-shadow:0 2px 12px rgba(79,107,237,.08); }
.integ-card.connected { border-color:rgba(16,185,129,.35);background:linear-gradient(to bottom,rgba(240,253,249,.6),var(--surface)); }

.integ-card-top { display:flex;align-items:flex-start;gap:14px;margin-bottom:12px; }
.integ-icon { width:48px;height:48px;border-radius:12px;border:1px solid var(--border);background:var(--bg);display:flex;align-items:center;justify-content:center;font-size:26px;flex-shrink:0; }
.integ-meta { flex:1; }
.integ-name { font-size:14px;font-weight:700;color:var(--text);margin-bottom:3px; }
.integ-connected-as { font-size:11px;color:var(--success);font-weight:500; }

.integ-status-badge { display:inline-flex;align-items:center;gap:4px;padding:3px 9px;border-radius:20px;font-size:11px;font-weight:600; }
.integ-status-badge.connected { background:#D1FAE5;color:#065F46; }
.integ-status-badge.not-connected { background:#F3F4F6;color:#6B7280; }

.integ-desc { font-size:12.5px;color:var(--text-secondary);line-height:1.5;margin-bottom:16px;flex:1; }

.integ-connect-btn { width:100%;padding:9px;border-radius:7px;font-size:13px;font-weight:600;cursor:pointer;border:1.5px solid;transition:all .15s; }
.integ-connect-btn.not-connected { background:white;border-color:var(--border);color:var(--text); }
.integ-connect-btn.not-connected:hover { border-color:var(--accent);color:var(--accent); }
.integ-connect-btn.connected { background:#FEF2F2;border-color:#FECACA;color:#DC2626; }
.integ-connect-btn.connected:hover { background:#FEE2E2; }

@media (max-width:1200px) {
  .analytics-kpi-row { grid-template-columns:repeat(3,1fr); }
  .analytics-charts-row-2 { grid-template-columns:1fr 1fr; }
  .integ-grid { grid-template-columns:repeat(2,1fr); }
}

/* ── Subscriptions module ─────────────────────────────────────────────── */

.sub-summary-row { display:grid;grid-template-columns:repeat(4,1fr);gap:14px;padding:20px 24px 0; }
.sub-summary-card { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px 20px; }
.sub-summary-label { font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted);margin-bottom:8px; }
.sub-summary-value { font-size:28px;font-weight:800;color:var(--text);letter-spacing:-.5px; }
.sub-summary-sub { font-size:11.5px;color:var(--text-muted);margin-top:3px; }

.sub-filter-bar { display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:16px 24px;background:var(--surface);border-bottom:1px solid var(--border);margin:16px 24px 0;border-radius:var(--radius) var(--radius) 0 0; }
.sub-filter-label { font-size:11.5px;font-weight:600;color:var(--text-muted);white-space:nowrap; }
.sub-filter-chip { padding:5px 12px;border:1.5px solid var(--border);border-radius:20px;font-size:12px;font-weight:500;color:var(--text-secondary);background:var(--surface);cursor:pointer;transition:all .15s; }
.sub-filter-chip:hover { border-color:var(--accent);color:var(--accent); }
.sub-filter-chip.active { background:var(--accent);border-color:var(--accent);color:white;font-weight:600; }

.sub-table-wrap { margin:0 24px 24px;border:1px solid var(--border);border-radius:0 0 var(--radius) var(--radius);overflow:hidden;background:var(--surface); }
.sub-table { width:100%;border-collapse:collapse; }
.sub-table thead th { background:#F8F9FC;padding:10px 16px;text-align:left;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted);border-bottom:1px solid var(--border); }
.sub-table td { padding:14px 16px;border-bottom:1px solid var(--border);vertical-align:middle; }
.sub-table tbody tr:last-child td { border-bottom:none; }
.sub-row { cursor:pointer;transition:background .12s; }
.sub-row:hover { background:#F8F9FC; }
.sub-row-pastdue { background:#FFF7F7; }
.sub-row-pastdue:hover { background:#FEF2F2; }
.sub-empty { text-align:center;padding:40px!important;color:var(--text-muted);font-size:13px; }

.sub-avatar { width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--accent),#7C3AED);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:white;flex-shrink:0; }
.sub-plan-badge { display:inline-block;padding:3px 10px;border-radius:20px;font-size:11.5px;font-weight:600;background:#EEF2FF;color:#4338CA; }
.sub-status-badge { display:inline-block;padding:3px 10px;border-radius:20px;font-size:11.5px;font-weight:600; }
.sub-st-active   { background:#D1FAE5;color:#065F46; }
.sub-st-trial    { background:#FEF3C7;color:#92400E; }
.sub-st-pastdue  { background:#FEE2E2;color:#991B1B; }
.sub-st-cancelled{ background:#F3F4F6;color:#6B7280; }
.sub-st-paused   { background:#E0E7FF;color:#3730A3; }

/* Change Plan modal — plan option cards */
.plan-option { display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border:1.5px solid var(--border);border-radius:10px;cursor:pointer;transition:border-color .15s,background .15s; }
.plan-option:hover { border-color:var(--accent);background:var(--accent-light); }
.plan-option-name { font-size:14px;font-weight:600;color:var(--text-primary); }
.plan-option-mrr { font-size:12.5px;color:var(--text-muted);margin-top:2px; }
.plan-pick { font-size:12.5px;font-weight:600;color:var(--accent); }
.plan-option-selected { border-color:var(--accent);background:var(--accent-light);box-shadow:0 0 0 2px var(--accent) inset; }
.plan-option-current { border-color:#10B981;background:#ECFDF5;cursor:default; }
.plan-option-current:hover { border-color:#10B981;background:#ECFDF5; }
.plan-current-badge { font-size:11.5px;font-weight:700;color:#065F46;background:#D1FAE5;padding:4px 10px;border-radius:20px;white-space:nowrap; }
.sub-sync-badge  { display:inline-flex;align-items:center;gap:4px;padding:3px 9px;border-radius:20px;font-size:11px;font-weight:600; }
.sub-sync-wpd    { background:#E0F2FE;color:#0369A1; }
.sub-sync-cxwe   { background:#F0FDF4;color:#15803D; }

/* Subscriptions detail view */
.sub-detail-header { background:var(--surface);border-bottom:1px solid var(--border);padding:20px 24px 0;margin:0; }
.sub-back-btn { background:none;border:none;font-size:13px;font-weight:500;color:var(--accent);cursor:pointer;padding:0;margin-bottom:16px;display:flex;align-items:center;gap:4px; }
.sub-back-btn:hover { text-decoration:underline; }
.sub-detail-client-row { display:flex;align-items:center;gap:14px;margin-bottom:20px; }
.sub-detail-avatar { width:48px;height:48px;border-radius:50%;background:linear-gradient(135deg,var(--accent),#7C3AED);display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:700;color:white;flex-shrink:0; }
.sub-detail-name { font-size:18px;font-weight:700;color:var(--text); }
.sub-detail-tabs { display:flex;gap:0;border-top:1px solid var(--border);margin-top:0; }
.sub-detail-tab { padding:12px 20px;font-size:13px;font-weight:500;color:var(--text-secondary);cursor:pointer;border-bottom:2.5px solid transparent;margin-bottom:-1px;transition:all .15s; }
.sub-detail-tab:hover { color:var(--accent); }
.sub-detail-tab.active { color:var(--accent);border-bottom-color:var(--accent);font-weight:600; }
.sub-detail-body { padding:24px; }
.sub-tab-section { }
.sub-tab-empty { padding:48px;text-align:center;color:var(--text-muted);font-size:13px; }
.sub-info-card { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px; }
.sub-info-card-title { font-size:13px;font-weight:700;color:var(--text);margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid var(--border); }
.sub-info-row { display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--border);font-size:13px; }
.sub-info-row:last-child { border-bottom:none; }
.sub-info-label { color:var(--text-muted);font-weight:500; }
.sub-info-value { color:var(--text);font-weight:500; }

/* ── Payment Details ──────────────────────────────────────────────────── */

.pay-two-col { display:grid;grid-template-columns:1fr 1fr;gap:24px; }

.pay-panel-heading { font-size:14px;font-weight:700;color:var(--text);margin-bottom:16px; }

.pay-address-form { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;display:flex;flex-direction:column;gap:12px; }
.pay-address-lookup-row { display:flex;gap:8px; }
.addr-results { background:var(--surface);border:1px solid var(--border);border-radius:8px;margin-top:-6px;box-shadow:0 4px 16px rgba(0,0,0,.1);overflow:hidden; }
.addr-result-item { padding:12px 14px;font-size:13px;cursor:pointer;border-bottom:1px solid var(--border);transition:background .12s;display:flex;align-items:center;gap:8px; }
.addr-result-item:last-child { border-bottom:none; }
.addr-result-item:hover { background:#F0F2FF; }
.pay-form-2col { display:grid;grid-template-columns:1fr 1fr;gap:12px; }
.form-optional { font-size:11px;color:var(--text-muted);font-weight:400; }

/* ── Billing Address: underline / filled input style (scoped) ─────────── */
.pay-address-form .form-group { margin-bottom: 0; }
.pay-address-form .form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.pay-address-form .form-input,
.pay-address-form select.form-input,
.pay-address-form textarea.form-input {
  width: 100%;
  padding: 10px 12px;
  background: #F0F5FC;
  border: none;
  border-bottom: 2px solid #C9D5EE;
  border-radius: 6px 6px 0 0;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  box-shadow: none;
  transition: border-bottom-color .15s, border-bottom-width .1s;
  -webkit-appearance: none;
  appearance: none;
}
.pay-address-form .form-input:focus,
.pay-address-form select.form-input:focus,
.pay-address-form textarea.form-input:focus {
  background: #E8F0FD;
  border-bottom-color: var(--accent);
  border-bottom-width: 2.5px;
}
.pay-address-form .form-input::placeholder { color: var(--text-muted); opacity: .7; }
.pay-address-lookup-row .form-input { flex: 1; }

.pm-global-warning { display:flex;align-items:center;gap:12px;padding:14px 18px;background:#FEF2F2;border:1px solid #FECACA;border-radius:var(--radius);margin-bottom:20px;font-size:13px;color:#991B1B; }
.pm-global-warning span:first-child { flex-shrink:0; }
.pm-global-warning span:nth-child(2) { flex:1; }

.pm-list { display:flex;flex-direction:column;gap:10px; }
.pm-empty { padding:32px;text-align:center;color:var(--text-muted);font-size:13px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius); }

/* No overflow:hidden here — it would clip the row-actions "…" dropdown. The expired
   banner rounds its own top corners instead (see .pm-expired-banner). */
.pm-row { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);position:relative; }
.pm-row-expired { border-color:#FECACA; }
.pm-expired-banner { background:#FEF2F2;border-bottom:1px solid #FECACA;border-radius:calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;padding:10px 16px;font-size:12.5px;color:#991B1B;display:flex;align-items:center;gap:8px;font-weight:500; }
.pm-row-inner { display:flex;align-items:center;gap:14px;padding:14px 16px; }
.pm-info { flex:1;min-width:0; }
.pm-label { font-size:13.5px;font-weight:600;color:var(--text);margin-bottom:2px; }
.pm-sublabel { font-size:11.5px;color:var(--text-muted); }
.pm-row-actions { display:flex;align-items:center;gap:10px;flex-shrink:0; }

.pm-brand { display:inline-flex;align-items:center;justify-content:center;border-radius:5px;font-weight:800;font-size:11px;letter-spacing:.5px;min-width:36px;height:24px;flex-shrink:0; }
.pm-brand-visa { background:#1A1F71;color:#F7B600;font-style:italic; }
.pm-brand-mc   { background:#EB001B;color:white;position:relative; }
.pm-brand-amex { background:#007BC1;color:white; }
.pm-brand-pp   { background:#003087;color:#009CDE;font-size:12px; }

.pm-badge { display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border-radius:20px;font-size:11.5px;font-weight:600; }
.pm-badge-primary { background:#D1FAE5;color:#065F46; }
.pm-badge-backup  { background:#F3F4F6;color:#6B7280; }
.pm-badge-expired { background:#FEE2E2;color:#991B1B; }

.pm-menu-btn { background:none;border:1px solid var(--border);border-radius:6px;width:30px;height:30px;cursor:pointer;font-size:16px;color:var(--text-muted);display:flex;align-items:center;justify-content:center;transition:all .15s; }
.pm-menu-btn:hover { background:var(--bg);color:var(--text); }
.pm-dropdown { position:absolute;right:0;top:36px;background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 20px rgba(0,0,0,.12);min-width:160px;z-index:200;overflow:hidden; }
.pm-menu-item { padding:10px 14px;font-size:13px;cursor:pointer;transition:background .12s;display:flex;align-items:center;gap:8px; }
.pm-menu-item:hover { background:var(--bg); }
.pm-menu-danger { color:var(--danger); }
.pm-menu-danger:hover { background:#FEF2F2; }

/* Add Payment Method modal */
.pm-modal-overlay { position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;z-index:1000; }
.pm-modal { background:var(--surface);border-radius:14px;width:520px;max-width:calc(100vw - 32px);box-shadow:0 20px 60px rgba(0,0,0,.25);overflow:hidden; }
.pm-modal-hd { display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--border); }
.pm-modal-title { font-size:16px;font-weight:700;color:var(--text); }
.pm-modal-close { background:none;border:none;font-size:18px;cursor:pointer;color:var(--text-muted);width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:6px; }
.pm-modal-close:hover { background:var(--bg); }
.pm-modal-body { padding:24px; }

.pm-type-grid { display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:20px; }
.pm-type-card { border:2px solid var(--border);border-radius:12px;padding:20px;cursor:pointer;text-align:center;transition:all .15s;background:var(--surface); }
.pm-type-card:hover { border-color:var(--accent);background:#F0F2FF; }
.pm-type-selected { border-color:var(--accent);background:#F0F2FF; }
.pm-type-icons { display:flex;gap:6px;justify-content:center;margin-bottom:12px; }
.pm-type-label { font-size:14px;font-weight:700;color:var(--text);margin-bottom:4px; }
.pm-type-sub { font-size:12px;color:var(--text-muted); }
.pm-card-form { border-top:1px solid var(--border);padding-top:20px;display:flex;flex-direction:column;gap:12px; }
.pm-paypal-form { border-top:1px solid var(--border);padding-top:20px; }
.pm-paypal-btn { width:100%;padding:14px;background:#FFC439;border:none;border-radius:8px;font-size:14px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:10px;transition:background .15s; }
.pm-paypal-btn:hover { background:#F0B429; }

@media (max-width:1100px) {
  .pay-two-col { grid-template-columns:1fr; }
  .sub-summary-row { grid-template-columns:repeat(2,1fr); }
}

/* ── Avatar dropdown (header) ──────────────────────────────────────────── */
.avatar-wrap { position: relative; }
.header-avatar { cursor: pointer; user-select: none; transition: opacity .15s; }
.header-avatar:hover { opacity: .85; }
.avatar-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  min-width: 180px;
  z-index: 9999;
  overflow: hidden;
  animation: menuFadeIn .15s ease;
}
.avatar-menu.open { display: block; }
@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.avatar-menu-item {
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background .1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar-menu-item:hover { background: #F9FAFB; color: #111827; }
.avatar-menu-sep { height: 1px; background: #F3F4F6; margin: 2px 0; }
.avatar-menu-danger { color: #EF4444; }
.avatar-menu-danger:hover { background: #FEF2F2; color: #DC2626; }

/* ── Helpdesk live loading states ──────────────────────────────────────── */
.hd-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 20px;
  font-size: 13.5px;
  color: #9CA3AF;
}
.hd-error { color: #EF4444; }
.spin-dark {
  width: 16px;
  height: 16px;
  border: 2.5px solid #E5E7EB;
  border-top-color: #4F6BED;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ── Edit Page (full-width in-app edit view — no modals/overlays) ─────── */
.ep-wrap { padding: 32px 40px 56px; max-width: 800px; }
.ep-back { display:inline-flex;align-items:center;gap:6px;color:var(--accent);font-size:13px;font-weight:600;cursor:pointer;margin-bottom:24px;background:none;border:none;padding:0;transition:opacity .15s; }
.ep-back:hover { opacity:.7;text-decoration:underline; }
.ep-heading { font-size:24px;font-weight:800;color:var(--text-primary);letter-spacing:-.4px;margin-bottom:28px; }
.ep-card { background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:28px;margin-bottom:16px; }
.ep-card-title { font-size:12px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.6px;margin-bottom:18px; }
.ep-grid-2 { display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:20px; }
.ep-field { display:flex;flex-direction:column;gap:5px; }
.ep-label { font-size:11px;font-weight:700;color:var(--text-muted);letter-spacing:.4px;text-transform:uppercase; }
.ep-input, .ep-select, .ep-textarea {
  width:100%;padding:10px 13px;background:#fff;border:1px solid #D1D5DB;
  border-radius:8px;font-size:14px;font-family:inherit;color:var(--text-primary);
  outline:none;box-shadow:none;transition:border-color .15s,box-shadow .15s;
  -webkit-appearance:none;appearance:none;
}
.ep-input:focus, .ep-select:focus, .ep-textarea:focus {
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(79,107,237,.12);
}
.ep-input::placeholder, .ep-textarea::placeholder { color:var(--text-muted);opacity:.7; }
.ep-actions { display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:8px; }
.ep-error { color:var(--danger);font-size:13px;font-weight:500;margin-top:10px; }
.ep-divider { height:1px;background:var(--border);margin:20px 0; }
/* Plan picker cards */
.ep-plan-grid { display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:4px; }
.ep-plan-opt { border:2px solid var(--border);border-radius:10px;padding:16px;cursor:pointer;transition:border-color .15s,background .15s;background:var(--surface);position:relative; }
.ep-plan-opt:not(.ep-plan-current):hover { border-color:var(--accent);background:#F4F6FE; }
.ep-plan-opt.ep-plan-selected { border-color:var(--accent);background:#EEF1FD; }
.ep-plan-opt.ep-plan-current { border-color:#A7F3D0;background:#F0FDF4;cursor:default; }
.ep-plan-name { font-size:14px;font-weight:700;color:var(--text-primary); }
.ep-plan-price { font-size:12px;color:var(--text-muted);margin-top:2px; }
.ep-plan-badge { position:absolute;top:10px;right:10px;font-size:10.5px;font-weight:700;background:#D1FAE5;color:#065F46;border-radius:20px;padding:3px 8px; }
.ep-plan-pick { position:absolute;top:10px;right:10px;font-size:11px;color:var(--accent);font-weight:600;opacity:.7; }
/* Billing cycle toggle */
.ep-cycle-row { display:flex;gap:10px; }
.ep-cycle-btn { flex:1;padding:14px 16px;border:2px solid var(--border);border-radius:8px;cursor:pointer;text-align:left;font-size:13px;font-weight:600;background:var(--surface);transition:border-color .15s,background .15s;color:var(--text-primary); }
.ep-cycle-btn:hover { border-color:var(--accent);background:#F4F6FE; }
.ep-cycle-btn.ep-cycle-selected { border-color:var(--accent);background:#EEF1FD;color:var(--accent); }
