/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #c0392b;
  --red-dark:   #96281b;
  --navy:       #1a2332;
  --navy-mid:   #253449;
  --bg:         #f0f2f5;
  --surface:    #ffffff;
  --text:       #2c3e50;
  --muted:      #6b7a8d;
  --border:     #dde2e8;
  --radius:     8px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --nav-h:      56px;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: .75rem;
  height: var(--nav-h);
  background: var(--navy);
  padding: 0 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-icon { font-size: 1.2rem; }

/* hamburger — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: .2s;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: .2rem;
  flex: 1;
}

.nav-links a {
  display: block;
  padding: .45rem .8rem;
  color: rgba(255,255,255,.72);
  border-radius: var(--radius);
  font-size: .88rem;
  transition: background .15s, color .15s;
}

.nav-links a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}

.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-bottom: 2px solid var(--red);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-username {
  color: rgba(255,255,255,.65);
  font-size: .82rem;
}

.btn-logout {
  color: rgba(255,255,255,.78);
  font-size: .82rem;
  border: 1px solid rgba(255,255,255,.28);
  padding: .28rem .65rem;
  border-radius: var(--radius);
  transition: .15s;
}

.btn-logout:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}

/* ── Mobile nav ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--navy-mid);
    flex-direction: column;
    gap: 0;
    padding: .4rem 0;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    border-radius: 0;
    padding: .72rem 1.2rem;
    font-size: .95rem;
  }

  .nav-links a.active {
    border-bottom: none;
    border-left: 3px solid var(--red);
    padding-left: calc(1.2rem - 3px);
  }

  .nav-user { order: -1; margin-left: 0; }
  .nav-username { display: none; }
  .nav-brand { flex: 1; }
}

/* ── Main content ──────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ── Flash messages ────────────────────────────────────────────────────────── */
.flash-messages { margin-bottom: 1.2rem; }

.flash {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: .4rem;
  font-size: .9rem;
}

.flash-success { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.flash-error   { background: #fadbd8; color: #c0392b; border: 1px solid #f1948a; }
.flash-info    { background: #d6eaf8; color: #1a5276; border: 1px solid #85c1e9; }

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }

.page-header h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--navy);
}

.page-header .subtitle {
  color: var(--muted);
  margin-top: .2rem;
  font-size: .95rem;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .65rem;
}

/* ── Stats grid ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  border-top: 3px solid var(--red);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .3rem;
}

.stat-link {
  display: inline-block;
  margin-top: .55rem;
  font-size: .8rem;
  color: var(--red);
}

/* ── Module grid ───────────────────────────────────────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.module-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--text);
  border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  border-color: var(--red);
  text-decoration: none;
  color: var(--text);
}

.module-icon { font-size: 2.4rem; margin-bottom: .65rem; }

.module-card h3 {
  color: var(--navy);
  font-size: 1rem;
  margin-bottom: .3rem;
}

.module-card p {
  font-size: .85rem;
  color: var(--muted);
}

/* ── Status grid (reminders) ───────────────────────────────────────────────── */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.status-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
}

.status-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: .35rem;
}

.status-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .58rem 1.15rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .92rem;
  font-weight: 500;
  line-height: 1.4;
  transition: .15s;
}

.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: .3rem .75rem; font-size: .82rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: .32rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .58rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .94rem;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,.14);
}

.form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.2rem;
}

.form-check label { margin: 0; font-size: .88rem; }

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-page {
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  padding: 2rem 2rem 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-icon { font-size: 2.4rem; display: block; margin-bottom: .5rem; }

.login-header h1 {
  font-size: 1.25rem;
  color: var(--navy);
  margin-bottom: .25rem;
}

.login-header p { color: var(--muted); font-size: .88rem; }

/* ── Error pages ───────────────────────────────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.error-code {
  font-size: 5rem;
  font-weight: 800;
  color: var(--red);
  line-height: 1;
  margin-bottom: .5rem;
}

.error-page p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}
