/* ─── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-bg:     #eff6ff;
  --primary-light:  #dbeafe;

  --btn:            #111827;
  --btn-hover:      #1f2937;

  --stat-active:    #1e3a8a;

  --success:        #16a34a;
  --success-bg:     #dcfce7;
  --success-border: #86efac;
  --danger:         #ef4444;
  --danger-bg:      #fee2e2;
  --danger-border:  #fca5a5;

  --text:    #111827;
  --text-2:  #374151;
  --muted:   #6b7280;
  --subtle:  #9ca3af;
  --faint:   #d1d5db;

  --bg:      #f9fafb;
  --card:    #ffffff;
  --border:  #e5e7eb;
  --border-2:#f3f4f6;

  --r-xs: 6px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.08);

  --nav-w:    240px;
  --topbar-h: 60px;
}

/* ─── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}
button  { font-family: inherit; cursor: pointer; border: none; background: none; }
a       { text-decoration: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ─── Language switcher ──────────────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 1px;
}

.lang-btn {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  transition: all 0.12s;
  min-height: 28px;
  background: transparent;
}
.lang-btn.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--btn);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--btn-hover); }

.btn-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  transition: all 0.12s;
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text); border-color: var(--text-2); }
.btn-icon svg { width: 15px; height: 15px; }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.1s, color 0.1s;
  width: 100%;
  text-align: left;
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { background: var(--danger-bg); color: var(--danger); }

.btn-ghost-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-ghost-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

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

.input-wrap {
  position: relative;
}

.input-wrap svg:first-child {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--subtle);
  pointer-events: none;
  flex-shrink: 0;
}

.input-wrap input { padding-left: 40px; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--faint); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
  padding-top: 11px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Remember me / checkbox row */
.remember-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  cursor: pointer;
}
.remember-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.remember-label {
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.hidden { display: none !important; }

/* ─── Toasts ─────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 380px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--btn);
  color: white;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: toastIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.toast.out { animation: toastOut 0.18s ease forwards; }
@keyframes toastIn  { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.toast-icon { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; }
.toast-icon svg { width: 14px; height: 14px; }
.toast-success .toast-icon { background: rgba(255,255,255,0.12); color: #86efac; }
.toast-error   .toast-icon { background: rgba(239,68,68,0.2);   color: #fca5a5; }
.toast-msg { font-size: 13.5px; font-weight: 500; flex: 1; }

/* ─────────────────────────────────────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(env(safe-area-inset-top), 24px) 16px max(env(safe-area-inset-bottom), 24px);
}

.login-content {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.login-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--btn);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.login-brand-icon svg { width: 20px; height: 20px; color: white; }
.login-brand-name { font-size: 15px; font-weight: 700; color: var(--text); }

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow);
  position: relative;
}

.login-lang {
  position: absolute;
  top: 20px;
  right: 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 24px;
  padding-right: 80px;
}

.login-footer {
  margin-top: 20px;
  font-size: 12px;
  color: var(--subtle);
  text-align: center;
}
.login-footer::before {
  content: '• ';
}

/* ─────────────────────────────────────────────────────────────────────────────
   APP LAYOUT
   ───────────────────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ── Sidebar (desktop only) ── */
.sidebar {
  width: var(--nav-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border-2);
}
.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--btn);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 16px; height: 16px; color: white; }
.sidebar-logo-text { font-size: 14px; font-weight: 700; color: var(--text); }

.sidebar-org {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  gap: 7px;
}
.sidebar-org svg { width: 13px; height: 13px; color: var(--subtle); flex-shrink: 0; }
.sidebar-org-name { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: 8px 8px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.1s, color 0.1s;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover  { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }

.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border-2);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-bottom: 4px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-bg);
  border: 1.5px solid var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.user-avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.user-info-text strong { display: block; font-size: 13px; color: var(--text); font-weight: 600; }
.user-info-text small  { font-size: 11px; color: var(--muted); }

/* ── Main wrapper ── */
.main-wrapper {
  margin-left: var(--nav-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  gap: 12px;
}

/* Brand — hidden on desktop (shown on mobile) */
.topbar-brand { display: none; }

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 7px;
}
.topbar-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ── Main content ── */
.main-content { padding: 24px; flex: 1; }

/* ─── Views ──────────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: viewIn 0.18s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Page header ────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}
.page-header-actions { display: flex; align-items: center; gap: 8px; }

/* ─── Stats row ──────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-sm); }

.stat-card.active {
  background: var(--stat-active);
  border-color: var(--stat-active);
}
.stat-card.active .stat-num { color: white; }
.stat-card.active .stat-lbl { color: rgba(255,255,255,0.65); }
.stat-card.active .stat-icon { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.8); }

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.indigo { background: var(--primary-bg); color: var(--primary); }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }

.stat-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}
.stat-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Sync bar ───────────────────────────────────────────────────────────────── */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--muted);
  padding: 0 2px;
}
.sync-bar svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--success); }

