:root {
  color-scheme: light;
  --ink: #000;
  --paper: #fff;
  --soft: #f6f6f6;
  --line: #d9d9d9;
  --muted: #5f5f5f;
  --brand: #ff8c28;
  --brand-deep: #cc7020;
  --danger: #9d1717;
  --warning: #fff4e9;
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 20rem; background: var(--paper); }
body { display: grid; grid-template-rows: auto 1fr auto; margin: 0; min-height: 100vh; background: var(--paper); }
body.modal-open { overflow: hidden; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: .65rem clamp(1rem, 3vw, 2rem);
  color: white;
  background: var(--ink);
  border-bottom: 1px solid #333;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: white; text-decoration: none; }
.brand-name { display: block; width: 4.2rem; height: 1.125rem; overflow: visible; }
.brand-mark { display: block; width: 1.65rem; height: 1.85rem; transform-origin: 13.5px 15px; transition: transform .7s ease; }
.brand:hover .brand-mark { transform: rotate(180deg); }
.brand-product { color: white; font-size: 1.125rem; font-weight: 400; letter-spacing: -.02em; line-height: 1; }
.site-header nav { display: flex; align-items: center; gap: clamp(.8rem, 3vw, 2rem); }
.site-header nav a, .environment-label { color: white; font-size: .9rem; text-decoration: none; }
.site-header nav a { position: relative; min-height: 2.75rem; display: inline-flex; align-items: center; font-weight: 600; }
.site-header nav a::after { position: absolute; right: 0; bottom: .25rem; left: 0; height: 2px; content: ""; background: var(--brand); transform: scaleX(0); transition: transform .2s ease; }
.site-header nav a:hover::after, .site-header nav a:focus-visible::after, .site-header nav a[aria-current="page"]::after { transform: scaleX(1); }
.environment-label { color: white; font-size: 1rem; font-weight: 400; line-height: 1.5; }

.page-shell { width: min(calc(100% - clamp(2rem, 6vw, 4rem)), 92rem); margin: 0 auto; padding: clamp(2.75rem, 8vw, 7rem) 0; }
.breadcrumbs { margin: 0 0 1.25rem; color: var(--muted); font-size: .82rem; }
.breadcrumbs-compact { max-width: 47rem; margin-inline: auto; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .65rem; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before { margin-right: .65rem; color: var(--brand-deep); content: ">"; }
.breadcrumbs a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.auth-card, .compact-card, .page-shell > .content-card:only-child { max-width: 47rem; margin-inline: auto; }
.content-card, .auth-card { padding: clamp(1.5rem, 3vw, 2.25rem); background: var(--paper); border: 1px solid var(--line); border-radius: .5rem; }
.eyebrow { display: flex; align-items: center; gap: .65rem; margin: 0 0 1rem; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; letter-spacing: -.01em; text-transform: uppercase; }
.eyebrow::before { color: var(--brand); content: "["; font-weight: 800; }
.eyebrow::after { color: var(--brand); content: "]"; font-weight: 800; }
h1, h2, h3 { letter-spacing: -.035em; text-wrap: balance; }
h1 { max-width: 17ch; margin: 0 0 1.25rem; font-size: clamp(2.55rem, 5vw, 4rem); font-weight: 560; line-height: .98; }
h2 { font-size: clamp(1.55rem, 3vw, 2.25rem); font-weight: 600; line-height: 1.05; }
h3 { font-size: 1.2rem; }
p { line-height: 1.55; }
.auth-card > p:not(.eyebrow):not(.warning):not(.form-message), .compact-card > p:not(.eyebrow):not(.warning):not(.success):not(.form-message) { max-width: 58ch; color: var(--muted); }
.assist-noscript { margin-top: 1rem; }

form { display: grid; gap: 1.15rem; margin: 1.75rem 0; }
label { display: grid; gap: .5rem; font-size: .86rem; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 3rem; padding: .75rem .85rem; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: .3rem; font-size: 1rem; }
textarea { min-height: 5rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: #767676; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.site-header a:focus-visible { outline-color: var(--brand); }
.check { grid-template-columns: 1.2rem 1fr; align-items: start; font-weight: 450; line-height: 1.45; }
.check input { width: 1.1rem; min-height: 0; height: 1.1rem; margin-top: .15rem; accent-color: var(--brand); }
button, .button-link { display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 2.8rem; padding: .72rem 1rem; color: var(--ink); background: var(--brand); border: 0; border-radius: .32rem; font-weight: 650; text-decoration: none; cursor: pointer; transition: transform .2s ease, background .2s ease; }
button::before, .button-link::before { margin-right: .65rem; content: "["; }
button::after, .button-link::after { margin-left: .65rem; content: "]"; }
button:hover, .button-link:hover { background: #ffa14f; transform: scale(1.025); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
button[aria-busy="true"]:disabled { cursor: wait; }
button.secondary, .button-link.secondary { color: white; background: var(--ink); }
button.secondary:hover, .button-link.secondary:hover { color: var(--ink); background: var(--brand); }
button.danger-button { color: white; background: var(--danger); }
button.danger-button:hover { color: white; background: #7d1010; }
.text-button { min-height: 2.75rem; padding: .5rem; color: var(--ink); background: none; border-radius: 0; text-decoration: underline; }
.text-button::before, .text-button::after { content: none; }
.text-button:hover { color: var(--brand-deep); background: none; transform: none; }
.text-button.danger, .danger { color: var(--danger); }
.warning, .success { padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: .35rem; }
.warning { background: var(--warning); border-left: .4rem solid var(--brand); }
.success { background: #edf8f1; border-left: .4rem solid #278257; }
.form-message { min-height: 1.5rem; margin: 0; font-weight: 650; }
.form-message:empty { min-height: 1.5rem; }
.form-message.error { color: var(--danger); }
.logout-form { padding-top: 1.25rem; margin-top: 2rem; border-top: 1px solid var(--line); }

dl { display: grid; gap: .45rem; }
dt { color: var(--muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
dd { margin: 0; overflow-wrap: anywhere; }
dd + dt { margin-top: .75rem; }
.pre-wrap { overflow-wrap: anywhere; white-space: pre-wrap; }
.muted { color: var(--muted); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding-bottom: clamp(2rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.page-heading > * { min-width: 0; }
.page-heading h1 { margin-bottom: .8rem; overflow-wrap: anywhere; }
.case-reference { max-width: none; font-size: clamp(2rem, 4.5vw, 3.5rem); }
.page-heading p { max-width: 48rem; margin-bottom: 0; color: var(--muted); }
.page-heading > .button-link { flex-shrink: 0; white-space: nowrap; }
.page-heading-link { display: inline-flex; align-items: center; min-height: 2.75rem; }
.page-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; }
.case-list { display: grid; margin-top: 1.5rem; border-bottom: 1px solid var(--line); }
.case-sort-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.case-sort-group { display: flex; flex: 1 1 15rem; align-items: center; justify-content: space-between; gap: .75rem; min-width: 0; color: var(--muted); font-size: .78rem; letter-spacing: .02em; text-transform: uppercase; }
.case-sort-buttons { display: inline-flex; flex-shrink: 0; gap: .35rem; }
.sort-button { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: .25rem; font-size: 1rem; font-weight: 700; line-height: 1; text-decoration: none; }
.sort-button:hover, .sort-button:focus-visible, .sort-button[aria-current="true"] { color: white; background: var(--ink); border-color: var(--ink); }
.case-row { position: relative; display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(5rem, .55fr) minmax(7rem, .75fr) minmax(10rem, 1fr); gap: 1rem; align-items: center; min-height: 6.75rem; padding: 1.25rem 2.4rem 1.25rem 1rem; color: inherit; border-top: 1px solid var(--line); text-decoration: none; transition: background .2s ease; }
.case-row::after { position: absolute; right: .75rem; content: "→"; font-size: 1.35rem; transition: transform .2s ease; }
.case-row:hover { background: var(--soft); }
.case-row:hover::after { transform: translateX(.2rem); }
.case-row > span { display: grid; gap: .3rem; min-width: 0; }
.case-row small { color: var(--muted); }
.case-row time { overflow-wrap: anywhere; }
.case-row span:first-child strong { font-size: 1.25rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.case-pagination { display: flex; justify-content: flex-end; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.case-pagination .previous-page { margin-right: auto; }
.case-pagination .next-page { margin-left: auto; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.empty-state { margin-top: 2rem; text-align: center; padding-block: 3rem; }
.empty-state h2 { margin-top: 0; }
.page-heading + .empty-state .button-link { display: none; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.section-heading h2, .content-card h2 { margin-top: 0; }
.case-editor { gap: 1.75rem; margin-top: 0; }
.case-editor .content-card > .field-grid + label, .case-editor .content-card > label:not(.check) + label { margin-top: 1.25rem; }
.isolate-editor, .isolate-cards { display: grid; gap: 1rem; }
.isolate-row, .isolate-card { border: 1px solid var(--line); border-radius: .4rem; }
.isolate-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 1rem; align-items: end; min-inline-size: 0; padding: 1.2rem; }
.isolate-row > * { min-width: 0; }
.isolate-row legend { padding-inline: .45rem; font-weight: 750; }
.isolate-row [hidden] { display: none; }
.isolate-row [data-remove-isolate] { grid-column: -2 / -1; justify-self: end; }
.isolate-card { padding: 1.25rem; }
.isolate-card h3 { margin: 0 0 .3rem; overflow-wrap: anywhere; }
.isolate-card p, .read-only-isolates p { overflow-wrap: anywhere; }
.isolate-list-actions { margin-top: 1rem; }
.field-grid, .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.detail-grid { align-items: start; margin: 1.25rem 0; }
.detail-grid > :nth-child(3) { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }
[data-sticky-save] { position: sticky; top: 4.5rem; z-index: 10; display: grid; gap: .65rem; padding: .65rem 0; background: var(--paper); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(5px); }
.case-action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; }
.sticky-case-actions .confirm-panel { padding: 1rem; background: var(--soft); border: 1px solid var(--line); }
.sticky-case-actions form { margin: 0; }
.delegate-card { margin: 0 0 2rem; }
.action-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.25rem 2rem; margin-top: 2rem; background: var(--soft); }
.action-card > div { min-width: 0; }
.action-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; }
.action-card form { margin: 0; }
.danger-zone { margin-top: 1rem; border-color: #c98989; border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.confirm-panel { grid-column: 1 / -1; padding-top: 1rem; border-top: 1px solid var(--line); }
.js .confirm-panel { display: none; }
.js .confirm-panel[data-confirm-enhanced]:not([hidden]) { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow-y: auto; padding: clamp(1rem, 4vw, 3rem); background: rgb(0 0 0 / 72%); border: 0; }
.confirm-dialog { width: min(100%, 36rem); padding: clamp(1.25rem, 4vw, 2rem); background: var(--paper); border: 1px solid var(--ink); border-radius: .5rem; box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 35%); }
.js .confirm-panel[data-confirm-enhanced]:not([hidden]) .confirm-dialog { max-height: calc(100dvh - 2rem); overflow-y: auto; }
.confirm-dialog h2 { margin-top: 0; }
.confirm-dialog form { margin: 0; }
.confirm-panel p { margin-top: 0; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.status-pill, .urgent-pill { display: inline-flex; align-items: center; width: fit-content; padding: .4rem .75rem; border: 1px solid transparent; border-radius: 999px; font-size: .82rem; font-weight: 750; }
.status-pill[data-status="draft"] { background: #ececec; }
.status-pill[data-status="submitted"], .status-pill[data-status="in_transit"] { background: #fce5c6; }
.status-pill[data-status="received"], .status-pill[data-status="processing"], .status-pill[data-status="phage_matching"] { background: #ffe1aa; }
.status-pill[data-status="complete"] { background: #d8f0df; }
.status-pill[data-status="cancelled"] { color: #6f1515; background: #f5dada; }
.status-pill.compact, .urgent-pill { padding: .18rem .5rem; font-size: .72rem; }
.urgent-pill { color: #6f1515; background: #fff; border-color: #9d1717; }
.timeline { position: relative; display: grid; gap: 0; padding-left: 0; list-style: none; border-top: 1px solid var(--line); }
.timeline li { position: relative; padding: 1.1rem 1rem 1.1rem 2rem; border-bottom: 1px solid var(--line); }
.timeline li::before { position: absolute; top: 1.55rem; left: .25rem; width: .55rem; height: .55rem; content: ""; background: #999; border-radius: 50%; }
.timeline li[aria-current="step"] { font-weight: 650; background: var(--warning); }
.timeline li[aria-current="step"]::before { background: var(--brand); box-shadow: 0 0 0 .22rem #ffe2c5; }
.timeline strong, .timeline time { display: block; }
.timeline time { margin-top: .2rem; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.status-timeline-card { margin-top: 1.25rem; }
.isolate-list { display: grid; gap: .7rem; padding: 0; list-style: none; }
.isolate-list > li { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.isolate-summary { min-width: 0; overflow-wrap: anywhere; }
.isolate-report, .file-list { grid-column: 1 / -1; min-width: 0; }
.file-list { display: grid; gap: .75rem; margin: 0; padding: .25rem 0 0; list-style: none; }
.file-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: baseline; padding-top: .75rem; border-top: 1px solid var(--line); }
.file-list a { overflow-wrap: anywhere; }
.read-only-isolates { display: grid; gap: 0; }
.read-only-isolates p { margin: 0; padding: 1rem 0; border-top: 1px solid var(--line); }
.read-only-shipment { overflow-wrap: anywhere; }
.share-rules { display: grid; gap: .6rem; padding-left: 1.25rem; line-height: 1.45; }
.copy-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .75rem; }
.assist-recovery[hidden] { display: none; }

.site-footer { display: grid; grid-template-columns: 1fr; gap: .75rem; align-items: start; min-height: 10rem; padding: 2rem clamp(1rem, 3vw, 2rem); color: var(--ink); background: var(--brand); border-top: 1px solid var(--brand-deep); }
.footer-product { margin: 0; font-size: 1rem; font-weight: 520; }
.footer-meta { display: grid; justify-items: end; gap: .25rem; text-align: right; }
.footer-meta p { margin: 0; }
.footer-help, .footer-about { font-size: .82rem; }
.footer-help a { font-weight: inherit; }
.footer-about { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 650; }

@media (max-width: 900px) {
  .page-heading, .action-card { display: grid; align-items: start; gap: 1.25rem; }
  .action-card { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid > :nth-child(3) { grid-column: auto; }
  .page-heading > .button-link, .page-heading > .page-heading-link { justify-self: start; }
  .page-heading-actions { justify-content: flex-start; }
  .case-row { grid-template-columns: minmax(5rem, .55fr) minmax(7rem, .75fr) minmax(0, 1.45fr); min-height: auto; padding-block: 1.1rem; }
  .case-row span:first-child { grid-column: 1 / -1; }
  .isolate-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .isolate-row [data-remove-isolate] { grid-column: auto; justify-self: start; }
  .action-card-actions { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .site-header { min-height: 4rem; }
  .site-header nav { gap: .75rem; }
  .environment-label { text-align: right; }
  .page-shell { padding-top: 2.5rem; }
  .case-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-row span:first-child, .case-row span:last-child { grid-column: 1 / -1; }
  .section-heading { display: grid; align-items: start; gap: 1.25rem; }
  .section-heading button { justify-self: start; }
  .field-grid, .isolate-row { grid-template-columns: 1fr; }
  .isolate-list > li, .file-list > li { grid-template-columns: 1fr; }
  .file-list { grid-column: auto; }
  .environment-label { font-size: .875rem; }
  [data-sticky-save] { top: 4rem; margin-inline: -1rem; padding-inline: 1rem; }
  .site-footer { grid-template-columns: 1fr; }
  .empty-state { padding-block: 2.25rem; }
}

@media (max-width: 430px) {
  .brand { gap: .4rem; }
  .brand-name { width: 3.75rem; height: 1rem; }
  .brand-product { font-size: 1rem; }
  .site-header nav a { font-size: .82rem; }
  .page-shell { width: calc(100% - 2rem); }
  .case-row { grid-template-columns: minmax(0, 1fr); }
  .case-row span:first-child, .case-row span:last-child { grid-column: auto; }
  .case-reference { font-size: clamp(1.65rem, 8.25vw, 1.9rem); letter-spacing: -.025em; }
  .content-card, .auth-card { padding: 1.5rem; }
  .action-card-actions, .confirm-actions { align-items: stretch; flex-direction: column; }
  .action-card-actions button, .confirm-actions button { width: 100%; }
  .case-action-buttons { display: grid; grid-template-columns: 1fr; }
  .case-action-buttons button { width: 100%; }
  .page-heading-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .page-heading-actions > * { width: 100%; }
}

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