/* ============================================================
   EPULSE SERVICES – style.css
   Mobile-first | Dark/Light mode | Space Grotesk
   ============================================================ */

/* ─── GOOGLE FONT ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ─── CSS CUSTOM PROPERTIES ───────────────────────────────── */
:root {
  --blue-primary:   #3B82F6;
  --blue-hover:     #2563EB;
  --blue-light:     #60A5FA;
  --blue-dim:       rgba(59,130,246,0.15);

  /* Dark mode (default) */
  --bg-primary:     #000000;
  --bg-secondary:   #111111;
  --bg-card:        #0f0f0f;
  --bg-card-hover:  #222222;
  --bg-input:       #1F1F1F;
  --text-primary:   #FFFFFF;
  --text-secondary: #A3A3A3;
  --text-muted:     #5C5C5C;
  --border:         #2A2A2A;
  --border-light:   #333333;
  --success:        #22C55E;
  --success-dim:    rgba(34,197,94,0.15);
  --warning:        #F59E0B;
  --warning-dim:    rgba(245,158,11,0.15);
  --danger:         #EF4444;
  --danger-dim:     rgba(239,68,68,0.15);
  --shadow:         0 2px 12px rgba(0,0,0,0.4);
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --radius-pill:    999px;
}

[data-theme="light"] {
  --bg-primary:     #FFFFFF;
  --bg-secondary:   #F3F4F6;
  --bg-card:        #FFFFFF;
  --bg-card-hover:  #F9FAFB;
  --bg-input:       #F3F4F6;
  --text-primary:   #111827;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;
  --border:         #E5E7EB;
  --border-light:   #D1D5DB;
  --shadow:         0 2px 12px rgba(0,0,0,0.08);
}

/* ─── BASE RESET ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 80px; /* bottom nav clearance */
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--blue-primary); text-decoration: none; }
a:hover { color: var(--blue-hover); }

img { max-width: 100%; display: block; }

input, textarea, select, button {
  font-family: inherit;
  font-size: 1rem;
}

/* ─── LAYOUT SHELL ────────────────────────────────────────── */
.app-container {
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

@media (min-width: 768px) {
  .app-container {
    max-width: 1200px;
  }
}

/* ─── HEADER ──────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);

  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--blue-primary);
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 2px solid var(--blue-primary);
  object-fit: cover;
  cursor: pointer;
}

.header-avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-primary);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ─── BOTTOM NAVIGATION ───────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: space-around;
  padding: 8px 0 12px;
  z-index: 100;
  backdrop-filter: blur(12px);
}

@media (min-width: 768px) {
  .bottom-nav {
    max-width: 1200px;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border: none;
  background: none;
  transition: color 0.2s;
  position: relative;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue-primary);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  position: absolute;
  top: 0; right: 0;
  background: var(--danger);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

/* ─── SECTION / PAGE TITLES ───────────────────────────────── */
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 20px 20px 8px;
  letter-spacing: -0.02em;
}

.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}

/* ─── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 16px 12px;
  padding: 16px;
  transition: background 0.2s;
}

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

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.card-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--blue-dim);
  object-fit: cover;
  flex-shrink: 0;
}

.card-avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-primary);
  font-weight: 700;
  font-size: 1rem;
}

.card-title { font-weight: 600; font-size: 0.92rem; }
.card-sub   { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* ─── STATUS BADGES ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge-online   { background: var(--success-dim);  color: var(--success); }
.badge-offline  { background: var(--border);       color: var(--text-muted); }
.badge-pending  { background: var(--warning-dim);  color: var(--warning); }
.badge-active   { background: var(--blue-dim);     color: var(--blue-primary); }
.badge-success  { background: var(--success-dim);  color: var(--success); }
.badge-danger   { background: var(--danger-dim);   color: var(--danger); }
.badge-muted    { background: var(--border);       color: var(--text-secondary); }

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--blue-primary); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }

.btn-secondary { background: var(--border); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border-light); }

.btn-danger    { background: var(--danger-dim); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success   { background: var(--success-dim); color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }

.btn-ghost     { background: transparent; color: var(--blue-primary); padding: 8px 14px; }
.btn-ghost:hover { background: var(--blue-dim); }

.btn-full      { width: 100%; }
.btn-sm        { padding: 7px 14px; font-size: 0.78rem; border-radius: 6px; }
.btn-lg        { padding: 14px 28px; font-size: 0.95rem; border-radius: var(--radius); }

/* ─── INPUTS & FORMS ──────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

/* Fix for dark mode - ensure inputs have proper styling */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

