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

:root {
  --bg: #f0f2f8;
  --surface: #ffffff;
  --sidebar-bg: #0c0e1a;
  --sidebar-text: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-rgb: 99,102,241;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---- Auth ---- */
#auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4c1d95 100%);
}
.auth-box {
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  padding: 44px 40px; width: 380px;
}
.brand {
  font-size: 30px; font-weight: 800; text-align: center; margin-bottom: 4px;
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  letter-spacing: -.5px;
}
.brand-sub { text-align: center; color: var(--text-muted); margin-bottom: 28px; font-size: 13px; }
.tab-bar { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 22px; }
.tab {
  flex: 1; padding: 10px; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; font-weight: 500; transition: color .15s;
}
.tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); margin-bottom: -2px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
  background: #fafafa;
}
.auth-form input:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12);
}
.auth-form .btn-primary { margin-top: 4px; }
.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---- Layout ---- */
#main-screen { display: flex; height: 100vh; }
.sidebar {
  width: 228px; background: var(--sidebar-bg); display: flex; flex-direction: column;
  flex-shrink: 0; border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-brand {
  color: #fff; font-size: 21px; font-weight: 800; padding: 22px 18px 20px;
  letter-spacing: -.4px;
  background: linear-gradient(135deg, #818cf8, #c084fc, #f472b6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav-links { list-style: none; padding: 10px 0; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  color: var(--sidebar-text); text-decoration: none;
  border-radius: var(--radius-sm); margin: 1px 8px; transition: background .15s, color .15s;
  font-size: 13.5px; font-weight: 450;
}
.nav-link i { width: 16px; text-align: center; flex-shrink: 0; font-size: 14px; opacity: .8; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }
.nav-link.active {
  background: rgba(99,102,241,.22); color: #a5b4fc;
  box-shadow: inset 3px 0 0 #6366f1;
}
.nav-link.active i { opacity: 1; }
.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-footer span { color: var(--sidebar-text); font-size: 12px; font-weight: 500; }

/* Language button in sidebar footer */
.lang-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: #e2e8f0; font-size: 12px; font-weight: 500; padding: 5px 10px;
  border-radius: 20px; cursor: pointer; transition: background .15s, border-color .15s;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
}
.lang-btn:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); }

.content { flex: 1; overflow-y: auto; padding: 32px; }
.view h2 { font-size: 22px; font-weight: 700; margin-bottom: 20px; letter-spacing: -.3px; }
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.view-header h2 { margin-bottom: 0; }

/* ---- Buttons ---- */
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb),.35);
  letter-spacing: .01em;
}
.btn-primary:hover {
  opacity: .92; box-shadow: 0 4px 14px rgba(var(--primary-rgb),.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-ghost {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 13px; padding: 5px 10px; border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-danger {
  background: var(--danger); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(239,68,68,.3); transition: opacity .15s;
}
.btn-danger:hover { opacity: .88; }
.btn-icon {
  background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px;
  line-height: 1; border-radius: 6px; color: var(--text-muted); transition: background .15s;
}
.btn-icon:hover { background: var(--border); }

/* ---- Avatar / picture ---- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-initials {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-upload-cell { position: relative; }
.avatar-upload-cell:hover .avatar-upload-btn { opacity: 1; }
.avatar-upload-btn {
  position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s;
  cursor: pointer; border: none; font-size: 18px;
}

/* Photo in contact detail modal */
.contact-photo-header { display: flex; flex-direction: column; align-items: center; padding: 20px 20px 0; gap: 10px; }
.contact-photo-wrap { position: relative; width: 100px; height: 100px; }
.contact-photo-wrap img, .contact-photo-placeholder {
  width: 100px; height: 100px; border-radius: 50%; object-fit: cover;
}
.contact-photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; color: #fff;
}
.contact-photo-overlay {
  position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; cursor: pointer;
}
.contact-photo-wrap:hover .contact-photo-overlay { opacity: 1; }
.contact-photo-overlay span { color: #fff; font-size: 24px; }
.contact-photo-name { font-size: 18px; font-weight: 700; }
.contact-photo-nick { font-size: 13px; color: var(--text-muted); }

/* Picture hover tooltip */
.pic-tooltip {
  position: fixed; z-index: 200; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; pointer-events: none; min-width: 120px; text-align: center;
}
.pic-tooltip img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 6px; }
.pic-tooltip div { font-size: 12px; font-weight: 600; }

/* ---- Dashboard ---- */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
  border: 1px solid rgba(0,0,0,.04);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--text-muted); margin: 0; text-transform: uppercase; letter-spacing: .05em; }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.event-list, .contact-list { display: flex; flex-direction: column; gap: 10px; }
