:root {
  color-scheme: light;
  --page: #f3f4f6;
  --surface: #fff;
  --ink: #181a20;
  --muted: #5b5e69;
  --line: #e3e4e8;
  --input-line: #838690;
  --accent: #44388c;
  --accent-hover: #352a72;
  --accent-soft: #eeecf7;
  --danger: #a52136;
  --danger-soft: #fbecef;
  --warning: #744909;
  --warning-soft: #fcf2dd;
  --success: #23624a;
  --success-soft: #e8f4ed;
  --focus: #5043a4;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font: 100% / 1.6 var(--font);
  color: var(--ink);
  background: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p, ol, ul, dl, dd { margin: 0; }
h1 { font-size: clamp(1.9rem, 3.5vw, 2.65rem); font-weight: 650; letter-spacing: -.035em; line-height: 1.2; text-wrap: balance; }
h2 { font-size: 1.0625rem; font-weight: 650; line-height: 1.4; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: .2em; }
a, button { touch-action: manipulation; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
small { font-size: .8125rem; }
img { display: block; height: auto; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; top: .75rem; left: .75rem; z-index: 1; transform: translateY(-200%); padding: .5rem .75rem; background: var(--surface); }
.skip-link:focus { transform: none; }
.secondary, .identifier, .record-meta { color: var(--muted); font-size: .875rem; }
.identifier { margin-top: .55rem; }
.danger-text, .file-alert { color: var(--danger); }
.product-code, time { font-variant-numeric: tabular-nums; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .content { max-width: 87rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 3rem); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 3.6rem; gap: 1rem; }
.topbar-leading, .account { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: .625rem; color: var(--ink); font-size: .9375rem; font-weight: 700; text-decoration: none; line-height: 1.3; }
.brand-mark { position: relative; display: block; flex: none; width: 2rem; height: 2rem; overflow: hidden; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); }
.brand-mark img { position: absolute; width: 175%; max-width: none; inset: -18% auto auto 50%; transform: translateX(-50%); }
.topbar-link { color: var(--muted); font-size: .875rem; white-space: nowrap; text-decoration: none; }
.account { font-size: .875rem; gap: .625rem; }
.account-name { color: var(--muted); max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exit { min-height: 2.75rem; border: 0; padding: .35rem .5rem; background: none; color: var(--ink); white-space: nowrap; }
.exit:hover, .breadcrumbs a:hover, .topbar-link:hover { text-decoration: underline; }

.content { padding-block: clamp(1.65rem, 4vw, 3rem) 4rem; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-bottom: 1.15rem; font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs span[aria-hidden] { color: var(--muted); }
.page-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.45rem; overflow-wrap: anywhere; }
.product-identifier { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.product-identifier .product-code { color: var(--ink); font-weight: 650; }

.button {
  display: inline-flex; justify-content: center; align-items: center; gap: .35rem; min-height: 2.75rem;
  padding: .4rem .85rem; border: 1px solid var(--input-line); border-radius: .45rem;
  background: var(--surface); color: var(--ink); font-size: .875rem; font-weight: 650; line-height: 1.35;
  text-decoration: none; text-align: center;
}
.button:hover { background: var(--page); border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.quiet { background: none; border-color: transparent; color: var(--accent); }
.button.quiet:hover { background: var(--accent-soft); }
.button.compact { padding-inline: .7rem; }
input, select, textarea { min-width: 0; }
.search, .form-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; }
.search { margin-bottom: 1.4rem; max-width: 38rem; }
.search input { flex: 1 1 13rem; }
.search input, .field :is(input, select, textarea) {
  width: 100%; min-height: 2.75rem; padding: .48rem .72rem;
  color: var(--ink); background: var(--surface); border: 1px solid var(--input-line); border-radius: .45rem;
}
.search input { width: auto; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

.directory, .record-list, .timeline { list-style: none; padding: 0; }
.directory { max-width: 65rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.directory > li { border-bottom: 1px solid var(--line); }
.directory-row { display: flex; align-items: center; gap: 1rem; min-height: 4.45rem; padding: .7rem .5rem; color: var(--ink); text-decoration: none; }
.directory-row:hover, .record:hover { background: var(--page); }
.directory-row::after { content: ""; flex: none; width: .42rem; height: .42rem; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); margin-right: .25rem; }
.directory-row > .secondary { max-inline-size: 38%; text-align: right; overflow-wrap: anywhere; }
.directory-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.directory-name strong, .directory-name small { display: block; }
.directory-name strong { font-size: 1.0625rem; font-weight: 650; }
.directory-name small { color: var(--muted); margin-top: .12rem; }
.customer-overview h2 { margin-bottom: .7rem; }
.product-overview { padding-bottom: 1rem; }
.overview-links { display: flex; flex-wrap: wrap; gap: 0 1rem; padding-inline: .5rem; font-size: .875rem; }
.overview-links a { display: inline-flex; align-items: center; min-height: 2rem; color: var(--muted); text-decoration: none; }
.overview-links .danger-text { color: var(--danger); font-weight: 650; }
.overview-links a:hover, .overview-event:hover { text-decoration: underline; }
.overview-event { display: inline-flex; align-items: baseline; gap: .75rem; padding: .2rem .5rem; color: var(--muted); font-size: .8125rem; text-decoration: none; overflow-wrap: anywhere; }
.overview-event time { flex: none; font-weight: 600; }
.empty { padding-block: .3rem; color: var(--muted); }
.empty-directory { padding: 1.7rem 1rem; }

.archive-layout { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.75rem); border-top: 1px solid var(--line); }
.archive-nav { position: sticky; top: 1rem; align-self: start; display: grid; gap: .125rem; max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1rem .25rem .5rem; }
.archive-nav a { display: inline-flex; align-items: center; min-height: 2.15rem; padding: .2rem .55rem; border-radius: .35rem; color: var(--muted); font-size: .875rem; font-weight: 550; text-decoration: none; }
.archive-nav a:hover { background: var(--page); color: var(--ink); }
.archive-nav a:focus-visible { outline-offset: -2px; }
.detail-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, .44fr); gap: clamp(1.2rem, 3vw, 2.75rem); }
.sections { min-width: 0; }
.panel {
  min-width: 0; padding-block: 1.25rem; border-top: 1px solid var(--line); scroll-margin-top: .9rem;
}
.panel:target { border-color: var(--focus); }
.archive-layout .panel:first-child:not(:target) { border-top-color: transparent; }
.product-aside { padding-inline-start: clamp(1rem, 2.5vw, 1.75rem); border-inline-start: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .35rem .7rem; margin-bottom: .75rem; }
.section-heading > a { font-size: .875rem; }
.prose, .record-title { overflow-wrap: anywhere; }
.prose { max-width: 44rem; }
.record {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(5.75rem, .54fr) max-content; align-items: center;
  gap: .3rem .6rem; min-height: 3.25rem; padding: .55rem .4rem; border-radius: .48rem;
  color: var(--ink); text-decoration: none;
}
.record-list li + li { border-top: 1px solid var(--line); }
.record-title { font-size: .9375rem; font-weight: 650; }
.record-title small { display: block; margin-top: .15rem; font-weight: 400; }
.record-meta { overflow-wrap: anywhere; font-size: .8125rem; }
.status {
  display: inline-block; max-width: 100%; width: fit-content; padding: .18rem .55rem; border-radius: .4rem;
  color: var(--muted); background: var(--page); font-size: .8125rem; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere;
}
.record > .status { max-inline-size: 9rem; }
.status.missing, .status.overdue, .status.returned { color: var(--danger); background: var(--danger-soft); }
.status.pending, .status.verifying, .status.review { color: var(--warning); background: var(--warning-soft); }
.status.verified, .status.closed, .status.approved { color: var(--success); background: var(--success-soft); }
.file-alert { display: flex; flex-wrap: wrap; gap: .25rem .8rem; width: fit-content; max-width: 100%; padding: .55rem .8rem; margin-bottom: 1.1rem; border-inline-start: 2px solid currentColor; border-radius: .2rem; background: var(--danger-soft); font-size: .875rem; text-decoration: none; }
.file-alert:hover { text-decoration: underline; }
.contract-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .65rem; margin-top: .85rem; font-size: .875rem; }

