:root {
  color-scheme: light;
  --paper: #f5f5ec;
  --surface: #fffefa;
  --ink: #242b21;
  --muted: #555e51;
  --line: #d9dfd1;
  --dark: #222c23;
  --accent: #d5ed8d;
  --accent-ink: #354c19;
  --danger: #872b25;
  --radius: 1.25rem;
  font: 100%/1.6 system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #496d22; outline-offset: 3px; }

.shell { width: min(75rem, calc(100% - 3rem)); margin-inline: auto; }
.skip-link {
  position: absolute;
  z-index: 2;
  inset: .75rem auto auto .75rem;
  padding: .5rem .8rem;
  border-radius: .5rem;
  background: var(--accent);
  color: var(--ink);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header-inner, .account-bar, .brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.site-header-inner { min-height: 4.5rem; justify-content: space-between; padding-block: .6rem; }
.brand { font-size: 1.15rem; font-weight: 780; text-decoration: none; letter-spacing: -.02em; }
.brand small { margin-inline-start: .3rem; font-size: .76rem; color: var(--muted); letter-spacing: 0; }
.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: .65rem;
  background: var(--accent);
}
.brand-mark::before {
  content: "";
  width: 0;
  height: 0;
  margin-inline-start: .14rem;
  border-block: .38rem solid transparent;
  border-inline-start: .6rem solid #283b18;
}
.account-bar { justify-content: flex-end; flex-wrap: wrap; font-size: .86rem; }
.account-name { font-weight: 650; overflow-wrap: anywhere; }
.account-bar form, .account-bar .badge { flex: none; }

.workspace { display: grid; gap: 1.25rem; padding-block-start: 1.65rem; }
.hero, .login-cover {
  position: relative;
  isolation: isolate;
  background: var(--dark);
  color: #faffee;
  overflow: hidden;
}
.hero::before, .login-cover::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 97% 15%, #b9e47026, transparent 64%),
    repeating-linear-gradient(90deg, transparent 0 2.45rem, #e7f4d10b 2.45rem 2.5rem);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
  align-items: center;
  gap: 2rem;
  border-radius: var(--radius);
  padding: clamp(1.35rem, 4vw, 3.2rem);
}
.eyebrow { color: var(--muted); font-size: .75rem; font-weight: 750; letter-spacing: .12em; }
.hero .eyebrow, .login-cover .eyebrow { color: var(--accent); }
.hero h1 { margin: .35rem 0 .55rem; font-size: clamp(1.7rem, 3.6vw, 3.05rem); letter-spacing: -.025em; }
.hero-copy > p:last-child, .login-cover-copy > p:last-child { color: #d4dfcc; }
.timeline {
  width: 100%;
  max-width: 22rem;
  padding: .8rem .9rem .9rem;
  border: 1px solid #65775d;
  border-radius: .8rem;
  background: #1a221bf2;
  box-shadow: 0 .6rem 1.5rem #131b1670;
  font: .68rem/1.3 ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .08em;
}
.timeline-title { display: flex; align-items: center; gap: .45rem; color: #d8e3d1; }
.timeline-title span:last-child { margin-inline-start: auto; color: #b3c1ab; }
.timeline-dot { display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); }
.timeline-tracks { position: relative; display: grid; gap: .32rem; margin-top: .7rem; padding-top: .45rem; border-top: 1px solid #475644; }
.timeline-track { display: grid; grid-template-columns: 2.25rem repeat(6, minmax(0, 1fr)); align-items: center; gap: .18rem; background: #232d24; border-radius: .2rem; }
.timeline-track span { color: #c9d7c2; padding-inline-start: .2rem; font-family: system-ui, sans-serif; }
.timeline-track i { display: block; height: .88rem; border-radius: .15rem; background: #617759; }
.timeline-source i:nth-of-type(1), .timeline-source i:nth-of-type(2), .timeline-source i:nth-of-type(3) { grid-column: span 2; }
.timeline-cut i { background: var(--accent); }
.timeline-cut i:nth-of-type(1) { grid-column: 2 / 4; }
.timeline-cut i:nth-of-type(2) { grid-column: 5 / 8; }
.timeline-playhead { position: absolute; inset: -.15rem auto -.13rem 51%; width: 1px; background: #f6f9ea; }
.timeline-playhead::before { content: ""; position: absolute; left: -.16rem; width: .34rem; height: .34rem; border-radius: 50%; background: inherit; }

.workspace-grid { display: grid; grid-template-columns: minmax(17rem, 2fr) minmax(0, 3fr); gap: 1.25rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 2.4vw, 1.65rem); box-shadow: 0 .25rem 1rem #27332008; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: .65rem; }
.panel-header h2 { margin-top: .2rem; font-size: 1.4rem; }
.panel-intro { margin: .55rem 0 1.1rem; color: var(--muted); font-size: .91rem; }
.badge, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  white-space: nowrap;
  font-weight: 690;
}
.badge { flex: none; min-height: 1.55rem; padding: .05rem .52rem; border-radius: 99rem; background: #ecf0e7; color: #465441; font-size: .75rem; }
.transfer-badge, .badge-positive, .state-completed { background: #e9f4d4; color: #354d20; }
.state-uploading, .state-sealing { background: #edf0f5; color: #41556d; }
.state-queued { background: #f8efd9; color: #695018; }
.state-processing { background: #e5efe9; color: #315542; }
.state-failed { background: #faeae6; color: var(--danger); }
.badge-public { background: #fff5d9; color: #66501a; }
.button { min-height: 2.35rem; padding: .34rem .78rem; border-radius: .55rem; font-size: .88rem; line-height: 1.35; text-decoration: none; }
.button-primary { background: var(--dark); color: #faffee; }
.button-primary:hover:not(:disabled) { background: #384b33; }
.button-quiet { border-color: var(--line); background: var(--surface); color: #3c4f34; }
.button-quiet:hover:not(:disabled, [aria-disabled="true"]) { border-color: #a7b7a1; background: #f0f4eb; }
.button-danger { color: var(--danger); }
.button-danger:hover:not(:disabled) { background: #faeae6; }
.button:disabled, .button[aria-disabled="true"] { background: #e8ebe3; border-color: transparent; color: #586455; cursor: not-allowed; }

.drop-zone {
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding: 1.3rem .75rem;
  text-align: center;
  border: 1px dashed #a0af93;
  border-radius: .8rem;
  background: #f6f8ee;
}
.drop-zone.is-dragging { background: #e9f4d4; border-color: #5d7d36; }
.upload-mark, .empty-mark { position: relative; display: grid; place-items: center; width: 2.35rem; height: 2.35rem; border-radius: .65rem; color: #435d2d; }
.upload-mark { background: #e9f1d7; }
.upload-mark::before { content: ""; width: .95rem; height: .38rem; margin-top: .5rem; border: 1.5px solid; border-top: 0; border-radius: 0 0 .14rem .14rem; }
.upload-mark::after { content: ""; position: absolute; width: .52rem; height: .52rem; top: .62rem; border: 1.5px solid; border-width: 1.5px 0 0 1.5px; transform: rotate(45deg); }
.drop-title { font-weight: 730; }
.file-picker {
  display: inline-grid;
  place-items: center;
  min-height: 2.25rem;
  padding-inline: .75rem;
  position: relative;
  border: 1px solid #a0af93;
  border-radius: .5rem;
  background: var(--surface);
  color: var(--accent-ink);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
}
.file-picker:hover { background: #edf2e5; }
.file-picker:focus-within { outline: 3px solid #496d22; outline-offset: 3px; }
.file-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone.is-busy .file-picker { opacity: .6; }
.file-picker input:disabled { cursor: not-allowed; }
.upload-rules { margin: .55rem 0 .8rem; color: var(--muted); font-size: .84rem; }
.form-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.upload-meter, .upload-status:not(:empty), .refresh-status:not(:empty) { margin-top: .75rem; font-size: .85rem; }
.upload-status, .refresh-status { color: var(--muted); overflow-wrap: anywhere; }
.meter-caption, .selection-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.meter-caption span { font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: .7rem; margin-top: .3rem; accent-color: #55763a; }
.selection { margin: .75rem 0; }
.selection-heading { font-size: .86rem; font-weight: 700; }
.upload-list { margin: .4rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.upload-list li { border-top: 1px solid var(--line); padding: .25rem 0; }
#selected-files { display: grid; gap: .55rem; margin-top: .55rem; }
.upload-list .selected-file { padding: .72rem .78rem .78rem; border: 1px solid var(--line); border-radius: .72rem; background: #f8faf3; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.product-target { min-width: 0; margin: 0; padding: 0; border: 0; }
.selected-file-header { display: flex; align-items: center; gap: .6rem; padding-bottom: .55rem; border-bottom: 1px solid var(--line); }
.selected-file-icon { position: relative; display: grid; place-items: center; flex: none; width: 1.95rem; height: 1.95rem; border-radius: .47rem; background: #eaf1db; color: var(--accent-ink); }
.selected-file-icon::before { content: ""; width: .93rem; height: .67rem; border: 1.5px solid; border-radius: .13rem; }
.selected-file-icon::after { content: ""; position: absolute; border-block: .16rem solid transparent; border-inline-start: .24rem solid; margin-inline-start: .06rem; }
.selected-file-title { display: grid; min-width: 0; line-height: 1.28; }
.selected-file-name { color: var(--ink); font-weight: 690; overflow-wrap: anywhere; }
.selected-file-size { margin-top: .13rem; color: var(--muted); font-size: .72rem; }
.product-fields { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: end; gap: .55rem .65rem; margin-top: .52rem; }
.product-fields .field { margin: 0; font-size: .8rem; }
.product-name-field { grid-column: 1 / -1; }
.product-name-field .field-hint { margin: 0; font-size: .74rem; font-weight: 400; }
.product-select { position: relative; }
.product-select::after { content: ""; position: absolute; inset: 50% .7rem auto auto; width: .38rem; height: .38rem; border: solid #596a50; border-width: 0 1.5px 1.5px 0; transform: translateY(-65%) rotate(45deg); pointer-events: none; }
.product-select select { display: block; appearance: none; min-height: 2.35rem; padding-inline-end: 1.5rem; cursor: pointer; }
.caption-toggle { position: relative; display: inline-flex; align-items: center; gap: .4rem; min-height: 2.35rem; padding: .25rem .46rem; font-size: .78rem; line-height: 1.25; color: var(--ink); font-weight: 650; cursor: pointer; }
.caption-toggle input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.caption-toggle-track { display: flex; align-items: center; flex: none; width: 1.85rem; height: 1.1rem; padding: .15rem; border-radius: 1rem; background: #677465; transition: background-color .16s; }
.caption-toggle-track::after { content: ""; width: .8rem; height: .8rem; border-radius: 50%; background: #fff; transition: transform .16s; }
.caption-toggle input:checked + .caption-toggle-track { background: #496d30; }
.caption-toggle input:checked + .caption-toggle-track::after { transform: translateX(.75rem); }
.caption-toggle input:focus-visible + .caption-toggle-track { outline: 3px solid #496d22; outline-offset: 3px; }
.structure-settings { margin-top: .5rem; border-top: 1px solid var(--line); }
.structure-settings summary { padding: .35rem 0; color: var(--accent-ink); font-size: .8rem; font-weight: 650; cursor: pointer; }
.structure-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: .45rem; }
.structure-fields .field { margin: 0; font-size: .8rem; }
.structure-fields .field select { min-height: 2.2rem; padding: .3rem .4rem; }
.structure-settings .field-hint { font-size: .74rem; }
@media (prefers-reduced-motion: reduce) {
  .caption-toggle-track, .caption-toggle-track::after { transition: none; }
}
.upload-list .result-error { color: var(--danger); }
.upload-list .result-success { color: #35542b; }
.upload-notes { display: grid; gap: .6rem; margin-top: 1.15rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .84rem; }
.upload-notes div { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .55rem; }
.upload-notes dt { font-weight: 720; }
.upload-notes dd { color: var(--muted); }

.jobs, .accounts { display: grid; gap: .65rem; padding: 0; list-style: none; }
.job, .accounts li { padding: .8rem .85rem; border: 1px solid var(--line); border-radius: .75rem; background: #fafbf6; }
.job-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .32rem .6rem; }
.job-heading h3 { max-width: 100%; font-size: 1rem; overflow-wrap: anywhere; }
.job-meta, .job-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .55rem; }
.job-meta { margin: .35rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.job-meta li { max-width: 100%; }
.job-note { margin-top: .3rem; color: var(--muted); font-size: .84rem; }
.job-error, .notice-error { color: var(--danger); }
.job-actions { margin-top: .65rem; }
.refresh-status:not(:empty) { margin: -.45rem 0 .8rem; }
.empty-jobs {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 13rem;
  gap: .45rem;
  padding: 1.25rem;
  border: 1px dashed var(--line);
  border-radius: .8rem;
  text-align: center;
  background: #f9faf4;
}
.empty-jobs p { max-width: 19rem; color: var(--muted); font-size: .88rem; }
.empty-mark { background: #eef2e5; }
.empty-mark::before { content: ""; width: 1.05rem; height: .8rem; border: 1.5px solid; border-radius: .16rem; }
.empty-mark::after { content: ""; position: absolute; border-block: .2rem solid transparent; border-inline-start: .27rem solid; margin-inline-start: .05rem; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1.25rem; margin-top: 1rem; }
.admin-grid h3 { margin-bottom: .65rem; font-size: 1rem; }
.admin-form { padding: .95rem 1rem; border: 1px solid var(--line); border-radius: .75rem; background: #fafbf6; }
.field { display: grid; gap: .3rem; margin-top: .85rem; color: var(--ink); font-size: .9rem; font-weight: 690; }
.field input, .field select { min-width: 0; width: 100%; padding: .48rem .65rem; border: 1px solid #aab6a2; border-radius: .45rem; background: var(--surface); color: var(--ink); font-weight: 400; }
.field-hint { margin-top: .3rem; color: var(--muted); font-size: .8rem; }
.admin-form button { margin-top: .85rem; }
.accounts li { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .6rem; }
.accounts li > strong { flex: 1 1 6rem; overflow-wrap: anywhere; }
.empty-account { color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; gap: .5rem; padding-block: 1rem 1.75rem; font-size: .8rem; color: var(--muted); }
.site-footer span:first-child { font-weight: 720; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(58rem, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1rem 3rem #27332014;
}
.login-cover { display: grid; align-content: space-between; gap: clamp(1rem, 5vw, 3rem); }
.login-cover, .sign-in { padding: clamp(1.3rem, 5.5vw, 3rem); }
.login-cover .brand small { color: #d4dfcc; }
.login-headline { margin: .4rem 0 .55rem; font-size: clamp(2rem, 6vw, 4rem); line-height: 1.1; font-weight: 800; letter-spacing: -.04em; }
.sign-in { align-self: center; }
.sign-in h1 { margin: .35rem 0; font-size: clamp(1.55rem, 4vw, 2.3rem); }
.sign-in-intro { color: var(--muted); }
.sign-in form { margin-top: 1.5rem; }
.sign-in button { width: 100%; margin-top: 1.15rem; min-height: 2.65rem; }
.notice { margin-top: .85rem; border: 1px solid var(--line); border-radius: .55rem; padding: .5rem .65rem; background: #f6f8ee; font-size: .88rem; }
.notice-error { border-color: #ebc8c1; background: #fbede9; }

@media (max-width: 47rem) {
  .shell { width: calc(100% - 1.5rem); }
  .workspace { padding-block-start: .9rem; }
  .workspace, .workspace-grid { gap: .85rem; }
  .workspace-grid, .hero, .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { gap: 1rem; }
  .site-header .brand small { display: none; }
}
@media (max-width: 38rem) {
  .login-page { padding: .75rem; }
  .login-shell { grid-template-columns: minmax(0, 1fr); }
  .login-cover .timeline { display: none; }
  .login-headline br { display: none; }
}
@media (max-width: 25rem) {
  .site-header-inner, .account-bar { gap: .4rem; }
  .site-header .brand { font-size: .96rem; gap: .35rem; }
  .site-header .brand-mark { width: 1.65rem; height: 1.65rem; }
}