.event-item, .contact-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.event-item:last-child, .contact-item:last-child { border-bottom: none; }
.event-name { font-weight: 500; }
.event-date { font-size: 12px; color: var(--text-muted); }
.badge-count {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff; border-radius: 10px; padding: 2px 7px;
  font-size: 11px; font-weight: 700; margin-left: 6px;
}

/* Outstanding contacts */
.outstanding-card h3 { margin-bottom: 16px; }
.outstanding-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.outstanding-item:last-child { border-bottom: none; }
.outstanding-info { flex: 1; }
.outstanding-name { font-weight: 600; }
.outstanding-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.overdue-pill {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
  background: #fee2e2; color: #991b1b; white-space: nowrap;
}

/* ---- Type badge ---- */
.type-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px;
  padding: 2px 8px; border-radius: 12px; font-weight: 500; white-space: nowrap;
}
.type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ---- Money ---- */
.money-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.money-incoming { background: #d1fae5; color: #065f46; }
.money-outgoing { background: #fee2e2; color: #991b1b; }

/* ---- Contact Methods ---- */
.methods-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.method-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }

.method-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.method-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 20px; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
a.method-chip:hover { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; transform: translateY(-1px); }
.method-chip-sm { padding: 3px 8px; font-size: 11px; }
.method-icon { font-size: 13px; line-height: 1; }
.method-value { font-size: inherit; }

.outstanding-methods { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ---- Table ---- */
.search-input {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
  background: var(--surface);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.1); }
.filter-bar { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.filter-bar select {
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--surface); outline: none; transition: border-color .15s;
}
.filter-bar select:focus { border-color: var(--primary); }
.data-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  border: 1px solid rgba(0,0,0,.04);
}
.data-table th {
  text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 1.5px solid var(--border); background: #f8fafc;
}
.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbff; }
.row-actions { display: flex; gap: 6px; }
.empty-row td { color: var(--text-muted); text-align: center; padding: 40px; }
.color-swatch { width: 20px; height: 20px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.1); }

.contact-name-link { cursor: pointer; color: var(--primary); font-weight: 600; text-decoration: none; }
.contact-name-link:hover { text-decoration: underline; }

/* ---- Settings ---- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 560px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
  border: 1px solid rgba(0,0,0,.06);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: #fafbff; border-radius: 16px 16px 0 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.modal-header-actions { display: flex; align-items: center; gap: 4px; }
.modal-header .btn-ghost { font-size: 20px; line-height: 1; }
#modal-body { padding: 22px; flex: 1; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s, box-shadow .15s; background: #fafafa;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.1);
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-check { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.form-check input[type=checkbox] { width: auto; }
.form-check label { margin: 0; color: var(--text); font-weight: 400; font-size: 14px; text-transform: none; letter-spacing: 0; }
.modal-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}
.modal-actions-right { display: flex; gap: 8px; }

/* ---- Upgrade modal options ---- */
.upgrade-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.upgrade-option:hover { border-color: var(--primary); }
.upgrade-option-active { border-color: var(--primary); background: var(--surface); }