.timeline li { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .65rem; padding: .55rem 0; overflow-wrap: anywhere; }
.timeline li + li { border-top: 1px solid var(--line); }
.timeline time, .timeline small { color: var(--muted); font-size: .8125rem; }
.timeline strong, .timeline small { display: block; }
.timeline strong { font-size: .875rem; }
.windows > div { display: flex; justify-content: space-between; gap: .65rem; }
.windows dd { text-align: right; overflow-wrap: anywhere; }
.windows > div + div { margin-top: .4rem; }
.windows dt, .metadata dt { color: var(--muted); }
.focused { max-width: 48rem; }
.metadata > div { display: grid; grid-template-columns: minmax(6rem, 1fr) minmax(0, 3fr); gap: .65rem; padding: .45rem 0; overflow-wrap: anywhere; }
.metadata > div + div, .attachment + .attachment { border-top: 1px solid var(--line); }
.metadata + .prose { margin-top: .8rem; }
.file-list { margin-top: .8rem; border-top: 1px solid var(--line); }
.attachment { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding-block: .7rem; overflow-wrap: anywhere; }
.attachment small { display: block; color: var(--muted); }
.attachment .button { flex: none; }

.fields { display: grid; gap: .9rem; }
.field label { display: block; margin-bottom: .28rem; font-size: .875rem; font-weight: 650; }
.field textarea { resize: vertical; }
.field input[type="file"]::file-selector-button { margin-right: .65rem; padding: .27rem .5rem; border: 0; border-radius: .35rem; background: var(--accent-soft); color: var(--accent); font: inherit; cursor: pointer; }
.field .helptext { color: var(--muted); font-size: .875rem; }
.invalid :is(input, select, textarea) { border-color: var(--danger); }
.errorlist { margin: .25rem 0 0; padding-inline-start: 1.15rem; color: var(--danger); font-size: .875rem; }
.form-errors, .notice { padding: .55rem .72rem; border-inline-start: 3px solid currentColor; border-radius: .35rem; }
.form-errors { background: var(--danger-soft); color: var(--danger); }
.notice { margin-bottom: 1rem; background: var(--success-soft); color: var(--success); }