[data-theme="dark"] .form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

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

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 5px;
  display: none;
}

.form-error.visible { display: block; }

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group { flex: 1; }

/* Checkbox / Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.toggle-label { font-size: 0.88rem; font-weight: 500; }
.toggle-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
}

.toggle-switch input {
  opacity: 0; width: 0; height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Checkbox group */
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-item {
  position: relative;
}

.check-item input {
  position: absolute;
  opacity: 0;
  width: 0;
}

.check-item label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.check-item input:checked + label {
  border-color: var(--blue-primary);
  background: var(--blue-dim);
  color: var(--blue-primary);
}

/* ─── CHAT BUBBLES ────────────────────────────────────────── */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  height: calc(100dvh - 140px);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;

  background: var(--bg-primary);
}

.chat-header-back {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.chat-header-back svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }

.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 600; font-size: 0.9rem; }
.chat-header-status { font-size: 0.72rem; color: var(--success); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

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

.msg.sent     { align-self: flex-end; align-items: flex-end; }
.msg.received { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.msg.sent .msg-bubble {
  background: var(--blue-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.received .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-bubble img {
  border-radius: 8px;
  max-width: 220px;
  margin: 4px 0;
}

.msg-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* System / invoice / extra-fund messages */
.msg-system {
  background: var(--bg-primary);

  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 4px 0;
  align-self: center;
  text-align: center;
  max-width: 90%;
}

.msg-invoice {
  background: var(--bg-card);
  border: 1px solid var(--blue-primary);
  border-radius: 10px;
  padding: 12px 14px;
  max-width: 85%;
  align-self: flex-start;
}

.msg-invoice.sent { align-self: flex-end; }

.msg-invoice-title {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--blue-primary);
  margin-bottom: 4px;
}

.msg-invoice-amount {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 4px 0;
}

.msg-invoice-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ─── CHAT INPUT ──────────────────────────────────────────── */
.chat-input-area {

  padding: 10px 12px;
  background: var(--bg-primary);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-input);

  border-radius: var(--radius-sm);
  padding: 0 12px;
  gap: 8px;
}

.chat-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 11px 0;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.chat-input-wrap input::placeholder { color: var(--text-muted); }

.chat-attach-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.chat-attach-btn:hover { color: var(--blue-primary); }
.chat-attach-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.chat-send-btn {
  background: var(--blue-primary);
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-send-btn:hover { background: var(--blue-hover); }
.chat-send-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* Image preview */
.img-preview-strip {
  display: flex;
  gap: 8px;
  padding: 8px 12px 0;
  overflow-x: auto;
}

.img-preview-thumb {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.img-preview-thumb img { width: 100%; height: 100%; object-fit: cover; }

.img-preview-remove {
  position: absolute;
  top: 2px; right: 2px;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  width: 18px; height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── WALLET CARDS ────────────────────────────────────────── */
.wallet-main {
  background: linear-gradient(135deg, var(--blue-primary), #1D4ED8);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin: 16px;
  color: #fff;
}

.wallet-label {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.wallet-amount {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wallet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.wallet-actions .btn {
  flex: 1;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 0.8rem;
}

.wallet-actions .btn:hover { background: rgba(255,255,255,0.25); }

/* Vendor mini balance cards */
.balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 16px 16px;
}

.balance-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.balance-card-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.balance-card-val {
  font-size: 1.1rem;
  font-weight: 700;
}

/* ─── CATEGORY GRID ───────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px;
}

.category-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 8px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.category-item:hover,
.category-item.active {
  border-color: var(--blue-primary);
  background: var(--blue-dim);
}

.category-icon {
  width: 36px; height: 36px;
  margin: 0 auto 8px;
  background: var(--blue-dim);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-primary);
  font-size: 1.4rem;
  line-height: 1;
}

.category-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* ─── SERVICE TYPE PILLS ──────────────────────────────────── */
.type-pills {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 4px;
}

.type-pill {
  flex: 1;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.type-pill.active,
.type-pill:hover {
  border-color: var(--blue-primary);
  background: var(--blue-dim);
  color: var(--blue-primary);
}

/* ─── VENDOR LIST ITEM ────────────────────────────────────── */
.vendor-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}

.vendor-item:hover { background: var(--bg-card-hover); }

.vendor-item-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--blue-dim);
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
}

.vendor-online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  background: var(--success);
  border: 2px solid var(--bg-card);
  border-radius: 50%;
}

.vendor-item-info { flex: 1; min-width: 0; }
.vendor-item-name { font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vendor-item-cat  { font-size: 0.72rem; color: var(--text-muted); }

.vendor-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.star-rating {
  font-size: 0.72rem;
  color: var(--warning);
  font-weight: 600;
}

/* ─── JOB / REQUEST CARDS ─────────────────────────────────── */
.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 16px 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.job-card:hover { border-color: var(--blue-primary); }

.job-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.job-card-title { font-weight: 600; font-size: 0.9rem; }
.job-card-time  { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }

.job-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.job-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── TRANSACTION LIST ────────────────────────────────────── */
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.tx-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.tx-icon.credit  { background: var(--success-dim); color: var(--success); }
.tx-icon.debit   { background: var(--danger-dim);  color: var(--danger); }
.tx-icon.pending { background: var(--warning-dim); color: var(--warning); }

.tx-info  { flex: 1; }
.tx-label { font-size: 0.82rem; font-weight: 500; }
.tx-date  { font-size: 0.7rem;  color: var(--text-muted); }
.tx-amount { font-weight: 700; font-size: 0.9rem; }
.tx-amount.credit { color: var(--success); }
.tx-amount.debit  { color: var(--danger); }

/* ─── MODALS ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 32px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  max-height: 85vh;
  overflow-y: auto;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 18px;
}

.modal-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

/* ─── TOAST / NOTIFICATION ────────────────────────────────── */
.toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 1000;
  transition: top 0.35s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow);
  max-width: 90vw;
  text-align: center;
  white-space: nowrap;
}

.toast.show { top: 16px; }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }

/* ─── LOADING / SPINNERS ──────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--blue-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state-text { font-size: 0.88rem; }

/* ─── AUTH SCREENS ────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue-primary);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  text-align: center;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 32px;
  text-align: center;
}

.auth-form {
  width: 100%;
  max-width: 400px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--blue-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.auth-link a { color: var(--blue-primary); font-weight: 600; }

/* File upload styled */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.file-upload-area:hover { border-color: var(--blue-primary); }
.file-upload-area input { display: none; }

.file-upload-icon { font-size: 1.6rem; margin-bottom: 8px; color: var(--text-muted); }
.file-upload-text { font-size: 0.78rem; color: var(--text-muted); }
.file-upload-text span { color: var(--blue-primary); font-weight: 600; }

/* Uploaded file chip */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.file-chip-remove {
  border: none;
  background: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

/* ─── ADMIN TABLE ─────────────────────────────────────────── */
.admin-table-wrap {
  overflow-x: auto;
  margin: 0 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 420px;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.admin-table tr:hover td { background: var(--bg-card-hover); }

/* ─── STATS GRID (admin dashboard) ────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
  margin-bottom: 16px;
}

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

.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-change { font-size: 0.7rem; margin-top: 4px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ─── DIVIDERS ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 16px;
}

/* ─── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ─── MAP CONTAINER ───────────────────────────────────────── */
#map-container {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 8px;
}

/* ─── RESPONSIVE TWEAKS ───────────────────────────────────── */
@media (min-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .balance-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 340px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .category-name { font-size: 0.65rem; }
  .wallet-amount { font-size: 1.6rem; }
}

/* ─── UTILITY CLASSES ─────────────────────────────────────── */
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-2  { margin-bottom: 8px; }
.mb-4  { margin-bottom: 16px; }
.px-4  { padding: 0 16px; }
.py-2  { padding: 8px 0; }
.py-4  { padding: 16px 0; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: 0.78rem; }
.text-xs     { font-size: 0.68rem; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-blue   { color: var(--blue-primary); }
.font-bold   { font-weight: 700; }
.font-semi   { font-weight: 600; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }
.sr-only     { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }