:root {
  --ink: #261a3b;
  --muted: #685f76;
  --dark: #392467;
  --brand: #713abe;
  --brand-dark: #5d2da1;
  --lavender: #f1e9fc;
  --line: #e9e2f1;
  --paper: #fff;
  --bg: #f8f6fb;
  --good: #17654c;
  --good-bg: #e4f4ee;
  --warn: #875411;
  --warn-bg: #fff2dc;
  --bad: #a42346;
  --bad-bg: #fce8ef;
  --shadow: 0 20px 55px #38245916;
  font: 100%/1.5 Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 18rem; }
[hidden] { display: none !important; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-dark); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .57; }
button, a, input, select, summary { outline-offset: 4px; }
:focus-visible { outline: 3px solid #8b5bd3; }
h1, h2, h3, p, dl, dd { margin: 0; }
img { display: block; max-width: 100%; }
.skip { position: fixed; z-index: 12; left: 1rem; top: 1rem; padding: 1rem; background: var(--paper); transform: translateY(-200%); }
.skip:focus { transform: none; }
.ic { width: 1.25em; height: 1.25em; display: inline-block; flex: none; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linejoin: round; stroke-linecap: round; vertical-align: -.22em; }
.eyebrow { color: var(--brand-dark); font-size: .8125rem; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: inherit; width: fit-content; }
.brand img { width: 2.75rem; height: 2.75rem; flex: none; object-fit: contain; }
.brand strong { display: block; font-size: 1.12rem; line-height: 1.2; font-weight: 820; letter-spacing: -.03em; }
.brand small { display: block; font-size: .8rem; color: var(--muted); margin-top: .18rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; border: 1px solid transparent; border-radius: .7rem; padding: .57rem .95rem; text-decoration: none; font-size: .9rem; font-weight: 700; white-space: nowrap; line-height: 1.24; transition: background .16s, border-color .16s, box-shadow .16s; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:not(:disabled):hover { background: var(--brand-dark); box-shadow: 0 6px 14px #713abe2a; }
.btn-secondary { background: white; color: var(--dark); border-color: var(--line); }
.btn-secondary:not(:disabled):hover { background: var(--lavender); border-color: #d9c5f4; }
.btn-ghost { background: transparent; color: var(--brand-dark); }
.btn-ghost:not(:disabled):hover { background: var(--lavender); }
.btn-icon { width: 2.75rem; padding: 0; }
.field { display: grid; align-content: start; gap: .35rem; font-size: .9rem; font-weight: 720; min-width: 0; }
.control { min-height: 2.8rem; border: 1px solid #dcd3e7; border-radius: .67rem; width: 100%; background-color: #fff; padding: .64rem .79rem; font-size: 1rem; font-weight: 470; }
.control::placeholder { color: #746b80; }
.control:hover { border-color: #b79ecf; }
select.control { appearance: none; padding-right: 2rem; background: white url("/assets/chevron.svg") no-repeat right .66rem center / 1rem; }
.password { position: relative; }
.password .control { padding-right: 3.1rem; }
.password .btn { min-height: 2.15rem; width: 2.4rem; position: absolute; top: .32rem; right: .3rem; }
.inline-message { padding: .75rem .9rem; border: 1px solid #f2c8d6; border-radius: .62rem; background: var(--bad-bg); color: var(--bad); font-size: .875rem; }
.inline-message.success { color: var(--good); background: var(--good-bg); border-color: #bfe4d9; }
.startup { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: .7rem; color: var(--muted); }
.spinner { flex: none; width: 1.25rem; height: 1.25rem; border: 2px solid #d9c7ee; border-top-color: var(--brand); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.login { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(23rem, 1.03fr) minmax(23rem, 1fr); background: white; }
.login-masthead { color: white; padding: clamp(2rem, 5vw, 5.4rem); background: radial-gradient(ellipse at 98% 77%, #6941a2 0%, #4f327e 32%, #392467 57%, #281a44 92%); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-masthead .brand { position: absolute; top: clamp(1.5rem, 4vw, 4rem); left: clamp(2rem, 5vw, 5.4rem); }
.login-masthead .brand small { color: #e6d8f8; }
.login-masthead .brand img { background: #fff; border-radius: .65rem; }
.login-art { width: 100%; height: auto; max-width: 36rem; margin: -1rem 0 -3rem; opacity: .97; pointer-events: none; }
.login-intro { position: relative; z-index: 1; }
.login-intro .eyebrow { color: #dbc3ff; margin-bottom: .85rem; }
.login-intro h2 { max-width: 37rem; font-size: clamp(2.5rem, 4.8vw, 4.5rem); font-weight: 780; letter-spacing: -.065em; line-height: 1.035; text-wrap: balance; }
.login-intro p:last-child { max-width: 30rem; margin-top: 1.2rem; color: #e7d9fb; line-height: 1.62; }
.login-form-side { position: relative; display: flex; align-items: center; justify-content: center; min-height: 38rem; padding: clamp(2rem, 5vw, 5rem); }
.login-card { width: min(100%, 26rem); }
.login-card > .eyebrow { margin: 1.1rem 0 .4rem; }
.login-card h1 { font-size: clamp(1.95rem, 4vw, 2.85rem); font-weight: 800; letter-spacing: -.052em; line-height: 1.1; }
.login-description { color: var(--muted); margin: .75rem 0 1.65rem; }
.login form, .modal form { display: grid; gap: 1rem; }
.login form .control { min-height: 3rem; }
.login-submit { width: 100%; min-height: 3rem; }
.login-help { align-self: center; justify-self: center; }
.transport-caption { display: flex; gap: .55rem; align-items: center; justify-content: center; margin-top: 1.45rem; border-top: 1px solid var(--line); padding-top: 1.15rem; color: var(--muted); font-size: .83rem; }
.login-copyright { position: absolute; bottom: 1.8rem; inset-inline: .5rem; text-align: center; font-size: .8rem; color: var(--muted); }
.icon-tile { display: inline-flex; width: 2.8rem; height: 2.8rem; align-items: center; justify-content: center; border-radius: .8rem; background: var(--lavender); color: var(--brand-dark); --icon-bg: var(--lavender); font-size: 1.05rem; flex: none; }
.icon-tile.peach { color: #985716; background: #fff0de; --icon-bg: #fff0de; }

.app { min-height: 100vh; display: grid; grid-template: auto 1fr / 15rem minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .85rem clamp(1rem, 2.7vw, 2.75rem); background: white; border-bottom: 1px solid var(--line); min-height: 4.5rem; }
.account-btn { min-width: 0; max-width: min(28rem, 54%); display: flex; text-align: left; align-items: center; gap: .6rem; }
.account-btn .icon-tile { width: 1.85rem; height: 1.85rem; border-radius: .55rem; font-size: .83rem; }
.account-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar { border-right: 1px solid var(--line); background: white; display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; padding: 1.6rem 1rem; }
.sidebar nav { display: grid; gap: .28rem; }
.sidebar .eyebrow { color: var(--muted); margin: .15rem .72rem .55rem; font-size: .75rem; }
.nav-btn { display: flex; gap: .65rem; align-items: center; width: 100%; min-height: 2.85rem; padding: .65rem .7rem; border-radius: .65rem; text-align: left; border: 0; background: transparent; font-size: .9rem; font-weight: 650; color: var(--muted); }
.nav-btn:hover { background: var(--bg); color: var(--dark); }
.nav-btn[aria-current] { background: var(--lavender); color: var(--brand-dark); --icon-bg: var(--lavender); font-weight: 750; }
.nav-btn .ic { width: 1.22rem; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: .68rem; }
.app-content { min-width: 0; width: min(100%, 93rem); margin: 0 auto; padding: clamp(1.25rem, 3.2vw, 3rem); }
.app-content h1 { font-size: clamp(1.95rem, 4vw, 2.85rem); line-height: 1.12; letter-spacing: -.047em; font-weight: 800; }
.page-head { margin-bottom: 1.3rem; }
.page-head .eyebrow { margin-bottom: .28rem; }
.page-head p:last-child { color: var(--muted); margin-top: .5rem; }
.hero { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 15.5rem; overflow: hidden; border-radius: 1.25rem; background: #392467 radial-gradient(ellipse at 100% 50%, #634292, #392467 70%); color: white; padding: clamp(1.45rem, 4.5vw, 3.2rem); isolation: isolate; }
.hero > img { width: min(52%, 31rem); height: auto; opacity: .8; position: absolute; z-index: -1; right: .2rem; top: 50%; transform: translateY(-50%); }
.hero .eyebrow { color: #e6d3ff; margin-bottom: .48rem; }
.hero p:last-child { max-width: 31rem; color: #eee1ff; margin-top: .7rem; }
.hero h1 { max-width: min(31rem, 68%); text-wrap: balance; overflow-wrap: anywhere; }
.quick-title { margin: 1.65rem 0 .75rem; font-size: 1.2rem; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.module { border: 1px solid var(--line); text-align: left; border-radius: .95rem; background: white; padding: 1.15rem; display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; transition: border-color .16s, box-shadow .16s; }
.module:hover { border-color: #cdb4e9; box-shadow: 0 8px 20px #39246712; }
.module strong { color: var(--ink); font-size: 1.075rem; margin-top: .22rem; }
.module .muted { font-size: .92rem; }
.module .module-link { margin-top: .4rem; color: var(--brand-dark); font-size: .875rem; font-weight: 730; }
.help-box { display: flex; align-items: flex-start; gap: .8rem; border: 1px dashed #cdbce1; padding: .95rem; border-radius: .8rem; margin-top: 1rem; color: var(--muted); font-size: .9rem; }
.help-box .ic { color: var(--brand); }
.help-box strong { color: var(--dark); }
.filters { border: 1px solid var(--line); border-radius: .95rem; background: white; padding: 1rem; display: grid; gap: .85rem; }
.filter-heading, .results-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.filter-heading h2, .results-heading h2 { font-size: 1.05rem; letter-spacing: -.015em; }
.filter-heading h2 .ic { color: var(--brand); margin-right: .35rem; }
.filter-grid { display: grid; gap: .68rem; grid-template-columns: repeat(auto-fit, minmax(min(8.5rem, 100%), 1fr)); }
.filter-footer { display: flex; gap: .5rem; flex-wrap: wrap; }
.results { margin-top: 1.3rem; }
.results-heading { margin-bottom: .65rem; }
.result-label { margin: 1.05rem 0 .38rem; color: var(--muted); font-size: .875rem; font-weight: 750; }
.result-grid { display: grid; gap: .55rem; }
.result-card { display: grid; grid-template-columns: 1.1fr minmax(7rem, 1.5fr) minmax(7rem, 1.15fr) auto; gap: .7rem; align-items: center; border: 1px solid var(--line); border-radius: .8rem; background: white; padding: .8rem; font-size: .875rem; overflow-wrap: anywhere; }
.result-card h3 { font-size: .99rem; line-height: 1.36; color: var(--dark); }
.result-route { display: grid; gap: .13rem; }
.result-route b { color: var(--muted); font-weight: 600; }
.route-line { display: flex; align-items: flex-start; gap: .32rem; }
.route-line .ic { color: var(--brand); margin-top: .15rem; }
.result-status { display: flex; align-items: flex-start; flex-direction: column; gap: .3rem; }
.badge { border-radius: 2rem; padding: .17rem .52rem; font-weight: 720; font-size: .8125rem; color: var(--dark); background: var(--lavender); width: fit-content; max-width: 100%; white-space: normal; }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.states { padding: 1.8rem .85rem; min-height: 9rem; text-align: center; border: 1px solid var(--line); border-radius: .9rem; background: white; display: grid; justify-items: center; gap: .55rem; align-content: center; }
.states h3 { font-size: 1rem; }
.states p { color: var(--muted); font-size: .9rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: .6rem; margin: .95rem 0 0; font-size: .9rem; }

dialog { border: 1px solid var(--line); padding: 0; color: var(--ink); background: white; }
dialog::backdrop { background: #2112349c; }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; max-height: 100%; height: 100%; height: 100dvh; width: min(100%, 44rem); max-width: 100%; border-radius: 1rem 0 0 1rem; box-shadow: var(--shadow); }
.drawer[open] { animation: drawer-in .22s ease-out; }
@keyframes drawer-in { from { transform: translateX(2rem); opacity: .35; } to { transform: none; opacity: 1; } }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem; padding: 1.1rem clamp(.85rem, 3.2vw, 1.6rem); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: white; z-index: 2; }
.dialog-head h2 { font-size: 1.38rem; letter-spacing: -.03em; }
.dialog-head .muted { font-size: .88rem; }
.drawer-content, .modal-content { padding: 1rem clamp(.85rem, 3.2vw, 1.6rem) 1.5rem; }
.detail-heading { margin-top: 1.2rem; }
.detail-heading:first-child { margin-top: 0; }
.detail-heading, .file-heading { font-size: 1rem; color: var(--dark); margin-bottom: .55rem; }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.detail-fields > div { border: 1px solid var(--line); border-radius: .65rem; background: var(--bg); padding: .62rem .7rem; min-width: 0; }
.detail-fields > .wide { grid-column: 1 / -1; }
.detail-fields dt { color: var(--muted); font-size: .81rem; }
.detail-fields dd { font-size: .95rem; font-weight: 630; overflow-wrap: anywhere; }
.detail-nav { display: flex; gap: .32rem; flex-wrap: wrap; margin-bottom: 1rem; }
.detail-nav [aria-pressed="true"] { background: var(--lavender); border-color: #dfcdf6; color: var(--brand-dark); }
.doc-list, .file-list { display: grid; gap: .55rem; }
.doc-item, .file-item { border: 1px solid var(--line); border-radius: .75rem; padding: .7rem; min-width: 0; }
.doc-item { background: var(--bg); }
.doc-item p { overflow-wrap: anywhere; font-size: .875rem; margin-top: .22rem; }
.file-item { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
.file-item .icon-tile { width: 2rem; height: 2rem; }
.file-label { flex: 1 0 min(10rem, 85%); overflow-wrap: anywhere; font-size: .9rem; }
.file-actions { display: flex; flex-wrap: wrap; gap: .26rem; }
.preview { margin-bottom: .85rem; border: 1px solid var(--line); border-radius: .72rem; background: var(--bg); padding: .7rem; text-align: center; }
.preview img { margin: .5rem auto; object-fit: contain; max-height: 65vh; border-radius: .4rem; }
.preview-title { display: flex; align-items: center; justify-content: space-between; gap: .4rem; text-align: left; }
.preview-title strong { overflow-wrap: anywhere; }
.modal { width: min(calc(100% - 1rem), 28rem); margin: auto; border-radius: .95rem; box-shadow: var(--shadow); }
.modal-content .muted { margin-bottom: 1rem; }
.recovery-code { background: var(--lavender); font-weight: 750; letter-spacing: .13em; }
.recovery-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.recovery-actions + .muted { margin: .45rem 0 0; }
.toast { z-index: 5; position: fixed; bottom: 1rem; right: 1rem; max-width: min(calc(100% - 2rem), 26rem); border-radius: .7rem; background: var(--dark); color: #fff; padding: .75rem 1rem; font-size: .9rem; box-shadow: var(--shadow); }
.account-actions { display: grid; gap: .5rem; }

@media (max-width: 65rem) {
  .app { grid-template-columns: 12rem minmax(0, 1fr); }
  .result-card { grid-template-columns: 1fr 1.25fr auto; }
  .result-status { grid-column: 1 / 3; flex-direction: row; flex-wrap: wrap; }
  .result-card .btn { grid-column: 3; grid-row: 1 / 3; }
}
@media (max-width: 51rem) {
  .login { grid-template-columns: 1fr; }
  .login-masthead { min-height: 17rem; padding: 1.1rem 1.6rem 1.65rem; justify-content: flex-end; }
  .login-masthead .brand { position: static; margin-bottom: 1.1rem; }
  .login-intro h2 { max-width: 25rem; font-size: clamp(2rem, 6vw, 3.1rem); }
  .login-intro p:last-child { margin-top: .6rem; }
  .login-art { position: absolute; right: 0; bottom: 0; width: min(58%, 20rem); margin: 0 -3rem -2.5rem 0; opacity: .35; }
  .login-form-side { align-items: flex-start; min-height: 31rem; padding: 1.5rem 1.3rem 3.7rem; }
  .login-card { margin: 0 auto; }
  .login-card > .eyebrow { margin-top: .65rem; }
  .app { display: block; }
  .sidebar { display: block; padding: .4rem .65rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; overflow: auto; gap: .2rem; }
  .sidebar .eyebrow, .sidebar-foot { display: none; }
  .nav-btn { white-space: nowrap; flex: 0 0 auto; width: auto; padding: .54rem .63rem; min-height: 2.65rem; }
  .hero > img { opacity: .43; width: min(62%, 20rem); }
}
@media (max-width: 30rem) {
  .hero { min-height: 13rem; }
  .hero h1 { max-width: 100%; }
  .module-grid { grid-template-columns: 1fr; }
  .app-content { padding: .9rem; }
  .results-heading h2 { font-size: 1rem; }
  .result-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr); gap: .6rem; }
  .result-status { grid-column: 1 / -1; }
  .result-card .btn { grid-column: 1 / -1; grid-row: auto; }
  .filter-footer .btn { flex: 1 0 auto; }
  .brand { gap: .47rem; }
  .brand img { width: 2.3rem; height: 2.3rem; }
  .brand strong { font-size: 1rem; }
  .brand small { font-size: .74rem; }
  .account-btn { padding-inline: .4rem; max-width: 49%; }
  .drawer { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
