/* Innovace Temp — design system (spec §12). No inline styles: CSP style-src 'self'. */

:root {
  /* Brand palette */
  --yale-blue:     #094074;
  --baltic-blue:   #3c6997;
  --sky-aqua:      #5adbff;
  --mustard:       #ffdd4a;
  --deep-saffron:  #fe9000;

  /* Semantic tokens — light mode */
  --bg:            #f6f9fc;
  --surface:       #ffffff;
  --surface-alt:   #eaf1f8;
  --text:          #0b1b2b;
  --text-muted:    #4a5b6c;
  --primary:       var(--yale-blue);
  --primary-hover: var(--baltic-blue);
  --on-primary:    #ffffff;
  --accent:        var(--deep-saffron);
  --accent-hover:  #e58200;
  --on-accent:     #0b1b2b;
  --highlight:     var(--mustard);
  --info:          var(--sky-aqua);
  --border:        #d6e0ea;
  --focus-ring:    0 0 0 3px rgba(90, 219, 255, 0.6);
  --success-bg:    #e3f6ea;
  --success-text:  #14532d;
  --error-bg:      #fde8e8;
  --error-text:    #8a1c1c;
  --warning-bg:    #fff6d6;
  --warning-text:  #5c4500;
  --info-bg:       #e3f6fd;
  --info-text:     #08415a;

  --gradient-brand: linear-gradient(135deg, #094074, #3c6997, #5adbff, #ffdd4a, #fe9000);
  --gradient-hero:  linear-gradient(135deg, #094074, #3c6997);

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 2px rgba(11, 27, 43, 0.06), 0 4px 16px rgba(11, 27, 43, 0.06);
  --font:      "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1120px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #06182b;
    --surface:       #0c2540;
    --surface-alt:   #0a1f36;
    --text:          #eaf2fa;
    --text-muted:    #a8bccf;
    --primary:       var(--sky-aqua);
    --primary-hover: #8fe7ff;
    --on-primary:    #06182b;
    --border:        #1e3a58;
    --success-bg:    #0f3320;
    --success-text:  #b9f0cd;
    --error-bg:      #3d1414;
    --error-text:    #ffc9c9;
    --warning-bg:    #3a2f05;
    --warning-text:  #ffe9a3;
    --info-bg:       #082c3d;
    --info-text:     #bdeeff;
    --shadow:        0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:            #06182b;
  --surface:       #0c2540;
  --surface-alt:   #0a1f36;
  --text:          #eaf2fa;
  --text-muted:    #a8bccf;
  --primary:       var(--sky-aqua);
  --primary-hover: #8fe7ff;
  --on-primary:    #06182b;
  --border:        #1e3a58;
  --success-bg:    #0f3320;
  --success-text:  #b9f0cd;
  --error-bg:      #3d1414;
  --error-text:    #ffc9c9;
  --warning-bg:    #3a2f05;
  --warning-text:  #ffe9a3;
  --info-bg:       #082c3d;
  --info-text:     #bdeeff;
  --shadow:        0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; outline: none; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

code { font-size: 0.9em; background: var(--surface-alt); padding: 0.1em 0.35em; border-radius: 4px; }

.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.lead { font-size: 1.125rem; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.page { padding-top: 32px; padding-bottom: 48px; }
.narrow { max-width: 760px; }
.narrow-sm { max-width: 480px; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--primary); color: var(--on-primary);
  padding: 10px 16px; border-radius: var(--radius-sm); text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--on-primary); }

/* ---------- Header ---------- */

.brand-strip { height: 6px; background: var(--gradient-brand); }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }

.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.125rem; color: var(--text); text-decoration: none; }
.logo:hover { color: var(--text); }
.logo-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 8px; background: var(--gradient-hero); color: #fff; font-size: 0.875rem; letter-spacing: 0.02em;
}

.site-nav { position: relative; }
.nav-menu { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.nav-menu a:not(.btn) {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--text); text-decoration: none; border-radius: var(--radius-sm);
}
.nav-menu a:not(.btn):hover { background: var(--surface-alt); }
.nav-toggle { display: none; }

.theme-toggle {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); font: inherit; font-size: 0.875rem; cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
  }
  .nav-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
    flex-direction: column; align-items: stretch; min-width: 220px; padding: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .nav-menu.is-open { display: flex; }
  .nav-menu .btn, .nav-menu .theme-toggle { width: 100%; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-sm { min-height: 40px; padding: 0 14px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-alt); color: var(--text); }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
