:root {
  --navy:#10243e; --blue:#2563eb; --sky:#eaf2ff; --ink:#172033;
  --muted:#68758a; --line:#e4e9f0; --bg:#f5f7fa; --white:#fff;
  --green:#16855b; --red:#c43d4b;
}
* { box-sizing:border-box; }
body { margin:0; font:15px/1.5 Inter,system-ui,-apple-system,sans-serif; color:var(--ink); background:var(--bg); }
a { color:inherit; text-decoration:none; }
.topbar { height:68px; background:var(--navy); color:#fff; display:flex; align-items:center; justify-content:space-between; padding:0 28px; }
.brand,.login-logo { font-size:19px; font-weight:800; letter-spacing:.08em; }
.brand span,.login-logo span { color:#64a1ff; }
.user { display:flex; gap:18px; align-items:center; }
.user form { margin:0; }
.user button { background:transparent; border:1px solid #ffffff45; color:#fff; border-radius:7px; padding:7px 12px; }
.shell { display:grid; grid-template-columns:230px 1fr; min-height:calc(100vh - 68px); }
nav { background:#fff; border-right:1px solid var(--line); padding:24px 14px; }
nav a { display:block; padding:10px 13px; border-radius:7px; margin:2px 0; }
nav a:hover { background:var(--sky); color:var(--blue); }
nav small { display:block; color:#94a0b2; font-size:10px; font-weight:700; letter-spacing:.12em; margin:22px 13px 7px; }
main { padding:30px; min-width:0; }
.pagehead { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
.pagehead h1 { font-size:26px; margin:0 0 4px; }
.pagehead p { color:var(--muted); margin:0; }
.stats { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:22px; }
.stat,.card { background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 2px 9px #17203308; }
.stat { padding:22px; }
.stat strong { display:block; font-size:30px; color:var(--navy); }
.stat span { color:var(--muted); }
.card { padding:22px; margin-bottom:20px; }
.card h2 { font-size:17px; margin:0 0 16px; }
.actions { display:flex; gap:10px; flex-wrap:wrap; }
.actions a { background:var(--sky); color:var(--blue); padding:10px 14px; border-radius:8px; }
.primary { background:var(--blue); color:#fff; border:0; border-radius:8px; padding:11px 17px; font-weight:650; }
.primary:disabled { opacity:.45; }
.alert { padding:12px 15px; border-radius:8px; margin-bottom:18px; }
.alert.error { background:#ffe9ec; color:var(--red); }
.alert.success { background:#e6f7ef; color:var(--green); }
.tablewrap { overflow:auto; }
table { border-collapse:collapse; width:100%; font-size:13px; }
th,td { text-align:left; padding:10px 12px; border-bottom:1px solid var(--line); white-space:nowrap; }
th { color:var(--muted); font-size:11px; text-transform:uppercase; }
.empty { text-align:center; color:var(--muted); padding:35px; }
.inline { display:flex; align-items:center; gap:10px; }
.inline textarea { min-height:44px; flex:1; }
.inline input,.inline textarea,.login input { border:1px solid #ccd4df; border-radius:8px; padding:11px; font:inherit; }
.login { min-height:100vh; display:grid; place-items:center; padding:22px; background:linear-gradient(135deg,#0c1e36,#193d68); }
.login section { width:min(420px,100%); background:#fff; border-radius:16px; padding:36px; box-shadow:0 20px 60px #0005; }
.login-logo { color:var(--navy); margin-bottom:30px; }
.login h1 { font-size:24px; margin:0 0 5px; }
.login p { color:var(--muted); margin:0 0 24px; }
.login label { display:block; font-weight:650; margin:14px 0; }
.login label small { color:var(--muted); font-weight:500; }
.login input { display:block; width:100%; margin-top:6px; }
.login .primary { width:100%; margin-top:10px; }
.login-links { display:flex; justify-content:center; gap:6px; flex-wrap:wrap; margin-top:22px; padding-top:18px; border-top:1px solid var(--line); font-size:13px; color:var(--muted); }
.login-links a { color:var(--blue); font-weight:700; }
.registration-page section { width:min(720px,100%); }
.registration-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 18px; }
.registration-grid label { margin-bottom:2px; }
.field-help { display:block; margin-top:5px; }
.consent { display:flex!important; align-items:flex-start; gap:10px; font-weight:500!important; }
.consent input { width:auto!important; margin:4px 0 0!important; }
.security-note { margin:16px 0; padding:12px 14px; border-radius:8px; color:#4e5f76; background:var(--sky); font-size:13px; }
.verification-code { text-align:center; font-size:25px!important; font-weight:800; letter-spacing:.32em; }
.resend-form { margin-top:12px; text-align:center; }
.resend-form button { border:0; background:transparent; color:var(--blue); font-weight:700; cursor:pointer; }
.status-card { text-align:center; }
.status-icon { display:grid; place-items:center; width:68px; height:68px; margin:0 auto 20px; border-radius:50%; font-size:34px; font-weight:800; }
.status-icon.pending { color:var(--blue); background:var(--sky); }
.status-icon.approved { color:var(--green); background:#e6f7ef; }
.status-icon.rejected { color:var(--red); background:#ffe9ec; }
.status-action { display:inline-flex; justify-content:center; margin-top:10px; }
.status-action.secondary { padding:10px 15px; border:1px solid var(--line); border-radius:8px; color:var(--ink); font-weight:700; }
.record-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.record-form label { font-weight:650; }
.record-form label span { display:block; margin-bottom:6px; }
.record-form input,.record-form textarea,.record-form select { width:100%; border:1px solid #ccd4df; border-radius:8px; padding:11px; font:inherit; background:#fff; }
.record-form label:has(textarea),.form-actions { grid-column:1/-1; }
.form-actions { display:flex; justify-content:flex-end; align-items:center; gap:18px; border-top:1px solid var(--line); padding-top:18px; }
.row-actions { display:flex; gap:7px; }
.row-actions form { margin:0; }
.row-actions button { border:0; border-radius:6px; padding:7px 10px; color:#fff; }
.row-actions .edit-action { display:inline-flex; align-items:center; border-radius:6px; padding:7px 10px; color:#fff; background:var(--blue); font-weight:700; }
.approve { background:var(--green); }
.reject { background:var(--red); }
.applications-table td strong,.applications-table td small { display:block; }
.applications-table td small { margin-top:4px; color:var(--muted); }
.status-badge { display:inline-block; padding:5px 8px; border-radius:999px; font-size:11px; font-weight:800; }
.status-badge.pending_admin { color:#8a5b00; background:#fff2cc; }
.status-badge.pending_email { color:var(--blue); background:var(--sky); }
.status-badge.approved { color:var(--green); background:#e6f7ef; }
.status-badge.rejected,.status-badge.expired { color:var(--red); background:#ffe9ec; }
.application-actions { display:grid; gap:8px; min-width:300px; }
.application-actions form { display:flex; gap:6px; margin:0; }
.application-actions input { min-width:170px; border:1px solid #ccd4df; border-radius:6px; padding:7px; font:inherit; }
.application-actions button { border:0; border-radius:6px; padding:7px 10px; color:#fff; font-weight:700; }
.muted { color:var(--muted); }
@media(max-width:800px) {
  .shell { grid-template-columns:1fr; }
  nav { display:flex; overflow:auto; border-right:0; border-bottom:1px solid var(--line); padding:8px; }
  nav small { display:none; }
  nav a { white-space:nowrap; }
  .stats { grid-template-columns:repeat(2,1fr); }
  main { padding:18px; }
  .topbar { padding:0 16px; }
  .user span { display:none; }
  .inline { align-items:stretch; flex-direction:column; }
  .record-form,.registration-grid { grid-template-columns:1fr; }
  .record-form label,.form-actions { grid-column:1; }
  .application-actions { min-width:260px; }
}
@media(max-width:480px) {
  .stats { grid-template-columns:1fr; }
  .pagehead { align-items:flex-start; gap:12px; }
  .login section { padding:25px; }
}
