:root {
  --green: #25d366;
  --green-dark: #128c7e;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #111b21;
  --muted: #667781;
  --border: #e9edef;
  --danger: #ea0038;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0 }
.hidden { display: none !important }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

a { color: var(--green-dark); text-decoration: none }
a:hover { text-decoration: underline }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; font-size: .9rem; font-weight: 600;
  cursor: pointer; border: none; transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97) }
.btn:disabled { opacity: .5; cursor: not-allowed }
.btn-primary { background: var(--green); color: #fff }
.btn-primary:hover:not(:disabled) { background: var(--green-dark) }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border) }
.btn-ghost:hover { background: var(--bg) }
.btn-danger { background: var(--danger); color: #fff }
.btn-full { width: 100% }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px }
label { font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em }
input, textarea, select {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .95rem; font-family: inherit; background: var(--card);
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--green);
}
textarea { resize: vertical; min-height: 80px }

/* ── Card ────────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}

/* ── Auth page ───────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100dvh; display: flex; align-items: center;
  justify-content: center; padding: 16px;
}
.auth-box { width: 100%; max-width: 400px }
.auth-logo { text-align: center; margin-bottom: 28px }
.auth-logo h1 { font-size: 1.8rem; color: var(--green-dark) }
.auth-logo p { color: var(--muted); font-size: .9rem }
.auth-form { display: flex; flex-direction: column; gap: 16px }
.auth-tabs { display: flex; gap: 0; margin-bottom: 24px; border-radius: 8px; overflow: hidden; border: 1.5px solid var(--border) }
.auth-tab { flex: 1; padding: 10px; text-align: center; background: transparent; border: none; cursor: pointer; font-weight: 600; color: var(--muted); font-size: .9rem }
.auth-tab.active { background: var(--green); color: #fff }
.auth-error { color: var(--danger); font-size: .85rem; padding: 8px 12px; background: #ffeef0; border-radius: 6px }

/* ── App shell ───────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100dvh }

.topbar {
  background: var(--green-dark); color: #fff; padding: 0 20px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);
}
.topbar-brand { font-weight: 700; font-size: 1.1rem }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: .88rem }
.topbar-user button { background: rgba(255,255,255,.15); border: none; color: #fff; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: .85rem }
.topbar-user button:hover { background: rgba(255,255,255,.25) }

.main-layout { display: flex; flex: 1 }

.sidebar {
  width: 220px; background: var(--card); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: var(--text); font-size: .9rem; font-weight: 500;
  transition: background .15s;
}
.sidebar-link:hover, .sidebar-link.active { background: var(--bg); text-decoration: none }
.sidebar-link.active { color: var(--green-dark); font-weight: 700 }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 0 }

.page-content { flex: 1; padding: 24px; overflow-y: auto }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px }
.page-header h2 { font-size: 1.25rem }

/* ── Reminders list ──────────────────────────────────────────────────── */
.reminders-grid { display: flex; flex-direction: column; gap: 12px }
.reminder-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 20px; display: flex; align-items: flex-start; gap: 16px;
  cursor: pointer; transition: box-shadow .15s;
}
.reminder-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12) }
.reminder-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px }
.reminder-info { flex: 1 }
.reminder-title { font-weight: 600; font-size: 1rem }
.reminder-meta { font-size: .83rem; color: var(--muted); margin-top: 2px }
.reminder-status { margin-top: 6px }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.badge-active { background: #dcfce7; color: #166534 }
.badge-paused { background: #fef9c3; color: #713f12 }
.badge-sent { background: #dbeafe; color: #1e40af }
.badge-failed { background: #fee2e2; color: #991b1b }
.badge-cancelled { background: #f1f5f9; color: #475569 }

/* ── Contacts list ───────────────────────────────────────────────────── */
.contacts-grid { display: flex; flex-direction: column; gap: 10px }
.contact-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 18px; display: flex; align-items: center; gap: 14px;
}
.contact-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--green);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.contact-info { flex: 1 }
.contact-name { font-weight: 600 }
.contact-phone { font-size: .85rem; color: var(--muted) }
.contact-actions { display: flex; gap: 8px }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  z-index: 100;
}
.modal-overlay.hidden { display: none }
.modal { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 90dvh; overflow-y: auto }
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between }
.modal-header h3 { font-size: 1.1rem }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1 }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 10px }

