:root {
  color-scheme: light;
  --ink: #201d31;
  --body: #3c3850;
  --muted: #69657d;
  --line: #e9e7f0;
  --background: #f7f8fc;
  --surface: #fff;
  --violet: #6441c8;
  --violet-dark: #4c2ca7;
  --lavender: #f2ecff;
  --radius: 13px;
  --shadow: 0 2px 4px #271a5910;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .52; }
a { color: var(--violet-dark); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, p, dl, dd { margin: 0; }
::selection { background: #ddd0fb; }
:focus-visible { outline: 2px solid #7d5be9; outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.icon {
  --i: 0; display: inline-block; width: 1.25em; height: 1.25em; flex: 0 0 auto;
  background: currentColor; mask: url("/icons.png") calc(100% * var(--i) / 29) 50% / 3000% 100% no-repeat;
  vertical-align: middle;
}
.icon-home { --i: 1; }.icon-layers { --i: 2; }.icon-swap { --i: 3; }.icon-history { --i: 4; }
.icon-users { --i: 5; }.icon-chevron { --i: 6; }.icon-plus { --i: 7; }.icon-download { --i: 8; }
.icon-search { --i: 9; }.icon-filter { --i: 10; }.icon-map { --i: 11; }.icon-alert { --i: 12; }
.icon-out { --i: 13; }.icon-in { --i: 14; }.icon-clipboard { --i: 15; }.icon-close { --i: 16; }
.icon-arrow { --i: 17; }.icon-logout { --i: 18; }.icon-menu { --i: 19; }.icon-lock { --i: 20; }
.icon-refresh { --i: 21; }.icon-check { --i: 22; }.icon-more { --i: 23; }.icon-expand { --i: 24; }
.icon-user { --i: 25; }.icon-left { --i: 26; }.icon-right { --i: 27; }.icon-calendar { --i: 28; }.icon-barcode { --i: 29; }

.initial { margin: 18vh auto; text-align: center; color: var(--muted); }
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex; flex-flow: column; position: sticky; top: 0; height: 100dvh;
  background: #fff; border-right: 1px solid var(--line); z-index: 4;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.sidebar .brand { padding: 24px 23px 29px; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: #6d4ed1; color: #fff; font-size: 19px; box-shadow: 0 3px 8px #7755cf30;
}
.brand strong { display: block; font-size: 18px; font-weight: 720; line-height: 1.25; letter-spacing: .035em; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.sidebar nav { padding: 3px 13px; }
.nav-group + .nav-group { margin-top: 27px; }
.nav-label { color: #777189; font-size: 12px; font-weight: 600; margin: 0 11px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; height: 43px; padding: 0 11px;
  border-radius: 8px; margin: 3px 0; color: #504a66; font-size: 14px; font-weight: 550;
}
.nav-link:hover { background: #f6f3fc; }
.nav-link.active { background: #f0e9fc; color: var(--violet-dark); font-weight: 710; }
.nav-link .icon { font-size: 15px; }
.sidebar-foot { margin-top: auto; padding: 17px 16px 20px; }
.side-places {
  display: flex; align-items: center; gap: 9px; padding: 13px 11px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.side-places strong { color: var(--body); margin-left: 3px; }
.workspace { min-width: 0; }
.topbar {
  height: 67px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(18px, 2.5vw, 38px); background: #fff; border-bottom: 1px solid var(--line);
}
.crumb { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 14px; }
.crumb strong { color: var(--ink); font-weight: 650; }
.crumb-slash { color: #a19bb0; }
.account { position: relative; z-index: 6; }
.account summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.avatar {
  display: grid; place-items: center; height: 34px; width: 34px; border-radius: 50%;
  background: #ece1ff; color: var(--violet-dark); font-size: 15px; font-weight: 710;
}
.account-label { min-width: 54px; display: grid; gap: 2px; font-size: 13px; }
.account-label small { color: var(--muted); font-size: 12px; }
.account summary .icon { color: var(--muted); font-size: 13px; }
.account-menu {
  position: absolute; min-width: 146px; right: 0; top: calc(100% + 13px); display: grid; gap: 1px;
  background: #fff; padding: 5px; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 9px 24px #22163c1d;
}
.account-menu .button { justify-content: flex-start; }
.mobile-nav { display: none !important; }
.main { width: 100%; max-width: 1550px; padding: 26px clamp(18px, 2.5vw, 38px) 40px; margin-inline: auto; }

.hero {
  position: relative; isolation: isolate; min-height: 191px; display: flex; align-items: center; overflow: hidden;
  padding: 25px 31px; border: 1px solid #e9defa; border-radius: 16px; background: linear-gradient(111deg, #f1e9ff 5%, #f9f4ff 60%, #f0e6fd);
}
.hero-content { position: relative; z-index: 1; }
.hero h1, .page-heading h1 { font-size: 32px; line-height: 1.22; font-weight: 730; letter-spacing: .015em; }
.hero h1 { color: #2e2148; }
.hero p { color: #605072; margin-top: 9px; line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-image { position: absolute; right: 1%; bottom: -5px; width: min(46%, 465px); pointer-events: none; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  min-height: 38px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px;
  font-size: 14px; font-weight: 630; line-height: 1.3; text-decoration: none;
}
.button .icon { font-size: 14px; }
.button.primary { background: var(--violet); color: #fff; border-color: var(--violet); box-shadow: 0 2px 3px #5135ae21; }
.button.primary:hover { background: #5532bb; border-color: #5532bb; }
.button.danger { background: #a72f42; border-color: #a72f42; color: #fff; }
.button.danger:hover { background: #872536; border-color: #872536; }
.button.danger-outline { background: #fff; border-color: #f1d9df; color: #a72f42; }
.button.danger-outline:hover, .button.plain.danger-text:hover { background: #fceff2; }
.button.plain.danger-text { color: #a72f42; }
.button.secondary { background: #fff; border-color: #e3dfed; color: var(--body); }
.button.secondary:hover { background: #f9f7fe; border-color: #d9d0ec; }
.button.hero-secondary { background: #ffffffbd; border-color: #e4d9f6; color: var(--violet-dark); }
.button.hero-secondary:hover { background: #fff; }
.button.plain { background: transparent; color: var(--violet-dark); }
.button.plain:hover { background: var(--lavender); }
.icon-button {
  display: inline-grid; place-items: center; flex-shrink: 0; min-width: 33px; height: 33px;
  border: 1px solid transparent; border-radius: 7px; background: transparent; color: #746c88; line-height: 1;
}
.icon-button:hover:enabled { color: var(--violet-dark); background: var(--lavender); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 17px 0 20px; }
.stat-card {
  min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px;
  background: #fff; box-shadow: var(--shadow); text-align: left;
}
.stat-link:hover { border-color: #d7c7f4; }
.stat-head { display: flex; align-items: center; gap: 9px; color: #514963; font-size: 14px; font-weight: 640; line-height: 1.25; }
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; font-size: 16px; }
.purple { background: #f0e8fd; color: #6944c7; }
.mint { background: #e4f5ef; color: #21765d; }
.blue { background: #eaf1fe; color: #376db1; }
.amber { background: #fff1db; color: #945214; }
.stat-value { display: block; margin-top: 8px; font-size: 28px; line-height: 1.15; font-weight: 710; letter-spacing: -.018em; font-variant-numeric: tabular-nums; }
.stat-card small { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-head, .toolbar, .table-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head { padding: 17px 19px 3px; }
.panel-head h2 { font-size: 20px; font-weight: 720; }
.panel-head p, .page-heading p { margin-top: 5px; color: var(--muted); line-height: 1.5; }
.panel-head p { font-size: 14px; }
.toolbar { min-height: 62px; padding: 11px 19px; }
.toolbar-label { display: flex; align-items: center; gap: 8px; color: var(--body); font-weight: 640; font-size: 15px; }
.toolbar-label > span:last-child:not(.icon) { color: var(--muted); font-weight: 500; font-size: 13px; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-field, .select-wrap { display: inline-flex; position: relative; align-items: center; color: #77718a; min-width: 0; }
.search-field { width: clamp(215px, 27vw, 346px); }
.search-field > .icon { position: absolute; left: 10px; font-size: 14px; pointer-events: none; }
.search-field input, .select-wrap select {
  margin: 0; width: 100%; height: 36px; border: 1px solid #e5e1ec; border-radius: 7px;
  background: #fff; color: var(--ink); font-size: 14px;
}
.search-field input { padding: 0 10px 0 34px; }
::placeholder { color: #7b748b; opacity: 1; }
.select-wrap select { appearance: none; padding: 0 28px 0 10px; cursor: pointer; min-width: 96px; }
.select-wrap > .icon { position: absolute; right: 8px; font-size: 12px; pointer-events: none; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; text-align: left; width: 100%; font-size: 14px; line-height: 1.45; }
.product-table { min-width: 750px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #eeebf3; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 19px; }
th:last-child, td:last-child { padding-right: 19px; }
th { white-space: nowrap; color: #575169; font-weight: 650; background: #f9f8fc; }
td { color: #48425a; }
tbody tr:hover { background: #fcfaff; }
.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.negative-text { color: #aa343a !important; font-weight: 700; }
.product-link {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 0; padding: 0;
  background: none; border-radius: 6px; min-width: 190px; max-width: 340px;
}
.product-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 8px; font-size: 15px; }
.product-icon.lavender { background: #f0e9fc; color: #744fc9; }.product-icon.rose { background: #f8e9f1; color: #a55283; }
.product-icon.sage { background: #e8f5ee; color: #39806d; }.product-icon.sky { background: #e8f4fb; color: #3c7c9f; }
.product-icon.sand { background: #fcf0df; color: #a46731; }.product-icon.periwinkle { background: #eaeafa; color: #5d60af; }
.product-name { display: grid; gap: 3px; }
.product-name strong { font-size: 14px; color: var(--ink); font-weight: 650; }
.product-link:hover .product-name strong { color: var(--violet-dark); }
.product-name small, .cell-sub { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.cell-sub { margin-top: 3px; }
.sku, .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.sku { color: #686078; }
.category-tag { display: inline-block; white-space: nowrap; border-radius: 5px; padding: 3px 7px; background: #f4f1f8; color: #605472; font-size: 13px; }
.row-action { text-align: right; width: 1%; }
.sku-actions { white-space: nowrap; }
.sku-actions .button { padding-inline: 8px; }
.chip { white-space: nowrap; display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 25px; padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 650; }
.chip.pending, .chip.low { color: #8c530f; background: #fdf0dc; }
.chip.negative, .chip.out { color: #a33036; background: #fce9ea; }
.chip.verified, .chip.in { color: #246d51; background: #e4f4ec; }
.chip.transfer, .chip.count { color: #5b3aae; background: #eee7fd; }
.chip.muted { color: #6a6179; background: #f0edf3; }
.table-footer { min-height: 58px; padding: 9px 19px; font-size: 13px; color: var(--muted); }
.pagination { display: flex; align-items: center; gap: 8px; }
.pagination .icon-button { border-color: #e7e2ef; background: #fff; }
.empty { padding: 45px 18px; text-align: center; color: var(--muted); border-block: 1px solid #efedf3; }
.empty .icon { display: block; margin: 0 auto 12px; font-size: 26px; color: var(--violet); }
.empty strong { color: var(--ink); }
.empty p { margin-top: 6px; font-size: 14px; }
.retry { text-align: center; padding: 12px; }

.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 13px; margin-bottom: 24px; padding-top: 7px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.archive-note { display: flex; align-items: center; gap: 11px; margin: 15px 19px 0; padding: 12px; background: #f5f0fe; border-radius: 8px; color: var(--violet-dark); overflow-wrap: anywhere; }
.archive-note small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.source-ref { white-space: nowrap; color: var(--muted); font-size: 13px; }
.history-note { margin-top: 4px; max-width: 320px; }
.history-note summary { color: var(--violet-dark); cursor: pointer; font-size: 13px; }
.history-note p { white-space: pre-line; margin: 5px 0; overflow-wrap: anywhere; }
.history-note code { overflow-wrap: anywhere; }
.text-button { padding: 0; border: 0; background: none; text-align: left; color: var(--violet-dark); }
.text-button:hover { text-decoration: underline; }
.movement-record { border-top: 1px solid var(--line); }
.movement-record summary {
  display: grid; grid-template-columns: 1.2fr 1.2fr 1fr auto auto; align-items: center; gap: 16px; padding: 15px 19px;
  list-style: none; cursor: pointer; color: var(--body); font-size: 14px;
}
.movement-record summary:hover { background: #faf8fd; }
.movement-record summary > .icon { transition: transform .15s; }
.movement-record[open] summary > .icon { transform: rotate(180deg); }
.movement-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.movement-meta small { display: block; color: var(--muted); margin-top: 2px; }
.movement-line-count { color: var(--muted); white-space: nowrap; }
.movement-body { padding: 0 19px 15px; }
.movement-body p { padding: 7px 0 12px; color: var(--body); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.movement-body table { min-width: 520px; }
.audit-record { border-top: 1px solid var(--line); }
.audit-entry {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(155px, 24%) 20px;
  min-height: 64px; align-items: center; gap: 14px; padding: 12px 19px; color: var(--body); font-size: 14px;
}
summary.audit-entry { cursor: pointer; list-style: none; }
summary.audit-entry:hover { background: #faf8fd; }
.audit-record[open] summary > .icon { transform: rotate(180deg); }
.audit-entry-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.audit-entry-title strong, .audit-entry-meta strong { overflow-wrap: anywhere; }
.audit-entry-meta small { font-variant-numeric: tabular-nums; }
.audit-fields { margin: 0 19px 14px; }
.audit-fields table { min-width: 295px; table-layout: fixed; }
.audit-fields th:first-child { width: 30%; }
.audit-fields td { overflow-wrap: anywhere; }

.analysis-toolbar { margin-bottom: 14px; }
.analysis-stats { margin: 14px 0; }
.valuation-value { font-size: clamp(18px, 2.1vw, 27px); overflow-wrap: anywhere; }
.analysis-note {
  display: flex; align-items: flex-start; gap: 9px; margin-bottom: 15px; padding: 11px 14px;
  border: 1px solid #f4e2bf; border-radius: 8px; background: #fff8eb; color: #754717; font-size: 14px; line-height: 1.5;
}
.analysis-note .icon { margin-top: 1px; }
.analysis-stale { align-items: center; justify-content: space-between; margin-top: 12px; }
.analysis-split {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px;
  align-items: start;
}
.analysis-split .panel-head { padding-bottom: 12px; }
.location-valuation { min-width: 385px; }
.location-valuation tr:last-child td { border-bottom: 0; }
.valuation-chart { display: grid; gap: 12px; max-height: 248px; overflow-y: auto; padding: 4px 19px 17px; }
.valuation-bar {
  display: grid; grid-template-columns: minmax(55px, .8fr) minmax(45px, 1.25fr) minmax(94px, 1fr);
  align-items: center; gap: 9px; font-size: 14px; color: var(--body);
}
.valuation-bar strong { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.valuation-bar progress {
  appearance: none; border: 0; width: 100%; height: 8px; background: #f0e9fa; color: #7957cf; border-radius: 8px;
}
.valuation-bar progress::-webkit-progress-bar { background: #f0e9fa; border-radius: 8px; }
.valuation-bar progress::-webkit-progress-value { background: #7957cf; border-radius: 8px; }
.valuation-bar progress::-moz-progress-bar { background: #7957cf; border-radius: 8px; }
.valuation-empty { padding: 16px 19px; font-size: 14px; color: var(--muted); }
.valuation-table { min-width: 790px; }

.purchase-filters {
  display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(130px, 1.2fr) repeat(2, minmax(120px, .8fr)) auto;
  align-items: end; gap: 12px; padding: 14px 19px;
}
.purchase-filters .form-error { grid-column: 1 / -1; margin-top: 0; }
.purchase-filter-actions { display: flex; gap: 2px; align-items: center; }
.purchase-filter-actions .button { min-height: 39px; }
.purchase-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 15px 0; }
.purchase-panel-head { padding-bottom: 14px; }
.purchase-record { border-top: 1px solid var(--line); }
.purchase-entry {
  display: grid; grid-template-columns: minmax(0, 1.4fr) 125px minmax(100px, .75fr) minmax(75px, .55fr) 20px;
  min-height: 65px; align-items: center; gap: 10px; padding: 11px 19px; list-style: none;
  color: var(--body); font-size: 14px; cursor: pointer;
}
.purchase-entry:hover { background: #faf8fd; }
.purchase-entry strong, .purchase-entry-author { overflow-wrap: anywhere; }
.purchase-entry-amount { font-variant-numeric: tabular-nums; }
.purchase-entry-author { color: var(--muted); }
.purchase-record[open] summary > .icon { transform: rotate(180deg); }
.purchase-order-body { padding: 0 19px 15px; }
.purchase-order-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.purchase-order-actions p { font-size: 14px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.purchase-order-table { min-width: 460px; }
.purchase-summary { margin-top: 15px; }
.purchase-summary tbody tr:last-child td { border-bottom: 0; }
.purchase-form-line {
  display: grid; grid-template-columns: minmax(115px, 1.55fr) minmax(68px, .55fr) minmax(90px, .85fr) minmax(82px, .7fr) auto;
  gap: 7px; align-items: end; padding: 8px 0; border-top: 1px solid var(--line);
}
.purchase-form-line label, .purchase-form-unit {
  display: grid; gap: 4px; min-width: 0; font-size: 13px; font-weight: 620; color: var(--body);
}
.purchase-form-unit output {
  display: block; min-height: 39px; padding: 9px 2px; line-height: 1.45; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.purchase-line-remove { margin-bottom: 3px; }
.purchase-form-total {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  margin: 6px 0 12px; padding: 9px 10px; background: #f5f0fd; border-radius: 7px; font-size: 14px;
}
.purchase-form-total output { font-size: 16px; font-weight: 700; }

.stock-report-dialog { width: min(940px, calc(100vw - 24px)); }
.stock-report-dialog .dialog-head p { overflow-wrap: anywhere; }
.stock-report-table { max-height: min(44dvh, 430px); border: 1px solid var(--line); border-radius: 8px; margin-top: 13px; }
.stock-report-table table { min-width: 720px; }
.stock-report-table th { position: sticky; top: 0; z-index: 1; }
.stock-report-table td { vertical-align: middle; }
.stock-report-table .report-check { width: 17px; height: 17px; min-height: 0; accent-color: var(--violet); margin: 0; }
.report-match { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.report-match select { min-height: 32px; max-width: 245px; font-size: 13px; }
.report-issue { color: #945214; }
.report-selection, .report-meta { color: var(--muted); font-size: 14px; line-height: 1.5; }
.report-selection { margin-top: 10px; }
.stock-report-dialog .form-hint p + p { margin-top: 4px; }

dialog {
  width: min(700px, calc(100vw - 24px)); max-height: min(91dvh, 850px); border: 1px solid var(--line);
  border-radius: 15px; padding: 0; box-shadow: 0 15px 70px #21163c42; color: var(--ink); overflow: hidden;
  background: #fff;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #2c204b56; }
dialog.drawer {
  width: min(560px, 100vw); height: 100dvh; max-height: 100dvh; max-width: 100vw; margin: 0 0 0 auto;
  border-radius: 15px 0 0 15px;
}
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 21px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 22px; line-height: 1.35; overflow-wrap: anywhere; }
.dialog-head p { margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.dialog-body { padding: 19px 21px 22px; overflow-y: auto; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-section { margin-top: 20px; }
.detail-section h3 { font-size: 17px; margin-bottom: 10px; }
.detail-section p { font-size: 14px; color: var(--body); margin-bottom: 9px; }
.detail-stock {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 11px;
  padding: 11px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 7px;
}
.detail-stock small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; border-radius: 8px; background: #f8f7fb; }
.detail-grid dt { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.detail-grid dd { font-size: 15px; overflow-wrap: anywhere; }
.barcode-image { display: block; width: min(220px, 100%); max-height: 125px; object-fit: contain; object-position: left center; }
.label-copy { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; color: var(--body); line-height: 1.55; }
.fields { display: grid; gap: 12px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
form > label, .fields label { display: grid; gap: 6px; color: var(--body); font-size: 14px; font-weight: 620; }
form > label + label, .fields + label { margin-top: 12px; }
form input, form select, form textarea {
  min-width: 0; width: 100%; min-height: 39px; border: 1px solid #ded9e8; border-radius: 7px;
  background: #fff; color: var(--ink); font-size: 15px; font-weight: 450; padding: 7px 9px;
}
form fieldset { border: 0; padding: 0; }
form textarea { resize: vertical; }
form input[readonly], form select:disabled { background: #f7f6fa; color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; margin-top: 16px; }
.form-error, .form-hint { font-size: 14px; margin-top: 12px; border-radius: 7px; padding: 9px 10px; line-height: 1.5; }
.form-error { background: #fce8ec; color: #9e283e; }
.form-hint { background: #f4effc; color: #59476e; }
.line-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 11px; }
.line-header h3 { font-size: 16px; white-space: nowrap; }
.line-header .button { min-height: 33px; padding: 0 7px; }
.line-scroll { max-height: min(35dvh, 280px); padding: 3px; margin: 4px -3px 13px; }
.movement-lines { display: grid; gap: 8px; }
.movement-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 120px) auto; gap: 8px; align-items: start; }
.movement-line .icon-button { height: 39px; }
.toast {
  position: fixed; right: 16px; bottom: 18px; z-index: 8; display: flex; align-items: center; gap: 9px;
  max-width: min(90vw, 430px); padding: 12px 15px; border-radius: 9px; background: #35265b; color: #fff;
  box-shadow: 0 6px 20px #241a4860; visibility: hidden; opacity: 0; transition: opacity .16s;
}
.toast.visible { visibility: visible; opacity: 1; }
.login-layout { display: grid; grid-template-columns: minmax(300px, 450px) minmax(340px, 560px); align-items: stretch; justify-content: center; min-height: 100dvh; padding: max(7vh, 20px) 22px; }
.login-card { display: flex; flex-direction: column; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 20px 0 0 20px; padding: clamp(25px, 6vw, 66px); }
.login-brand { margin-bottom: clamp(20px, 5vh, 54px); }
.login-card h1 { font-weight: 730; font-size: 30px; }
.login-card > p { margin: 8px 0 23px; color: var(--muted); }
.login-card form .primary { width: 100%; margin-top: 18px; min-height: 42px; }
.login-art {
  display: grid; align-items: center; justify-items: center; min-height: 320px; border-radius: 0 20px 20px 0;
  background: radial-gradient(ellipse at 66% 31%, #faf5ff, #efe4ff 69%, #e5d4fb); border: 1px solid #e8dbf9;
}
.login-art img { width: 98%; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 192px minmax(0, 1fr); }
  .sidebar .brand { padding-inline: 17px; }
  .stat-card { padding-inline: 11px; }
  .stat-head { gap: 6px; }
}
@media (max-width: 1000px) {
  .purchase-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 870px) {
  .shell { grid-template-columns: 65px minmax(0, 1fr); }
  .sidebar .brand { padding: 19px 12px 22px; }
  .sidebar .brand > div:last-child, .nav-label, .nav-link span:not(.icon), .sidebar-foot { display: none; }
  .sidebar nav { padding-inline: 9px; }
  .nav-link { justify-content: center; }
  .nav-link .icon { font-size: 17px; }
  .nav-group + .nav-group { margin-top: 13px; }
}
@media (max-width: 690px) {
  .shell { display: block; }
  .sidebar {
    display: none; position: absolute; top: 60px; left: 0; width: min(245px, 86vw); height: auto;
    padding-bottom: 14px; border: 1px solid var(--line); border-radius: 0 0 12px 0; box-shadow: 0 8px 18px #32224f25;
  }
  .sidebar-open .sidebar { display: flex; }
  .sidebar .brand { padding-left: 17px; }
  .sidebar .brand > div:last-child, .nav-label, .nav-link span:not(.icon) { display: block; }
  .nav-link { justify-content: flex-start; }
  .mobile-nav { display: inline-grid !important; margin-left: -5px; }
  .topbar { height: 60px; }
  .main { padding: 15px 12px 30px; }
  .hero { padding: 19px 15px; min-height: 172px; }
  .hero h1, .page-heading h1 { font-size: 27px; }
  .hero p { max-width: min(75%, 400px); font-size: 14px; }
  .hero-image { width: 43%; right: -4%; bottom: 13px; opacity: .72; }
  .hero-actions { gap: 6px; margin-top: 16px; }
  .hero-actions .button { padding-inline: 9px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 12px; }
  .stat-value { font-size: 25px; }
  .panel-head, .toolbar, .table-footer { padding-inline: 11px; }
  .panel-head { align-items: flex-start; }
  .toolbar { flex-wrap: wrap; }
  .search-field { width: 100%; }
  .panel-head p { font-size: 13px; }
  .select-wrap select { min-width: 85px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
  .page-heading p { font-size: 14px; }
  .movement-record summary { grid-template-columns: 1fr auto; row-gap: 4px; padding: 11px; }
  .movement-identity { grid-column: 1; grid-row: 1; }.movement-location { grid-column: 1; grid-row: 2; }
  .movement-meta { grid-column: 2; grid-row: 2; text-align: right; }
  .movement-record summary > .icon { grid-column: 2; grid-row: 1; justify-self: end; }
  .movement-line-count { display: none; }
  .audit-entry { grid-template-columns: minmax(0, 1fr) 18px; gap: 5px 8px; padding: 11px; }
  .audit-entry-meta { grid-row: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; }
  .audit-entry > .icon { grid-column: 2; grid-row: 1; }
  .audit-fields { margin-inline: 11px; }
  .analysis-split { grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
  .analysis-split .panel-head { padding-bottom: 10px; }
  .valuation-chart { padding-inline: 11px; }
  .valuation-value { font-size: clamp(17px, 5vw, 23px); }
  .purchase-filters { padding-inline: 11px; gap: 8px; }
  .purchase-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-entry { grid-template-columns: minmax(0, 1fr) minmax(74px, auto) 18px; gap: 5px 8px; padding-inline: 11px; }
  .purchase-entry-quantity { grid-row: 2; font-size: 13px; }
  .purchase-entry-author { grid-row: 2; text-align: right; }
  .purchase-entry > .icon { grid-column: 3; grid-row: 1; }
  .purchase-entry-amount { grid-row: 1; text-align: right; }
  .purchase-order-body { padding-inline: 11px; }
  .purchase-form-line { grid-template-columns: minmax(56px, .65fr) minmax(83px, 1fr) minmax(76px, .95fr) auto; }
  .purchase-line-item { grid-column: 1 / -1; }
  .dialog-body, .dialog-head { padding-inline: 13px; }
  .login-layout { grid-template-columns: minmax(0, 430px); align-items: center; }
  .login-card { border-radius: 16px; min-height: 430px; }
  .login-art { display: none; }
}
@media (max-width: 410px) {
  .crumb-root, .crumb-slash { display: none; }
  .hero-image { display: none; }
  .hero p { max-width: 100%; }
  .select-wrap select { font-size: 13px; }
  .fields.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-header .button { font-size: 12px; padding-inline: 3px; }
  .line-header .button .icon { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
