:root {
  --bg: #0d1b2a;
  --surface: #1b2838;
  --surface2: #243447;
  --border: #2e4057;
  --text: #e8eef4;
  --muted: #8b9cb3;
  --primary: #3d8bfd;
  --primary-d: #2a6fd6;
  --accent: #f0a500;
  --danger: #e74c3c;
  --success: #2ecc71;
  --radius: 14px;
  --nav-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.view { min-height: 100dvh; }

/* Access */
#view-access {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(165deg, #0d1b2a 0%, #1a3a5c 100%);
}
.access-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--border);
}
.brand { font-size: 48px; margin-bottom: 8px; }
.access-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.tagline { color: var(--muted); font-size: 0.9rem; margin-bottom: 24px; }

label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 12px 0 6px;
}
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background .15s, transform .1s;
  color: var(--text);
  background: var(--surface2);
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); color: #fff; width: 100%; margin-top: 18px; }
.btn.primary:hover { background: var(--primary-d); }
.btn.sm { padding: 8px 14px; font-size: 0.85rem; width: auto; }
.btn.danger { background: var(--danger); color: #fff; width: 100%; margin-top: 16px; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 16px;
  cursor: pointer;
  text-decoration: underline;
}
.hint { font-size: 0.8rem; color: var(--muted); margin: 10px 0; text-align: left; }

/* App shell */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.user-info small { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; }
.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 8px 2px;
  cursor: pointer;
}
.nav-item.active { color: var(--primary); }

.content {
  padding: 16px 16px calc(var(--nav-h) + 20px);
  max-width: 640px;
  margin: 0 auto;
}
.page { display: none; }
.page.active { display: block; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
h2 { font-size: 1.3rem; margin-bottom: 12px; }
h3 { font-size: 1rem; color: var(--muted); margin: 20px 0 10px; }

.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}
.chip:hover { border-color: var(--primary); }

/* Cards */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card h4 { font-size: 1.05rem; margin-bottom: 6px; }
.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.card p { font-size: 0.9rem; color: #c5d0de; margin-bottom: 10px; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge.active { background: #1b4332; color: #95d5b2; }
.badge.full { background: #5c3d1e; color: #ffd166; }
.badge.pending { background: #3d2b1f; color: var(--accent); }
.muted { color: var(--muted); font-size: 0.9rem; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }

/* Forms */
.form { margin-top: 12px; }
.form .btn { margin-top: 16px; }
.tabs-mini { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-mini {
  flex: 1;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}
.tab-mini.active { border-color: var(--primary); color: var(--primary); }

.row { display: flex; gap: 10px; }
.row input { flex: 1; }

/* Admin */
.admin-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.admin-block h3 { margin-bottom: 12px; font-size: 1rem; }
.invite-box {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  word-break: break-all;
  font-family: monospace;
  font-size: 1.1rem;
  color: var(--accent);
  text-align: center;
}

/* Toast & Modal */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all .3s;
  z-index: 100;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.error { background: var(--danger); }
#toast.success { background: #1b7a3d; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}
.modal-card h3 { margin-bottom: 12px; }
.modal-card .btn { width: 100%; margin-top: 16px; }

.offer {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin: 4px 0 8px;
}