/* ── Recipients list in form ─────────────────────────────────────────── */
.recipient-row { display: flex; gap: 8px; align-items: center }
.recipient-row input { flex: 1 }
.recipient-row button { flex-shrink: 0 }
#add-recipient-btn { align-self: flex-start; font-size: .85rem }

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted) }
.empty-state .emoji { font-size: 3rem; margin-bottom: 12px }
.empty-state p { font-size: 1rem }

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: .9rem; opacity: 0; transition: opacity .25s;
  pointer-events: none; z-index: 999; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1 }
#toast.toast-error { background: var(--danger) }
#toast.toast-success { background: var(--text) }

/* ── Loading spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.btn-sm { padding: 6px 12px; font-size: .8rem }
.btn-danger-soft { color: var(--danger) }
.btn-danger-soft:hover { background: #ffeef0 }

/* ── Reminder actions ────────────────────────────────────────────────── */
.reminder-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center }

/* ── Skeleton loading ────────────────────────────────────────────────── */
.skeleton-list { display: flex; flex-direction: column; gap: 12px }
.skeleton {
  height: 72px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--border) 25%, #e2e5e8 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0 } }

/* ── Profile avatar + dropdown ───────────────────────────────────────── */
.topbar-username { font-size: .88rem; opacity: .85 }
.profile-wrap { position: relative }
.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.25); border: none; color: #fff;
  font-weight: 700; font-size: .95rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.avatar-btn:hover { background: rgba(255,255,255,.35) }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow);
  border: 1px solid var(--border); min-width: 180px; z-index: 50;
  overflow: hidden;
}
.dropdown-item {
  display: block; padding: 10px 16px; font-size: .9rem; color: var(--text);
  background: none; border: none; width: 100%; text-align: left; cursor: pointer;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--bg); text-decoration: none }
.dropdown-item-danger { color: var(--danger) }
.dropdown-divider { height: 1px; background: var(--border) }

/* ── Contact email ───────────────────────────────────────────────────── */
.contact-email { font-size: .8rem; color: var(--muted) }

/* ── Logs ────────────────────────────────────────────────────────────── */
.log-filter { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap }
.log-filter input[type=date] { padding: 6px 10px; font-size: .85rem; max-width: 150px }
.logs-grid { display: flex; flex-direction: column; gap: 8px }
.log-row {
  background: var(--card); border-radius: 8px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.log-title { flex: 1; font-weight: 500; font-size: .9rem; min-width: 120px }
.log-date { font-size: .82rem; color: var(--muted) }
.log-attempt { font-size: .78rem; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 99px }

/* ── Send jobs detail (modal) ────────────────────────────────────────── */
.job-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--border); font-size: .85rem; flex-wrap: wrap;
}
.job-row:last-child { border-bottom: none }
.job-phone { font-weight: 500; min-width: 120px }
.job-email { font-size: .8rem; color: var(--muted); min-width: 140px }
.job-alert { color: var(--muted); min-width: 90px }
.job-sent { color: var(--muted); font-size: .8rem; margin-left: auto }

/* ── Calendar sidebar groups ─────────────────────────────────────────────── */
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 4px }
.sidebar-cals-header { display: flex; align-items: center; padding: 4px 12px 2px; gap: 6px }
.sidebar-cals-title { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; flex: 1 }
.sidebar-add-btn { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 0 4px; border-radius: 4px; line-height: 1.4 }
.sidebar-add-btn:hover { background: var(--bg); color: var(--text) }
.cal-sidebar-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; transition: background .12s; position: relative }
.cal-sidebar-item:hover { background: var(--bg) }
.cal-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; cursor: pointer; transition: opacity .15s }
.cal-dot.hidden-cal { opacity: .25 }
.cal-item-name { font-size: .88rem; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.cal-item-name.hidden-cal { opacity: .45; text-decoration: line-through }
.cal-item-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s }
.cal-sidebar-item:hover .cal-item-actions { opacity: 1 }
.cal-item-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .75rem; padding: 3px 5px; border-radius: 4px; line-height: 1 }
.cal-item-btn:hover { background: var(--border); color: var(--text) }
.cal-no-cals { font-size: .8rem; color: var(--muted); padding: 6px 12px; font-style: italic }

