/* upload.kasumilabs.com. The 混搭 direction from the approved mock
   (kasumi-hq ops/company/vendors/202611_data-intake/upload-mock.html).
   Light theme only. State colors on white: success 6.47, warning 5.63,
   error 5.64 (see README.md). */

:root {
  --d-paper: #F4F5F7;
  --d-surface: #fff;
  --d-ink: #1F2026;
  --d-muted: #666B84;
  --d-rule: #DBDCE4;
  --d-ctl-border: #9296AE;
  --d-primary: #502F8D;
  --d-primary-hover: #3F2470;
  --d-selected: #F0E8FD;
  --d-success: #1E6B46;
  --d-success-bg: #EAF4EE;
  --d-warning: #895F28;
  --d-warning-bg: #F8EFDF;
  --d-error: #B2404A;
  --d-error-bg: #FDECEE;
  --d-display: "Instrument Sans", "PingFang TC", "Noto Sans TC", sans-serif;
  --d-body: "IBM Plex Sans", "PingFang TC", "Noto Sans TC", sans-serif;
  --d-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --d-display-weight: 600;
  --d-track: -.015em;
  --d-radius-ctl: 10px;
  --d-radius-card: 12px;
  --d-top-bg: #FBFBFC;
  --d-top-image: radial-gradient(70% 140% at 100% 0%, rgba(231, 214, 253, .42), transparent 65%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { background: var(--d-paper); color: var(--d-ink); }
body { margin: 0; font: 16px/1.6 var(--d-body); }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--d-primary); color: #fff; padding: .6rem 1rem; border-radius: var(--d-radius-ctl); z-index: 10; }
.skip:focus { top: 1rem; }

:focus-visible { outline: 2px solid var(--d-primary); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
main:focus { outline: none; }

.screen { max-width: 1080px; margin: 1.5rem auto 3rem; border: 1px solid var(--d-rule); border-radius: 14px; overflow: hidden; background: var(--d-paper); box-shadow: 0 1px 2px rgba(31, 32, 38, .05); }

/* Header */
.top { position: relative; padding: 1rem 2rem 0; background: var(--d-top-bg); background-image: var(--d-top-image); border-bottom: 1px solid var(--d-rule); overflow: hidden; }
.top .brandrow { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-family: var(--d-mono); font-size: .8rem; color: var(--d-muted); }
.top .brandrow b { font-family: var(--d-display); font-size: .95rem; color: var(--d-ink); font-weight: 600; letter-spacing: -.01em; }
.top .brandrow a { color: var(--d-muted); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.top .title { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: end; padding: .6rem 0 1rem; }
.top h1 { font-family: var(--d-display); font-size: 1.5rem; margin: 0 0 .35rem; letter-spacing: var(--d-track); font-weight: var(--d-display-weight); }
.top dl { display: grid; grid-template-columns: auto 1fr; gap: .1rem 1rem; margin: 0; font-size: .9rem; max-width: 52ch; }
.top dt { color: var(--d-muted); }
.top dd { margin: 0; }
.top dd code { font-family: var(--d-mono); font-size: .86rem; }
.fig { margin: 0; }
.top .leaf { width: 230px; height: auto; pointer-events: none; display: block; }
.top .latin { font-family: var(--d-mono); font-size: .72rem; color: var(--d-muted); text-align: right; margin-top: -.3rem; font-style: italic; }

.steps { display: flex; list-style: none; border-top: 1px solid var(--d-rule); margin: 0 -2rem; padding: 0 2rem; background: var(--d-surface); }
.steps li { flex: 1; padding: .65rem 0 .6rem; font-size: .88rem; color: var(--d-muted); display: flex; align-items: center; gap: .5rem; border-bottom: 2px solid transparent; transition: color 150ms, border-color 150ms; }
.steps li i { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--d-ctl-border); font-style: normal; font-family: var(--d-mono); font-size: .7rem; align-items: center; justify-content: center; flex: none; }
.steps li.on { color: var(--d-ink); border-bottom-color: var(--d-primary); font-weight: 500; }
.steps li.on i { border-color: var(--d-primary); background: var(--d-primary); color: #fff; }
.steps li.done { color: var(--d-ink); }
.steps li.done i { border-color: var(--d-success); color: var(--d-success); }
.steps li.done i svg { width: 11px; height: 11px; stroke: var(--d-success); fill: none; stroke-width: 2.5; }

/* Body grid */
.body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; padding: 1.6rem 2rem 2rem; }
.body.full { grid-template-columns: 1fr; }
.main { min-width: 0; }
.loading { color: var(--d-muted); }

.aside { font-size: .9rem; }
.aside section { background: var(--d-surface); border: 1px solid var(--d-rule); border-radius: var(--d-radius-card); padding: .9rem 1rem; margin-bottom: .8rem; }
.aside h2 { font-family: var(--d-display); font-size: .95rem; margin: 0 0 .4rem; font-weight: 600; }
.aside p { margin: 0 0 .4rem; color: var(--d-muted); }
.aside dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; }
.aside dt { color: var(--d-muted); }
.aside dd { margin: 0; }
.aside ul { list-style: none; margin: 0; padding: 0; }
.aside li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .2rem 0; border-bottom: 1px solid var(--d-rule); min-height: 44px; }
.aside li:last-child { border-bottom: 0; }
.aside .cli { width: 100%; }
.aside .cli summary { cursor: pointer; color: var(--d-primary); font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.aside .cli pre { margin: .2rem 0 .4rem; padding: .6rem .7rem; font: 12px/1.5 var(--d-mono); background: var(--d-paper); border-radius: 8px; white-space: pre-wrap; word-break: break-all; color: var(--d-ink); }
.aside .cli p { font-size: .82rem; }
.aside .awake { color: var(--d-ink); }

/* Buttons: 44 px targets everywhere */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; min-width: 44px; font: 600 .95rem var(--d-body); padding: .55rem 1.1rem; border-radius: var(--d-radius-ctl); background: var(--d-primary); color: #fff; text-decoration: none; border: 0; cursor: pointer; vertical-align: middle; transition: background-color 150ms; }
.btn:hover { background: var(--d-primary-hover); }
.btn.sec { background: var(--d-surface); color: var(--d-ink); border: 1px solid var(--d-ctl-border); }
.btn.sec:hover { background: var(--d-selected); }
.btn.txt { background: transparent; color: var(--d-primary); padding: .3rem .6rem; }
.btn.txt:hover { background: var(--d-selected); }
.btn.sm { font-size: .88rem; padding: .3rem .8rem; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Drop zone */
.drop { border: 1.5px dashed var(--d-ctl-border); border-radius: var(--d-radius-card); padding: 2rem 1.4rem 1.6rem; text-align: center; background: var(--d-surface); cursor: pointer; transition: background-color 150ms, border-color 150ms; }
.drop.over { background: var(--d-selected); border-color: var(--d-primary); }
.drop .ico { width: 36px; height: 36px; stroke: var(--d-primary); fill: none; stroke-width: 1.6; margin-bottom: .3rem; }
.drop p { margin: .25rem 0; }
.drop .big { font-size: 1.05rem; }
.drop .big .btn { margin-left: .3rem; }
.drop .hint { color: var(--d-muted); font-size: .88rem; }
.drop .chips { margin-top: .6rem; display: flex; gap: .35rem; justify-content: center; flex-wrap: wrap; }
.chip { font-family: var(--d-mono); font-size: .76rem; border: 1px solid var(--d-rule); border-radius: 5px; padding: .05rem .45rem; color: var(--d-muted); background: var(--d-paper); }
.page-over::after { content: ""; position: fixed; inset: 0; border: 3px dashed var(--d-primary); pointer-events: none; z-index: 20; }

/* Resume card */
.resume { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--d-surface); border: 1px solid var(--d-primary); border-radius: var(--d-radius-card); padding: .8rem 1rem; margin-bottom: 1rem; }
.resume p { margin: 0; }
.resume small { display: block; color: var(--d-muted); }

/* Stats and batch progress */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: .9rem; }
.stats > div { background: var(--d-surface); border: 1px solid var(--d-rule); border-radius: var(--d-radius-card); padding: .6rem .8rem; }
.stats b { display: block; font-family: var(--d-display); font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stats small { color: var(--d-muted); font-size: .82rem; display: inline-flex; align-items: center; }
.batch { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .2rem 0 .45rem; font-size: .92rem; flex-wrap: wrap; }
.batch .pct { font-family: var(--d-mono); color: var(--d-muted); font-variant-numeric: tabular-nums; }
.track { height: 8px; background: var(--d-rule); border-radius: 999px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--d-primary); width: 0; transition: width 200ms ease-out; }
.track.done i { background: var(--d-success); }
.status-line { margin: .6rem 0 0; font-size: .9rem; color: var(--d-warning); display: flex; gap: .5rem; align-items: flex-start; }
.status-line svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex: none; margin-top: .25rem; }