/* ---- Connection status toggle ---- */
.connection-status-row { display: flex; gap: 10px; margin-bottom: 16px; }
.conn-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 14px; border-radius: var(--radius-sm); border: 2px solid var(--border);
  background: var(--bg); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s; color: var(--text-muted);
}
.conn-btn-success.active { background: #dcfce7; border-color: #16a34a; color: #15803d; }
.conn-btn-missed.active  { background: #fef9c3; border-color: #ca8a04; color: #92400e; }
.conn-btn:hover:not(.active) { border-color: var(--text-muted); color: var(--text); }

/* ---- Follow-up section ---- */
.followup-section {
  background: #fef9c3; border: 1px solid #fde68a;
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px;
}

/* Money panel */
.money-section {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px;
}
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; color: #065f46; }

/* Custom type expansion */
.custom-type-section {
  background: #fef9c3; border: 1px solid #fde68a;
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px;
}
.custom-type-section .section-label { color: #92400e; }

/* ---- Interactions in contact detail ---- */
.interaction-entry {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.interaction-entry:last-child { border-bottom: none; }
.interaction-header { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.interaction-meta { font-size: 12px; color: var(--text-muted); }
.interaction-title { font-weight: 600; font-size: 14px; }
.interaction-summary { font-size: 13px; color: var(--text); }
.interaction-money { font-size: 12px; }

/* ---- Reminder entries ---- */
.reminder-entry {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.reminder-entry:last-child { border-bottom: none; }
.reminder-entry.reminder-overdue { background: rgba(239,68,68,.04); border-radius: 8px; padding: 10px 8px; }
.reminder-entry.reminder-done { opacity: .5; }
.reminder-main { flex: 1; min-width: 0; }
.reminder-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.reminder-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; white-space: pre-wrap; word-break: break-word; }
.reminder-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.reminder-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ---- Contact detail sections ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.detail-field span { font-size: 11px; color: var(--text-muted); display: block; }
.detail-field strong { font-size: 13px; }
.section-divider { border-top: 2px solid var(--border); margin: 18px 0 14px; }
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 12px;
}
.copy-md-btn {
  font-size: 12px; color: var(--text-muted); background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; cursor: pointer; transition: background .15s;
}
.copy-md-btn:hover { background: var(--bg); color: var(--text); }

/* ---- Add method row ---- */
.add-method-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.add-method-row select { flex: 0 0 130px; }
.add-method-row input { flex: 1; }

/* ---- Analytics ---- */
.analytics-section { margin-bottom: 16px; padding: 0; overflow: hidden; }
.analytics-section-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border);
}
.analytics-section-header:hover { background: var(--bg); }
.analytics-section-title { font-size: 15px; font-weight: 600; }
.analytics-section-caret { font-size: 16px; color: var(--text-muted); transition: transform .2s; }
.analytics-section-caret.collapsed { transform: rotate(-90deg); }
.analytics-section-body { padding: 20px; }
.analytics-section-body.collapsed { display: none; }

.analytics-kpi-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.kpi-card {
  flex: 1; min-width: 120px; background: var(--bg);
  border-radius: var(--radius-sm); padding: 14px 16px; text-align: center;
  border: 1px solid var(--border);
}
.kpi-num  { font-size: 28px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.kpi-num.incoming { color: #10b981; }
.kpi-num.outgoing { color: #ef4444; }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.analytics-charts-row { display: flex; gap: 24px; flex-wrap: wrap; }
.analytics-chart-block { flex: 1; min-width: 180px; }
.analytics-chart-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: 10px;
}

/* Horizontal bar chart */
.bar-chart-h { display: flex; flex-direction: column; gap: 6px; }
.bh-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bh-label { width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.bh-track { flex: 1; background: var(--border); border-radius: 4px; height: 10px; overflow: hidden; }
.bh-fill  { height: 100%; border-radius: 4px; transition: width .4s ease; }
.bh-val   { width: 50px; flex-shrink: 0; text-align: right; color: var(--text-muted); }

/* Vertical bar chart (monthly) */
.bar-chart-col { display: flex; align-items: flex-end; gap: 6px; height: 100px; }
.bc-col  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bc-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bc-bar  { width: 100%; border-radius: 3px 3px 0 0; transition: height .4s ease; min-height: 2px; }
.bc-lbl  { font-size: 9px; color: var(--text-muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 36px; }
.bc-val  { font-size: 10px; color: var(--text-muted); }

/* Stacked bar (donations by month) */
.bc-bar-stack { width: 100%; display: flex; flex-direction: column; border-radius: 3px 3px 0 0; overflow: hidden; }

/* ---- Bulk action toolbar ---- */
.bulk-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: #eff6ff; border-bottom: 1px solid #bfdbfe; font-size: 13px; flex-wrap: wrap;
}
.bulk-toolbar span { font-weight: 600; color: var(--primary); margin-right: 4px; }

/* ---- Guild cards ---- */
.guild-list { display: flex; flex-direction: column; gap: 10px; }
.guild-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  transition: box-shadow .15s;
}
.guild-card:hover { box-shadow: var(--shadow-md); }
.guild-card-body { flex: 1; min-width: 0; }
.guild-card-name { font-weight: 600; font-size: 14px; }
.guild-card-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.guild-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.guild-invite-code {
  font-family: monospace; font-size: 13px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px;
  letter-spacing: .08em; cursor: pointer; transition: background .15s;
}
.guild-invite-code:hover { background: var(--bg); }
.guild-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #dbeafe; color: #1d4ed8; font-weight: 600; margin-left: 6px; }
.guild-badge.owner { background: #fef9c3; color: #92400e; }

/* ---- Admin Panel ---- */
.admin-stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 4px; }
.admin-stat-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 24px; text-align: center; border: 1px solid rgba(0,0,0,.04);
}
.stat-num { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.badge-admin   { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #ede9fe; color: #5b21b6; font-weight: 600; }
.badge-active  { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #dcfce7; color: #166534; font-weight: 600; }
.badge-inactive{ display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #fee2e2; color: #991b1b; font-weight: 600; }
.nav-link-admin { color: #fbbf24 !important; }
.nav-link-admin:hover, .nav-link-admin.active { background: rgba(251,191,36,.15) !important; color: #fde68a !important; }

/* ---- API key reveal box ---- */
.api-key-reveal {
  font-family: monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; word-break: break-all; margin: 12px 0;
}

/* ---- Currency management ---- */
.currency-rate-input {
  width: 110px; font-size: 13px; padding: 3px 6px;
  border: 1.5px solid var(--border); border-radius: 4px; text-align: right;
  transition: border-color .15s;
}
.currency-rate-input:focus { border-color: var(--primary); outline: none; }
.currency-symbol { font-size: 16px; min-width: 20px; text-align: center; }
.badge-virtual { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #fef3c7; color: #92400e; font-weight: 600; }
.badge-fiat    { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #dbeafe; color: #1d4ed8; font-weight: 600; }

/* Currency search modal */
.currency-search-box { position: relative; margin-bottom: 12px; }
.currency-search-box input {
  width: 100%; padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; outline: none;
}
.currency-search-box input:focus { border-color: var(--primary); }
.currency-picker-list {
  max-height: 320px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.currency-picker-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  cursor: pointer; transition: background .12s; border-bottom: 1px solid var(--border);
}
.currency-picker-item:last-child { border-bottom: none; }
.currency-picker-item:hover { background: var(--bg); }
.currency-picker-code { font-weight: 700; font-size: 13px; width: 52px; flex-shrink: 0; color: var(--primary); }
.currency-picker-name { flex: 1; font-size: 13px; color: var(--text); }
.currency-picker-symbol { font-size: 15px; color: var(--text-muted); width: 24px; text-align: center; }

/* ── Live Event ───────────────────────────────────────────── */
.live-session-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.live-dot-wrapper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
  animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse {
  0%,100% { box-shadow: 0 0 4px var(--danger), 0 0 10px rgba(239,68,68,.4); opacity: 1; }
  50%      { box-shadow: 0 0 2px var(--danger); opacity: .55; }
}
.live-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--danger); }
.live-session-info { flex: 1; min-width: 0; }
.live-session-title { font-size: 17px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-session-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.live-elapsed { font-family: monospace; font-weight: 600; color: var(--primary); }
.live-end-btn { flex-shrink: 0; color: var(--danger) !important; }
.live-log-card { margin-bottom: 20px; }
.live-add-btn { margin-top: 4px; }

.live-feed-entry {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.live-feed-entry:last-child { border-bottom: none; }
.live-feed-time { font-size: 11px; color: var(--text-muted); font-family: monospace; width: 52px; flex-shrink: 0; padding-top: 2px; }
.live-feed-body { flex: 1; min-width: 0; }
.live-feed-contact { font-weight: 600; font-size: 13px; color: var(--text); }
.live-feed-type {
  display: inline-block; font-size: 11px; padding: 1px 7px;
  border-radius: 10px; background: var(--bg); border: 1px solid var(--border); margin: 3px 0;
}
.live-feed-amount { display: inline-block; font-size: 12px; font-weight: 600; margin-left: 6px; }
.live-feed-amount.incoming { color: var(--success); }
.live-feed-amount.outgoing { color: var(--danger); }
.live-feed-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.live-feed-del { margin-left: auto; flex-shrink: 0; opacity: .5; }
.live-feed-del:hover { opacity: 1; }

.live-past-header { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

.hidden { display: none !important; }
.chip {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border);
}

/* ---- Feature Requests ---- */
.feature-card {
  display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px; align-items: flex-start;
  transition: box-shadow .15s;
}
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-vote { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 40px; flex-shrink: 0; }
.vote-btn {
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; color: var(--text-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.vote-btn:hover { border-color: var(--primary); color: var(--primary); background: #ede9fe; }
.vote-btn.voted { border-color: var(--primary); color: var(--primary); background: #ede9fe; }
.vote-count { font-size: 13px; font-weight: 700; color: var(--text); }
.feature-body { flex: 1; min-width: 0; }
.feature-header-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.feature-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.feature-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.feature-author { font-size: 12px; color: var(--text-muted); }
.category-badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
}
.category-badge.cat-contacts     { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.category-badge.cat-events       { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.category-badge.cat-analytics    { background: #fef9c3; border-color: #fde68a; color: #92400e; }
.category-badge.cat-integrations { background: #dcfce7; border-color: #86efac; color: #166534; }
.category-badge.cat-ui           { background: #fce7f3; border-color: #f9a8d4; color: #9d174d; }
.category-badge.cat-performance  { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.category-badge.cat-other        { background: var(--bg); border-color: var(--border); color: var(--text-muted); }

/* ---- Admin system banner ---- */
.admin-system-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #7f1d1d; color: #fecaca;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.admin-system-banner i { font-size: 14px; }
.admin-system-banner.has-banner ~ #app { padding-top: 42px; }

/* ---- Danger Zone ---- */
.danger-zone-card { border: 1px solid rgba(239,68,68,.3); }
.danger-zone-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0;
}
.danger-zone-info { flex: 1; min-width: 0; }
.danger-zone-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.danger-zone-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.danger-zone-divider { border-top: 1px solid var(--border); margin: 0; }
.btn-danger-active { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-active:hover { background: #dc2626; border-color: #dc2626; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

/* Mobile sidebar toggle button — hidden on desktop */
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 20px; padding: 4px 8px;
  border-radius: var(--radius-sm); line-height: 1; flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--border); }

/* Mobile top bar — hidden on desktop */
.mobile-topbar {
  display: none;
  align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.mobile-topbar-brand {
  font-size: 17px; font-weight: 800; letter-spacing: -.3px;
  background: linear-gradient(135deg, #818cf8, #c084fc, #f472b6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* Sidebar overlay — hidden until .open */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 49;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  /* Show mobile chrome */
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .mobile-topbar  { display: flex; }

  /* Sidebar: slide in from left as an overlay */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
    width: 228px;
  }
  .sidebar.open { transform: translateX(0); }

  /* Content: full width (sidebar is no longer in flow) */
  .content { padding: 0; }
  .view    { padding: 16px; }

  /* Auth */
  #auth-screen { padding: 16px; align-items: flex-start; padding-top: 48px; }
  .auth-box { width: 100%; max-width: 420px; padding: 32px 24px; margin: 0 auto; }

  /* All 2-column grids → 1 column */
  .dashboard-grid,
  .settings-grid { grid-template-columns: 1fr; }

  /* Admin stats: 2 columns on mobile */
  .admin-stats-grid { grid-template-columns: 1fr 1fr; }

  /* Form rows → 1 column */
  .form-row { grid-template-columns: 1fr; }

  /* Contact detail grid → 1 column */
  .detail-grid { grid-template-columns: 1fr; }

  /* Tables: horizontally scrollable */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* View header: allow wrap so title + button don't collide */
  .view-header { flex-wrap: wrap; gap: 10px; }

  /* Filter bar: wrap */
  .filter-bar { flex-wrap: wrap; gap: 10px; }

  /* Analytics: stack chart blocks vertically */
  .analytics-charts-row { flex-direction: column; }
  .bh-label { width: 80px; }

  /* Add method row: select full-width then input */
  .add-method-row { flex-wrap: wrap; }
  .add-method-row select { flex: 1 1 100%; }

  /* Modal */
  #modal-body    { padding: 16px; }
  .modal-header  { padding: 14px 16px; }
  .modal-actions { flex-direction: column; gap: 10px; align-items: stretch; }
  .modal-actions-right { justify-content: flex-end; }

  /* Live session header: wrap on narrow screens */
  .live-session-header { flex-wrap: wrap; }

  /* Danger zone rows: stack info + button */
  .danger-zone-row { flex-direction: column; gap: 10px; }
  .danger-zone-row .btn-sm { align-self: flex-start; }

  /* Analytics section */
  .analytics-section-body { padding: 14px; }

  /* Cards and headings */
  .card   { padding: 16px; }
  .view h2 { font-size: 19px; }

  /* Connection status buttons can wrap */
  .connection-status-row { flex-wrap: wrap; }

  /* Bulk toolbar: wrap action buttons */
  .bulk-toolbar { flex-wrap: wrap; gap: 6px; }
}

@media (max-width: 480px) {
  .admin-stats-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 12px; }
  .analytics-kpi-row { gap: 8px; }
  .kpi-card { min-width: 80px; }
  .auth-box { padding: 28px 18px; }
}
