* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #f2038d;
  --primary-dark: #9d0a5a;
  --primary-light: #f8a5c2;
  --accent: #d4a017;
  --accent-light: #f6ec8c;
  --bg: #fdf2f8;
  --card: #ffffff;
  --text: #1e1b2e;
  --muted: #6b5b7a;
  --border: #f0d6e8;
  --danger: #dc2626;
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --radius: 14px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #2a1230;
  color: var(--text);
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}
.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
}
.app-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 22px 16px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header .header-inner { display: flex; align-items: center; gap: 12px; }
.app-header .app-logo { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.7); background: #fff; flex-shrink: 0; }
.app-header .header-text { flex: 1; min-width: 0; }
.app-header h1 { font-size: 18px; font-weight: 700; letter-spacing: .2px; line-height: 1.2; }
.app-header .subtitle { font-size: 12px; opacity: .85; margin-top: 2px; }
.app-main { flex: 1; padding: 16px 16px 90px; }
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 14px;
  z-index: 20;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  gap: 2px;
  flex: 1;
}
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav .icon { font-size: 20px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
}
.hero h2 { font-size: 18px; margin-bottom: 6px; color: var(--primary-dark); }
.hero p { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--primary-dark); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
}
.stat-num { font-size: 24px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.2; }

.form .field { margin-bottom: 14px; }
.form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form input[type="text"],
.form input[type="tel"],
.form input[type="email"],
.form input[type="search"],
.form input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: #f8fafc;
  transition: border-color .15s;
}
.form input:focus { outline: none; border-color: var(--primary); background: #fff; }
.radio-group { display: flex; gap: 10px; }
.radio-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  background: #f8fafc;
  transition: all .15s;
}
.radio-pill input { accent-color: var(--primary); }
.radio-pill:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .05s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; margin-top: 8px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #e2e8f0; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block + .btn-block { margin-top: 6px; }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.flash-success { background: var(--success-light); color: var(--success); border: 1px solid #c8e6c9; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }

/* Modal popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  animation: popIn .18s ease;
}
.modal-icon { font-size: 40px; margin-bottom: 10px; }
.modal-msg { font-size: 15px; color: var(--text); margin-bottom: 16px; line-height: 1.4; }
.flash-modal.flash-success { border-top: 4px solid var(--success); }
.flash-modal.flash-error { border-top: 4px solid var(--danger); }
.flash-modal.flash-warning { border-top: 4px solid #eab308; }
.flash-modal.flash-info { border-top: 4px solid #3b82f6; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.record-list { list-style: none; }
.record-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.record-item:last-child { border-bottom: none; }
.record-link { flex: 1; text-decoration: none; color: inherit; }
.record-name { font-weight: 600; font-size: 15px; }
.record-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.record-actions { display: flex; gap: 4px; }
.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.icon-btn:hover { background: #e2e8f0; }
.icon-btn.danger:hover { background: #fee2e2; }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge-yes { background: var(--success-light); color: var(--success); }
.badge-no { background: #fee2e2; color: #991b1b; }

.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.detail-row:last-of-type { border-bottom: none; }
.detail-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.detail-value { font-size: 15px; text-align: right; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 20px 0; font-size: 14px; }

.search-form { display: flex; gap: 8px; margin-bottom: 12px; }
.search-form input { flex: 1; }
.search-form .btn { white-space: nowrap; }

.action-row { display: flex; gap: 8px; margin: 14px 0 8px; }
.action-row .btn { flex: 1; }

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.page-info { font-size: 13px; color: var(--muted); }

a { color: var(--primary); }
a.tel { color: inherit; text-decoration: none; }
