:root {
  --primary: #0b6396;
  --primary-dark: #063e69;
  --primary-soft: #e0f4ff;
  --accent: #078565;
  --accent-soft: #d1fae5;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ink: #0f2f46;
  --muted: #526575;
  --line: #c9d9e5;
  --surface: #fff;
  --background: #f4f8fb;
  --shadow: 0 12px 30px rgba(15, 47, 70, .08);
  --radius: 14px;
  font-family: "Atkinson Hyperlegible", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 3% 0%, #d8f4ff 0, transparent 27rem), radial-gradient(circle at 97% 8%, #d9f7ed 0, transparent 23rem), var(--background); font-size: 16px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #38bdf8; outline-offset: 2px; }
.hidden { display: none !important; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.skip-link { position: fixed; z-index: 10; top: -100px; left: 16px; padding: 10px 14px; color: #fff; background: var(--primary); border-radius: 8px; }
.skip-link:focus { top: 16px; }

.site-header { position: sticky; top: 0; z-index: 5; background: linear-gradient(115deg, #063e69, #0b6396 64%, #147b94); border-bottom: 1px solid rgba(255,255,255,.2); box-shadow: 0 7px 24px rgba(6, 62, 105, .2); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark { display: grid; place-items: center; flex: 0 0 38px; height: 38px; color: #0b6396; font-weight: 900; background: linear-gradient(145deg, #fff, #c9efff); border-radius: 11px; box-shadow: 0 4px 10px rgba(0,0,0,.15); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; line-height: 1.25; }
.brand small { color: #c9e9f6; font-size: 12px; }
nav { display: flex; gap: 4px; }
.nav-link { min-height: 40px; padding: 8px 13px; border: 1px solid transparent; color: #d8f2fb; background: transparent; border-radius: 8px; }
.nav-link:hover, .nav-link.is-active { color: #063e69; background: #fff; box-shadow: 0 3px 9px rgba(0,0,0,.12); font-weight: 800; }

.view { padding-top: 36px; padding-bottom: 64px; }
.page-intro { position: relative; display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; overflow: hidden; margin-bottom: 22px; padding: 35px 34px; border-radius: 18px; color: #fff; background: linear-gradient(120deg, #06466f, #0b789a 62%, #178b83); box-shadow: 0 18px 40px rgba(7, 89, 133, .2); }
.page-intro::after { position: absolute; top: -120px; right: 15%; width: 260px; height: 260px; border: 32px solid rgba(255,255,255,.1); border-radius: 50%; content: ""; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.page-intro .eyebrow, .page-intro .intro-copy { position: relative; z-index: 1; color: #d9f5ff; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 10px; font-size: clamp(30px, 4vw, 42px); line-height: 1.18; letter-spacing: -.03em; }
.intro-copy { max-width: 700px; margin-bottom: 0; color: var(--muted); }
.notice-card { position: relative; z-index: 1; flex: 0 0 min(310px, 34%); padding: 17px 18px; border: 1px solid rgba(255,255,255,.3); border-radius: 12px; color: #fff; background: rgba(255,255,255,.14); backdrop-filter: blur(8px); }
.notice-card strong, .notice-card span { display: block; }
.notice-card strong { margin-bottom: 5px; }
.notice-card span { font-size: 14px; line-height: 1.45; }

.form-section, .dashboard-card, .login-card { margin-bottom: 20px; padding: 26px; border: 1px solid rgba(157, 190, 210, .72); border-radius: 16px; background: rgba(255,255,255,.96); box-shadow: 0 12px 30px rgba(15, 47, 70, .08), inset 0 1px 0 #fff; }
.identity-section { border-top: 4px solid #0783b5; }
.supply-section { border-top: 4px solid #09866c; }
.other-section { border-top: 4px solid #5374b9; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 6px; }
.section-heading > div:first-child { display: flex; align-items: center; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.step-number { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--primary-dark); background: var(--primary-soft); font-size: 13px; font-weight: 800; }
b { color: var(--danger); }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.field { display: grid; gap: 6px; color: #294b61; font-size: 14px; font-weight: 700; }
.field-wide { grid-column: span 2; }
.field span { color: var(--muted); font-weight: 400; }
input, select { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #a8c3d3; border-radius: 9px; color: var(--ink); background: #fff; box-shadow: inset 0 1px 2px rgba(7, 89, 133, .04); }
input::placeholder { color: #72889a; }
input:hover, select:hover { border-color: #5d8eaa; }
.field-help { min-height: 19px; color: #9a3412 !important; font-size: 12px; font-weight: 400 !important; }
.section-copy { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.completion { display: flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: 13px; }
.completion strong { color: var(--primary-dark); font-size: 18px; }

.catalog-groups { display: grid; gap: 12px; }
.catalog-group { overflow: hidden; border: 1px solid #ccdee7; border-radius: 12px; background: #fff; transition: box-shadow .18s ease, border-color .18s ease; }
.catalog-group[open] { border-color: #8ec3d9; box-shadow: 0 8px 18px rgba(13, 83, 112, .08); }
.catalog-group summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 60px; padding: 13px 16px; background: linear-gradient(90deg, #fbfdff, #f1fafc); list-style: none; cursor: pointer; }
.catalog-group summary::-webkit-details-marker { display: none; }
.catalog-group summary::after { content: "⌄"; color: var(--primary); font-size: 20px; transition: transform .18s ease; }
.catalog-group[open] summary::after { transform: rotate(180deg); }
.category-name { font-weight: 800; color: #124863; }
.category-meta { color: var(--muted); font-size: 13px; }
.category-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.category-actions { display: flex; justify-content: flex-end; padding: 12px 0 8px; }
.text-button { padding: 5px 8px; border: 0; color: var(--primary-dark); background: transparent; text-decoration: underline; font-size: 14px; font-weight: 700; }
.supply-table { width: 100%; border-collapse: collapse; }
.supply-table th, .supply-table td { padding: 12px 8px; border-bottom: 1px solid #dde8ef; vertical-align: middle; text-align: left; }
.supply-table tr:last-child td { border-bottom: 0; }
.supply-table th { color: var(--muted); font-size: 12px; font-weight: 700; }
.item-name { min-width: 150px; font-weight: 700; }
.stock-toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; color: #526575; font-size: 14px; font-weight: 800; cursor: pointer; }
.stock-toggle input { position: absolute; width: 1px; min-height: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; opacity: 0; pointer-events: none; clip: rect(0 0 0 0); }
.stock-toggle:has(input:focus-visible) span { outline: 3px solid #38bdf8; outline-offset: 2px; }
.stock-toggle span { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 2px solid #96acba; border-radius: 6px; background: #fff; transition: background .16s ease, border-color .16s ease; }
.stock-toggle input:checked + span { border-color: #078565; background: #078565; }
.stock-toggle input:checked + span::after { width: 10px; height: 5px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; content: ""; transform: rotate(-45deg) translate(1px, -1px); }
.stock-toggle:has(input:checked) { color: #066b52; }
.inline-input { min-width: 88px; min-height: 38px; padding: 6px 8px; }
.row-details { opacity: .45; pointer-events: none; }
.row-details.is-active { opacity: 1; pointer-events: auto; }

.secondary-button, .primary-button { min-height: 44px; padding: 9px 15px; border-radius: 8px; font-weight: 800; transition: background .18s ease, transform .18s ease; }
.secondary-button { border: 1px solid #75a4bd; color: var(--primary-dark); background: #fff; }
.secondary-button:hover { background: var(--primary-soft); }
.primary-button { border: 1px solid var(--primary); color: #fff; background: var(--primary); box-shadow: 0 4px 12px rgba(7, 89, 133, .22); }
.primary-button:hover { background: var(--primary-dark); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.other-items { display: grid; gap: 12px; }
.other-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 12px; align-items: end; padding: 14px; border: 1px solid #c9dce7; border-radius: 11px; background: linear-gradient(90deg, #fbfdff, #f5fbff); }
.icon-button { width: 42px; height: 44px; border: 1px solid #f0b7b0; border-radius: 8px; color: var(--danger); background: #fff; font-size: 24px; line-height: 1; }
.icon-button:hover { background: var(--danger-soft); }
.submit-section { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 28px; }
.submit-section p { margin: 0; color: var(--muted); font-size: 13px; }
.form-error { display: none; width: 100%; padding: 12px 14px; border: 1px solid #f5b5ad; border-radius: 9px; color: #8c1d18; background: var(--danger-soft); }
.form-error.is-visible { display: block; }

.success-dialog { width: min(430px, calc(100% - 32px)); padding: 32px; border: 0; border-radius: 16px; color: var(--ink); text-align: center; box-shadow: 0 20px 60px rgba(15, 47, 70, .28); }
.success-dialog::backdrop { background: rgba(8, 32, 49, .42); }
.success-dialog p:not(.eyebrow) { color: var(--muted); }
.success-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 15px; border-radius: 50%; color: #065f46; background: var(--accent-soft); font-size: 28px; font-weight: 800; }

.dashboard-layout { display: grid; gap: 20px; }
.dashboard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dashboard-top h1 { margin-bottom: 0; font-size: 30px; }
.dashboard-actions { display: flex; gap: 8px; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 17px; border: 1px solid #d6e3eb; border-radius: 11px; background: #fbfdff; }
.metric span, .metric small { display: block; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin: 4px 0; color: var(--primary-dark); font-size: 28px; line-height: 1.1; }
.metric small { color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 20px; }
.dashboard-card h2 { margin-bottom: 15px; font-size: 18px; }
.bar-list { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 85px 1fr 32px; gap: 8px; align-items: center; font-size: 13px; }
.bar-track { overflow: hidden; height: 9px; border-radius: 999px; background: #e6eff5; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: #0284c7; }
.data-table-wrap { overflow: auto; }
.data-table { width: 100%; min-width: 650px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 11px 9px; border-bottom: 1px solid #dce8ef; text-align: left; white-space: nowrap; }
.data-table th { color: var(--muted); font-size: 12px; }
.data-table td { font-size: 14px; }
.data-table tr:last-child td { border-bottom: 0; }
.link-button { padding: 4px 0; border: 0; color: var(--primary); background: transparent; font-weight: 800; text-decoration: underline; }
.empty { padding: 28px 16px; color: var(--muted); text-align: center; }
.login-wrap { display: grid; min-height: 55vh; place-items: center; }
.login-card { width: min(440px, 100%); }
.login-card h1 { font-size: 28px; }
.login-card .field { margin-top: 14px; }
.login-card .primary-button { width: 100%; margin-top: 20px; }
.login-tip { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.version-list { display: grid; gap: 10px; }
.version-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.version-item.is-active { border-color: #38bdf8; background: #f0f9ff; }
.version-item.is-viewing { box-shadow: inset 4px 0 0 #078565; }
.version-item p { margin: 0; font-size: 13px; }
.version-item p + p { color: var(--muted); }
.detail-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 20px; }
.detail-heading h2 { margin: 0 0 4px; font-size: 21px; }
.detail-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.detail-heading .eyebrow { margin-bottom: 5px; }
.inventory-count { display: grid; min-width: 114px; padding: 11px 18px; border: 1px solid #b8e8d9; border-radius: 11px; color: #057458; background: #effcf7; font-size: 30px; font-weight: 800; line-height: 1; text-align: center; }
.inventory-count small { margin-top: 6px; color: #2f7768; font-size: 12px; font-weight: 700; }
.category-chip { display: inline-block; padding: 3px 8px; border-radius: 99px; color: #075985; background: #e0f2fe; font-size: 12px; font-weight: 800; }
.inventory-table td { font-size: 15px; }
.inventory-amount { color: #065f46; font-weight: 800; font-variant-numeric: tabular-nums; }
.inventory-amount span { margin-left: 4px; color: #317165; font-weight: 600; }
.version-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.version-actions .secondary-button { min-height: 38px; padding: 6px 10px; font-size: 13px; }
.selected-version { padding: 5px 8px; border-radius: 6px; color: #076b54; background: #d9f7ea; font-size: 13px; font-weight: 800; }

@media (max-width: 860px) {
  .page-intro, .dashboard-top { flex-direction: column; }
  .notice-card { flex-basis: auto; width: 100%; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-wide { grid-column: span 2; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .other-row { grid-template-columns: minmax(0, 1fr) 42px; }
  .other-row .field:first-child { grid-column: auto; }
  .other-row .icon-button { grid-column: auto; grid-row: auto; }
  .detail-heading { align-items: flex-start; }
}
@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1180px); }
  .header-inner { min-height: 62px; }
  .brand small { display: none; }
  .brand strong { font-size: 14px; }
  .nav-link { padding: 8px; font-size: 14px; }
  .view { padding-top: 24px; }
  .form-section, .dashboard-card, .login-card { padding: 18px; }
  .field-grid, .filters { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .supply-heading { flex-direction: row; align-items: center; }
  .supply-table thead { display: none; }
  .supply-table, .supply-table tbody, .supply-table tr, .supply-table td { display: block; width: 100%; }
  .supply-table tr { padding: 13px 0; border-bottom: 1px solid #dde8ef; }
  .supply-table tr:last-child { border-bottom: 0; }
  .supply-table td { padding: 5px 0; border: 0; }
  .item-name { font-size: 16px; }
  .supply-table td[data-label]::before { display: inline-block; width: 68px; color: var(--muted); content: attr(data-label); font-size: 13px; }
  .row-details { display: block; }
  .other-row { grid-template-columns: 1fr; }
  .other-row .field:first-child, .other-row .icon-button { grid-column: auto; grid-row: auto; }
  .other-row .icon-button { width: 100%; }
  .dashboard-actions { width: 100%; }
  .dashboard-actions > * { flex: 1; }
  .detail-heading { flex-direction: column; }
  .inventory-count { width: 100%; text-align: left; }
  .version-item { align-items: flex-start; flex-direction: column; }
  .version-actions { width: 100%; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
