:root {
  --navy: #0A2238;
  --navy-2: #12304d;
  --accent: #00A2E9;
  --accent-dark: #0083bd;
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --text: #16202B;
  --muted: #5A6675;
  --placeholder: #A0A8B4;
  --border: #D5DBE3;
  --success: #1A6B3A;
  --danger: #B42318;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; font-size: 16px; line-height: 1.5; }
.topbar { background: var(--navy); display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; gap: 16px; }
.brand img { height: 40px; width: auto; display: block; }
.userbar { color: #DCE6F0; display: flex; gap: 16px; align-items: center; font-size: 15px; }
.link-light { background: none; border: 0; color: #fff; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.view { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 32px 20px 48px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }

.auth { max-width: 440px; margin: 24px auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 20px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; color: var(--navy); }
h2 { font-size: 19px; margin: 0 0 12px; color: var(--navy); }
.sub { color: var(--muted); margin: 0 0 20px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
input, select { width: 100%; font: inherit; font-size: 16px; color: var(--text); padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: #fff; }
input::placeholder { color: var(--placeholder); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,162,233,.18); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; border-radius: 999px; padding: 12px 22px; border: 0; cursor: pointer; background: var(--navy); color: #fff; text-decoration: none; }
.btn:hover { background: var(--navy-2); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.block { width: 100%; margin-top: 20px; }
.btn.secondary { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.danger { background: #fff; color: var(--danger); border: 1.5px solid #E6B5B0; }
.links { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; text-align: center; }
a, .linkbtn { color: var(--accent-dark); font-weight: 600; }
.linkbtn { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.note { background: #EAF6FD; border: 1px solid #BFE3F7; color: #0C3C57; border-radius: 10px; padding: 12px 14px; font-size: 15px; margin: 0 0 16px; }
.error { background: #FDECEA; border: 1px solid #F3C1BC; color: var(--danger); border-radius: 10px; padding: 12px 14px; font-size: 15px; margin: 12px 0 0; }
.ok { color: var(--success); font-weight: 600; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .k { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; }
.row-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 12px; align-items: end; }
.row-form label { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 12px 10px; border-bottom: 1px solid #EDF0F4; vertical-align: middle; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 6px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #E8EDF3; color: var(--navy); }
.pill.admin { background: #DDF1FB; color: #00577D; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 8px 0; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.spinner { text-align: center; color: var(--muted); padding: 60px 0; }
@media (max-width: 640px) {
  .row-form { grid-template-columns: 1fr; }
  .brand img { height: 32px; }
  td.actions .btn { margin: 4px 0 0 6px; }
  .card { padding: 20px; }
}

[hidden] { display: none !important; }
