:root {
  --paper: #f6f5f0;
  --surface: #fff;
  --ink: #192c3e;
  --muted: #63717a;
  --line: #dedfd9;
  --soft: #efefe9;
  --accent: #aa420b;
  --accent-soft: #f9ebdf;
  --danger: #9d302a;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
input, select, textarea { color: var(--ink); background: var(--surface); border: 1px solid #9ba6a9; border-radius: var(--radius); }
input, select { min-height: 42px; padding: 9px 12px; }
input::placeholder, textarea::placeholder { color: #697680; opacity: 1; }
textarea { display: block; width: 100%; padding: 12px; resize: vertical; min-height: 100px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.25; letter-spacing: -.03em; font-weight: 650; }
h2 { font-size: 20px; line-height: 1.35; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
.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-link { position: fixed; top: -70px; left: 16px; z-index: 10; padding: 10px 16px; background: var(--surface); border: 1px solid var(--ink); border-radius: var(--radius); }
.skip-link:focus { top: 12px; }
.brand { font-size: 25px; font-weight: 780; letter-spacing: -.07em; line-height: 1; }
.brand-mark { display: inline-block; margin-left: 3px; font-size: 11px; vertical-align: top; letter-spacing: 0; }
.brand-link { color: var(--ink); text-decoration: none; }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .04em; margin-bottom: 10px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 42px; padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: background-color 120ms, border-color 120ms; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: #8e3507; }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button-secondary:hover:not(:disabled) { background: var(--soft); border-color: #b1b9bb; }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.boot-view { display: grid; place-items: center; min-height: 100dvh; color: var(--muted); font-size: 14px; }
.login-view { display: grid; place-items: center; padding: 40px 22px; min-height: 100dvh; }
.login-panel { width: min(100%, 440px); }
.login-panel .brand { margin-bottom: 56px; }
.login-panel h1 { font-size: clamp(30px, 6vw, 42px); line-height: 1.35; }
.login-description { margin-top: 18px; color: var(--muted); font-size: 14px; }
.login-form { display: grid; gap: 10px; margin-top: 36px; }
.login-form label { font-size: 13px; font-weight: 600; }
.login-form input { width: 100%; min-height: 48px; }
.login-form .button { margin-top: 8px; min-height: 48px; }
.login-footnote { margin-top: 24px; text-align: center; font-size: 12px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; }
.app-header { display: flex; align-items: center; gap: 22px; padding: 20px max(24px, calc((100vw - 1360px) / 2)); min-height: 78px; border-bottom: 1px solid var(--line); background: var(--surface); }
.header-divider { width: 1px; height: 20px; background: var(--line); }
.header-label { font-size: 13px; color: var(--muted); }
.app-header .button { margin-left: auto; }
.workspace { max-width: 1408px; margin: 0 auto; padding: 42px 24px 24px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.heading-description { margin-top: 12px; color: var(--muted); font-size: 14px; }
.status-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 28px; }
.status-filter { position: relative; padding: 20px 22px; text-align: left; border: 0; background: var(--paper); color: var(--muted); transition: background-color 120ms; }
.status-filter span { display: block; font-size: 13px; }
.status-filter strong { display: block; color: var(--ink); font-size: 27px; line-height: 1.25; font-weight: 620; font-variant-numeric: tabular-nums; margin-top: 8px; }
.status-filter:hover { background: var(--surface); }
.status-filter[aria-pressed="true"] { background: var(--surface); color: var(--accent); }
.status-filter[aria-pressed="true"]::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: var(--accent); }
.status-filter:focus-visible { outline-offset: -4px; z-index: 1; }
.archive-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.archive-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.archive-toolbar h2 { font-size: 16px; }
.search-form { display: flex; gap: 8px; }
.search-form input { width: 310px; font-size: 13px; }
.notice { margin: 18px 24px; border-radius: var(--radius); border: 1px solid var(--line); padding: 12px 16px; font-size: 13px; }
.notice-error { color: var(--danger); border-color: #dfb9b5; background: #fff5f3; }
.table-wrap { overflow-x: auto; }
.archive-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.archive-table thead { background: #fafaf7; color: var(--muted); }
.archive-table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 500; white-space: nowrap; }
.archive-table th:first-child { padding-left: 24px; }
.archive-table td { padding: 18px 16px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.archive-table td:first-child { padding-left: 24px; width: 36%; }
.archive-table td:last-child { padding-right: 24px; text-align: right; }
.archive-table tbody tr:last-child td { border-bottom: 0; }
.archive-table tbody tr:hover { background: #fdfdf9; }
.design-cell { display: flex; align-items: center; gap: 15px; min-width: 230px; }
.thumbnail { display: grid; place-items: center; width: 80px; height: 60px; flex: 0 0 80px; border: 1px solid var(--line); background: var(--soft); border-radius: 7px; overflow: hidden; color: var(--muted); font-size: 11px; }
.thumbnail img { width: 100%; height: 100%; object-fit: contain; }
.design-copy { min-width: 0; }
.design-name { display: block; font-size: 14px; font-weight: 650; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; text-align: left; }
.design-name:hover { color: var(--accent); }
.design-id { margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.design-size { margin-top: 5px; color: var(--muted); font-size: 12px; }
.status-badge { display: inline-block; padding: 4px 9px; border-radius: 6px; font-size: 12px; white-space: nowrap; background: var(--soft); color: #53616a; }
.status-pending_order { color: #8a410e; background: var(--accent-soft); }
.status-ordered { color: var(--ink); background: #eaf0f4; }
.status-paid { color: #365541; background: #eaf1e9; }
.status-cancelled { color: #6e6161; background: #f0ebeb; }
.cell-primary { font-weight: 550; overflow-wrap: anywhere; }
.cell-secondary { margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.record-time { white-space: nowrap; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 290px; padding: 40px 24px; text-align: center; }
.empty-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--soft); color: #829099; font-size: 27px; font-weight: 600; margin-bottom: 18px; }
.empty-state p { color: var(--muted); font-size: 13px; max-width: 420px; margin-top: 10px; }
.empty-state .button { margin-top: 20px; }
.loading-state { padding: 0 24px; }
.skeleton-row { display: flex; align-items: center; gap: 18px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.skeleton-row:last-child { border: 0; }
.skeleton-row span { display: block; border-radius: 6px; background: var(--soft); }
.skeleton-image { height: 60px; width: 80px; }
.skeleton-copy { width: min(38%, 280px); height: 30px; }
.skeleton-short { width: 100px; height: 22px; margin-left: auto; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; padding: 18px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination-controls { display: flex; align-items: center; gap: 10px; }
.pagination-controls select { min-height: 36px; padding: 5px 8px; }
.pagination .button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.page-number { font-variant-numeric: tabular-nums; min-width: 45px; text-align: center; }
.app-footer { max-width: 1408px; margin: 0 auto; padding: 4px 24px 28px; font-size: 11px; color: var(--muted); }
.detail-dialog { width: min(1120px, calc(100vw - 48px)); max-height: calc(100dvh - 64px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); box-shadow: 0 24px 80px #192c3e25; }
.detail-dialog::backdrop { background: #192c3e72; }
.detail-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.detail-header .eyebrow { margin-bottom: 6px; overflow-wrap: anywhere; }
.detail-header h2 { max-width: 820px; overflow-wrap: anywhere; }
.detail-body { padding: 26px 28px 30px; }
.detail-loading { padding: 44px 10px; text-align: center; font-size: 14px; color: var(--muted); }
.detail-top { display: grid; grid-template-columns: 1.05fr 1fr; gap: 28px; align-items: start; }
.preview-frame { display: grid; place-items: center; min-height: 300px; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.preview-frame img { width: 100%; height: 100%; object-fit: contain; }
.preview-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.preview-switch { display: flex; gap: 8px; margin-top: 12px; }
.preview-switch .button { flex: 1; }
.preview-switch [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.detail-summary > .status-badge { margin-bottom: 14px; }
.detail-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.detail-section h3 { margin-bottom: 14px; }
.parameter-list { display: grid; grid-template-columns: minmax(95px, 1fr) minmax(0, 2fr); column-gap: 20px; row-gap: 11px; margin: 0; font-size: 13px; }
.parameter-list dt { color: var(--muted); overflow-wrap: anywhere; }
.parameter-list dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.download-list { display: flex; flex-wrap: wrap; gap: 10px; }
.download-missing { color: var(--muted); font-size: 13px; }
.detail-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.detail-lower .detail-section { min-width: 0; }
.record-list { display: grid; gap: 14px; padding: 0; list-style: none; margin: 0; }
.record-list li { border-left: 2px solid var(--line); padding-left: 14px; min-width: 0; }
.record-list p { font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.record-list time { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.muted-copy { color: var(--muted); font-size: 13px; }
.note-form { display: grid; gap: 10px; margin-top: 18px; }
.note-form label { font-size: 13px; font-weight: 600; }
.note-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-counter { font-size: 11px; color: var(--muted); }
.configuration-section details { margin-top: 20px; font-size: 13px; }
.configuration-section summary { color: var(--muted); cursor: pointer; }
.configuration-section details .parameter-list { margin-top: 18px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: calc(100vw - 40px); padding: 12px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 6px 24px #192c3e1f; font-size: 13px; text-align: center; }

@media (max-width: 1024px) {
  .archive-table th, .archive-table td { padding-right: 12px; padding-left: 12px; }
  .archive-table td:first-child { width: 31%; }
  .design-cell { min-width: 195px; gap: 10px; }
  .thumbnail { width: 64px; height: 52px; flex-basis: 64px; }
  .design-name { max-width: 165px; }
  .status-filter { padding: 18px; }
}

@media (max-width: 768px) {
  .app-header { padding: 18px 20px; gap: 14px; min-height: 70px; }
  .header-label { font-size: 12px; }
  .brand { font-size: 23px; }
  .workspace { padding: 28px 16px 20px; }
  .page-heading { align-items: flex-start; margin-bottom: 24px; }
  .page-heading .button { padding: 8px 12px; margin-top: 23px; }
  .heading-description { max-width: 280px; font-size: 13px; }
  .status-filter { padding: 14px 11px; }
  .status-filter span { font-size: 11px; }
  .status-filter strong { font-size: 22px; }
  .archive-toolbar { align-items: stretch; flex-direction: column; gap: 14px; padding: 18px; }
  .search-form input { width: 100%; min-width: 0; }
  .table-wrap { overflow: visible; }
  .archive-table, .archive-table tbody { display: block; }
  .archive-table thead { display: none; }
  .archive-table tr { display: grid; grid-template-columns: 1fr auto; gap: 12px 18px; padding: 18px; border-bottom: 1px solid var(--line); }
  .archive-table tr:last-child { border-bottom: 0; }
  .archive-table td, .archive-table td:first-child, .archive-table td:last-child { display: block; padding: 0; border: 0; width: auto; text-align: left; }
  .archive-table td:first-child { grid-column: 1 / -1; }
  .archive-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  .archive-table td:nth-child(4) { text-align: right; grid-row: 2; grid-column: 2; }
  .archive-table td:nth-child(5) { color: var(--muted); font-size: 11px; grid-row: 4; grid-column: 1; align-self: center; }
  .archive-table td:nth-child(6) { grid-row: 4; grid-column: 2; }
  .design-cell { min-width: 0; }
  .thumbnail { width: 80px; height: 60px; flex-basis: 80px; }
  .design-name { max-width: min(65vw, 360px); }
  .pagination { padding: 16px 18px; }
  .pagination-controls { flex-wrap: wrap; width: 100%; gap: 8px; }
  .pagination-controls label { margin-right: -3px; }
  .pagination-controls .button:first-of-type { margin-left: auto; }
  .app-footer { padding-left: 16px; }
  .detail-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 12px; }
  .detail-header { padding: 18px 20px; }
  .detail-header h2 { font-size: 18px; }
  .detail-body { padding: 20px; }
  .detail-top, .detail-lower { grid-template-columns: 1fr; gap: 24px; }
  .detail-lower { gap: 0; }
  .preview-frame { min-height: 240px; }
}

@media (max-width: 420px) {
  .app-header { padding: 16px; gap: 10px; }
  .header-divider { display: none; }
  .header-label { font-size: 11px; }
  .app-header .button { padding: 8px; font-size: 11px; }
  .page-heading h1 { font-size: 25px; }
  .page-heading .button { font-size: 12px; padding: 8px 10px; }
  .status-filter { padding: 13px 8px; }
  .status-filter span { font-size: 10px; }
  .status-filter strong { font-size: 20px; }
  .pagination-controls .button { padding: 6px 8px; font-size: 11px; }
  .pagination-controls select { font-size: 11px; }
  .page-number { min-width: 36px; }
}

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