:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --accent: #A5B4FC;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --nav-h: 56px;
  --footer-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + var(--footer-h) + var(--safe-bottom) + 16px);
}
body.fade-in { animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#app-root { max-width: 640px; margin: 0 auto; }
#app-main { padding: 12px 14px 20px; min-height: 50vh; }
#skeleton-root { padding: 16px; max-width: 640px; margin: 0 auto; }

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.page-title { font-size: 1.25rem; margin: 0 0 12px; }
.section { margin: 20px 0; }
.section-title { font-size: 1rem; margin: 0 0 10px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px; padding: 10px 18px;
  font-size: 0.95rem; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #eef2ff; color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; width: 100%; margin-top: 12px; }
.btn-block { width: 100%; margin-bottom: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; background: #eef2ff; color: var(--primary); }
.badge-active { background: #dcfce7; color: #166534; }
.badge-upcoming { background: #fef3c7; color: #92400e; }
.badge-ended { background: #f1f5f9; color: #64748b; }

.form-stack label { display: block; margin-bottom: 10px; font-size: 0.9rem; }
.form-stack input, .form-stack textarea, .form-stack select {
  width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font: inherit;
}

.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.header-brand { font-weight: 600; font-size: 0.95rem; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-actions select { font-size: 0.8rem; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: calc(var(--footer-h) + var(--safe-bottom));
  background: var(--surface); border-top: 1px solid var(--border); z-index: 30;
}
.bottom-nav ul { display: flex; list-style: none; margin: 0; padding: 0; }
.bottom-nav li { flex: 1; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; padding: 8px 4px;
  text-decoration: none; color: var(--text-muted); font-size: 0.72rem;
}
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav span { font-size: 1.1rem; }

.contact-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--border); padding: 8px 12px calc(8px + var(--safe-bottom));
}
.contact-footer__btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.contact-footer__cta, .contact-footer__btn {
  padding: 8px 14px; border-radius: 999px; font-size: 0.85rem; text-decoration: none; border: none; cursor: pointer;
}
.contact-footer__cta { background: var(--primary); color: #fff; }
.contact-footer__btn { background: #f1f5f9; color: var(--text); }
.contact-footer__brand { text-align: center; font-size: 0.7rem; color: var(--text-muted); margin: 6px 0 0; }

.toast-container { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 9999; }
.toast { padding: 10px 18px; border-radius: 8px; margin-bottom: 8px; color: #fff; font-size: 0.9rem; animation: toastIn 0.25s ease; }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info { background: #334155; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.empty-state { text-align: center; padding: 32px 16px; }
.empty-icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }

@media (min-width: 768px) {
  #app-root { max-width: 720px; }
}
