:root {
  --navy: #14213D;
  --navy-light: #1F2E52;
  --amber: #FCA311;
  --amber-dark: #E08E00;
  --paper: #F7F6F2;
  --card: #FFFFFF;
  --ink: #1B1F27;
  --slate: #6B7280;
  --line: #E5E3DD;
  --ok: #2E7D32;
  --ok-bg: #E8F5E9;
  --danger: #C0392B;
  --danger-bg: #FDECEA;
  --pending-bg: #FFF4E0;
  --pending: #9A6300;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,33,61,0.06), 0 4px 16px rgba(20,33,61,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

h1, h2, h3, .display {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Top nav ---------- */
.topnav {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
}
.topnav .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: Georgia, serif; font-size: 20px; font-weight: 700;
}
.topnav .brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--amber); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.topnav .nav-right { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topnav .nav-right .who { color: #C9D0E0; }
.topnav button.link {
  background: none; border: none; color: #C9D0E0;
  font-size: 14px; padding: 6px 10px;
}
.topnav button.link:hover { color: #fff; }

/* ---------- Landing / Auth ---------- */
.landing-hero {
  background: var(--navy);
  color: #fff;
  padding: 90px 28px 110px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.landing-hero::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 50% 0%, rgba(252,163,17,0.18), transparent 70%);
}
.landing-hero h1 { font-size: 44px; max-width: 680px; margin: 0 auto 18px; position: relative; }
.landing-hero p { font-size: 18px; color: #C9D0E0; max-width: 560px; margin: 0 auto 34px; position: relative; }
.landing-hero .cta-row { display: flex; gap: 14px; justify-content: center; position: relative; flex-wrap: wrap; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 28px; width: 100%; }
.auth-wrap { display: flex; justify-content: center; padding: 48px 20px; }
.auth-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 36px; width: 100%; max-width: 420px;
}
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { color: var(--slate); font-size: 14px; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--navy); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--amber); outline-offset: 1px; border-color: var(--amber);
}
.role-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.role-toggle button {
  flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 14px; font-weight: 600; color: var(--slate);
}
.role-toggle button.active { border-color: var(--navy); background: var(--navy); color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.btn-primary { background: var(--amber); color: var(--navy); }
.btn-primary:hover { background: var(--amber-dark); }
.btn-outline { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); }
.btn-outline:hover { border-color: #fff; }
.btn-block { width: 100%; }
.btn-small { padding: 7px 14px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #F3C6C1; }
.btn-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #BFE3C1; }

.switch-row { margin-top: 18px; font-size: 13px; color: var(--slate); text-align: center; }
.switch-row button { background: none; border: none; color: var(--amber-dark); font-weight: 700; }

.error-banner {
  background: var(--danger-bg); color: var(--danger); border: 1px solid #F3C6C1;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}

/* ---------- Dashboard layout ---------- */
.dash { display: flex; flex: 1; }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--line);
  padding: 24px 14px; flex-shrink: 0;
}
.sidebar button {
  display: block; width: 100%; text-align: left; padding: 10px 14px;
  border: none; background: none; border-radius: 8px; font-size: 14px;
  color: var(--navy); margin-bottom: 4px; font-weight: 600;
}
.sidebar button.active { background: var(--navy); color: #fff; }
.sidebar button:hover:not(.active) { background: var(--paper); }
.main { flex: 1; padding: 32px; min-width: 0; }
.main h2.page-title { font-size: 26px; margin-bottom: 22px; }

/* ---------- Cards / lists ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h3 { font-size: 17px; margin-bottom: 4px; }
.card .meta { color: var(--slate); font-size: 13px; margin-bottom: 10px; }
.card .desc { font-size: 14px; color: #374151; margin-bottom: 14px; }
.card .card-actions { display: flex; gap: 8px; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  font-size: 12px; font-weight: 700;
}
.pill.pending { background: var(--pending-bg); color: var(--pending); }
.pill.accepted { background: var(--ok-bg); color: var(--ok); }
.pill.rejected { background: var(--danger-bg); color: var(--danger); }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--slate);
  border: 1px dashed var(--line); border-radius: var(--radius); background: #fff;
}
.empty-state h3 { color: var(--navy); margin-bottom: 6px; }

.list-row {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap;
}
.list-row .info h3 { font-size: 15px; margin-bottom: 3px; }
.list-row .info .meta { font-size: 13px; color: var(--slate); }
.list-row .actions { display: flex; gap: 8px; align-items: center; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,33,61,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 28px; max-width: 440px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal h3 { margin-bottom: 14px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); z-index: 100;
}

.loading { padding: 40px; text-align: center; color: var(--slate); }

@media (max-width: 760px) {
  .dash { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 12px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar button { width: auto; white-space: nowrap; }
  .landing-hero h1 { font-size: 32px; }
  .main { padding: 20px; }
}