/* File table */
table.files { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 1rem; background: var(--d-surface); border: 1px solid var(--d-rule); border-radius: var(--d-radius-card); overflow: hidden; font-size: .92rem; }
table.files th, table.files td { text-align: left; padding: .5rem .8rem; border-bottom: 1px solid var(--d-rule); vertical-align: middle; height: 48px; }
table.files th { font-weight: 500; color: var(--d-muted); font-size: .76rem; font-family: var(--d-mono); letter-spacing: .05em; background: var(--d-paper); }
table.files tbody tr:last-child td { border-bottom: 0; }
table.files td.act { white-space: nowrap; width: 1%; text-align: right; }
table.files tr:focus-visible { outline-offset: -2px; }
td.fn, td.md5 { font-family: var(--d-mono); font-size: .86rem; overflow-wrap: anywhere; }
td.fn { min-width: 20ch; max-width: 34ch; }
td.num { font-variant-numeric: tabular-nums; font-family: var(--d-mono); font-size: .86rem; text-align: right; white-space: nowrap; }
th.num { text-align: right; }
.prog { display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.mini { display: inline-block; width: 72px; height: 6px; background: var(--d-rule); border-radius: 999px; overflow: hidden; flex: none; }
.mini i { display: block; height: 100%; background: var(--d-primary); transition: width 200ms ease-out; }
.mini.done i { background: var(--d-success); }
.pct2 { font-family: var(--d-mono); font-size: .82rem; font-variant-numeric: tabular-nums; }
.parts { display: block; font-family: var(--d-mono); font-size: .76rem; color: var(--d-muted); font-variant-numeric: tabular-nums; }
.st { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.st svg { width: 15px; height: 15px; stroke-width: 2.2; fill: none; stroke: currentColor; flex: none; }
.st.ok { color: var(--d-success); }
.st.err { color: var(--d-error); }
.st.warn { color: var(--d-warning); }
.st.wait, .st.todo { color: var(--d-muted); }
.st .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px dashed var(--d-ctl-border); }
.errrow td { background: var(--d-error-bg); }
.msg { display: block; font-size: .84rem; color: var(--d-error); margin-top: .15rem; font-family: var(--d-body); }
.warnrow td { background: var(--d-warning-bg); }
.warnrow .msg { color: var(--d-warning); }
.keep { margin: .8rem 0 0; font-size: .9rem; color: var(--d-muted); display: flex; gap: .5rem; align-items: flex-start; }
.keep svg { width: 16px; height: 16px; stroke: var(--d-muted); fill: none; stroke-width: 2; flex: none; margin-top: .25rem; }

/* Receipt */
.receipt { background: var(--d-surface); border: 1px solid var(--d-rule); border-radius: var(--d-radius-card); padding: 1.1rem 1.3rem; }
.receipt .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.receipt h2 { font-family: var(--d-display); font-size: 1.15rem; margin: 0; font-weight: var(--d-display-weight); display: flex; align-items: center; gap: .5rem; }
.receipt h2 svg { width: 22px; height: 22px; stroke: var(--d-success); fill: none; stroke-width: 2; flex: none; }
.receipt .when { font-family: var(--d-mono); font-size: .82rem; color: var(--d-muted); white-space: nowrap; }
.receipt dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem 1rem; margin: .7rem 0 .9rem; font-size: .9rem; }
.receipt dt { color: var(--d-muted); }
.receipt dd { margin: 0; }
.receipt code { font-family: var(--d-mono); font-size: .86rem; background: var(--d-selected); padding: .05rem .4rem; border-radius: 4px; }
.dlstatus { color: var(--d-error); font-size: .9rem; margin: .4rem 0 0; }
.dlstatus:empty { display: none; }

