@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&family=Work+Sans:wght@400;500;600;700&display=swap");

:root {
  --color-primary: #1e40af;
  --color-primary-strong: #0b2f6b;
  --color-secondary: #3b82f6;
  --color-accent: #15803d;
  --color-background: #eff6ff;
  --color-surface: #ffffff;
  --color-ink: #10233f;
  --color-muted: #52637a;
  --color-border: #c8d9ef;
  --color-soft: #f7faff;
  --color-warning: #b45309;
  --color-danger: #b91c1c;
  --navy: var(--color-primary-strong);
  --blue: var(--color-primary);
  --gold: #d99c22;
  --ink: var(--color-ink);
  --muted: var(--color-muted);
  --line: var(--color-border);
  --surface: var(--color-surface);
  --soft: var(--color-background);
  --danger: var(--color-danger);
  --shadow-sm: 0 1px 2px rgba(11, 47, 107, .07);
  --shadow-md: 0 14px 34px rgba(11, 47, 107, .1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, #f7faff 0, var(--color-background) 36rem);
  color: var(--color-ink);
  font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
a { color: var(--color-primary); text-underline-offset: .2em; }
a:hover { color: var(--color-primary-strong); }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 30; transform: translateY(-160%); padding: .65rem 1rem; border-radius: 6px; background: #fff; color: var(--color-primary-strong); box-shadow: var(--shadow-md); }
.skip-link:focus { transform: none; }

header { background: var(--color-primary-strong); color: #fff; }
.header-inner, .shell { width: min(1240px, calc(100% - 2rem)); margin-inline: auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.brand img { width: 48px; height: 48px; object-fit: contain; }
.brand span { display: grid; }
.brand strong { font-family: "Outfit", sans-serif; font-size: 1.06rem; }
.brand small { color: #c8d8ef; }
header nav { display: flex; align-items: center; gap: 1.5rem; }
header nav a { color: #e9f1ff; font-weight: 600; text-decoration: none; }
header nav a:hover { color: #fff; text-decoration: underline; }

.shell { padding: clamp(1.5rem, 4vw, 3rem) 0 4rem; }
h1, h2 { margin-top: 0; color: var(--color-primary-strong); font-family: "Outfit", sans-serif; line-height: 1.15; }
h1 { margin-bottom: 1rem; font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.03em; }
h2 { margin-bottom: .65rem; font-size: clamp(1.22rem, 2vw, 1.55rem); }
p { margin-top: 0; }
.eyebrow, .step-label, .form-kicker { margin: 0 0 .75rem; color: var(--color-primary); font-size: .75rem; font-weight: 700; letter-spacing: .14em; }
.lead { max-width: 62ch; color: var(--color-muted); font-size: 1.07rem; }
.muted, .help, .field-help { color: var(--color-muted); }
.field-help { margin: -.25rem 0 .35rem; font-size: .88rem; }

.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 500px); align-items: center; gap: clamp(2rem, 7vw, 6rem); min-height: calc(100vh - 180px); }
.login-context { padding: 2rem 0; }
.login-context h1 { max-width: 13ch; }
.login-card, .panel, .access-form-card { border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface); box-shadow: var(--shadow-sm); }
.login-card { padding: clamp(1.5rem, 4vw, 2.25rem); box-shadow: var(--shadow-md); }
.login-card h2 { font-size: 1.75rem; }
.security-list { display: grid; gap: 1rem; margin: 2rem 0; padding: 0; list-style: none; }
.security-list li { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: .85rem; align-items: start; }
.security-list strong, .security-list small { display: block; }
.security-list small { margin-top: .12rem; color: var(--color-muted); }
.security-icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #b7cdf0; border-radius: 8px; background: #eaf2ff; color: var(--color-primary); }
.security-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.support-note { padding: .9rem 1rem; border-left: 3px solid var(--color-accent); background: #f0fdf4; color: #244234; }

form { display: grid; gap: .7rem; margin-top: 1.35rem; }
label { color: #213650; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 48px; padding: .78rem .9rem; border: 1px solid #93a6be; border-radius: 7px; background: #fff; color: var(--color-ink); transition: border-color 180ms ease, box-shadow 180ms ease; }
input::placeholder, textarea::placeholder { color: #6b7d93; }
input:focus, select:focus, textarea:focus, a:focus-visible, button:focus-visible { outline: 3px solid rgba(30, 64, 175, .22); outline-offset: 2px; border-color: var(--color-primary); }
button, .button-link { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--color-primary); border-radius: 7px; background: var(--color-primary); color: #fff; padding: .74rem 1rem; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
button:hover, .button-link:hover { border-color: var(--color-primary-strong); background: var(--color-primary-strong); color: #fff; }
button:disabled { opacity: .62; cursor: wait; }
.secondary { border-color: #94a6bc; background: #fff; color: var(--color-primary-strong); }
.secondary:hover { border-color: var(--color-primary); background: #edf4ff; color: var(--color-primary-strong); }
.help { margin: 1.25rem 0 0; font-size: .92rem; }
.demo-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.demo-entry p { margin: 0; font-size: .92rem; }

.dashboard-utility { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border); color: var(--color-muted); font-size: .88rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.heading h1 { margin-bottom: .35rem; }
.actions { display: flex; gap: .65rem; flex-wrap: wrap; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0; }
.metrics article { position: relative; display: grid; min-height: 150px; padding: 1.25rem; overflow: hidden; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; }
.metrics article::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--color-primary); content: ""; }
.metrics span { color: var(--color-muted); font-size: .9rem; font-weight: 600; }
.metrics strong { align-self: center; color: var(--color-primary-strong); font-family: "Outfit", sans-serif; font-size: 2.6rem; line-height: 1; }
.metrics small { color: var(--color-muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(260px, .72fr) minmax(0, 1.7fr); gap: 1rem; align-items: start; }
.panel { margin-bottom: 1rem; padding: 1.4rem; }
.trend-panel, .candidate-panel { margin: 0; }
.notice, .status { margin: 1rem 0; padding: 1rem; border-left: 4px solid var(--color-warning); background: #fff8e8; }
.status:empty { display: none; }
.status.error { border-color: var(--color-danger); background: #fef2f2; color: var(--color-danger); }
.notice p { margin: .35rem 0 .85rem; }
.notice button { width: auto; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.section-heading h2 { margin: .1rem 0 .25rem; }
.readonly-label { color: var(--color-muted); font-weight: 700; white-space: nowrap; }
.referral-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2rem; margin-top: 1rem; }
.referral-copy label { display: block; margin: .9rem 0 .35rem; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; }
.copy-row input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.feedback { min-height: 1.55em; margin: .45rem 0 0; }
.qr-card { display: grid; justify-items: center; gap: .75rem; }
.qr-card canvas { display: block; width: 200px; max-width: 100%; height: auto; border: 1px solid var(--color-border); background: #fff; }
.qr-card button { width: 100%; }

.profile-list { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(0, 2fr); margin: 0; }
.profile-list dt, .profile-list dd { padding: .7rem 0; border-bottom: 1px solid var(--color-border); }
.profile-list dt { color: var(--color-muted); font-weight: 700; }
.profile-list dd { margin: 0; overflow-wrap: anywhere; }
.profile-form { gap: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid label { display: grid; align-content: start; gap: .35rem; }
.form-grid .wide { grid-column: 1 / -1; }
fieldset { padding: 1rem; border: 1px solid var(--color-border); border-radius: 9px; }
legend { color: var(--color-primary-strong); font-family: "Outfit", sans-serif; font-weight: 700; }
dialog { width: min(680px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 24px 70px rgba(11, 47, 107, .3); }
dialog::backdrop { background: rgba(9, 30, 62, .7); }
.dialog-card { margin: 0; padding: 1.5rem; }
.progress-dialog { width: min(430px, calc(100% - 2rem)); overflow: hidden; }
.progress-card { padding: 2rem; text-align: center; }
.progress-card h2 { margin: 0 0 .6rem; }
.progress-card p:last-child { margin-bottom: 0; }
.progress-mark { width: 72px; height: 72px; margin: 0 auto 1.25rem; display: flex; align-items: center; justify-content: center; gap: .35rem; border-radius: 50%; background: #eaf2ff; }
.progress-mark span { width: 9px; height: 9px; border-radius: 50%; background: var(--color-primary); animation: progress-pulse 1.05s ease-in-out infinite; }
.progress-mark span:nth-child(2) { animation-delay: 140ms; }
.progress-mark span:nth-child(3) { animation-delay: 280ms; }
@keyframes progress-pulse { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-7px); } }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .75rem; border-bottom: 1px solid var(--color-border); text-align: left; }
th { background: #f3f7fd; color: #39506c; font-size: .78rem; letter-spacing: .03em; text-transform: uppercase; }
tbody tr { transition: background-color 180ms ease; }
tbody tr:hover { background: #f7faff; }
th:last-child, td:last-child { text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid #e0e9f5; border-radius: 8px; }
.candidate-table th:last-child, .candidate-table td:last-child { text-align: left; }
.candidate-table th:nth-child(4), .candidate-table td:nth-child(4) { text-align: right; }
.candidate-table td, .candidate-table th { vertical-align: top; }
.candidate-table td:nth-child(5) { min-width: 12rem; }

@media (max-width: 960px) {
  .login-layout { grid-template-columns: minmax(0, .85fr) minmax(350px, 1fr); gap: 2rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header-inner { min-height: 68px; }
  header nav { gap: 1rem; }
  header nav a:first-child { display: none; }
  .shell { padding-top: 1.25rem; }
  .login-layout { display: flex; min-height: auto; flex-direction: column; align-items: stretch; }
  .login-context { padding: 1rem 0 0; }
  .login-context h1 { max-width: 18ch; }
  .security-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: 1fr; }
  .metrics article { min-height: 120px; }
  .referral-panel, .form-grid, .copy-row { grid-template-columns: 1fr; }
  .section-heading, .heading { display: grid; }
  .readonly-label { white-space: normal; }
  .profile-list { grid-template-columns: 1fr; }
  .profile-list dt { padding-bottom: 0; border-bottom: 0; }
  .profile-list dd { padding-top: .2rem; }
  .qr-card { justify-self: center; width: min(100%, 232px); }
}

@media (max-width: 540px) {
  .header-inner, .shell { width: min(100% - 1.25rem, 1240px); }
  .brand img { width: 42px; height: 42px; }
  .brand strong { font-size: .95rem; }
  .brand small { font-size: .76rem; }
  header nav a { font-size: .86rem; }
  .login-card, .panel { padding: 1.1rem; }
  .security-list { grid-template-columns: 1fr; }
  .demo-entry { grid-template-columns: 1fr; }
  .dashboard-utility { align-items: stretch; flex-direction: column; }
  .actions, .actions button, .heading button, .copy-row button, .notice button { width: 100%; }
  .candidate-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .candidate-table tr { display: grid; padding: .65rem; border-bottom: 1px solid var(--color-border); }
  .candidate-table th, .candidate-table td, .candidate-table th:nth-child(4), .candidate-table td:nth-child(4), .candidate-table th:last-child, .candidate-table td:last-child { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; padding: .3rem 0; border: 0; text-align: left; }
  .candidate-table td::before, .candidate-table th::before { color: var(--color-muted); font-weight: 700; content: attr(data-label); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