/* ── Color picker ────────────────────────────────────────────────────────── */
.color-picker-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: transform .1s, border-color .1s; flex-shrink: 0 }
.color-swatch:hover { transform: scale(1.15) }
.color-swatch.selected { border-color: var(--text) }

/* ── Settings ────────────────────────────────────────────────────────── */
.settings-wrap { max-width: 560px }
.settings-form { display: flex; flex-direction: column; gap: 16px }
.settings-section-title { font-size: 1rem; font-weight: 700; color: var(--text) }
.settings-hint { font-size: .85rem; color: var(--muted) }
.settings-divider { height: 1px; background: var(--border); margin: 4px 0 }
.copy-field { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 8px; padding: 8px 12px }
.copy-value { font-size: .78rem; color: var(--muted); word-break: break-all; flex: 1; font-family: monospace }

/* ── Stats bar ───────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex; gap: 0; margin-bottom: 12px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.stat-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 12px 8px; border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none }
.stat-num { font-size: 1.4rem; font-weight: 700; color: var(--text) }
.stat-label { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap }
.filter-btn {
  padding: 5px 14px; border-radius: 99px; font-size: .82rem; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--card); color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.filter-btn:hover { border-color: var(--green); color: var(--green-dark) }
.filter-btn.active { background: var(--green); color: #fff; border-color: var(--green) }

/* ── Reminder card status stripe ─────────────────────────────────────────── */
.reminder-card { position: relative; padding-left: 24px }
.reminder-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 5px; border-radius: var(--radius) 0 0 var(--radius);
  background: var(--border);
}
.reminder-card[data-status="active"]::before { background: var(--green) }
.reminder-card[data-status="paused"]::before { background: #eab308 }
.reminder-card[data-status="sent"]::before { background: #3b82f6 }
.reminder-card[data-status="failed"]::before { background: var(--danger) }
.reminder-card[data-status="cancelled"]::before { background: #94a3b8 }

/* ── WhatsApp preview bubble ─────────────────────────────────────────────── */
.wa-preview {
  background: #e5ddd5; border-radius: 8px; padding: 12px 14px;
  min-height: 60px; display: flex; align-items: flex-start;
}
.wa-bubble {
  background: #fff; border-radius: 0 8px 8px 8px; padding: 8px 12px;
  font-size: .9rem; line-height: 1.5; color: var(--text); max-width: 100%;
  white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.1);
  position: relative;
}
.wa-bubble::before {
  content: ''; position: absolute; top: 0; left: -8px;
  border: 8px solid transparent; border-top-color: #fff;
  border-left: 0; border-right-width: 8px;
}

/* ── Log detail tooltip ──────────────────────────────────────────────────── */
.log-detail { font-size: .9rem; color: var(--muted); cursor: help }

/* ── Bottom nav (mobile) ─────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1px solid var(--border);
  height: 60px; z-index: 40;
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font-size: .7rem; color: var(--muted);
  text-decoration: none; padding: 6px 0;
}
.bottom-nav-item.active { color: var(--green-dark); font-weight: 600 }
.bottom-nav-icon { font-size: 1.25rem }

@media (max-width: 640px) {
  .sidebar { display: none }
  .bottom-nav { display: flex }
  .page-content { padding: 16px; padding-bottom: 76px }
  .topbar-username { display: none }

  /* Reminder card: stack actions on a second row */
  .reminder-card { flex-wrap: wrap }
  .reminder-icon { display: none }
  .reminder-info { flex: 1; min-width: 0 }
  .reminder-actions {
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  /* Modal: full-width, bottom-anchored */
  .modal-overlay { align-items: flex-end; padding: 0 }
  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
  }

  /* Settings */
  .settings-wrap { max-width: 100% }

  /* Contact card actions */
  .contact-actions { flex-shrink: 0 }
}

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-bar { margin-bottom: 16px }
.search-bar input {
  width: 100%; padding: 10px 14px; font-size: .95rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--card); font-family: inherit; transition: border-color .15s;
}
.search-bar input:focus { outline: none; border-color: var(--green) }

