:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff6ff;
  --success: #16a34a;
  --success-bg: #ecfdf3;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --whatsapp: #25d366;
  --primary-soft: #dbeafe;
  --accent: #7c3aed;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 1px rgba(16, 24, 40, 0.04);
  --shadow: 0 6px 20px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.18);
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.006em;
}
button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.97); }

#app {
  min-height: 100%;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--safe-top) + 14px) 16px 12px;
}
.topbar h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.topbar .sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.topbar .sub-lead { color: var(--text); font-size: 16px; font-weight: 800; letter-spacing: -0.01em; margin-top: 0; }

/* ---- Brand header (Dashboard) ---- */
.brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; padding-right: 40px; }
.brand-row img { width: 30px; height: 30px; border-radius: 9px; box-shadow: var(--shadow-sm); }
.brand-row .brand-name { font-size: 13px; font-weight: 800; color: var(--primary-dark); letter-spacing: -0.01em; }
.brand-row .brand-tag { font-size: 11px; color: var(--text-faint); font-weight: 600; margin-left: auto; background: var(--surface-2); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); }
.logout-icon-btn {
  position: absolute;
  top: calc(var(--safe-top) + 14px);
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Empty-state icon circle ---- */
.icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-circle svg { width: 28px; height: 28px; }
.icon-circle.lg { width: 76px; height: 76px; }
.icon-circle.lg svg { width: 32px; height: 32px; }

.page { padding: 12px 16px 24px; }

/* ---- Search ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 10px;
}
.search-bar input {
  border: none;
  background: none;
  outline: none;
  flex: 1;
  font-size: 15px;
  min-height: 24px;
  color: var(--text);
}
.search-bar svg { flex-shrink: 0; color: var(--text-faint); }

/* ---- Country chips ---- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 4px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.chip .flag { font-size: 16px; }
.chip .count {
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chip.active .count { background: rgba(255,255,255,0.25); color: #fff; }
.chip.all { }

/* ---- Date group headers ---- */
.date-group { margin-top: 18px; }
.date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  cursor: pointer;
}
.date-header .label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.date-header .chev { transition: transform 0.2s ease; color: var(--text-faint); }
.date-header.collapsed .chev { transform: rotate(-90deg); }
.date-group-body { display: flex; flex-direction: column; gap: 10px; }
.date-group-body.collapsed { display: none; }

