:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --border: #dbe3ef;
  --primary: #155eef;
  --primary-dark: #0b3ca8;
  --primary-soft: #eaf1ff;
  --navy: #102447;
  --teal: #087f8c;
  --danger: #b42318;
  --success: #16794b;
  --warning: #b54708;
  --shadow-sm: 0 1px 3px rgba(16, 36, 71, .08);
  --shadow-md: 0 12px 30px rgba(16, 36, 71, .10);
  --radius: 16px;
  --focus: 0 0 0 3px rgba(21, 94, 239, .24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: var(--bg); line-height: 1.55; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-dark); }

.container { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 30; color: #fff; background: linear-gradient(115deg, var(--navy), #173d74 70%, #116477); box-shadow: 0 8px 22px rgba(7, 25, 54, .16); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 13px; background: rgba(255,255,255,.12); font-weight: 800; letter-spacing: -.04em; }
.brand strong, .brand small, .user-summary strong, .user-summary small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: .01em; }
.brand small, .user-summary small { color: #c9d9f0; font-size: .78rem; }
.user-summary { display: flex; align-items: center; gap: 16px; text-align: right; }
.user-summary form { margin: 0; }

.app-nav { position: sticky; top: 74px; z-index: 20; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); }
.nav-list { min-height: 54px; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.nav-list a { flex: 0 0 auto; padding: 9px 13px; color: #334155; border-radius: 10px; font-size: .9rem; font-weight: 700; text-decoration: none; }
.nav-list a:hover, .nav-list a:focus-visible { color: var(--primary-dark); background: var(--primary-soft); }
.public-nav { min-height: 20px; }

main.container { min-height: calc(100vh - 210px); padding: 34px 0 52px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1, .section-heading h2 { margin: 0; letter-spacing: -.035em; }
.page-heading h1 { font-size: clamp(1.7rem, 4vw, 2.45rem); }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: .76rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.muted, .help-text { color: var(--muted); }
.page-heading .muted { max-width: 720px; margin: 6px 0 0; }

.card { margin-bottom: 20px; padding: clamp(18px, 3vw, 28px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card h1, .card h2 { margin-top: 0; letter-spacing: -.025em; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card { position: relative; min-height: 162px; display: flex; flex-direction: column; padding: 21px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.metric-card::after { content: ""; position: absolute; right: -30px; top: -32px; width: 100px; height: 100px; border-radius: 50%; background: var(--primary-soft); }
.metric-card span { position: relative; z-index: 1; color: var(--muted); font-size: .86rem; font-weight: 750; }
.metric-card strong { position: relative; z-index: 1; margin: 10px 0 13px; font-size: 2.25rem; line-height: 1; letter-spacing: -.05em; }
.metric-card a { position: relative; z-index: 1; margin-top: auto; font-size: .85rem; font-weight: 750; text-decoration: none; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.action-card { min-height: 112px; display: flex; flex-direction: column; gap: 5px; padding: 18px; color: var(--text); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 13px; text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.action-card:hover { color: var(--text); border-color: #9bb8f5; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.action-card strong { color: var(--primary-dark); }
.action-card span { color: var(--muted); font-size: .88rem; }

.form-row { margin-bottom: 17px; }
label, legend { display: inline-block; margin-bottom: 6px; color: #26354d; font-weight: 750; }
fieldset { margin: 0 0 17px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--text); background: #fff; border: 1px solid #bdc9da; border-radius: 10px; transition: border-color .15s ease, box-shadow .15s ease; }
input:hover, select:hover, textarea:hover { border-color: #8799b2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: auto; margin-right: 7px; }
textarea { min-height: 108px; resize: vertical; }
button, .button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; color: #fff; background: var(--primary); border: 1px solid transparent; border-radius: 10px; font-weight: 780; text-decoration: none; cursor: pointer; transition: background .15s ease, transform .15s ease; }
button:hover, .button:hover { color: #fff; background: var(--primary-dark); }
button:active, .button:active { transform: translateY(1px); }
.button-small { min-height: 36px; padding: 6px 12px; font-size: .84rem; }
.button-ghost { color: #fff; background: transparent; border-color: rgba(255,255,255,.38); }
.button-ghost:hover { color: #fff; background: rgba(255,255,255,.12); }
button:disabled { opacity: .6; cursor: not-allowed; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: #42526b; background: #f2f5fa; font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcff; }

.errorlist, .alert-error { color: var(--danger); }
.alert-success { color: var(--success); }
.alert-error, .alert-success, .alert-warning { padding: 12px 14px; border-radius: 10px; background: #fff; border: 1px solid currentColor; }
.message-stack { margin-bottom: 18px; }

.site-footer { color: #d5e1f1; background: #0d1e39; }
.footer-inner { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 18px; font-size: .82rem; }
.footer-inner p { margin: 0; }
.skip-link { position: fixed; left: -9999px; top: 8px; z-index: 100; padding: 8px 12px; color: var(--primary-dark); background: #fff; border-radius: 8px; box-shadow: var(--shadow-md); }
.skip-link:focus { left: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); }

body.public main.container { max-width: 790px; padding-top: 42px; }
body.public .card { box-shadow: var(--shadow-md); }

@media (max-width: 920px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .container { width: min(100% - 22px, 1180px); }
  .header-inner { min-height: 66px; }
  .site-header { position: relative; }
  .app-nav { top: 0; }
  .brand small, .user-summary span { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  main.container { padding: 24px 0 38px; }
  .metric-grid, .action-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 130px; }
  .page-heading { align-items: start; flex-direction: column; }
  .card { padding: 17px; border-radius: 13px; }
  th, td { padding: 11px 12px; }
  .footer-inner { align-items: start; flex-direction: column; justify-content: center; padding: 18px 0; }
}
