* { box-sizing: border-box; }
:root {
  --bg: #0b1020;
  --card: #121731;
  --muted: #9aa4b2;
  --text: #e7ecf3;
  --primary: #0ea5e9;
  --primary-600: #0284c7;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow: 0 10px 30px rgba(2, 8, 23, 0.35);
}

/* Ensure elements with the hidden attribute are not displayed, even if other rules set display */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, #0b1020, #0f1830);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(11,16,32,0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 20;
}
.app-header h1 { font-size: 20px; margin: 0; letter-spacing: 0.3px; }

.icon-btn {
  border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 20px;
}

.container { padding: 16px; max-width: 900px; margin: 0 auto; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.search-sort { display: flex; gap: 10px; flex: 1 1 260px; }
.search-sort input, .search-sort select { flex: 1; min-width: 140px; }

input[type="search"], input[type="text"], input[type="date"], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
}
input::placeholder { color: #98a2b3; }

.btn { 
  padding: 10px 14px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; font-weight: 600; color: white;
}
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-600)); box-shadow: var(--shadow); }
.btn.outline { background: transparent; border-color: rgba(255,255,255,0.18); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); }

.people-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; grid-template-columns: 1fr !important; }
.person-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: var(--shadow);
}
.person-main { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #1f9cf0, #9333ea);
  flex: 0 0 44px; border: 1px solid rgba(255,255,255,0.15);
}
.meta .name { font-weight: 700; letter-spacing: .2px; }
.meta .sub { color: var(--muted); font-size: 14px; display: flex; gap: 6px; align-items: center; }

.actions { display: flex; align-items: center; gap: 6px; }
.actions .icon-btn { font-size: 18px; }
.actions .edit { filter: drop-shadow(0 2px 8px rgba(34,197,94,0.3)); }
.actions .delete { filter: drop-shadow(0 2px 8px rgba(239,68,68,0.3)); }

.empty-state { text-align: center; color: var(--muted); margin-top: 24px; }

.fab {
  position: fixed;
  right: 18px; bottom: 18px;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: white; border: none; box-shadow: 0 20px 30px rgba(14,165,233,0.35);
  cursor: pointer; font-size: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; text-align: center; -webkit-appearance: none; appearance: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 24px 36px rgba(14,165,233,0.45); }

.modal-overlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(2,8,23,0.55); backdrop-filter: blur(6px);
  animation: fadeIn .18s ease;
}
.modal {
  width: 100%; max-width: 440px; background: var(--card);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 16px;
  box-shadow: var(--shadow); transform: scale(.98); animation: popIn .18s ease forwards;
}
.form-field { display: grid; gap: 6px; margin: 10px 0; }
.form-field label { color: #c7d2fe; font-weight: 600; font-size: 14px; }
.error { color: #fca5a5; font-size: 12px; min-height: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.offline-banner {
  position: sticky; top: 0; text-align: center; padding: 8px 12px; background: #4338ca; color: white; z-index: 25; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.18);
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { transform: scale(.98); opacity: 0 } to { transform: scale(1); opacity: 1 } }

@media (min-width: 700px) {
  .people-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .people-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