/* Whole-page messages: S4, invalid link, unsupported browser */
.fullpage { padding: 3rem 1rem; text-align: center; }
.fullpage h2 { font-family: var(--d-display); font-size: 1.25rem; font-weight: var(--d-display-weight); margin: 0 0 .4rem; }
.fullpage p { color: var(--d-muted); margin: 0 0 1rem; }

.foot { padding: .75rem 2rem; border-top: 1px solid var(--d-rule); font-size: .84rem; color: var(--d-muted); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--d-surface); }

/* "?" tooltips: a 24 px circle inside a 44 px hit area, a real role=tooltip
   element linked by aria-describedby, shown on hover and keyboard focus. */
.tipwrap { position: relative; display: inline-flex; vertical-align: middle; margin-left: .25rem; }
.tip { position: relative; display: inline-flex; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--d-ctl-border); background: var(--d-surface); color: var(--d-muted); font: 500 .74rem/1 var(--d-mono); align-items: center; justify-content: center; cursor: help; padding: 0; text-transform: none; letter-spacing: 0; }
.tip::before { content: ""; position: absolute; inset: -10px; }
.tipbox { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 280px; background: var(--d-ink); color: #fff; font: 400 .84rem/1.5 var(--d-body); padding: .45rem .65rem; border-radius: 8px; white-space: normal; text-align: left; text-transform: none; letter-spacing: 0; opacity: 0; visibility: hidden; transition: opacity 120ms; z-index: 6; }
.tipbox.right { left: auto; right: -4px; transform: none; }
.tipwrap:hover .tipbox, .tip:focus-visible + .tipbox { opacity: 1; visibility: visible; }
.tipwrap.dismissed .tipbox { opacity: 0; visibility: hidden; }

@media (max-width: 860px) {
  .screen { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .body { grid-template-columns: 1fr; padding: 1.2rem 1rem 1.6rem; }
  .top { padding: 1rem 1rem 0; }
  .steps { margin: 0 -1rem; padding: 0 1rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .fig { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  html, body, .screen { background: #fff; }
  .screen { border: 0; box-shadow: none; margin: 0; max-width: none; }
  .top { background: #fff; padding: 0 0 .5rem; }
  .steps, .aside, .actions, .skip, .tipwrap, .keep, .fig, .brandrow a { display: none !important; }
  .body { display: block; padding: 1rem 0; }
  .receipt { border: 0; padding: 0; }
  table.files { border: 1px solid #999; }
  table.files th { background: #fff; }
  .foot { background: #fff; padding: .5rem 0; }
}