/* ---- Lead card ---- */
.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lead-card-top { display: flex; align-items: flex-start; gap: 12px; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.lead-card-info { flex: 1; min-width: 0; }
.lead-card-info .name { font-size: 16px; font-weight: 700; line-height: 1.3; }
.lead-card-info .meta { font-size: 13px; color: var(--text-muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.contact-badge.is-contact { background: var(--primary-bg); color: var(--primary-dark); border-color: transparent; }

.lead-card-row2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.last-contacted { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lead-card-actions { display: flex; gap: 8px; }
.icon-btn {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.icon-btn.call { color: var(--primary-dark); }
.icon-btn.whatsapp { color: #128a3f; background: #e9fbf0; border-color: transparent; }
.icon-btn.email { color: var(--text); }
.icon-btn.contact-toggle { flex: 0 0 44px; background: var(--surface-2); }
.icon-btn.contact-toggle.active { background: var(--primary); color: #fff; }

/* ---- Empty / loading states ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .title { font-weight: 800; color: var(--text); font-size: 16px; margin-top: 2px; }
.load-more-sentinel { height: 1px; }
.load-more-btn {
  display: block;
  margin: 16px auto 0;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  min-height: 44px;
}

/* ---- Bottom nav ---- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 30;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  min-height: 44px;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav svg { width: 22px; height: 22px; }
.bottom-nav .badge-dot {
  position: absolute;
  transform: translate(10px, -8px);
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ---- FAB ---- */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 25;
}

/* ---- Buttons ---- */
.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 999px; }

/* ---- Sheet library ---- */
.section-title { font-size: 15px; font-weight: 800; margin: 22px 0 10px; letter-spacing: -0.01em; }
.section-title .count-tag { font-weight: 700; color: var(--text-faint); font-size: 12px; margin-left: 6px; }

.sheet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  transition: box-shadow 0.15s ease;
}
.sheet-card-top { display: flex; align-items: flex-start; gap: 12px; }
.sheet-file-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sheet-file-icon svg { width: 20px; height: 20px; }
.sheet-card-titles { flex: 1; min-width: 0; }
.sheet-card .fname { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-card .fmeta { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sheet-card .lead-count-pill { background: var(--primary-bg); color: var(--primary-dark); font-weight: 700; padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.sheet-card .flags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.sheet-card .flag-pill { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.sheet-card .archived-tag { background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; flex-shrink: 0; }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.sheet-actions .btn-sm { flex: 1; gap: 6px; }
.sheet-actions .btn-danger { flex: 0 0 auto; width: 44px; padding: 0; }

/* ---- Upload card ---- */
.upload-card {
  display: block;
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-bg), var(--surface) 65%);
  border: 1.5px dashed #93c5fd;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.upload-card.dragover { border-color: var(--primary); background: var(--primary-bg); }
.upload-card .icon-circle { margin: 0 auto 14px; background: var(--surface); box-shadow: var(--shadow); color: var(--primary); }
.upload-card h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.upload-card p { margin: 4px 0 18px; font-size: 13px; color: var(--text-muted); }
.upload-card input[type=file] { display: none; }
.format-badges { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.format-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.format-badge .swatch { width: 8px; height: 8px; border-radius: 2px; }

/* ---- Mapping screen ---- */
.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 4px 14px;
  margin-top: 16px;
}
.map-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.map-row:last-child { border-bottom: none; }
.map-row .field-label { font-weight: 700; font-size: 14px; }
.map-row .field-label .req { color: var(--danger); }
.map-row .field-label .hint { display: block; font-size: 11px; font-weight: 500; color: var(--text-faint); margin-top: 1px; }
.map-row select {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 0 10px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface-2);
  max-width: 55%;
}
.map-row select.unmapped { color: var(--text-faint); border-style: dashed; }
.preview-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
table.preview-table { border-collapse: collapse; width: 100%; font-size: 12px; }
table.preview-table th, table.preview-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
table.preview-table th { background: var(--surface-2); position: sticky; top: 0; font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; }
table.preview-table tbody tr:last-child td { border-bottom: none; }
.mapping-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  display: flex;
  gap: 10px;
  z-index: 40;
  box-shadow: 0 -8px 24px rgba(16,24,40,0.08);
}
.mapping-footer .btn-primary { flex: 1; }

/* ---- Detail sheet (modal) ---- */
.sheet-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-modal {
  background: var(--surface);
  width: 100%;
  max-height: 92vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
.sheet-modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 999px; margin: 10px auto 0; }
.sheet-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.sheet-modal-body { overflow-y: auto; padding: 14px 16px calc(16px + var(--safe-bottom)); flex: 1; }
.close-btn { min-width: 36px; min-height: 36px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }

.detail-header { display: flex; align-items: center; gap: 12px; }
.detail-header .avatar { width: 52px; height: 52px; font-size: 18px; }
.detail-header .name { font-size: 19px; font-weight: 800; }
.detail-header .company { font-size: 13px; color: var(--text-muted); }

.quick-actions { display: flex; gap: 10px; margin-top: 16px; }
.quick-actions .icon-btn { flex-direction: column; min-height: 60px; gap: 4px; }

.field-grid { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.field-item .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 700; }
.field-item .v { font-size: 15px; margin-top: 2px; }

.status-select-wrap { margin-top: 18px; }
.status-select-wrap label { font-size: 13px; font-weight: 700; color: var(--text-muted); }
select.status-select {
  width: 100%;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: 0 12px;
  font-size: 15px;
  font-weight: 700;
  margin-top: 6px;
  background: var(--surface-2);
}

.contact-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.switch { position: relative; width: 46px; height: 26px; border-radius: 999px; background: var(--border); flex-shrink: 0; }
.switch.on { background: var(--primary); }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; box-shadow: var(--shadow-sm); }
.switch.on .knob { transform: translateX(20px); }

.notes-section { margin-top: 20px; }
.notes-section h3 { font-size: 14px; margin: 0 0 8px; }
.note-input-row { display: flex; gap: 8px; }
.note-input-row textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  resize: none;
  min-height: 44px;
  background: var(--surface-2);
}
.activity-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; gap: 10px; font-size: 13px; }
.activity-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.activity-item .text { color: var(--text); }
.activity-item .time { color: var(--text-faint); font-size: 11px; margin-top: 1px; }

.source-link { margin-top: 16px; font-size: 13px; color: var(--primary); font-weight: 700; display: flex; align-items: center; gap: 4px; }

/* ---- Filter bar ---- */
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 2px; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-bar select {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ---- Contacts view toggle ---- */
.view-toggle { display: flex; gap: 6px; padding: 10px 16px 0; }
.view-toggle button {
  flex: 1;
  min-height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
}
.view-toggle button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Kanban ---- */
.kanban-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 14px 16px 8px; scroll-snap-type: x proximity; }
.kanban-col {
  flex: 0 0 82%;
  max-width: 320px;
  scroll-snap-align: start;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 260px);
}
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.kanban-col-header .title { font-weight: 800; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kanban-col-header .dot { width: 9px; height: 9px; border-radius: 50%; }
.kanban-col-header .count { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.kanban-cards { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.kanban-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.kanban-card .name { font-weight: 700; font-size: 14px; }
.kanban-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kanban-card .country-tag { font-size: 11px; color: var(--text-faint); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kanban-card .card-actions { display: flex; gap: 6px; margin-top: 10px; }
.kanban-card .card-actions .icon-btn { min-height: 36px; font-size: 12px; padding: 0 6px; }
.kanban-card .move-select { margin-top: 8px; width: 100%; min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 12px; font-weight: 700; background: var(--surface-2); }

/* ---- Dashboard ---- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.stat-card .num { font-size: 26px; font-weight: 800; }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 600; }
.country-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.country-summary-card .top-row { display: flex; align-items: center; justify-content: space-between; }
.country-summary-card .name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.progress-bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--primary); }
.pill-row { display: flex; gap: 8px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.pill-row .won { color: var(--success); font-weight: 700; }
.pill-row .lost { color: var(--danger); font-weight: 700; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 80;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
  max-width: 90vw;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Misc ---- */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn { color: var(--primary); font-weight: 700; font-size: 13px; }

/* ---- Login screen ---- */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--primary-bg), var(--bg) 55%);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 26px;
  text-align: center;
}
.login-logo { width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.login-card h1 { margin: 14px 0 2px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 22px; color: var(--text-muted); font-size: 13px; }
.login-field { display: block; text-align: left; margin-bottom: 14px; }
.login-field span { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }
.login-field input {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
}
.login-field input:focus { outline: none; border-color: var(--primary); }
.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  text-align: left;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19;
    --surface: #131826;
    --surface-2: #1b2233;
    --border: #262f45;
    --text: #f3f4f6;
    --text-muted: #9aa4b2;
    --text-faint: #6b7688;
    --primary-bg: rgba(37,99,235,0.18);
    --success-bg: rgba(22,163,74,0.15);
    --warn-bg: rgba(217,119,6,0.15);
    --danger-bg: rgba(220,38,38,0.15);
    color-scheme: dark;
  }
}