label { font-weight: 600; font-size: 0.9375rem; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
/* Checkboxes and radios outside .check rows (e.g. table row selection) keep their natural size. */
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--primary); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--info); }
.field-error { color: var(--error-text); font-size: 0.875rem; }
[aria-invalid="true"] { border-color: var(--error-text); }

/* ---------- Hero ---------- */

.hero { background: var(--gradient-hero); color: #fff; padding: 56px 0 64px; }
.hero h1 { max-width: 720px; }
.hero .lead { color: #e3eefa; max-width: 640px; }

.hero-search {
  display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end;
  margin-top: 28px; padding: 16px; background: var(--surface); color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
@media (max-width: 860px) { .hero-search { grid-template-columns: 1fr 1fr; } .hero-search .btn { grid-column: 1 / -1; } }
@media (max-width: 520px) { .hero-search { grid-template-columns: 1fr; } }

/* ---------- Sections & cards ---------- */

.section { padding: 48px 0; }
.section-alt { background: var(--surface-alt); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }

.steps { padding-left: 1.25em; margin: 0 0 1.25em; }
.steps li { margin-bottom: 0.5em; }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr; } }

.empty-state { text-align: center; padding: 40px 24px; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.6;
}
.badge-shift-evenings { background: var(--baltic-blue); color: #fff; }
.badge-shift-weekends { background: var(--mustard); color: #0b1b2b; }
.badge-shift-days-off { background: var(--sky-aqua); color: #0b1b2b; }
.badge-new { background: var(--mustard); color: #0b1b2b; }
.badge-admin { background: var(--deep-saffron); color: #0b1b2b; font-size: 0.75rem; }
.shift-legend { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Alerts ---------- */

.flashes { padding-top: 16px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error   { background: var(--error-bg);   color: var(--error-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.alert-info    { background: var(--info-bg);    color: var(--info-text); }

/* ---------- Error pages ---------- */

.error-page { text-align: center; padding-top: 64px; }
.error-code { font-size: 4rem; font-weight: 800; line-height: 1; margin-bottom: 8px; color: var(--primary); }

/* ---------- Footer ---------- */

.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0 16px; margin-top: auto; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 24px; margin-bottom: 16px; }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; } }
.footer-brand { font-weight: 700; margin-bottom: 4px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links a { display: inline-flex; min-height: 32px; align-items: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Forms (Phase 2) ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.form fieldset { border: 0; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 12px; }
.form legend { font-weight: 700; font-size: 1.125rem; margin-bottom: 8px; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
/* Side-by-side fields: hints and errors go under the input so both inputs line up
   (the DOM order, and aria-describedby, are unchanged for screen readers). */
.form-grid > .field > .hint { order: 1; }
.form-grid > .field > .field-error { order: 2; }
.field-full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.narrow-field { max-width: 240px; }
.hint { margin: 0; font-size: 0.875rem; color: var(--text-muted); }
.field-error { margin: 0; font-weight: 600; }
textarea { min-height: 88px; resize: vertical; }
input[type="file"] { padding: 8px; }

.check { display: flex; gap: 10px; align-items: flex-start; }
.check input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.check label { font-weight: 400; }

.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Honeypot: off-screen for people, visible to naive bots */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.error-summary {
  border: 2px solid var(--error-text); background: var(--error-bg); color: var(--error-text);
  border-radius: var(--radius-sm); padding: 16px; margin-bottom: 16px;
}
.error-summary h2 { font-size: 1.0625rem; margin-bottom: 6px; }
.error-summary ul { margin: 0; padding-left: 1.25em; }
.error-summary a { color: var(--error-text); }

.banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.banner p { margin: 0; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 1em; }
.details dt { font-weight: 600; color: var(--text-muted); }
.details dd { margin: 0; }
@media (max-width: 520px) { .details { grid-template-columns: 1fr; } .details dd { margin-bottom: 8px; } }

.badge-ok { background: var(--success-bg); color: var(--success-text); }
.badge-error { background: var(--error-bg); color: var(--error-text); }

.table-wrap { overflow-x: auto; margin-bottom: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-weight: 600; }

.mfa-setup { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin: 16px 0; }
.qr { background: #fff; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); max-width: 100%; height: auto; }
.secret code { font-size: 1rem; letter-spacing: 0.05em; word-break: break-all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0 24px; }
.codes code { font-size: 1rem; display: block; text-align: center; padding: 6px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-grid .card { margin-bottom: 0; }
.stat-value { font-size: 2rem; font-weight: 800; margin: 0; color: var(--primary); }

/* ---------- Admin (Phase 3) ---------- */

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.admin-nav { border-top: 1px solid var(--border); background: var(--surface); }
.admin-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; }
.admin-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--text-muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.admin-nav a:hover { color: var(--text); }
.admin-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--text-muted); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

.filters-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-bottom: 16px; }
.filters-inline input, .filters-inline select { width: auto; min-width: 180px; flex: 1 1 180px; }
.filters-inline .btn { flex: none; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.field-end { justify-content: flex-end; }

.card-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h1, .card-head h2 { margin: 0; }
.table-card { padding: 16px; }
.table-compact { font-size: 0.875rem; }
.table-compact td { vertical-align: top; }
.nowrap { white-space: nowrap; }
td.meta code { font-size: 0.8rem; word-break: break-all; }
.align-start { align-items: start; }

.btn-danger { background: #b42318; color: #fff; }
.btn-danger:hover { background: #912018; color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.stat-link { text-decoration: none; color: inherit; display: block; }
.stat-link:hover { border-color: var(--primary); color: inherit; }

.plain-list { list-style: none; padding: 0; margin: 0 0 12px; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--border); margin-left: 4px; }

.action-form { margin: 0 0 16px; }
.action-form summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--primary); }
details.action-form[open] summary { margin-bottom: 8px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.rename-form { display: flex; gap: 8px; align-items: center; }
.rename-form input { min-height: 40px; }

.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.pager span { margin-right: auto; }

textarea.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 0.875rem; line-height: 1.5; }

.prose h1, .prose h2, .prose h3 { margin-top: 1.25em; }
.prose h1:first-child, .prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose blockquote { margin: 0 0 1em; padding-left: 12px; border-left: 3px solid var(--border); color: var(--text-muted); }

/* Admin header on narrow screens: let the actions wrap instead of overflowing. */
@media (max-width: 640px) {
  .area-admin .header-inner { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .area-admin .header-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- Jobs & company area (Phase 4) ---------- */

.job-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.job-card { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.job-card h3 { margin: 0; font-size: 1.0625rem; }
.job-card h3 a { text-decoration: none; }
.job-card h3 a:hover { text-decoration: underline; }
.job-card p { margin: 0; }
.job-layout { margin-top: 8px; }
.teaser { max-width: 640px; }

.check-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.label { font-weight: 600; font-size: 0.9375rem; }
.guidance { font-size: 0.9375rem; }
.company-head { margin-bottom: 8px; }
.company-head p { margin: 0 0 4px; }

.impersonation-banner { background: var(--mustard); color: #0b1b2b; border-bottom: 2px solid #b38f00; }
.impersonation-banner .banner-inner { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding-top: 8px; padding-bottom: 8px; }
.impersonation-banner p { margin: 0; }
.impersonation-banner .btn-primary { background: #094074; color: #fff; }

/* ---------- Seekers & applications (Phase 5) ---------- */

.badge-info { background: var(--info-bg); color: var(--info-text); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list .badge { background: var(--surface-alt); color: var(--text); }
.actions-col { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.message { border-left: 3px solid var(--border); padding: 6px 0 6px 12px; margin: 12px 0; }
.apply-card { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.apply-card p { margin: 0; }

.tracker { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 4px; counter-reset: step; }
.tracker li { flex: 1 1 110px; position: relative; padding: 8px 10px 8px 34px; border-radius: var(--radius-sm); background: var(--surface-alt); color: var(--text-muted); font-size: 0.875rem; counter-increment: step; }
.tracker li::before { content: counter(step); position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 50%; background: var(--border); color: var(--text); font-size: 0.75rem; display: grid; place-items: center; }
.tracker li.done { color: var(--text); }
.tracker li.done::before { background: var(--primary); color: var(--on-primary); content: "✓"; }
.tracker li.current { outline: 2px solid var(--primary); font-weight: 600; }

/* ---------- Privacy (Phase 6) ---------- */
.danger-zone { border-color: #e4a6a0; }
.danger-zone h2 { color: var(--error-text); }

/* =====================================================================
   Mobile design pass (Phase 7) — phones first, then tablets.
   ===================================================================== */

html { scroll-behavior: smooth; scroll-padding-top: 76px; }
img, svg { max-width: 100%; }

/* ---- Job cards: whole card is tappable ---- */
.job-card { position: relative; padding: 20px 44px 20px 20px; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.job-card:hover { border-color: var(--primary); box-shadow: 0 6px 24px rgba(9, 64, 116, 0.12); }
.job-card:active { transform: scale(0.995); }
.stretched-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.stretched-link:focus-visible { box-shadow: none; }
.stretched-link:focus-visible::after { box-shadow: var(--focus-ring); }
.job-card-meta { margin: 0; color: var(--text-muted); font-size: 0.875rem; }
.job-card-dates { margin: 0; color: var(--text-muted); font-size: 0.8125rem; }
.job-card-arrow { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.25rem; transition: transform .15s ease, color .15s ease; }
.job-card:hover .job-card-arrow { color: var(--primary); transform: translate(3px, -50%); }

/* ---- Job search: one search bar + collapsible filters ---- */
.job-search { padding: 16px; }
.search-bar { display: flex; gap: 8px; }
.search-bar input { flex: 1; min-width: 0; }
.search-bar .btn { flex: none; }
.more-filters { margin-top: 12px; }
.more-filters > summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 600; list-style: none;
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::after { content: "▾"; font-size: 0.85em; transition: transform .15s ease; }
.more-filters[open] > summary::after { transform: rotate(180deg); }
.more-filters[open] > summary { margin-bottom: 12px; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.results-count { font-weight: 600; margin: 8px 0 12px; }

/* ---- Job page: facts grid and sticky call to action ---- */
.facts { grid-template-columns: max-content 1fr; }
.mobile-cta, .mobile-cta-spacer { display: none; }

/* ---- Tabs: one swipeable line ---- */
.tabs {
  flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar, .admin-nav ul::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; flex: none; scroll-snap-align: start; }
.admin-nav ul { scrollbar-width: none; }

/* ---- Jump links (applicant page) ---- */
.jump-links { display: none; gap: 8px; margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.jump-links a {
  flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: 0.875rem;
}

/* ---- Spacing: sections stacked after a grid ---- */
.grid-2 + .card, .grid-3 + .card, .grid-2 + section, .stat-grid + .grid-2 { margin-top: 24px; }

/* ---- Mobile menu: hamburger icon ---- */
.nav-toggle::before {
  content: ""; display: inline-block; width: 18px; height: 2px; margin: 0 10px 0 0; background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor; border-radius: 2px; transition: transform .15s ease;
}
.nav-toggle[aria-expanded="true"]::before { box-shadow: none; transform: rotate(45deg); }

/* =================== Tablets and below =================== */
@media (max-width: 860px) {
  .job-layout { display: flex; flex-direction: column; }
  .job-layout .job-facts-card { order: -1; }
  .job-layout > .card { margin-bottom: 16px; }

  .mobile-cta {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px rgba(11, 27, 43, 0.12);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
  .mobile-cta-text { margin: 0; font-size: 0.9375rem; }
  .mobile-cta .btn { flex: none; min-width: 120px; }
  .mobile-cta-spacer { display: block; height: calc(76px + env(safe-area-inset-bottom)); }
  .apply-card .actions-row { display: none; } /* the sticky bar carries the Apply button */

  .jump-links { display: flex; }
}

/* =================== Phones =================== */
@media (max-width: 760px) {
  .site-header { position: sticky; top: 0; z-index: 30; }
  .header-inner { min-height: 60px; }
  .nav-menu {
    position: fixed; left: 0; right: 0; top: 66px; min-width: 0; border-radius: 0 0 var(--radius) var(--radius);
    padding: 8px 16px 16px; gap: 2px; max-height: calc(100vh - 66px); overflow-y: auto;
    box-shadow: 0 16px 40px rgba(11, 27, 43, 0.18);
  }
  .nav-menu a:not(.btn) { min-height: 52px; font-size: 1.0625rem; border-bottom: 1px solid var(--border); border-radius: 0; }
  .nav-menu .btn, .nav-menu .theme-toggle { min-height: 48px; margin-top: 8px; }
  .nav-menu .inline-form { display: block; }
  .impersonation-banner + .site-header .nav-menu { top: auto; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.625rem; }
  h2 { font-size: 1.1875rem; }
  .page { padding-top: 20px; padding-bottom: 32px; }
  .section { padding: 32px 0; }
  .card { padding: 18px; margin-bottom: 16px; border-radius: 12px; }
  .grid-2, .grid-3 { gap: 16px; }
  .hero { padding: 32px 0 40px; }
  .hero .lead { font-size: 1rem; }
  .lead { font-size: 1.0625rem; }

  /* Buttons stack full-width in action rows */
  .actions-row { flex-direction: column; align-items: stretch; }
  .actions-row > .btn, .actions-row > form, .actions-row > form .btn { width: 100%; }
  .card-head { align-items: flex-start; }

  .filters-inline { flex-direction: column; align-items: stretch; }
  .filters-inline input, .filters-inline select, .filters-inline .btn { width: 100%; }
  .filter-actions .btn { flex: 1; }

  /* Tables become labelled cards (labels are added by app.js) */
  table[data-stack] thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table[data-stack], table[data-stack] tbody, table[data-stack] tr, table[data-stack] td { display: block; width: 100%; }
  table[data-stack] tr { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface); box-shadow: var(--shadow); }
  table[data-stack] td { border: 0; padding: 6px 0; display: grid; grid-template-columns: 38% 1fr; gap: 10px; align-items: start; }
  table[data-stack] td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: 0.8125rem; }
  /* Cells with several elements (badge + note, name + headline) keep them all in the value column. */
  table[data-stack] td[data-label]:not([data-label=""]) { row-gap: 4px; }
  table[data-stack] td[data-label]:not([data-label=""]) > * { grid-column: 2; }
  table[data-stack] td:not([data-label]), table[data-stack] td[data-label=""] { grid-template-columns: 1fr; }
  table[data-stack] td:not([data-label])::before, table[data-stack] td[data-label=""]::before { content: none; }
  .table-wrap { overflow: visible; }
  .table-card { padding: 0; background: transparent; border: 0; box-shadow: none; }

  .details { grid-template-columns: 1fr; }
  .facts { grid-template-columns: minmax(84px, 30%) 1fr; gap: 10px 12px; }
  .facts dd { margin-bottom: 0; }

  .tracker li { flex: 1 1 100%; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-value { font-size: 1.625rem; }

  .footer-inner { gap: 16px; }
  .footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .site-footer { padding-top: 24px; }

  .error-summary { padding: 12px; }
  .codes { grid-template-columns: 1fr; }
  .mfa-setup { justify-content: center; text-align: center; }
}

@media (max-width: 380px) {
  .search-bar { flex-direction: column; }
  .search-bar .btn { width: 100%; }
  .stat-grid { grid-template-columns: 1fr; }
}

@media (hover: none) {
  .job-card:hover { box-shadow: var(--shadow); border-color: var(--border); }
}

/* Phase 7 refinements */
@media (max-width: 640px) {
  table[data-stack] td { justify-items: start; }
  .details { grid-template-columns: minmax(96px, 34%) 1fr; gap: 8px 12px; }
  .details dd { margin-bottom: 0; overflow-wrap: anywhere; }
}

/* Tappable checkbox chips and form section dividers */
.check-row .check, .check-grid .check {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface);
  align-items: center; cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.check-row .check label, .check-grid .check label { cursor: pointer; flex: 1; }
.check-row .check:has(input:checked), .check-grid .check:has(input:checked) { border-color: var(--primary); background: var(--info-bg); }
.check-row { gap: 8px; }
.form fieldset + fieldset > legend { width: 100%; border-top: 1px solid var(--border); padding-top: 20px; }
@media (max-width: 640px) {
  .check-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .check-row .check { flex: 1 1 calc(50% - 8px); }
}
@media (max-width: 340px) { .check-grid { grid-template-columns: 1fr; } }

/* Mobile menu polish */
@media (max-width: 760px) {
  .nav-menu li { width: 100%; }
  .nav-menu a:not(.btn) { display: flex; width: 100%; padding: 0 4px; }
  .nav-menu a:not(.btn):hover { background: transparent; color: var(--primary); }
}
.nav-toggle[aria-expanded="true"]::before {
  content: "\2715"; width: auto; height: auto; background: none; box-shadow: none; transform: none; font-size: 15px; line-height: 1;
}

.job-list .job-card { margin: 0; }

/* Admin & inline filters on phones */
@media (max-width: 640px) {
  .filters-inline input, .filters-inline select { flex: none; min-width: 0; }
  .header-actions .theme-toggle { width: 44px; padding: 0; font-size: 0; }
  .header-actions .theme-toggle::before { content: "\25D0"; font-size: 18px; }
  .area-admin .header-inner { flex-wrap: nowrap; }
  .area-admin .header-actions { width: auto; }
  .area-admin .logo { min-width: 0; font-size: 1rem; }
}
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 340px) {
  .stat-grid { grid-template-columns: 1fr; }
  .area-admin .badge-admin { display: none; }
}

@media (max-width: 440px) {
  .area-admin .logo-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stat-grid .card { padding: 14px; }
}
.logo { white-space: nowrap; }