.guest-main { display: grid; min-height: 100vh; min-height: 100dvh; }
.guest-main .error-page { place-self: center; width: min(calc(100% - 2rem), 29rem); padding-block: 2rem; }
.login-shell { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.login-heading {
  display: grid; align-content: center; justify-items: start; gap: 1.25rem; padding: clamp(2rem, 8vw, 7rem);
  background: var(--page); border-inline-end: 1px solid var(--line);
}
.login-heading .brand-mark { width: 3.75rem; height: 3.75rem; border-radius: .85rem; }
.login-heading h1 { font-size: clamp(1.9rem, 4.25vw, 3.6rem); text-wrap: initial; overflow-wrap: anywhere; }
.login-heading h1 span { display: block; }
.login-access { align-self: center; width: min(calc(100% - 4rem), 23.5rem); margin-inline: auto; padding-block: 2.5rem; }
.login-access > .button, .login-access form > .button { width: 100%; }
.error-page h1 { font-size: clamp(1.45rem, 6vw, 1.9rem); }
.error-page h1 + .button { margin-top: 1rem; }
.demo-accounts { margin-top: 1.5rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.demo-accounts h2 { margin-bottom: .55rem; color: var(--muted); font-size: .875rem; }
.demo-buttons { display: flex; flex-wrap: wrap; gap: .35rem; }
.demo-buttons .button { min-width: 3.2rem; padding-inline: .45rem; background: var(--page); border-color: var(--line); }
.demo-buttons .button:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }

@media (max-width: 1080px) {
  .archive-layout { display: block; }
  .archive-nav { position: static; display: flex; flex-wrap: wrap; max-height: none; padding: .45rem 0; border-bottom: 1px solid var(--line); overflow: visible; }
}
@media (max-width: 760px) {
  .detail-columns { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .product-aside { padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--line); }
  .topbar-inner { gap: .6rem; }
  .topbar-leading { flex-wrap: wrap; gap: .2rem .75rem; padding-block: .4rem; }
  .login-shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .login-heading { gap: .9rem; padding: clamp(1.5rem, 6vw, 2.75rem); border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .login-heading h1 { font-size: clamp(1.5rem, 5vw, 2.3rem); }
  .login-heading h1 span { display: inline; }
  .login-heading .brand-mark { width: 2.8rem; height: 2.8rem; border-radius: .65rem; }
  .login-access { width: min(calc(100% - 3rem), 23.5rem); padding-block: 1.75rem 2.5rem; }
}
@media (max-width: 530px) {
  .topbar-inner { min-height: 3.75rem; }
  .brand-mark { width: 2.15rem; height: 2.15rem; border-radius: .55rem; }
  .account-name { max-width: 5rem; }
  .account { gap: .15rem; }
  .account .exit { padding-inline: .32rem; }
  .record { grid-template-columns: minmax(0, 1fr) minmax(0, 35%); align-items: start; }
  .record-meta { grid-row: 2; grid-column: 1; }
  .record > .status { grid-row: 1 / span 2; grid-column: 2; justify-self: end; text-align: right; }
  .directory-row { gap: .6rem; }
}
@media (pointer: coarse) {
  .button, .exit, .archive-nav a, .overview-links a { min-height: 3rem; }
}
