:root {
  --ink: #14243A;
  --ink-2: #1F3350;
  --ivory: #F7F5F0;
  --paper: #FFFFFF;
  --yellow: #FDD756;
  --muted: #596579;
  --line: #E4E1DA;
  --good: #2F6B4F;
  --warn: #8A5A00;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --rail: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ivory); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rail :focus-visible, .signin-cover :focus-visible { outline-color: var(--yellow); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 6px; border: 1px solid var(--ink); background: var(--ink); color: var(--ivory); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--ink-2); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: var(--paper); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 500; }

/* Preview notice */
.preview-note { background: var(--yellow); color: var(--ink); font-size: 13px; padding: 7px 16px; text-align: center; }

/* Sign-in */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.signin-cover { background: var(--ink); color: var(--ivory); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.signin-cover .mark { width: 44px; }
.signin-cover h1 { font-size: clamp(40px, 5vw, 68px); max-width: 11ch; margin-top: 48px; }
.signin-cover p { color: #C9D0DA; max-width: 40ch; margin-top: 20px; font-size: 17px; }
.signin-cover .slashes { position: absolute; right: -60px; bottom: -40px; width: 340px; opacity: .08; }
.signin-cover small { color: #9AA6B6; font-size: 13px; }
.signin-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.signin-box { width: 100%; max-width: 380px; }
.signin-box h2 { font-size: 30px; }
.signin-box > .muted { margin: 8px 0 28px; }
.provider { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 16px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.provider:hover { border-color: var(--ink); }
.provider svg { width: 20px; height: 20px; flex: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ''; height: 1px; background: var(--line); flex: 1; }
.phone-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; margin-bottom: 12px; }
input.otp { display: block; margin: 16px 0; height: 58px; text-align: center; font-size: 26px; letter-spacing: .5em; padding-left: .5em; font-variant-numeric: tabular-nums; }
.fine { font-size: 13px; color: var(--muted); margin-top: 16px; }

/* Form fields */
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field > em { display: block; font-style: normal; color: var(--muted); font-size: 13px; margin: -2px 0 8px; }
input[type=text], input[type=email], input[type=tel], input[type=search], select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(20, 36, 58, .12); }
textarea { min-height: 130px; resize: vertical; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 14px; }
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.choice input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error { color: #A3361F; font-size: 14px; margin-top: 8px; }

/* Onboarding */
.onboard { max-width: 640px; margin: 0 auto; padding: 40px 20px 80px; }
.onboard header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.onboard header img { width: 30px; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 10px; }
.steps li { flex: 1; height: 4px; background: var(--line); border-radius: 2px; }
.steps li.on { background: var(--ink); }
.onboard h1 { font-size: 36px; margin: 18px 0 8px; }
.onboard .lede { color: var(--muted); margin-bottom: 30px; }
.onboard .actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }

/* App shell */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--ink); color: var(--ivory); padding: 26px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 28px; text-decoration: none; }
.brand img { width: 26px; }
.brand b { font-family: var(--serif); font-weight: 500; font-size: 19px; line-height: 1.1; }
.nav { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; color: #C9D0DA; text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--ink-2); color: var(--ivory); }
.nav a[aria-current=page] { background: var(--ink-2); color: var(--ivory); box-shadow: inset 3px 0 0 var(--yellow); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; background: var(--yellow); color: var(--ink); border-radius: 999px; padding: 0 7px; font-weight: 700; }
.rail-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--ink-2); font-size: 13px; color: #9AA6B6; }
.rail-foot a { color: var(--ivory); }
.main { padding: 40px clamp(20px, 4vw, 56px) 80px; max-width: 1180px; width: 100%; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: clamp(30px, 3.4vw, 42px); }
.page-head p { color: var(--muted); margin-top: 8px; max-width: 64ch; }
.topbar { display: none; }

/* File cover (home) */
.cover { background: var(--paper); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; position: relative; padding: 34px 36px 30px; margin-top: 34px; }
.cover::before { content: ''; position: absolute; top: -26px; left: -1px; width: 220px; height: 27px; background: var(--paper); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; }
.cover .tabtext { position: absolute; top: -21px; left: 18px; font-size: 13px; color: var(--muted); font-weight: 600; }
.cover h1 { font-size: clamp(34px, 4.4vw, 54px); max-width: 18ch; }
.cover .sub { color: var(--muted); margin-top: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 22px; font-size: 14px; }
.facts b { display: block; font-weight: 600; }
.facts span { color: var(--muted); }

.journey { list-style: none; padding: 0; margin: 30px 0 0; display: grid; grid-template-columns: repeat(7, 1fr); counter-reset: step; }
.journey li { position: relative; padding-top: 30px; font-size: 13px; color: var(--muted); counter-increment: step; }
.journey li::before { content: counter(step); position: absolute; top: 0; left: 0; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; font-size: 12px; font-weight: 600; z-index: 1; }
.journey li::after { content: ''; position: absolute; top: 11px; left: 22px; right: 0; height: 1px; background: var(--line); }
.journey li:last-child::after { display: none; }
.journey li.done { color: var(--ink); }
.journey li.done::before { background: var(--ink); border-color: var(--ink); color: var(--ivory); content: '✓'; }
.journey li.done::after { background: var(--ink); }
.journey li.now { color: var(--ink); font-weight: 600; }
.journey li.now::before { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }

.grid-home { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 24px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.panel h2 { font-size: 22px; margin-bottom: 6px; }
.panel .muted { margin-bottom: 16px; }
.next { border-left: 4px solid var(--yellow); }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mini-list li:first-child { border-top: 0; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--ivory); border: 1px solid var(--line); white-space: nowrap; }
.tag.en { background: #EAF1EC; border-color: #CFE0D5; color: var(--good); }
.tag.y { background: #FFF6D6; border-color: #F3E2A4; color: var(--ink); }
.tag.req { background: #FFF6D6; border-color: #F3E2A4; }
.tag.ok { background: #EAF1EC; border-color: #CFE0D5; color: var(--good); }
.tag.pub { background: #E8EDF5; border-color: #CCD6E6; color: var(--ink); }
.tag.partner { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.tag.top { background: var(--ink); border-color: var(--ink); color: var(--yellow); }
.tag.mix { background: linear-gradient(90deg, #EAF1EC 50%, #EEF3F8 50%); border-color: #D5E0EC; color: var(--ink); }
.tag.ef { background: #EEF3F8; border-color: #D5E0EC; color: var(--ink); }
.prog .lnote { font-size: 12px; color: var(--ink); align-self: center; }
.prog .odds { font-size: 12px; color: var(--muted); align-self: center; }
.hint { margin: 4px 0 0; padding: 12px 16px; background: #FFF6D6; border: 1px solid #F3E2A4; border-radius: 8px; font-size: 14px; }
.tag.city { background: transparent; color: var(--muted); font-weight: 500; }
.tag.ca { background: #F4EEF8; border-color: #E2D5EC; color: #4B2A63; }
.row h3 .tag { margin-left: 6px; vertical-align: 2px; }
.sheet.public .tab { color: var(--ink-2); }
.prog .pname a { text-decoration: none; }
.prog .pname a:hover { text-decoration: underline; text-underline-offset: 3px; }
.prog .fee { color: var(--ink); font-weight: 600; font-size: 12px; align-self: center; }
.prog .fee.none { color: var(--muted); font-weight: 400; }
select.compact { width: auto; min-height: 36px; padding: 6px 10px; font-size: 14px; }

/* Shortlist */
.filters { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: grid; gap: 14px; }
.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.filters-row .label { font-size: 13px; font-weight: 600; color: var(--muted); min-width: 52px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--paper); padding: 0 14px; min-height: 36px; cursor: pointer; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--ivory); }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; min-height: 34px; padding: 0 12px; font-size: 13px; cursor: pointer; }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--ink); }
.search { flex: 1; min-width: 200px; }
.result-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 26px 0 8px; }
.result-line h2 { font-size: 22px; }
.quota { font-size: 14px; color: var(--muted); }
.quota b { color: var(--ink); }

.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 46px 22px; margin-top: 42px; }
.sheet { background: var(--paper); border: 1px solid var(--line); border-radius: 0 10px 10px 10px; position: relative; display: flex; flex-direction: column; }
.sheet .tab { position: absolute; bottom: 100%; left: -1px; max-width: calc(100% - 40px); background: var(--paper); border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0; padding: 7px 16px 6px; font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: -1px; }
.sheet.applied .tab { box-shadow: inset 0 3px 0 var(--yellow); }
.sheet-head { padding: 16px 20px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.sheet-head a { font-size: 13px; margin-left: auto; color: var(--muted); }
.covers { padding: 10px 20px; font-size: 13px; color: var(--warn); background: #FFFBEA; border-bottom: 1px solid var(--line); }
.prog { list-style: none; padding: 0; margin: 0; }
.prog li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.prog li:first-child { border-top: 0; }
.prog .pname { font-size: 15px; }
.prog .meta { grid-column: 1; display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.prog .acts { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--yellow); }
.icon-btn svg { width: 16px; height: 16px; }
.sheet-foot { padding: 10px 20px 14px; margin-top: auto; border-top: 1px solid var(--line); }
.empty { text-align: center; padding: 60px 20px; background: var(--paper); border: 1px dashed var(--line); border-radius: 10px; margin-top: 24px; }
.empty h2 { font-size: 24px; margin-bottom: 8px; }
.more { display: flex; justify-content: center; margin-top: 30px; }

/* Lists: applications, documents, tickets */
.rows { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 18px 22px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; }
.row p { font-size: 14px; color: var(--muted); }
.row .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.track { display: flex; gap: 4px; margin-top: 10px; grid-column: 1 / -1; }
.track span { flex: 1; font-size: 11px; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--line); }
.track span.on { border-color: var(--ink); color: var(--ink); }
.section-title { font-size: 22px; margin: 34px 0 12px; }
.upload input[type=file] { display: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.callout { background: var(--ink); color: var(--ivory); border-radius: 10px; padding: 24px; }
.callout h2 { font-size: 24px; margin-bottom: 8px; }
.callout p { color: #C9D0DA; margin-bottom: 18px; }
.callout .btn { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--ivory); padding: 12px 18px; border-radius: 8px; font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(20, 36, 58, .25); max-width: calc(100% - 32px); }

/* Phones and tablets */
@media (max-width: 900px) {
  .signin { grid-template-columns: 1fr; }
  .signin-cover { padding: 28px 22px 34px; min-height: auto; }
  .signin-cover h1 { margin-top: 28px; font-size: 38px; }
  .signin-cover .slashes { width: 200px; }
  .signin-cover small { display: none; }
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; flex-direction: row; }
  .rail .brand, .rail-foot, .nav .hide-m { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .nav a { flex-direction: column; gap: 3px; font-size: 11px; padding: 8px 2px; text-align: center; }
  .nav a[aria-current=page] { box-shadow: inset 0 -3px 0 var(--yellow); }
  .nav .count { position: absolute; margin: -4px 0 0 18px; }
  .nav li { position: relative; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--ink); color: var(--ivory); }
  .topbar img { width: 22px; }
  .topbar a { color: var(--ivory); font-size: 14px; }
  .main { padding: 24px 16px 110px; }
  .grid-home, .two-col, .two { grid-template-columns: 1fr; }
  .journey { grid-template-columns: 1fr; gap: 0; }
  .journey li { padding: 0 0 14px 34px; min-height: 22px; }
  .journey li::after { top: 22px; bottom: 0; left: 11px; right: auto; width: 1px; height: auto; }
  .cover { padding: 26px 20px; }
  .filters { position: static; }
  .sheets { gap: 42px; }
  .prog .acts { grid-row: auto; grid-column: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .cover { animation: rise .5s ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* Live mode: loading screen and the Catalyst sign-in frame */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); text-align: center; padding: 24px; }
.boot img { width: 44px; height: auto; }
.df-login { margin: 8px 0 4px; }
.df-login iframe { width: 100% !important; height: 660px !important; border: 0; }
.auth-tabs { margin: 4px 0 18px; }