/* ── Page header actions group ───────────────────────────────────────────── */
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }

/* ── Import modal ────────────────────────────────────────────────────────── */
.import-options { display: flex; gap: 12px; margin-bottom: 16px }
.import-option-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 12px; border: 2px solid var(--border); border-radius: 10px;
  background: var(--card); cursor: pointer; font-size: .9rem; font-weight: 600;
  color: var(--text); transition: border-color .15s, background .15s; font-family: inherit;
}
.import-option-btn:hover { border-color: var(--green); background: #f0fdf4 }
.import-option-icon { font-size: 2rem }
.import-summary { font-size: .9rem; color: var(--muted); margin-bottom: 8px }
.import-table-wrap { max-height: 260px; overflow-y: auto; border-radius: 8px; border: 1px solid var(--border) }
.import-table { width: 100%; border-collapse: collapse; font-size: .85rem }
.import-table th { background: var(--bg); padding: 8px 10px; text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em }
.import-table td { padding: 6px 10px; border-top: 1px solid var(--border); color: var(--text) }
.import-preview { margin-top: 4px }

/* ── Templates page ──────────────────────────────────────────────────────── */
.page-description { font-size: .88rem; color: var(--muted); margin-bottom: 16px }
.page-description code { background: var(--bg); padding: 2px 5px; border-radius: 4px; font-size: .85rem }
.templates-list { display: flex; flex-direction: column; gap: 10px }
.tpl-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 20px;
}
.tpl-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px }
.tpl-name { font-weight: 600; flex: 1; font-size: .95rem }
.tpl-actions { display: flex; gap: 4px }
.tpl-body {
  font-size: .88rem; color: var(--muted); white-space: pre-wrap; word-break: break-word;
  line-height: 1.55; background: var(--bg); padding: 8px 10px; border-radius: 6px;
}

/* ── Template select in agenda form ──────────────────────────────────────── */
.tpl-select-row { margin-bottom: 6px }
.tpl-select-row select { width: 100%; font-size: .85rem; padding: 7px 10px }

/* ── Contact picker modal ────────────────────────────────────────────────── */
.picker-list { max-height: 320px; overflow-y: auto }
.picker-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px;
  border-radius: 8px; cursor: pointer; transition: background .12s;
}
.picker-item:hover { background: var(--bg) }
.picker-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--green);
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
  font-size: .95rem; flex-shrink: 0;
}
.picker-info { display: flex; flex-direction: column; gap: 2px }
.picker-name { font-weight: 500; font-size: .9rem }
.picker-phone { font-size: .82rem; color: var(--muted) }

/* ── Auth extras (forgot / reset) ────────────────────────────────────────── */
.auth-forgot { display: block; text-align: center; font-size: .85rem; margin-top: 8px; color: var(--muted) }
.auth-forgot:hover { color: var(--green-dark) }
.auth-ok { color: #16a34a; font-size: .85rem; padding: 8px 12px; background: #f0fdf4; border-radius: 6px }

/* ── Tag chips ───────────────────────────────────────────────────────── */
.tag-input-wrap {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--card); cursor: text; min-height: 42px; transition: border-color .15s;
}
.tag-input-wrap:focus-within { border-color: var(--green) }
.tag-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; background: #dcfce7; color: #166534;
  border-radius: 99px; font-size: .78rem; font-weight: 600;
}
.tag-chip-remove {
  background: none; border: none; cursor: pointer; color: inherit;
  font-size: .85rem; line-height: 1; padding: 0 1px; opacity: .7;
}
.tag-chip-remove:hover { opacity: 1 }
.tag-chip-input {
  border: none; outline: none; font-size: .88rem; font-family: inherit;
  color: var(--text); background: transparent; min-width: 80px; flex: 1; padding: 2px 0;
}
.contact-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px }
.contact-tags .tag-chip { font-size: .72rem; padding: 1px 7px }

