*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #a00000;
  --red-dark: #7a0000;
  --text: #1a1a1a;
  --muted: #666;
  --border: #e0e0e0;
  --bg: #f8f8f8;
  --white: #fff;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
}

/* NAV */
nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
nav .brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--red);
  text-decoration: none;
  margin-right: auto;
}
nav .brand img { height: 28px; width: auto; }
nav a {
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  padding: .25rem .5rem;
  border-radius: 4px;
  transition: background .15s;
}
nav a:hover { background: var(--bg); }
nav a.active { color: var(--red); font-weight: 600; }

/* CONTAINER */
.container {
  max-width: 680px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.container.narrow { max-width: 440px; }

/* CARD */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

/* FORM */
.form-group { margin-bottom: 1rem; }
label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--text);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--white);
  transition: border-color .15s;
}
input:focus {
  outline: none;
  border-color: var(--red);
}

/* BUTTONS */
.btn {
  display: inline-block;
  padding: .65rem 1.25rem;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s;
}
.btn-primary {
  background: var(--red);
  color: var(--white);
}
.btn-primary:hover { background: var(--red-dark); }
.btn-block { width: 100%; text-align: center; }

/* ALERTS */
.alert {
  padding: .75rem 1rem;
  border-radius: 6px;
  font-size: .9rem;
  margin-bottom: 1rem;
}
.alert-error { background: #fdeaea; color: #8b0000; border: 1px solid #f5c6c6; }
.alert-success { background: #eaf5ea; color: #1a5c1a; border: 1px solid #b2d8b2; }

/* STATUS BADGE */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
}
.badge-active { background: #eaf5ea; color: #1a5c1a; }
.badge-inactive { background: #f5f5f5; color: var(--muted); }

/* DASHBOARD GRID */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 520px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* RESPONSIVE TABLE */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1.75rem;
  padding: 0 1.75rem;
}
.table-responsive table { min-width: 520px; }

/* ADMIN STATS GRID (3 cols) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* WIDE CONTAINER (admin) */
.container.wide { max-width: 860px; }

/* MOBILE NAV */
@media (max-width: 600px) {
  nav { gap: .75rem; padding: 0 .75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  nav a { font-size: .82rem; padding: .2rem .3rem; white-space: nowrap; }
  nav .brand { font-size: .95rem; }
}

/* HIDE ON MOBILE */
@media (max-width: 480px) {
  .hide-mobile { display: none !important; }
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); }
.info-value { font-weight: 500; }

/* PAGE TITLE */
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

/* AUTH LOGO */
.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-logo img { height: 48px; }
.auth-logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--red);
  margin-top: .5rem;
}

.link-row {
  text-align: center;
  font-size: .875rem;
  margin-top: 1rem;
  color: var(--muted);
}
.link-row a { color: var(--red); text-decoration: none; font-weight: 600; }

.code-input {
  text-align: center;
  font-size: 2rem;
  letter-spacing: .5rem;
  font-weight: 700;
  width: 100%;
}