/* ─── Section headers ────────────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 20px 0 8px;
}
.section-head:first-child { margin-top: 0; }
.section-head-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--primary);
  white-space: nowrap;
}
.section-head-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--subtle);
}
.section-head-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Event cards ────────────────────────────────────────────────────────────── */
.event-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: grid;
  grid-template-columns: 60px 1px 1fr auto;
  overflow: hidden;
  transition: box-shadow 0.15s;
  margin-bottom: 6px;
  -webkit-tap-highlight-color: transparent;
}
.event-card:hover { box-shadow: var(--shadow-sm); }

.ev-date {
  background: var(--bg);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 18px;
  gap: 1px;
}
.ev-date-day   { font-size: 24px; font-weight: 800; line-height: 1; color: var(--text); letter-spacing: -0.04em; }
.ev-date-month { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary); margin-top: 2px; }
.ev-date-year  { font-size: 10px; color: var(--subtle); margin-top: 1px; }

.ev-divider { background: var(--border); }

.ev-body {
  padding: 12px 12px 10px;
  min-width: 0;
}

.ev-title-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.ev-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.ev-time {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.ev-time svg { width: 11px; height: 11px; color: var(--subtle); flex-shrink: 0; }

.ev-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ev-actions {
  padding: 12px 10px 12px 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-today    { background: #fef3c7; color: #92400e; }
.badge-upcoming { background: var(--primary-bg); color: var(--primary); }

/* ─── Skeleton loading ───────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  border-radius: 4px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e9eaec 50%, #f3f4f6 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 6px;
}

/* ─── Empty state ────────────────────────────────────────────────────────────── */
.state-empty {
  text-align: center;
  padding: 48px 20px;
}
.state-empty-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}
.state-empty-icon svg { width: 26px; height: 26px; color: var(--faint); }
.state-empty h3 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.state-empty p  { font-size: 13px; color: var(--muted); }

/* ─── Panel (forms) ──────────────────────────────────────────────────────────── */
.panel { max-width: 520px; }
.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

/* ─── Mobile bottom nav ──────────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 200;
}
.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  height: 56px;
}
.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.12s;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item svg { width: 21px; height: 21px; }
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item:active { opacity: 0.6; }

/* ─────────────────────────────────────────────────────────────────────────────
   MOBILE  ≤ 768px
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  .sidebar     { display: none; }
  .mobile-nav  { display: block; }
  .main-wrapper { margin-left: 0; }

  /* Topbar: fixed, safe-area aware, show brand */
  .topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding-top: env(safe-area-inset-top);
    padding-left: 16px;
    padding-right: 16px;
    height: auto;
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
    flex-wrap: wrap;
    align-items: stretch;
    box-shadow: 0 1px 0 var(--border);
  }

  /* Inner row that holds brand + right controls */
  .topbar > * { height: var(--topbar-h); display: flex; align-items: center; }

  .topbar-title { display: none; }

  .topbar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .topbar-brand-icon {
    width: 28px;
    height: 28px;
    background: var(--btn);
    border-radius: 7px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }
  .topbar-brand-icon svg { width: 14px; height: 14px; color: white; }
  .topbar-brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
  }
  .topbar-brand-name { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1; }
  .topbar-brand-domain {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
  }

  /* Main content: below topbar + above bottom nav */
  .main-content {
    padding-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 18px);
    padding-bottom: calc(56px + env(safe-area-inset-bottom) + 20px);
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Toasts */
  #toast-container {
    bottom: calc(56px + env(safe-area-inset-bottom) + 12px);
    left: 16px;
    right: 16px;
    transform: none;
    width: auto;
  }

  /* Prevent iOS zoom on input focus */
  .form-group input,
  .form-group select,
  .form-group textarea { font-size: 16px; }

  /* Stats */
  .stats-row { gap: 8px; }
  .stat-card  { padding: 12px 10px; gap: 8px; }
  .stat-num   { font-size: 24px; }
  .stat-lbl   { font-size: 9px; }
  .stat-icon  { width: 28px; height: 28px; }
  .stat-icon svg { width: 14px; height: 14px; }

  /* Event cards */
  .event-card { grid-template-columns: 52px 1px 1fr auto; }
  .ev-date { padding: 14px 6px; padding-top: 16px; }
  .ev-date-day { font-size: 20px; }
  .ev-body { padding: 10px 10px 8px; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }
  .panel { max-width: 100%; }
  .page-header h1 { font-size: 20px; }

  /* Login */
  .login-page {
    padding-top: max(env(safe-area-inset-top), 32px);
    padding-bottom: max(env(safe-area-inset-bottom), 24px);
    justify-content: flex-start;
  }
  .login-content { padding: 0 16px; }
  .login-brand { margin-bottom: 20px; }
  .login-card { padding: 24px 20px 20px; border-radius: var(--r-lg); }
  .login-title { font-size: 20px; margin-bottom: 20px; }
}

@media (max-width: 380px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .stats-row .stat-card:last-child {
    grid-column: span 2;
  }
}