/* ── Tag filter chips row ────────────────────────────────────────────── */
.tag-filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center }
.tag-filter-chip {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 99px; font-size: .82rem; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--card); color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.tag-filter-chip:hover { border-color: var(--green); color: var(--green-dark) }
.tag-filter-chip.active { background: var(--green); color: #fff; border-color: var(--green) }

/* ── Confirmation status badges ──────────────────────────────────────── */
.conf-badge { display: inline-block; padding: 2px 7px; border-radius: 99px; font-size: .73rem; font-weight: 600; white-space: nowrap }
.conf-badge-pending { background: #fef9c3; color: #713f12 }
.conf-badge-confirmed { background: #dcfce7; color: #166534 }
.conf-badge-declined { background: #fee2e2; color: #991b1b }

/* ── Dashboard ───────────────────────────────────────────────────────── */
.stat-cards-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; flex-direction: column; gap: 6px;
}
.stat-card-value { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1 }
.stat-card-label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em }
.stat-card-sub { font-size: .8rem; color: var(--muted) }
.dash-section-title {
  font-size: .8rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin: 20px 0 10px;
}
.success-rate-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 8px }
.success-rate-bar { flex: 1; height: 10px; background: var(--border); border-radius: 99px; overflow: hidden }
.success-rate-fill { height: 100%; background: var(--green); border-radius: 99px; transition: width .6s }
.success-rate-pct { font-size: 1rem; font-weight: 700; color: var(--text); min-width: 48px; text-align: right }
.chart-wrap {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 8px;
}
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 80px }
.chart-bar { flex: 1; background: var(--green); border-radius: 4px 4px 0 0; cursor: default }
.chart-bar.zero { background: var(--border) }
.chart-labels { display: flex; gap: 6px; margin-top: 6px }
.chart-label { flex: 1; text-align: center; font-size: .68rem; color: var(--muted) }
.upcoming-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px }
.upcoming-day {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.upcoming-day-date { font-weight: 700; font-size: .9rem; min-width: 90px; color: var(--green-dark) }
.upcoming-day-title { font-size: .9rem; flex: 1 }
.upcoming-day-loc { font-size: .8rem; color: var(--muted); width: 100% }

/* ── Period tabs ─────────────────────────────────────────────────────── */
.period-tabs { display: flex; gap: 4px; flex-wrap: wrap }
.period-tab {
  padding: 5px 14px; border-radius: 99px; font-size: .8rem; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--card); color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.period-tab:hover { border-color: var(--green); color: var(--green-dark) }
.period-tab.active { background: var(--green); color: #fff; border-color: var(--green) }

/* ── Admin panel ─────────────────────────────────────────────────────── */
.admin-stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px;
}
.admin-table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card) }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem }
.admin-table th {
  padding: 10px 14px; text-align: left; font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle }
.admin-table tr:last-child td { border-bottom: none }
.admin-table tr:hover td { background: var(--bg) }
.badge-active { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .73rem; font-weight: 600; background: #dcfce7; color: #166534 }
.badge-suspended { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .73rem; font-weight: 600; background: #fee2e2; color: #991b1b }
.admin-actions { display: flex; gap: 6px }
.btn-xs { padding: 4px 10px; font-size: .78rem; border-radius: 6px }
.admin-section { margin-bottom: 32px }
.admin-section-title {
  font-size: .8rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin: 0 0 10px;
}
.admin-pagination { display: flex; align-items: center; gap: 8px; margin-top: 12px }
.error-text { color: var(--danger); font-size: .82rem }

@media (max-width: 640px) {
  .stat-cards-grid { grid-template-columns: repeat(2, 1fr) }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr) }
}

/* Plan badge & usage */
.plan-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  margin-right: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.plan-badge-pro { background: #dcfce7; color: #166534 }
.plan-usage-card { padding: 16px 18px; margin-bottom: 16px }
.plan-usage-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: .9rem }
.plan-usage-link { font-size: .82rem; color: var(--green-dark); font-weight: 600 }
.usage-row { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 6px; color: var(--muted) }
.usage-bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden }
.usage-bar-fill { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s }

/* Onboarding wizard */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.onboarding-card {
  background: var(--card); border-radius: var(--radius);
  padding: 28px 24px; max-width: 420px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.onboarding-step { font-size: .78rem; font-weight: 700; color: var(--green-dark); margin-bottom: 8px }
.onboarding-card h3 { margin: 0 0 10px; font-size: 1.15rem }
.onboarding-card p { color: var(--muted); font-size: .9rem; line-height: 1.6; margin: 0 0 20px }
.onboarding-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap }
