:root {
  --navy: #0A2540;
  --navy-2: #123A5E;
  --navy-3: #1B4B7A;
  --gold: #C9A227;
  --gold-soft: #F3E7C4;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --ink: #0F2338;
  --muted: #5C7186;
  --line: #E3E9F0;
  --ok: #1F7A5C;
  --warn: #B76E00;
  --danger: #B3261E;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 35, 56, .06), 0 8px 24px rgba(15, 35, 56, .06);
  --shadow-lg: 0 12px 40px rgba(10, 37, 64, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.boot-mark { width: 56px; height: 56px; border-radius: 16px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: .04em; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; transition: .15s ease;
  background: var(--navy); color: #fff; min-height: 44px;
}
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--navy-3); }
.btn.gold { background: var(--gold); color: #2B2205; }
.btn.gold:hover { filter: brightness(.95); }
.btn.outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn.outline-light:hover { background: rgba(255,255,255,.1); }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.danger { background: #fff; color: var(--danger); border-color: #F0C9C6; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------------ layout */
.shell { display: flex; min-height: 100vh; }
.rail {
  width: 248px; flex: 0 0 248px; background: var(--navy); color: #fff;
  padding: 24px 18px; display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.rail .brand { display: flex; align-items: center; gap: 10px; }
.rail-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(140deg, var(--navy-3), var(--navy)); border: 1px solid rgba(201,162,39,.5); display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .06em; color: var(--gold); }
.rail-name { font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.rail-sub { font-size: 11px; color: rgba(255,255,255,.6); letter-spacing: .08em; text-transform: uppercase; }
.rail nav { display: flex; flex-direction: column; gap: 4px; }
.rail nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: rgba(255,255,255,.78); font-size: 14px; font-weight: 500;
}
.rail nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail nav a.active { background: rgba(201,162,39,.16); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.rail nav a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .9; }
.rail-foot { margin-top: auto; font-size: 12px; color: rgba(255,255,255,.55); display: grid; gap: 10px; }
.rail-user { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.rail-user .nm { font-size: 13px; font-weight: 600; color: #fff; }
.rail-user .mt { font-size: 11px; color: rgba(255,255,255,.55); }
.link-light { color: var(--gold); font-size: 12px; cursor: pointer; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.content { padding: 28px 32px 90px; max-width: 1120px; width: 100%; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 640px; }

.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav .row { display: flex; }
.bottom-nav a { flex: 1; display: grid; place-items: center; gap: 3px; padding: 6px 2px; font-size: 10.5px; color: var(--muted); }
.bottom-nav a.active { color: var(--navy); font-weight: 700; }
.bottom-nav svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 17px; }
.section-head .sub { color: var(--muted); font-size: 13px; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--navy-3); flex: 0 0 auto; }
.avatar.sm { width: 36px; height: 36px; }
.avatar.md { width: 48px; height: 48px; }
.avatar.lg { width: 64px; height: 64px; }
.avatar.xl { width: 88px; height: 88px; }

.person { display: flex; gap: 14px; padding: 16px; }
.person .who { min-width: 0; flex: 1; }
.person .nm { font-weight: 650; font-size: 15px; }
.person .role { color: var(--ink); font-size: 13.5px; margin-top: 1px; }
.person .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.person .help { font-size: 13px; margin-top: 8px; color: var(--ink); background: #F7F9FC; border-radius: 10px; padding: 8px 10px; }
.person .help b { font-weight: 600; color: var(--navy); }
.person .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: #EEF2F7; color: var(--navy-2); font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
}
.chip.gold { background: var(--gold-soft); color: #6B5510; }
.chip.navy { background: var(--navy); color: #fff; }
.chip.green { background: #E4F2EC; color: var(--ok); }
.chip.grey { background: #F1F3F6; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat .v { font-size: 22px; font-weight: 700; color: var(--navy); }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

.note { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; background: #F7F9FC; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.note svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--navy-2); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=date], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(27,75,122,.25); border-color: var(--navy-3); }
textarea { min-height: 92px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--navy); }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { min-height: 42px; }
.filter-bar .grow { flex: 1 1 200px; }

/* ------------------------------------------------------------------ landing */
.landing { min-height: 100vh; background: radial-gradient(1200px 600px at 80% -10%, #1B4B7A 0%, #0A2540 55%, #071C31 100%); color: #fff; }
.landing .wrap { max-width: 1080px; margin: 0 auto; padding: 40px 24px 64px; }
.landing header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.landing .brand { display: flex; align-items: center; gap: 12px; }
.landing .hero { padding: 56px 0 32px; max-width: 720px; }
.landing h1 { font-size: clamp(34px, 6vw, 54px); letter-spacing: -.02em; }
.landing h1 em { font-style: normal; color: var(--gold); }
.landing .lede { margin-top: 18px; font-size: 17px; color: rgba(255,255,255,.82); max-width: 620px; }
.landing .cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.promise { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 40px; }
.promise .p { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 18px; }
.promise .p h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.promise .p svg { width: 18px; height: 18px; color: var(--gold); }
.promise .p p { margin-top: 8px; font-size: 13.5px; color: rgba(255,255,255,.72); }
.landing .strip { margin-top: 44px; display: flex; gap: 26px; flex-wrap: wrap; color: rgba(255,255,255,.75); font-size: 13.5px; }
.landing .strip b { color: #fff; }
.landing footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.14); font-size: 12px; color: rgba(255,255,255,.55); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; background: radial-gradient(900px 500px at 50% -10%, #1B4B7A, #0A2540 60%); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 20px; padding: 26px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 22px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 20px; }
.auth-alt { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: grid; gap: 10px; }

/* ------------------------------------------------------------------ modules */
.module-card { padding: 18px; display: grid; gap: 10px; }
.module-card .date { font-size: 12.5px; color: var(--gold); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.module-card h3 { font-size: 16px; }
.module-card .cities { color: var(--navy-2); font-size: 13.5px; font-weight: 600; }
.module-card .blurb { color: var(--muted); font-size: 13.5px; }
.module-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ posts */
.post-card { padding: 18px; display: grid; gap: 10px; }
.post-card .top { display: flex; gap: 12px; align-items: center; }
.post-card h3 { font-size: 16px; }
.post-card .details { color: var(--muted); font-size: 13.5px; }
.post-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ table (admin only) */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.bars { display: grid; gap: 10px; }
.bar .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar .track { height: 8px; background: #EDF1F6; border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--navy-3), var(--navy)); border-radius: 999px; }
.bar.gold .fill { background: linear-gradient(90deg, #D9B94B, var(--gold)); }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.toast-host { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.modal-back { position: fixed; inset: 0; background: rgba(7,28,49,.55); display: grid; place-items: center; padding: 18px; z-index: 70; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; max-height: 86vh; overflow: auto; padding: 22px; box-shadow: var(--shadow-lg); }
.modal h2 { font-size: 19px; margin-bottom: 6px; }
.modal .close { float: right; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }

.sample-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: #FDF3E2; border: 1px solid #F2DFBB; padding: 3px 8px; border-radius: 6px; }

.privacy-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.privacy-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.privacy-card h3 { font-size: 14.5px; display: flex; gap: 8px; align-items: center; }
.privacy-card p { font-size: 13px; color: var(--muted); margin-top: 8px; }

@media (max-width: 980px) {
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .rail { display: none; }
  .topbar { display: flex; }
  .bottom-nav { display: block; }
  .content { padding: 18px 16px 96px; }
  .grid.cols-2, .grid.cols-3, .privacy-grid, .form-grid, .promise { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 22px; }
}
