/* Compact inventory and production workspace. */
body .compact-search-bar { display:flex !important; overflow:visible; gap:8px; }
body .compact-search-bar > input { width:0; min-width:0; flex:1; background:#f6f7f6; border-color:transparent; }
body .compact-filter-menu { position:relative; flex:0 0 auto; font-size:12px; }
body .compact-filter-menu > summary { padding:8px 10px; cursor:pointer; white-space:nowrap; border:1px solid #e4e9e5; border-radius:5px; }
body .compact-filter-options { position:absolute; right:0; top:calc(100% + 5px); z-index:30; width:230px; padding:10px; background:white; border:1px solid #e4e9e5; border-radius:6px; box-shadow:0 6px 20px #0002; display:grid; gap:8px; }
body .compact-filter-options :is(input,select,button) { width:100%; max-width:none; min-width:0; }
body .production-tabs { display:flex; gap:24px; margin:0 0 16px; border-bottom:1px solid #e4e9e5; }
body .production-tabs button { background:transparent; color:#68736b; padding:12px 2px; border-radius:0 !important; font-size:15px; }
body .production-tabs button.is-active { color:#20783d; border-bottom:3px solid #258647; }
body #openMySchedule, body #openScheduleReport { display:none; }
body .inventory-mode-tabs { background:transparent; border-radius:0; border-bottom:1px solid #e4e9e5; padding:0; }
body .inventory-mode-tabs button { background:transparent !important; border-radius:0 !important; padding:10px 14px; }
body .inventory-mode-tabs button.is-active { color:#237d40; border-bottom:3px solid #258647; }
body #materials .editor-panel > .panel-head { margin-bottom:10px; justify-content:flex-end; }
body #materials .panel-head-actions { display:flex; flex-wrap:nowrap; gap:8px; width:auto; }
body #materials .panel-head-actions button { min-height:32px; padding:6px 10px; font-size:12px; width:auto; }
body .material-row { padding:12px; border-radius:6px; box-shadow:none; gap:10px; }
body .material-row .status-pill { display:inline-block; width:auto; height:auto; min-width:0; min-height:0; padding:3px 5px; border:0; border-radius:4px; font-size:10px; line-height:1.3; white-space:nowrap; box-shadow:none; }
body .material-row .status-pill.empty { background:#fcebea; color:#b73d36; }
body .material-row .status-pill.low { background:#fff2e6; color:#c37324; }
body .material-row .status-pill.normal { background:#edf6ef; color:#377649; }
body .material-row-title { flex-wrap:wrap; gap:5px; align-items:center; }
body .material-row-title h3 { margin:0; flex:1 1 100%; white-space:normal; overflow:visible; font-size:14px; }
body .material-row-main p { font-size:11px; margin:3px 0; }
body .material-row-side { font-size:11px; }
body .material-row-side strong { font-size:20px; }
body .material-row-side small { font-size:10px; }
body .schedule-week-field { display:flex; align-items:center; gap:10px; padding:0; border:0; background:transparent; max-width:none; margin:0 0 12px; }
body .schedule-week-field input { width:150px; min-height:34px; padding:5px 8px; font-size:13px; }
body .schedule-week-field > span { font-size:12px; white-space:nowrap; }
body .schedule-gantt-scroll .gantt-row { gap:0; }
body .schedule-gantt-scroll .gantt-track { height:auto; border:0; border-radius:0; box-shadow:none; width:auto; }
body .schedule-gantt-scroll .gantt-bar { position:relative; top:auto; left:auto; height:auto; transform:none; box-shadow:none; border-radius:4px; }
body .assignment-range { min-width:0; grid-column:span 2; font-size:12px; }
body .assignment-range summary { cursor:pointer; padding:10px; border:1px solid var(--line); border-radius:6px; }
body .assignment-range p { color:var(--muted); font-size:11px; }
body .range-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:3px; }
body .range-days button { min-width:0; padding:8px 2px; font-size:12px; background:#edf6ef; color:#245e37; }
body .range-days small { display:block; font-size:9px; }
body :is(.filter-bar,.product-toolbar,.sample-picker-filters,.purchase-picker-filters) :is(input,select,button) { min-height:34px !important; height:34px !important; padding:5px 8px !important; font-size:12px !important; border-radius:5px !important; }
body :is(.chip-row,.pc-filter-chips) button { min-height:30px !important; padding:4px 8px !important; font-size:11px !important; }
@media(max-width:767px) {
  body .material-row { grid-template-columns:42px minmax(0,1fr) 86px; }
  body .material-row-thumb .thumb { width:42px; height:42px; border-radius:5px; }
  body .material-row-arrow { display:none; }
  body .material-stat { padding:8px 3px; border:0; background:transparent; }
  body .material-stat strong { font-size:23px; }
  body .material-stat span { font-size:10px; }
}

:root {
  color-scheme: light;
  --bg: #eef0ea;
  --surface: #ffffff;
  --ink: #0b0b0b;
  --muted: #74766d;
  --line: #e8eadf;
  --accent: #c8d934;
  --accent-strong: #b6c42e;
  --highlight: #fcf546;
  --warn: #b97513;
  --danger: #b43d35;
  --soft: #f4f8cf;
  --mint: #dbeceb;
  --peach: #f8e6d6;
  --black: #0b0b0b;
  --shadow: 0 22px 60px rgba(11, 11, 11, 0.08);
}

/* Unified line icons for dashboard and mobile navigation. */
.ui-icon,
.flow-icon,
.mobile-nav-icon {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.dashboard-alert-button .ui-icon {
  width: 24px;
  height: 24px;
}

.dashboard-action-icon .ui-icon {
  width: 34px;
  height: 34px;
}

.dashboard-action-arrow .ui-icon {
  width: 18px;
  height: 18px;
}

.metric-icon .ui-icon {
  width: 23px;
  height: 23px;
}

.flow-summary-item > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0 auto;
  border-radius: 8px;
  background: #eef8e8;
  color: var(--accent-strong);
}

.flow-summary-item .flow-icon {
  width: 21px;
  height: 21px;
}

.mobile-bottom-nav button > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 27px;
  margin: 0 auto;
}

.mobile-bottom-nav .mobile-nav-icon {
  width: 22px;
  height: 22px;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.file-field {
  display: grid;
  min-height: 48px;
  align-items: start;
  gap: 10px;
  border: 1px dashed var(--accent-strong);
  border-radius: 18px;
  padding: 12px 15px;
  color: var(--black);
  background: var(--soft);
  cursor: pointer;
}

.file-field span {
  font-weight: 700;
}

.file-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-preview {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  object-fit: cover;
  margin-bottom: 2px;
}

.thumb {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--soft);
}

[data-open-image] {
  cursor: zoom-in;
}

[data-open-image]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.image-edit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-file {
  display: inline-grid;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--black);
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.mini-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

[hidden] {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 76% 18%, rgba(252, 245, 70, 0.52), transparent 28%),
    linear-gradient(135deg, #f7fad8 0%, #eef0ea 52%, #dbeceb 100%);
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin-bottom: 14px;
}

.login-brand img {
  flex: 0 0 auto;
  width: 142px;
  height: auto;
}

.login-brand h1 {
  min-width: 0;
  font-size: 30px;
  line-height: 1.12;
  white-space: nowrap;
}

.login-card select,
.login-card input {
  min-height: 48px;
}

.login-card button {
  min-height: 50px;
  border-radius: 999px;
  color: #f9fadf;
  background: var(--black);
  font-weight: 800;
}

.login-card .login-link {
  min-height: 40px;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
}

.login-card p {
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  overflow: hidden;
  clip-path: inset(0);
  height: 100dvh;
  padding: 26px 18px;
  color: #f9fadf;
  background: var(--black);
}

.sidebar > *:not(.nav-deco) {
  position: relative;
  z-index: 1;
}

.nav-deco {
  position: absolute;
  left: -58px;
  bottom: 28px;
  width: 150px;
  height: 150px;
  object-fit: contain;
  opacity: 0.95;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  font-weight: 800;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #cfd48d;
  font-size: 12px;
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

.nav-tab {
  width: 100%;
  padding: 13px 16px;
  border-radius: 999px;
  color: #f2f4d6;
  background: transparent;
  text-align: left;
}

.nav-tab:hover,
.nav-tab.is-active {
  color: var(--black);
  background: var(--accent);
}

.user-panel {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 22px;
  color: #f9fadf;
  background: rgba(255, 255, 255, 0.08);
}

.user-panel span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.user-panel button {
  min-height: 36px;
  border-radius: 999px;
  color: var(--black);
  background: var(--accent);
  font-weight: 800;
}

.workspace {
  grid-column: 2;
  min-width: 0;
  max-width: 100%;
  padding: 30px;
  overflow-x: hidden;
}

.topbar {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  margin-bottom: 24px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 30px;
  background:
    radial-gradient(circle at 86% 12%, rgba(252, 245, 70, 0.5), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #fbfde9 100%);
  box-shadow: var(--shadow);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

.topbar p,
.panel-note {
  color: var(--muted);
}

.topbar p {
  margin-top: 8px;
}

.ghost-btn {
  min-width: 132px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--black);
  font-weight: 800;
}

.small-btn {
  min-height: 32px;
  border-radius: 999px;
  padding: 0 11px;
  color: var(--black);
  background: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.small-btn.secondary,
.small-link {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
}

.danger-btn {
  color: #ffffff;
  background: var(--danger);
}

.small-btn:disabled {
  cursor: default;
  color: var(--muted);
  background: #e5ebe6;
}

.text-link,
.small-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  text-decoration: none;
  white-space: nowrap;
}

.text-link {
  color: var(--black);
  background: var(--soft);
}

.view {
  display: none;
  min-width: 0;
  max-width: 100%;
}

.view.is-active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-grid:has(.inventory-cost-metric:not([hidden])) {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.inventory-cost-metric {
  background: #fcf546;
}

.inventory-cost-metric small {
  display: block;
  margin-top: 6px;
  color: #686b63;
  font-size: 11px;
  line-height: 1.4;
}

.metric,
.panel {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  overflow: hidden;
  border-top: 0;
}

.metric {
  padding: 20px;
}

.metric span,
.status-label {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  min-width: 0;
  gap: 18px;
}

.panel {
  padding: 20px;
  overflow: hidden;
}

.section-gap {
  margin-top: 18px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.compact-head {
  margin-bottom: 10px;
}

.compact-head h3 {
  margin: 0;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 10px;
  margin-bottom: 18px;
}

.bom-form,
.kit-form,
.purchase-form {
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
}

.multi-picker {
  display: grid;
  grid-column: span 2;
  max-height: 220px;
  gap: 8px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdfb;
}

.pick-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border-radius: 16px;
  background: var(--soft);
}

.pick-row input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.pick-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
}

.pick-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.pick-row input[type="number"] {
  min-height: 34px;
  padding: 0 9px;
  border-radius: 14px;
}

.purchase-form {
  grid-template-columns: repeat(6, minmax(130px, 1fr)) auto;
}

.purchase-ocr {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px 0;
  border-block: 1px solid var(--line);
}

.purchase-ocr-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.purchase-ocr-head > div:first-child {
  min-width: 0;
  margin-right: auto;
}

.purchase-ocr-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.purchase-ocr h3,
.purchase-ocr p {
  margin: 0;
}

.purchase-ocr p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.purchase-ocr-upload {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.purchase-ocr-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.purchase-ocr-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.2fr);
  gap: 14px;
  min-width: 0;
}

.purchase-ocr-source,
.purchase-ocr-result {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #f5f6f1;
}

.purchase-ocr-source > img {
  width: 100%;
  max-height: 330px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.purchase-ocr-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.purchase-ocr-result-head span {
  color: var(--muted);
  font-size: 12px;
}

.purchase-ocr-result label {
  display: grid;
  gap: 5px;
}

.purchase-ocr-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.purchase-ocr-summary > span {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff;
}

.purchase-ocr-summary small {
  color: var(--muted);
}

.purchase-ocr-summary strong {
  overflow-wrap: anywhere;
}

.purchase-crop-editor {
  display: grid;
  grid-template-columns: 92px repeat(3, minmax(90px, 1fr));
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.purchase-crop-editor > div {
  grid-column: 1 / -1;
}

.purchase-crop-editor small {
  display: block;
  color: var(--muted);
}

.purchase-crop-editor > img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
}

.purchase-crop-editor label {
  font-size: 12px;
}

.purchase-crop-editor input[type="range"] {
  width: 100%;
  min-height: 24px;
  padding: 0;
}

.purchase-material-filter {
  grid-column: 1 / -1;
}

.purchase-material-mode {
  display: inline-flex;
  grid-column: 1 / -1;
  justify-self: start;
  gap: 8px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
}

.purchase-material-mode button {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
}

.purchase-material-mode button.is-active {
  color: var(--black);
  background: var(--accent);
}

.purchase-material-trigger {
  display: flex;
  grid-column: span 2;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: #fbfdfb;
  text-align: left;
}

.purchase-material-trigger span {
  display: grid;
  min-width: 0;
  overflow: hidden;
}

.purchase-material-trigger strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-material-trigger small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-material-picker {
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(900px, 100%);
  overflow: hidden;
}

.purchase-material-picker .modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.purchase-picker-filters {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 10px;
}

.purchase-material-picker-list {
  display: grid;
  min-height: 0;
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
}

.purchase-picker-category {
  display: grid;
  gap: 8px;
}

.purchase-picker-category h3 {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 1;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 2px;
  background: var(--surface);
}

.purchase-picker-category h3 span {
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  font-size: 11px;
}

.purchase-picker-category > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.purchase-picker-category button {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #f7f8f4;
  text-align: left;
}

.purchase-picker-category button.is-selected {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.purchase-picker-category .thumb {
  width: 50px;
  height: 50px;
  border-radius: 8px;
}

.purchase-picker-category button span {
  display: grid;
  min-width: 0;
}

.purchase-picker-category button small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-field {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
}

.date-field > span {
  font-size: 13px;
  font-weight: 800;
}

.date-field > input {
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.date-field > small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.wood-purchase-form {
  display: grid;
  gap: 14px;
}

.wood-form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.wood-form-actions .secondary {
  color: var(--black);
  background: #ffffff;
  border: 1px solid var(--line);
}

.wood-batch-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.wood-item-head,
.wood-batch-summary,
.wood-batch-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.payment-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #7b2500;
  background: #ffe0d0;
  font-size: 12px;
  font-weight: 900;
}

.payment-badge.is-paid {
  color: #405000;
  background: #e9f59c;
}

.payment-summary {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  min-width: 280px;
  font-size: 12px;
  font-weight: 800;
}

.payment-summary i {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffe0d0;
}

.payment-summary b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.wood-item-head h3,
.wood-batch-summary h3,
.wood-batch-summary p {
  margin: 0;
}

.wood-item-editor,
.wood-purchase-list {
  display: grid;
  gap: 12px;
}

.wood-item-row {
  display: grid;
  grid-template-columns: 150px minmax(150px, 1.2fr) minmax(130px, 1fr) 90px 70px 110px 82px 145px auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--soft);
}

.wood-item-row > * {
  min-width: 0;
}

.wood-history-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  gap: 6px;
}

.wood-history-field input {
  min-width: 0;
}

.wood-history-field button {
  padding: 0 10px;
  border-radius: 14px;
  color: var(--black);
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.wood-history-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 11, 11, 0.48);
}

.wood-history-menu {
  display: grid;
  width: min(720px, 100%);
  max-height: min(760px, 88vh);
  gap: 14px;
  overflow: hidden;
  padding: 20px;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.wood-history-menu h2,
.wood-history-menu p {
  margin: 0;
}

.wood-history-menu p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.wood-history-groups {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.wood-history-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.wood-history-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  cursor: pointer;
  list-style: none;
}

.wood-history-group summary::-webkit-details-marker {
  display: none;
}

.wood-history-group summary::after {
  content: "+";
  font-size: 20px;
  font-weight: 900;
}

.wood-history-group[open] summary::after {
  content: "−";
}

.wood-history-group summary span {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.wood-history-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.wood-history-items button {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--black);
  background: var(--soft);
  text-align: left;
}

.wood-history-items button span {
  color: var(--muted);
  font-size: 12px;
}

.wood-item-image {
  min-height: 70px;
  padding: 8px 10px;
}

.wood-sample-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  white-space: nowrap;
}

.wood-sample-check input {
  width: 18px;
  min-height: 18px;
}

.wood-batch-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
}

.wood-batch-summary {
  width: 100%;
  padding: 0;
  color: var(--black);
  background: transparent;
  text-align: left;
}

.wood-batch-summary:disabled {
  cursor: default;
  opacity: 1;
}

.wood-batch-summary p,
.wood-more {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.batch-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 9px;
  padding: 2px 9px;
  border: 2px solid var(--black);
  border-radius: 999px;
  color: var(--black);
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}

.batch-type-badge.is-sample {
  background: var(--highlight);
}

.batch-type-badge.is-bulk {
  background: var(--accent);
}

.batch-type-badge.is-mixed {
  background: linear-gradient(90deg, var(--highlight) 0 50%, var(--accent) 50% 100%);
}

.wood-batch-card.batch-sample {
  border-left: 6px solid var(--highlight);
}

.wood-batch-card.batch-bulk {
  border-left: 6px solid var(--accent);
}

.wood-batch-card.batch-mixed {
  border-left: 6px solid #a9b800;
}

.wood-batch-status {
  align-items: flex-end;
  flex-direction: column;
  text-align: right;
  white-space: nowrap;
}

.wood-batch-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 12px;
  max-width: 100%;
  font-size: 13px;
  white-space: normal;
}

.wood-batch-counts b {
  font-weight: 900;
}

.wood-batch-details,
.wood-parts-list,
.wood-confirmations {
  display: grid;
  gap: 12px;
}

.wood-batch-details {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.wood-batch-note,
.wood-part-main h4,
.wood-part-main p,
.wood-confirmations h4 {
  margin: 0;
}

.sample-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 8px;
  padding: 2px 9px;
  border: 2px solid #111111;
  border-radius: 999px;
  color: #111111;
  background: var(--highlight);
  font-size: 12px;
  font-weight: 900;
  vertical-align: middle;
}

.wood-part-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: var(--soft);
}

.wood-part-main {
  display: grid;
  grid-template-columns: 54px minmax(140px, 1fr) auto auto auto auto;
  gap: 12px;
  align-items: center;
}

.wood-part-main .thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
}

.wood-part-main p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.wood-part-main .received-label small {
  display: block;
  margin-top: 2px;
}

.wood-part-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 300px;
}

.wood-logistics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wood-logistics-entry {
  display: grid;
  gap: 2px;
  min-width: 190px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.wood-logistics-entry small {
  color: var(--muted);
}

.wood-logistics-entry.is-received {
  border-color: var(--accent);
  background: #fbffd7;
}

.received-label,
.pending-label {
  font-size: 11px;
  font-weight: 800;
}

.received-label {
  color: #526000;
}

.pending-label {
  color: var(--muted);
}

.empty.slim {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.wood-item-table {
  max-width: 100%;
  overflow-x: auto;
}

.wood-item-table table {
  min-width: 760px;
}

.wood-item-table .thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.wood-item-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.wood-logistics-form {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(180px, 1fr) auto;
  gap: 10px;
}

.confirmation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.confirmation-grid a {
  display: grid;
  gap: 5px;
  color: var(--black);
  font-size: 12px;
  text-decoration: none;
}

.confirmation-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.confirmation-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.wood-batch-filter {
  margin-bottom: 14px;
}

.wood-gantt {
  --gantt-label-width: 210px;
  --gantt-row-gap: 10px;
  --gantt-timeline-width: 680px;
  display: grid;
  width: max-content;
  min-width: 100%;
  gap: 8px;
  padding: 12px 6px 4px;
}

.gantt-head-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.gantt-panel > .panel-head {
  position: relative;
  z-index: 8;
  width: 100%;
  background: #ffffff;
}

.gantt-zoom-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.gantt-zoom-controls .icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--black);
  font-size: 22px;
  line-height: 1;
}

.gantt-zoom-controls input[type="range"] {
  width: 110px;
  accent-color: var(--accent);
}

.gantt-zoom-controls .small-btn {
  min-height: 34px;
  padding: 6px 11px;
}

.gantt-legend {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  width: var(--gantt-timeline-width);
  margin-left: calc(var(--gantt-label-width) + var(--gantt-row-gap));
  font-size: 12px;
  font-weight: 800;
}

.gantt-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.gantt-legend i {
  width: 22px;
  height: 10px;
  border: 1px solid rgba(11, 11, 11, 0.35);
  border-radius: 4px;
}

.gantt-legend i.is-sample,
.gantt-bar.is-sample {
  background: var(--highlight);
}

.gantt-legend i.is-bulk,
.gantt-bar.is-bulk {
  background: var(--accent);
}

.gantt-legend i.is-mixed,
.gantt-bar.is-mixed {
  background: linear-gradient(90deg, var(--highlight) 0 50%, var(--accent) 50% 100%);
}

.gantt-panel {
  overflow: hidden;
}

.gantt-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}

.gantt-axis {
  position: relative;
  width: var(--gantt-timeline-width);
  height: 42px;
  margin-left: calc(var(--gantt-label-width) + var(--gantt-row-gap));
  border-bottom: 1px solid var(--line);
}

.gantt-axis span {
  position: absolute;
  bottom: 8px;
  box-sizing: border-box;
  border-left: 1px solid #d9dcc5;
  color: var(--black);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.gantt-axis span.is-grid-only {
  color: transparent;
}

.gantt-today-axis,
.gantt-today-line {
  position: absolute;
  z-index: 3;
  width: 2px;
  background: #e33b33;
  transform: translateX(-1px);
}

.gantt-today-axis {
  top: 0;
  bottom: -1px;
}

.gantt-today-axis b {
  position: absolute;
  top: -2px;
  left: 5px;
  padding: 2px 6px;
  border-radius: 6px;
  color: #ffffff;
  background: #e33b33;
  font-size: 11px;
  white-space: nowrap;
}

.gantt-today-line {
  inset-block: 0;
}

.gantt-row {
  display: grid;
  grid-template-columns: var(--gantt-label-width) var(--gantt-timeline-width);
  gap: var(--gantt-row-gap);
  align-items: center;
}

.gantt-row > strong {
  display: grid;
  gap: 4px;
  font-size: 12px;
  position: sticky;
  left: 0;
  z-index: 5;
  min-height: 34px;
  align-content: center;
  padding: 3px 8px 3px 2px;
  background: #ffffff;
  box-shadow: 8px 0 10px rgba(255, 255, 255, 0.9);
}

.gantt-batch-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-row > strong small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.gantt-row > strong .batch-type-badge {
  min-height: 19px;
  margin-left: 5px;
  padding: 1px 6px;
  border-width: 1px;
  font-size: 9px;
}

.gantt-track {
  position: relative;
  width: var(--gantt-timeline-width);
  height: 34px;
  border-radius: 10px;
  border: 1px solid #d9dcc5;
  background-color: #f7f8eb;
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--gantt-day-width) - 1px), #d9dcc5 calc(var(--gantt-day-width) - 1px), #d9dcc5 var(--gantt-day-width));
}

@media (max-width: 760px) {
  .gantt-panel .panel-head {
    align-items: flex-start;
  }

  .gantt-head-tools {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .gantt-zoom-controls {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .gantt-zoom-controls input[type="range"] {
    width: 82px;
  }

  .wood-gantt {
    --gantt-label-width: 150px;
  }
}

/* 2026 green dashboard refresh */
:root {
  --bg: #f3f6f2;
  --surface: #ffffff;
  --ink: #17221a;
  --muted: #6f786f;
  --line: #e2e9df;
  --accent: #8dcc3f;
  --accent-strong: #2e9e32;
  --accent-deep: #17652a;
  --accent-soft: #edf7e8;
  --shadow: 0 12px 30px rgba(43, 83, 46, 0.08);
}

body {
  background: var(--bg);
  color: var(--ink);
}

.sidebar {
  background: #12371f;
}

.nav-tab.is-active,
.nav-tab:hover {
  background: linear-gradient(135deg, #78c83e, #3daa37);
  color: #fff;
}

.user-panel {
  background: rgba(255, 255, 255, 0.1);
}

.workspace {
  padding: 24px;
}

.topbar {
  min-height: 122px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(110deg, #fff 0%, #fbfff7 68%, #e2f5cf 100%);
  box-shadow: var(--shadow);
}

.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dashboard-welcome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 20px;
}

.dashboard-welcome-copy h2 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
}

.dashboard-welcome-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.dashboard-alert-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent-deep);
  box-shadow: 0 8px 20px rgba(43, 83, 46, 0.08);
  font-size: 21px;
}

.dashboard-alert-button::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e43e36;
}

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-action-card {
  position: relative;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 150px;
  padding: 24px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  color: #fff;
  text-align: left;
  box-shadow: 0 14px 26px rgba(44, 126, 45, 0.18);
}

.dashboard-action-card::before {
  content: none;
}

.dashboard-action-card.purchase-action {
  background: linear-gradient(135deg, #59bc43, #209a2e);
}

.dashboard-action-card.material-action {
  background: linear-gradient(135deg, #b0d568, #78b91e);
}

.dashboard-action-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-strong);
  font-size: 32px;
  font-weight: 800;
}

.dashboard-action-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.dashboard-action-copy strong {
  font-size: 22px;
  line-height: 1.2;
}

.dashboard-action-copy small {
  max-width: 280px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  line-height: 1.55;
}

.dashboard-action-arrow {
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent-strong);
  font-size: 22px;
  font-weight: 800;
}

#dashboard .metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

#dashboard .metric {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 116px;
  padding: 18px;
  background: #fff;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 22px;
}

.metric-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.metric-copy span {
  color: var(--muted);
  font-size: 13px;
}

.metric-copy strong {
  font-size: 30px;
  line-height: 1;
}

.metric-copy strong small {
  margin-left: 3px;
  font-size: 13px;
  font-weight: 600;
}

.dashboard-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-panel {
  min-width: 0;
  padding: 22px;
  background: #fff;
}

.dashboard-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-panel .panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.panel-link {
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.dashboard-alert-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: stretch;
}

.inventory-cost-metric {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  padding: 22px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(135deg, #fbfff7, #edf8e6);
  box-shadow: none;
}

.inventory-cost-metric span,
.inventory-cost-metric small {
  color: var(--muted);
}

.inventory-cost-metric strong {
  color: var(--accent-strong);
  font-size: 34px;
  line-height: 1.15;
}

.dashboard-flow-panel {
  grid-column: auto;
}

.dashboard-flow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.flow-summary-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
  text-align: center;
}

.flow-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.flow-summary-item strong {
  color: var(--ink);
  font-size: 24px;
}

.flow-summary-item small {
  color: var(--accent-strong);
  font-size: 11px;
}

.mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.97);
  border-top-color: var(--line);
  box-shadow: 0 -8px 24px rgba(38, 75, 40, 0.08);
}

.mobile-nav-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

@media (max-width: 1100px) {
  .dashboard-primary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-alert-content {
    grid-template-columns: minmax(0, 1fr) 220px;
  }
}

@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    padding: 14px 14px calc(92px + env(safe-area-inset-bottom));
  }

  body.dashboard-active .topbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 70;
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.dashboard-active .topbar > div:first-child,
  body.dashboard-active .desktop-export,
  body.dashboard-active .mobile-subnav {
    display: none;
  }

  body.dashboard-active .topbar-actions {
    display: block;
  }

  body.dashboard-active .icon-menu-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 8px 22px rgba(43, 83, 46, 0.12);
  }

  body.dashboard-active .account-menu {
    position: fixed;
    top: 62px;
    right: 14px;
    z-index: 100;
    width: min(260px, calc(100vw - 28px));
  }

  .dashboard-welcome {
    min-height: 102px;
    padding: 12px 56px 18px 2px;
  }

  .dashboard-welcome-copy h2 {
    font-size: 26px;
  }

  .dashboard-welcome-copy p {
    font-size: 14px;
  }

  .dashboard-alert-button {
    display: none;
  }

  .dashboard-quick-actions {
    gap: 10px;
    margin-bottom: 14px;
  }

  .dashboard-action-card {
    grid-template-columns: 46px minmax(0, 1fr);
    align-content: start;
    gap: 10px;
    min-height: 142px;
    padding: 15px 13px;
  }

  .dashboard-action-icon {
    width: 46px;
    height: 46px;
    font-size: 23px;
  }

  .dashboard-action-copy strong {
    font-size: 17px;
  }

  .dashboard-action-copy small {
    font-size: 12px;
    line-height: 1.45;
  }

  .dashboard-action-arrow {
    right: 12px;
    bottom: 11px;
    width: 30px;
    height: 30px;
    font-size: 19px;
  }

  #dashboard .metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 14px;
    padding: 8px 4px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
  }

  #dashboard .metric {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 104px;
    padding: 8px 3px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    text-align: center;
  }

  #dashboard .metric:last-child {
    border-right: 0;
  }

  .metric-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .metric-copy {
    justify-items: center;
  }

  .metric-copy span {
    max-width: 100%;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .metric-copy strong {
    font-size: 24px;
  }

  .metric-copy strong small {
    font-size: 10px;
  }

  .dashboard-primary-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .dashboard-panel {
    max-width: 100%;
    padding: 16px;
    overflow: hidden;
  }

  .dashboard-panel .panel-head {
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .dashboard-panel .panel-head h2 {
    font-size: 18px;
  }

  .dashboard-alert-content {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .inventory-cost-metric {
    padding: 16px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .inventory-cost-metric strong {
    font-size: 30px;
  }

  .dashboard-flow-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .flow-summary-item {
    padding: 11px 3px;
  }

  .flow-summary-item strong {
    font-size: 21px;
  }

  .flow-summary-item span,
  .flow-summary-item small {
    font-size: 10px;
  }

  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 390px) {
  .dashboard-action-card {
    min-height: 136px;
    padding: 13px 10px;
  }

  .dashboard-action-copy strong {
    font-size: 16px;
  }

  .dashboard-action-copy small {
    font-size: 11px;
  }
}

/* Keep low-frequency account actions reachable on phones. This override lives
   after the legacy responsive rules so the old hidden desktop header cannot
   remove the mobile account menu. */
@media (max-width: 767px) {
  body:not(.mobile-editor-open) .topbar {
    display: flex;
    position: fixed;
    top: 12px;
    right: 12px;
    left: auto;
    z-index: 1100;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    justify-content: flex-end;
  }

  body:not(.mobile-editor-open) .topbar > div:first-child,
  body:not(.mobile-editor-open) .topbar .desktop-export {
    display: none !important;
  }

  body:not(.mobile-editor-open) .topbar-actions {
    display: flex;
    position: relative;
    margin: 0;
  }

  body:not(.mobile-editor-open) .icon-menu-btn {
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid #dfe7dc;
    border-radius: 50%;
    background: #fff;
    color: #17652a;
    box-shadow: 0 8px 22px rgba(18, 74, 31, .15);
  }

  body:not(.mobile-editor-open) .account-menu {
    position: fixed;
    top: 62px;
    right: 12px;
    z-index: 1110;
    width: min(280px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

  .mobile-subnav[hidden] {
    display: none !important;
  }

  .view > section:first-of-type .panel-head {
    padding-right: 60px;
  }

  .purchase-hub-hero {
    padding-right: 60px;
  }
}

/* Mobile-first application shell and record workflows */
.mobile-bottom-nav,
.mobile-subnav,
.mobile-editor-header,
.mobile-save-bar {
  display: none;
}

.mobile-create-button {
  min-height: 44px;
}

.material-summary-list,
.sample-series-list {
  display: grid;
  gap: 10px;
}

.material-summary-card,
.sample-series-summary {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.material-summary-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.summary-thumb .thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
}

.summary-main,
.sample-series-summary > div {
  min-width: 0;
}

.summary-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.summary-title h3,
.sample-series-summary h3 {
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-main p,
.sample-series-summary p {
  margin: 4px 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 7px;
  font-size: 13px;
}

.summary-main small,
.sample-series-summary small {
  color: var(--muted);
}

.status-pill,
.link-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.is-low {
  color: var(--danger);
  background: #fde8e5;
}

.sample-series-summary {
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 13px 14px;
}

.sample-summary-cost {
  display: grid;
  justify-items: end;
  gap: 3px;
  white-space: nowrap;
}

.list-load-more {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(11, 11, 11, 0.38);
}

.mobile-summary-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 90;
  width: min(480px, calc(100vw - 48px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background: var(--surface);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.14);
}

.drawer-handle {
  display: none;
}

.drawer-head,
.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head {
  position: sticky;
  top: -18px;
  z-index: 2;
  padding: 14px 0;
  background: var(--surface);
}

.drawer-head h2 {
  margin: 0;
}

.drawer-head button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
}

.drawer-actions button {
  width: 100%;
  min-height: 48px;
  border-radius: 999px;
  color: var(--black);
  background: var(--accent);
  font-weight: 800;
}

.drawer-content,
.recent-history,
.drawer-toys,
.cost-breakdown {
  display: grid;
  gap: 10px;
}

.drawer-hero {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.drawer-hero .thumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
}

.drawer-hero-info {
  display: grid;
  gap: 5px;
  justify-items: start;
  min-width: 0;
}

.drawer-hero-stock {
  font-size: 22px;
  font-weight: 900;
}

.drawer-hero-stock small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.drawer-hero h3,
.drawer-toy h3 {
  margin: 0 0 5px;
}

.drawer-hero p,
.drawer-toy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.material-info-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.info-item {
  min-width: 0;
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.info-item strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.summary-detail-grid,
.cost-breakdown {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-detail-grid > div,
.cost-breakdown > div,
.recent-history > article,
.drawer-toy {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-detail-grid span,
.cost-breakdown span,
.recent-history small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-detail-grid strong,
.cost-breakdown strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.sample-detail-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 15px;
  border-radius: 8px;
  color: #fff;
  background: var(--black);
}

.sample-detail-total strong {
  color: var(--highlight);
  font-size: 24px;
}

.detail-skeleton {
  min-height: 76px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f2ed 25%, #fafbf7 42%, #f1f2ed 60%);
  background-size: 300% 100%;
  animation: detail-loading 1.2s infinite linear;
}

@keyframes detail-loading {
  to { background-position: -150% 0; }
}

#materials:not(.mobile-editor-active) #materialForm,
#sampleCost:not(.mobile-editor-active) #sampleSeriesForm {
  display: none;
}

.view.mobile-editor-active > .panel.editor-panel {
  position: fixed;
  inset: 24px 24px 24px auto;
  z-index: 101;
  width: min(820px, calc(100vw - 308px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 20px;
  box-shadow: var(--shadow);
}

.view.mobile-editor-active > .panel:not(.editor-panel) {
  display: none;
}

.view.mobile-editor-active .mobile-editor-header {
  position: sticky;
  top: -20px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -20px -20px 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mobile-editor-header button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: var(--soft);
}

.view.mobile-editor-active .panel-head,
.view.mobile-editor-active .category-manager,
.view.mobile-editor-active .filter-bar,
.view.mobile-editor-active #materialRows {
  display: none;
}

.view.mobile-editor-active #materialForm,
.view.mobile-editor-active #sampleSeriesForm {
  display: grid;
}

.view.mobile-editor-active .mobile-save-bar {
  position: sticky;
  bottom: -20px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) minmax(180px, 1fr);
  gap: 10px;
  margin: 12px -20px -20px;
  padding: 12px 20px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.mobile-save-bar button {
  min-height: 48px;
}

/* Keep the backdrop in the same stacking context as the editor panel. */
body.mobile-editor-open .workspace::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 11, 11, 0.4);
}

@media (min-width: 768px) and (max-width: 1180px) {
  .app-shell {
    display: grid !important;
    grid-template-columns: 230px minmax(0, 1fr) !important;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    display: block !important;
    width: 230px !important;
    height: 100dvh !important;
  }

  .workspace {
    grid-column: 2;
    width: auto !important;
    margin: 0 !important;
  }

  .view.mobile-editor-active > .panel.editor-panel {
    width: calc(100vw - 278px);
  }
}

@media (max-width: 767px) {
  html,
  body,
  .app-shell,
  .workspace,
  .view,
  .panel {
    max-width: 100%;
    min-width: 0;
  }

  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block !important;
    min-height: 100dvh;
  }

  .sidebar {
    display: none !important;
  }

  .workspace {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 10px !important;
    overflow-x: clip;
  }

  .topbar {
    min-height: 66px;
    padding: 12px 14px;
    border-radius: 8px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .topbar p,
  .desktop-export {
    display: none !important;
  }

  .icon-menu-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .mobile-subnav {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    gap: 4px;
    margin: 8px 52px 10px 0;
    padding: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 999px;
    background: #e8ecdd;
    backdrop-filter: none;
  }

  .mobile-subnav::-webkit-scrollbar {
    display: none;
  }

  .mobile-subnav button {
    flex: 1 0 auto;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
  }

  .mobile-subnav button.is-active {
    color: var(--black);
    background: var(--accent);
  }

  .mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 80;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 28px rgba(11, 11, 11, 0.08);
  }

  .mobile-bottom-nav button {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 54px;
    padding: 5px 2px;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }

  .mobile-bottom-nav button.is-active {
    color: #269b32;
    background: #eaf7e4;
  }

  .panel,
  .metric {
    border-radius: 8px !important;
  }

  .panel {
    padding: 14px !important;
  }

  .panel-head {
    align-items: flex-start;
  }

  .panel-note {
    font-size: 12px;
  }

  .filter-bar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 0.45fr);
    gap: 8px;
  }

  .filter-bar input:first-child {
    grid-column: 1 / -1;
  }

  .filter-bar input,
  .filter-bar select,
  button,
  input,
  select {
    min-height: 44px;
  }

  .material-summary-card {
    grid-template-columns: 58px minmax(0, 1fr);
    padding: 10px;
  }

  .summary-thumb .thumb {
    width: 58px;
    height: 58px;
  }

  .material-summary-card > button {
    grid-column: 2;
    justify-self: start;
    min-height: 38px;
    padding: 0 13px;
  }

  .summary-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .summary-title h3 {
    max-width: 100%;
  }

  .sample-series-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
  }

  .sample-series-summary > div:first-child {
    grid-column: 1 / -1;
  }

  .sample-summary-cost {
    justify-items: start;
  }

  .mobile-summary-drawer {
    inset: auto 0 0;
    width: 100%;
    max-height: min(82dvh, 760px);
    padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.16);
  }

  .drawer-handle {
    display: block;
    width: 42px;
    height: 5px;
    margin: 2px auto 5px;
    border-radius: 99px;
    background: #c9cbc4;
  }

  .drawer-head {
    top: -8px;
    padding: 10px 0;
  }

  .drawer-hero {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .drawer-hero .thumb {
    width: 72px;
    height: 72px;
  }

  .view.mobile-editor-active > .panel.editor-panel {
    inset: 0;
    z-index: 101;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    padding: 14px;
    border-radius: 0 !important;
    box-shadow: none;
  }

  .view.mobile-editor-active .mobile-editor-header {
    top: -14px;
    margin: -14px -14px 14px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }

  .view.mobile-editor-active #materialForm,
  .view.mobile-editor-active #sampleSeriesForm,
  .view.mobile-editor-active .form-grid,
  .view.mobile-editor-active .sample-toy-head,
  .view.mobile-editor-active .sample-sync-panel {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: none !important;
    overflow: visible;
  }

  .view.mobile-editor-active .sample-material-fields > * {
    grid-area: auto !important;
  }

  .view.mobile-editor-active .mobile-save-bar {
    bottom: -14px;
    margin: 12px -14px -14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  body.mobile-editor-open {
    overflow: hidden;
    padding-bottom: 0;
  }

  body.mobile-editor-open .workspace::after {
    display: none;
  }

  body.mobile-editor-open .mobile-bottom-nav,
  body.mobile-editor-open .topbar,
  body.mobile-editor-open .mobile-subnav {
    display: none !important;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: hidden;
  }

  #dashboard table {
    width: 100%;
    table-layout: fixed;
  }

  #dashboard th,
  #dashboard td {
    padding: 9px 5px;
    overflow-wrap: anywhere;
    font-size: 12px;
  }

  #dashboard th:first-child,
  #dashboard td:first-child {
    width: 34%;
  }
}

.gantt-bar {
  position: absolute;
  top: 5px;
  height: 24px;
  min-width: 24px;
  overflow: hidden;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--black);
  z-index: 2;
  background: var(--accent);
  box-shadow: 0 2px 5px rgba(11, 11, 11, 0.18);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.wood-purchase-list.compact .wood-batch-card {
  padding: 12px;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  width: min(100%, 340px);
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 999px;
  background: #e8ecdd;
  box-shadow: none;
}

.mode-tab {
  flex: 1;
  min-height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  text-align: center;
}

.mode-tab.is-active {
  color: var(--black);
  background: var(--accent);
}

.product-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.product-toolbar input {
  flex: 1;
  min-width: 0;
}

.primary-action {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--black);
  background: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

.primary-action:disabled {
  opacity: 0.5;
}

.chip-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip-row button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.chip-row button.is-active {
  color: var(--black);
  background: var(--accent);
}

.product-row-list {
  display: grid;
  gap: 10px;
}

.product-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
}

.product-row .thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.product-row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.product-row-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-row-main small {
  color: var(--muted);
  font-size: 12px;
}

.product-row-arrow {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.bom-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.bom-status.complete {
  color: var(--accent-deep, #2b532e);
  background: var(--accent-soft, #edf7e8);
}

.bom-status.incomplete {
  color: #8d4d09;
  background: #fff1da;
}

.product-form-actions {
  display: flex;
  gap: 10px;
}

.product-form-actions button[type="submit"] {
  flex: 1;
}

.product-detail-hero {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.product-detail-hero .thumb {
  width: 88px;
  height: 88px;
  border-radius: 14px;
}

.product-detail-hero-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-detail-hero-main h2 {
  margin: 0;
}

.product-detail-hero-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.product-detail-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-detail-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.product-detail-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.product-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 10px;
}

.product-detail-head h3 {
  margin: 0;
}

.bom-detail-list {
  display: grid;
  gap: 10px;
}

.bom-detail-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.bom-detail-item.is-short {
  border-color: #f0c98f;
  background: #fffaf1;
}

.bom-detail-item .thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.bom-detail-item-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.bom-detail-item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bom-detail-item-main small {
  color: var(--muted);
  font-size: 12px;
}

.bom-detail-qty {
  display: grid;
  gap: 2px;
  justify-items: end;
}

.bom-detail-qty span {
  color: var(--muted);
  font-size: 11px;
}

.bom-detail-qty input {
  width: 76px;
  min-height: 36px;
  text-align: right;
}

.bom-detail-qty em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.bom-detail-remove {
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
}

.picker-page-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.picker-page-list .pick-row {
  grid-template-columns: auto 40px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.picker-page-list .pick-row input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
}

.picker-page-list .pick-row .thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.picker-page-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.picker-page-qty input {
  width: 64px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 12px;
  text-align: right;
}

.picker-page-qty em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.picker-page-footer {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
}

/* Sample editor sub-level modes: editing a toy hides series config, editing a material shows only that material */
.sample-material-edit-nav {
  display: none;
  gap: 12px;
  margin-bottom: 14px;
  align-items: center;
}

.sample-series-form.toy-detail-open .sample-series-head,
.sample-series-form.toy-detail-open > .sample-toolbar {
  display: none;
}

.sample-toy-edit.material-detail-open .sample-toy-edit-nav,
.sample-toy-edit.material-detail-open .sample-toy-head,
.sample-toy-edit.material-detail-open .sample-toy-attachment-editor,
.sample-toy-edit.material-detail-open .sample-toolbar,
.sample-toy-edit.material-detail-open .sample-material-edit {
  display: none;
}

.sample-toy-edit.material-detail-open .sample-material-edit-nav {
  display: flex;
}

.sample-toy-edit.material-detail-open .sample-material-edit.is-material-active {
  display: grid;
}

.sample-toy-edit.material-detail-open .sample-material-edit.is-material-active .sample-material-compact {
  display: none;
}

#sampleCost .panel-head {
  flex-wrap: wrap;
}

#sampleCost .panel-head-actions {
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
}

#openSampleCreate {
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 900;
}

@media (max-width: 767px) {
  .product-row {
    grid-template-columns: 48px minmax(0, 1fr) auto 14px;
    gap: 10px;
    padding: 9px 10px;
  }

  .product-row .thumb {
    width: 48px;
    height: 48px;
  }

  .bom-detail-item {
    grid-template-columns: 40px minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 9px 10px;
  }

  .bom-detail-item .thumb {
    width: 40px;
    height: 40px;
  }

  .bom-detail-qty input {
    width: 64px;
  }

  .product-detail-hero {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .product-detail-hero .thumb {
    width: 72px;
    height: 72px;
  }
}

.single-filter {
  grid-template-columns: minmax(0, 1fr);
}

.category-manager {
  display: grid;
  gap: 10px;
  margin: 4px 0 16px;
  padding: 14px;
  border-radius: 22px;
  background: #fffef0;
}

/* Compact account menu, category dialog and layered sample editor. */
[hidden] {
  display: none !important;
}

.topbar-actions {
  position: relative;
  display: flex;
  margin-left: auto;
}

.icon-menu-btn {
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #dfe7dc;
  border-radius: 50%;
  background: #fff;
  color: #17652a;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(18, 74, 31, .15);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 170;
  width: min(250px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .16);
}

body .account-menu.is-floating {
  position: fixed;
  top: 64px;
  right: 12px;
  left: auto;
  z-index: 10000;
  margin: 0;
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.account-menu button {
  width: 100%;
  min-height: 44px;
}

.mobile-create-button {
  min-height: 48px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 900;
}

.category-manager {
  position: fixed;
  inset: 0;
  z-index: 180;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  border-radius: 0;
  background: rgba(9, 9, 9, .48);
  align-content: center;
  overflow-y: auto;
}

.category-manager-card {
  display: grid;
  gap: 14px;
  width: min(560px, 100%);
  max-height: calc(100dvh - 36px);
  margin: auto;
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  overflow-y: auto;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .24);
}

body.category-manager-open {
  overflow: hidden;
}

.sample-toy-navigator {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.sample-toy-nav-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef0;
  color: var(--ink);
  text-align: left;
  align-items: center;
}

.sample-toy-nav-card img,
.sample-toy-nav-card .image-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
}

.sample-toy-nav-card span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.sample-toy-nav-card strong,
.sample-toy-nav-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-toy-nav-card b {
  color: #4d5500;
}

.sample-toy-edit-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  align-items: center;
}

@media (max-width: 767px) {
  body:not(.mobile-editor-open) .icon-menu-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
  }

  .panel-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 8px;
  }

  .panel-head-actions .panel-note {
    grid-column: 1 / -1;
  }

  .panel-head-actions button {
    width: 100%;
  }

  .sample-toy-navigator {
    grid-template-columns: minmax(0, 1fr);
  }

  .sample-toy-nav-card {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    min-height: 80px;
  }

  .sample-toy-nav-card img,
  .sample-toy-nav-card .image-placeholder {
    width: 56px;
    height: 56px;
  }

  .category-manager-card {
    padding: 16px;
  }

  .category-manager .inline-form {
    grid-template-columns: minmax(0, 1fr);
  }
}

.inline-form,
.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
}

.filter-bar {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  margin-bottom: 12px;
}

.picker-filter {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.inline-form button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--black);
  font-weight: 800;
  white-space: nowrap;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

.category-chip button {
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  color: #ffffff;
  background: var(--danger);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 15px;
  color: var(--ink);
  background: #fbfdfb;
}

input:focus,
select:focus {
  outline: 2px solid rgba(200, 217, 52, 0.45);
  border-color: var(--accent-strong);
}

form button {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--black);
  font-weight: 800;
  white-space: nowrap;
}

form button:hover {
  color: var(--black);
  background: var(--highlight);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-radius: 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  color: var(--black);
  background: #fbfce7;
  font-size: 13px;
  font-weight: 600;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 128px;
  background: var(--surface);
}

th:first-child {
  z-index: 3;
  background: #fbfce7;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--black);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.badge.warn {
  color: #8d4d09;
  background: #fff1da;
}

.badge.danger {
  color: var(--danger);
  background: #fae3df;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 0;
  border-radius: 22px;
  background: var(--soft);
}

.timeline-item strong {
  font-size: 14px;
}

.timeline-item span {
  color: var(--muted);
  font-size: 13px;
}

.bom-list,
.purchase-list {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.bom-card,
.purchase-card {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 26px;
  background: #fffef0;
}

.bom-card {
  padding: 16px;
}

.compact-card {
  padding: 10px;
}

.bom-summary {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  width: 100%;
  gap: 12px;
  align-items: center;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.bom-summary .thumb {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.bom-summary span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 800;
}

.bom-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.bom-detail {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.bom-card h3,
.purchase-card h3 {
  margin: 0;
  font-size: 16px;
}

.bom-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.bom-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 20px;
  background: #f7f9d0;
}

.bom-item:nth-child(3n + 2) {
  background: var(--mint);
}

.bom-item:nth-child(3n) {
  background: var(--peach);
}

.bom-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.bom-item input:disabled {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.inline-name-input {
  width: min(240px, 100%);
  min-height: 34px;
  border-radius: 999px;
}

.purchase-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  min-width: 0;
  gap: 16px;
  padding: 16px;
}

.purchase-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.purchase-meta span,
.purchase-card h3,
.timeline-item strong,
.timeline-item span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 8px;
  margin-top: 12px;
}

.action-row > * {
  min-width: 0;
}

.card-actions {
  margin-top: 0;
  margin-left: auto;
}

.material-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.material-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  background: #fffef0;
}

.material-main {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.material-image .thumb {
  width: 76px;
  height: 76px;
  border-radius: 20px;
}

.material-info {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.material-info h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.material-info p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.material-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 88px;
}

.material-shop-link {
  text-decoration: none;
}

.material-edit-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.material-edit-grid input {
  min-height: 38px;
}

.inline-link {
  justify-self: start;
  margin-top: 2px;
}

.subsection-title {
  margin: 18px 0 10px;
  font-size: 16px;
}

.inline-edit {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.inline-edit input {
  min-height: 34px;
}

.route {
  display: grid;
  min-width: 0;
  gap: 8px;
  align-content: center;
}

.route-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #e6e8c5;
  overflow: hidden;
}

.route-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 24px;
  color: var(--muted);
  background: #fffef0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 11, 11, 0.48);
}

.modal-card {
  display: grid;
  width: min(680px, 100%);
  max-height: min(720px, 86vh);
  gap: 16px;
  overflow: auto;
  padding: 22px;
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#userPermissionModal { padding: 0; }

.permission-manager {
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  max-height: none;
  padding: clamp(18px, 3vw, 36px);
  border-radius: 0;
}

.permission-list-view,
.permission-user-detail {
  min-height: 0;
  overflow: auto;
}

.permission-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.permission-table {
  width: 100%;
  border-collapse: collapse;
}

.permission-table th,
.permission-table td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.permission-table tbody tr { cursor: pointer; }
.permission-table tbody tr:hover { background: var(--accent-soft); }
.permission-table tbody tr:last-child td { border-bottom: 0; }
.permission-table td:first-child strong,
.permission-table td:first-child small { display: block; }
.permission-table td:first-child small { color: var(--muted); }
.permission-name-short { display: none; }

.permission-user-detail {
  display: grid;
  align-content: start;
  gap: 16px;
}

.permission-detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.permission-detail-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fffef6;
}

.permission-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.permission-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) repeat(2, minmax(72px, 0.6fr));
  gap: 8px;
  align-items: center;
}

.permission-grid label {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.permission-password-row,
.permission-danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.permission-password-row { margin-top: 14px; }
.permission-password-row input { flex: 1; min-height: 44px; }
.permission-danger { border-color: #e7b7af; background: #fff7f5; }

@media (max-width: 560px) {
  .permission-manager { padding: 18px; }
  .permission-user-head { align-items: flex-start; flex-direction: column; }
  .permission-table th:nth-child(3), .permission-table td:nth-child(3), .permission-table th:nth-child(4), .permission-table td:nth-child(4) { display: none; }
  .permission-table th, .permission-table td { padding: 12px 10px; }
  .permission-detail-head, .permission-password-row, .permission-danger { align-items: stretch; flex-direction: column; }
  .permission-name-full { display: none; }
  .permission-name-short { display: inline; }
  .permission-role-row { width: 100%; flex-direction: column; }
}

.image-viewer-modal {
  z-index: 90;
}

.image-viewer-card {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(960px, 100%);
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.image-viewer-stage {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  border-radius: 18px;
  background: #111;
}

.image-viewer-stage img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.image-download-button {
  display: grid;
  min-height: 48px;
  place-items: center;
  padding: 0 18px;
  border-radius: 999px;
  color: #f9fadf;
  background: var(--black);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 680px) {
  .purchase-material-mode { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-picker-filters, .purchase-picker-category > div { grid-template-columns: 1fr; }
  .image-viewer-modal {
    padding: 10px;
  }

  .image-viewer-card {
    max-height: calc(100vh - 20px);
    padding: 14px;
    border-radius: 22px;
  }

  .image-viewer-stage img {
    max-height: 68vh;
  }
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(11, 11, 11, 0.72);
}

.scanner-card {
  display: grid;
  width: min(520px, 100%);
  gap: 12px;
  padding: 12px;
  border-radius: 28px;
  background: var(--surface);
}

.scanner-card video {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  background: var(--black);
  object-fit: cover;
}

.scanner-card button {
  min-height: 46px;
  border-radius: 999px;
  color: #f9fadf;
  background: var(--black);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 16px;
  }

  .nav-deco {
      top: -18px;
      right: 0;
      bottom: auto;
      left: auto;
      width: 108px;
      height: 108px;
      transform: translateX(34%);
  }

  .nav-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-tab {
    text-align: center;
  }

  .user-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .workspace {
    grid-column: 1;
    padding: 20px;
  }

  .metric-grid,
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .bom-form,
  .kit-form,
  .purchase-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wood-batch-fields,
  .wood-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wood-history-items {
    grid-template-columns: minmax(0, 1fr);
  }

  .wood-history-overlay {
    padding: 10px;
  }

  .wood-history-menu {
    max-height: 92vh;
    padding: 15px;
    border-radius: 20px;
  }

  .wood-item-image {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
    max-width: 100vw;
    align-items: start;
    min-height: 0;
    overflow-x: hidden;
  }

  .topbar,
  .panel-head,
  .purchase-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-tabs,
  .metric-grid,
  .content-grid,
  .form-grid,
  .bom-form,
  .kit-form,
  .purchase-form {
    grid-template-columns: 1fr;
  }

  .purchase-material-trigger {
    grid-column: 1 / -1;
  }

  .wood-batch-fields,
  .wood-item-row,
  .wood-logistics-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .wood-batch-summary {
    align-items: flex-start;
    flex-direction: column;
    max-width: 100%;
  }

  .wood-batch-card {
    overflow: hidden;
  }

  .wood-batch-summary > div,
  .wood-batch-status {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .wood-part-main {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .wood-part-main > strong,
  .wood-part-main > span,
  .wood-part-main > button {
    grid-column: 2;
  }

  .wood-part-actions {
    grid-column: 2;
    justify-content: flex-start;
    max-width: none;
  }

  .confirmation-upload-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .wood-form-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .wood-batch-status {
    align-items: flex-start;
    text-align: left;
    white-space: normal;
  }

  .payment-summary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-width: 0;
    width: 100%;
  }

  .payment-summary span {
    min-width: 0;
    white-space: normal;
  }

  .wood-batch-counts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: start;
    width: 100%;
    gap: 6px 10px;
  }

  .sidebar {
    width: 100%;
    max-width: 100vw;
    padding: 12px 14px 8px;
    min-height: 0;
    height: auto;
    align-self: start;
    overflow: hidden;
    clip-path: inset(0);
    background:
      url("deco.svg") no-repeat right -20px top -16px / 92px 92px,
      var(--black);
  }

  .nav-deco {
    display: none;
  }

  .brand {
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    text-align: left;
    margin-bottom: 8px;
  }

  .brand > div:last-child {
    width: auto;
    text-align: left;
    padding-top: 8px;
  }

  .brand-mark {
    flex: 0 0 auto;
    width: 118px;
    height: 48px;
  }

  .brand strong {
    text-align: left;
    line-height: 1.12;
  }

  .brand span {
    text-align: left;
    margin-top: 4px;
  }

  .nav-tabs {
    display: flex;
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
    margin-bottom: 0;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    flex: 0 0 auto;
    width: auto;
    min-width: 88px;
    padding: 8px 18px;
    white-space: nowrap;
    text-align: center;
  }

  .user-panel {
    margin-top: 8px;
    padding: 10px 12px;
  }

  h1 {
    font-size: 22px;
  }

  .login-card {
    padding: 28px;
  }

  .login-brand {
    gap: 10px;
  }

  .login-brand img {
    width: 116px;
  }

  .login-brand h1 {
    font-size: 24px;
  }

  .workspace {
    width: 100%;
    max-width: 100vw;
    padding: 8px 10px 10px;
    overflow-x: hidden;
  }

  .topbar {
    display: none;
  }

  .topbar p {
    font-size: 13px;
  }

  .metric {
    padding: 14px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-grid:has(.inventory-cost-metric:not([hidden])) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric strong {
    font-size: 24px;
  }

  .metric span {
    font-size: 12px;
  }

  .panel {
    padding: 12px;
    border-radius: 24px;
  }

  .panel-head {
    gap: 4px;
    margin-bottom: 12px;
  }

  .panel-note {
    font-size: 12px;
  }

  .table-wrap {
    border: 1px solid var(--line);
    border-radius: 20px;
  }

  #dashboard .table-wrap {
    overflow-x: hidden;
  }

  #dashboard .table-wrap table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  #dashboard .table-wrap th,
  #dashboard .table-wrap td {
    padding: 9px 5px;
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
  }

  #dashboard .table-wrap th:first-child,
  #dashboard .table-wrap td:first-child {
    position: static;
    min-width: 0;
    width: 34%;
  }

  #dashboard .table-wrap th:nth-child(2),
  #dashboard .table-wrap td:nth-child(2),
  #dashboard .table-wrap th:nth-child(3),
  #dashboard .table-wrap td:nth-child(3),
  #dashboard .table-wrap th:nth-child(4),
  #dashboard .table-wrap td:nth-child(4) {
    width: 22%;
  }

  table {
    width: max-content;
    min-width: 680px;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .purchase-card {
    border-radius: 24px;
    gap: 12px;
    padding: 12px;
  }

  .purchase-meta {
    gap: 6px;
  }

  .purchase-meta span {
    flex: 1 1 100%;
  }

  .action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-form,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .multi-picker {
    grid-column: 1 / -1;
    max-height: 260px;
  }

  .pick-row {
    grid-template-columns: auto minmax(0, 1fr) 82px;
  }

  .action-row > * {
    width: 100%;
    white-space: normal;
    text-align: center;
  }

  .small-btn,
  .small-link,
  .text-link {
    min-height: 32px;
    padding: 0 8px;
    font-size: 13px;
  }

  .thumb {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    max-height: 88vh;
    padding: 16px;
    border-radius: 24px;
  }

  .inline-edit {
    grid-template-columns: minmax(160px, 1fr) auto;
    min-width: 0;
  }

  .inline-edit .text-link {
    grid-column: 1 / -1;
  }

  input,
  select {
    min-width: 0;
  }

  .material-card {
    padding: 10px;
    border-radius: 22px;
  }

  .material-main {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 10px;
  }

  .material-image .thumb {
    width: 70px;
    height: 70px;
    border-radius: 18px;
  }

  .material-actions {
    padding-left: 80px;
  }

  .material-edit-grid {
    grid-template-columns: 1fr;
  }

  .material-card.is-editing .material-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .material-card.is-editing .material-image {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }

  .material-card.is-editing .mini-file {
    justify-self: start;
    width: auto;
    max-width: 100%;
    white-space: normal;
  }

  .material-card.is-editing .material-actions {
    flex-wrap: wrap;
    padding-left: 0;
  }

  .bom-summary {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .bom-summary .thumb {
    width: 58px;
    height: 58px;
  }
}
/* Sample costing */
.sample-series-form { display: grid; gap: 12px; min-width: 0; max-width: 100%; overflow: hidden; }
.sample-series-head { grid-template-columns: 110px minmax(200px, 2fr) repeat(4, minmax(105px, 1fr)); align-items: end; }
.sample-series-image { min-height: 108px; }
.cost-field { display: grid; gap: 6px; font-size: 13px; color: #6e716a; }
.cost-field input { width: 100%; }
.sample-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sample-toolbar h3, .sample-toolbar h4 { margin: 0; }
.sample-toy-editor, .sample-series-list, .sample-material-editor, .sample-material-cost-list { display: grid; gap: 9px; min-width: 0; }

.sample-material-editor:empty::after {
  content: "暂无材料，点击右上角「增加材料」从仓库选择或新建";
  padding: 14px 12px;
  border: 1px dashed #d4dbc6;
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.sample-toy-edit { border: 1px solid #e2e5d7; background: #fff; padding: 11px; border-radius: 8px; display: grid; gap: 9px; min-width: 0; overflow: hidden; }
.sample-toy-head { display: grid; grid-template-columns: 110px minmax(180px, 1fr) 130px auto auto; gap: 8px; align-items: center; }
.sample-toy-attachment-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 11px; border-radius: 8px; background: #f4f5ef; }
.sample-toy-attachment-editor > div:first-child { display: grid; gap: 2px; }
.sample-toy-attachment-editor > div:first-child span { color: var(--muted); font-size: 12px; }
.sample-toy-attachment-editor .mini-file { position: relative; justify-self: end; cursor: pointer; }
.sample-toy-attachment-editor .mini-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sample-toy-attachment-list { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; }
.sample-attachment-item { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.sample-attachment-item > span:first-child { display: grid; min-width: 100px; max-width: 260px; }
.sample-attachment-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.sample-attachment-item small, .sample-attachment-pending { color: var(--muted); font-size: 11px; }
.sample-toy-attachment-downloads { display: grid; gap: 7px; margin: 9px 0; padding: 10px; border-radius: 8px; background: #f4f5ef; }
.sample-toy-attachment-downloads h4 { display: flex; gap: 7px; align-items: center; margin: 0; font-size: 13px; }
.sample-toy-attachment-downloads h4 span { color: var(--muted); }
.sample-toy-attachment-downloads > div { display: flex; flex-wrap: wrap; gap: 7px; }
.sample-toy-attachment-downloads a { display: flex; align-items: center; gap: 12px; min-width: 190px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; text-decoration: none; }
.sample-toy-attachment-downloads a > span { display: grid; min-width: 0; flex: 1; }
.sample-toy-attachment-downloads a strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.sample-toy-attachment-downloads a small { color: var(--muted); font-size: 11px; }
.sample-toy-attachment-downloads a b { color: var(--black); font-size: 12px; }
.sample-image-field { min-height: 76px; padding: 7px; }
.sample-image-field .image-preview { margin-top: 8px; }
.sample-image-field .thumb { width: 54px; height: 54px; }
.sample-material-edit { display: grid; gap: 8px; padding: 8px 10px; background: #f8fad1; border-radius: 8px; font-size: 13px; min-width: 0; }
.sample-material-compact { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; min-height: 58px; padding: 4px; border: 0; border-radius: 7px; background: transparent; color: #111; text-align: left; }
.sample-material-compact:hover { background: rgba(255, 255, 255, .55); }
.sample-material-compact-image .thumb { width: 46px; height: 46px; border-radius: 8px; }
.sample-material-compact-copy { display: grid; gap: 3px; min-width: 0; }
.sample-material-compact-copy strong, .sample-material-compact-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-material-compact-copy small { color: var(--muted); font-weight: 400; }
.sample-material-compact-cost { white-space: nowrap; font-weight: 900; }
.sample-material-compact-action { min-width: 48px; color: #667000; font-weight: 900; text-align: right; }
.sample-material-fields { display: grid; grid-template-columns: 110px minmax(130px, 1.2fr) minmax(110px, .8fr) minmax(130px, 1fr); grid-template-areas: "image source name spec" "image supplier supplier total" "quantity unit cost platform" "url url wood remove"; gap: 8px; align-items: center; width: 100%; min-width: 0; }
.sample-material-edit.is-collapsed .sample-material-fields { display: none; }
.sample-material-fields > .sample-image-field { grid-area: image; }
.sample-material-fields > .sample-material-source { grid-area: source; }
.sample-material-fields > .sample-material-name { grid-area: name; }
.sample-material-fields > .sample-material-spec { grid-area: spec; }
.sample-material-fields > .sample-material-supplier { grid-area: supplier; }
.sample-material-fields > .sample-material-quantity { grid-area: quantity; }
.sample-material-fields > .sample-material-unit { grid-area: unit; }
.sample-material-fields > .sample-material-cost { grid-area: cost; }
.sample-material-fields > .sample-material-platform { grid-area: platform; }
.sample-material-fields > .sample-material-url { grid-area: url; }
.sample-material-fields > .sample-material-wood { grid-area: wood; }
.sample-material-fields > .sample-line-cost { grid-area: total; justify-self: end; }
.sample-material-fields > .remove-sample-material { grid-area: remove; align-self: stretch; }
.sample-material-edit input, .sample-material-edit select { min-width: 0; width: 100%; }
.sample-material-edit input, .sample-material-edit select, .sample-toy-head input { min-height: 42px; padding: 8px 10px; font-size: 14px; }
.sample-material-source { min-width: 0; }
.sample-material-source button { width: 100%; min-height: 42px; padding: 7px 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.sample-line-cost, .sample-toy-total { white-space: nowrap; }
.sample-live-total { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px 24px; min-width: 0; background: #090909; color: #fff; padding: 16px 20px; border-radius: 8px; }
.sample-live-total strong { color: #fcf546; font-size: 20px; }
.sample-series-card { border: 1px solid #e2e5d7; border-radius: 8px; overflow: hidden; background: #fff; }
.sample-series-summary { width: 100%; border-radius: 0; background: #fff; color: #090909; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto auto; text-align: left; align-items: center; gap: 14px; padding: 14px 18px; }
.sample-series-summary > .thumb { width: 58px; height: 58px; }
.sample-series-summary span { display: grid; gap: 5px; }
.sample-series-summary small { color: #757970; font-weight: 400; }
.sample-series-details { display: grid; gap: 16px; padding: 0 18px 18px; }
.sample-toy-cost-card { border-top: 1px solid #e2e5d7; padding-top: 16px; }
.sample-toy-cost-head { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-bottom: 12px; }
.sample-toy-cost-head h3 { margin: 0 0 4px; }
.sample-material-cost-row { display: grid; grid-template-columns: 60px minmax(210px, 1fr) auto auto minmax(180px, auto) auto minmax(190px, auto); align-items: center; gap: 12px; background: #f8fad1; padding: 12px; border-radius: 8px; font-size: 13px; min-width: 0; }
.sample-material-cost-row > .thumb { width: 52px; height: 52px; border-radius: 12px; }
.sample-material-cost-row > div { display: grid; gap: 3px; }
.sample-material-name { min-width: 0; padding-left: 2px; }
.sample-material-name strong, .sample-material-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-material-cost-row span { color: #6f736b; }
.sample-link-actions { display: flex !important; flex-wrap: wrap; gap: 5px !important; }
.sample-order-types { font-weight: 700; color: #111 !important; white-space: nowrap; }
.sample-sync-check { display: flex; gap: 5px; align-items: center; white-space: nowrap; font-weight: 700; }
.sample-procurement { display: flex !important; flex-direction: column; align-items: stretch; gap: 5px; }
.sample-procurement-type { display: flex; align-items: center; gap: 8px; }
.sample-procurement-type > label:last-child { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.sample-procurement-type > label:last-child span { font-size: 12px; }
.sample-procurement input[type="number"] { width: 76px; min-height: 36px; padding: 6px; }
.sample-sync-panel { display: grid; grid-template-columns: minmax(180px, 1fr) 180px 180px auto; gap: 10px; align-items: end; padding: 14px; background: #f1f2ed; border-radius: 8px; }
.sample-purchase-modal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sample-purchase-modal .modal-head, .sample-purchase-modal button[type="submit"] { grid-column: 1 / -1; }
.sample-material-picker { width: min(920px, calc(100vw - 32px)); max-height: min(82vh, 820px); display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); gap: 12px; overflow: hidden; }
.sample-material-picker .modal-head p { margin: 4px 0 0; color: var(--muted); }
.sample-picker-filters { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px; }
.sample-picker-new { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 16px; background: #f8fad1; color: #111; border: 1px solid #dfe3b2; }
.sample-picker-new span { color: var(--muted); font-weight: 400; }
.sample-material-picker-list { min-height: 0; overflow-y: auto; display: grid; gap: 14px; padding-right: 4px; }
.sample-picker-category { display: grid; gap: 8px; }
.sample-picker-category h3 { display: flex; align-items: center; gap: 8px; margin: 0; position: sticky; top: 0; z-index: 1; background: #fff; padding: 6px 2px; }
.sample-picker-category h3 span { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 13px; background: #c8d934; font-size: 12px; }
.sample-picker-category > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sample-picker-category button { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 72px; padding: 9px; background: #f7f8f4; color: #111; text-align: left; }
.sample-picker-category button .thumb { width: 52px; height: 52px; border-radius: 10px; }
.sample-picker-category button span { display: grid; gap: 4px; min-width: 0; }
.sample-picker-category button small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1180px) {
  .sample-series-head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sample-series-head > :nth-child(2) { grid-column: auto; }
  .sample-toy-head { grid-template-columns: 120px minmax(160px, 1fr) 140px; }
  .sample-material-fields { grid-template-columns: repeat(2, minmax(130px, 1fr)); grid-template-areas: none; overflow-x: visible; }
  .sample-material-fields > * { grid-area: auto !important; }
  .sample-material-cost-row { grid-template-columns: 56px minmax(150px, 1fr) auto auto; }
  .sample-sync-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .sample-toy-head, .sample-sync-panel, .sample-purchase-modal { grid-template-columns: 1fr; grid-template-areas: none; }
  .view.mobile-editor-active .sample-series-head { grid-template-columns: 82px minmax(0, 1fr) !important; gap: 8px; align-items: end; }
  .sample-series-head > :first-child { grid-column: 1; grid-row: 1; }
  .sample-series-head > :nth-child(2) { grid-column: 2; grid-row: 1; }
  .sample-series-head > :nth-child(3), .sample-series-head > :nth-child(5) { grid-column: 1; }
  .sample-series-head > :nth-child(4), .sample-series-head > :nth-child(6) { grid-column: 2; }
  .sample-series-image { min-height: 82px; padding: 6px; }
  .sample-series-image .thumb { width: 52px; height: 52px; }
  .cost-field { gap: 3px; font-size: 12px; }
  .cost-field input { min-height: 44px; padding: 8px 10px; }
  .sample-material-compact { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 8px; }
  .sample-material-compact-image .thumb { width: 42px; height: 42px; }
  .sample-material-compact-action { grid-column: 3; font-size: 12px; }
  .sample-material-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: none; }
  .sample-material-fields > * { grid-area: auto !important; }
  .sample-material-fields > .sample-image-field, .sample-material-fields > .sample-material-name, .sample-material-fields > .sample-material-supplier, .sample-material-fields > .sample-material-url, .sample-material-fields > .remove-sample-material { grid-column: 1 / -1; }
  .sample-material-fields > .sample-line-cost { justify-self: start; }
  .sample-toy-attachment-editor { grid-template-columns: 1fr; }
  .sample-toy-attachment-editor .mini-file { justify-self: start; }
  .sample-toy-attachment-list { grid-column: 1; }
  .sample-attachment-item { width: 100%; flex-wrap: wrap; }
  .sample-attachment-item > span:first-child { max-width: min(100%, 220px); flex: 1; }
  .sample-toy-attachment-downloads a { width: 100%; min-width: 0; }
  .sample-purchase-modal .modal-head, .sample-purchase-modal button[type="submit"] { grid-column: auto; }
  .sample-toy-head .sample-image-field { width: 130px; }
  .sample-series-summary { grid-template-columns: 52px 1fr auto; }
  .sample-series-summary > strong { grid-column: 2 / -1; }
  .sample-material-cost-row { grid-template-columns: 52px minmax(0, 1fr); }
  .sample-material-cost-row > :not(.thumb):not(div) { justify-self: start; }
  .sample-live-total { align-items: flex-end; flex-direction: column; gap: 5px; }
  .sample-picker-filters, .sample-picker-category > div { grid-template-columns: 1fr; }
  .sample-picker-new { align-items: flex-start; flex-direction: column; gap: 3px; }
}

@media (max-width: 760px) {
  .purchase-ocr,
  .purchase-ocr-workspace,
  .purchase-ocr-source,
  .purchase-ocr-result {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .purchase-ocr-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .purchase-ocr-head > div:first-child {
    grid-column: 1 / -1;
  }

  .purchase-ocr-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
  }

  .purchase-ocr-actions .purchase-ocr-upload,
  .purchase-ocr-actions button {
    width: 100%;
    min-width: 0;
  }

  .purchase-ocr-workspace,
  .purchase-ocr-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-ocr-source img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
  }

  .purchase-crop-editor {
    grid-template-columns: 80px minmax(0, 1fr);
    align-items: center;
  }

  .purchase-crop-editor > img {
    grid-row: 1 / span 3;
    width: 80px;
    height: 80px;
  }

  .purchase-crop-editor label {
    min-width: 0;
  }
}

/* Keep the dashboard account trigger compact and floating after all legacy
   mobile header rules have been applied. */
@media (max-width: 767px) {
  body.dashboard-active:not(.mobile-editor-open) .topbar {
    display: flex;
    position: fixed;
    top: 12px;
    right: 12px;
    left: auto;
    z-index: 1100;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
  }

  body.dashboard-active:not(.mobile-editor-open) .topbar > div:first-child,
  body.dashboard-active:not(.mobile-editor-open) .topbar .desktop-export,
  body.dashboard-active:not(.mobile-editor-open) .topbar .mobile-subnav {
    display: none !important;
  }

  body.dashboard-active:not(.mobile-editor-open) .topbar-actions {
    display: block;
    position: static;
    margin: 0;
  }

  body.dashboard-active:not(.mobile-editor-open) .icon-menu-btn {
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid #dfe7dc;
    border-radius: 50%;
    background: #fff;
    color: #17652a;
    box-shadow: 0 8px 22px rgba(18, 74, 31, .15);
  }

  body.dashboard-active:not(.mobile-editor-open) .account-menu {
    position: fixed;
    top: 62px;
    right: 12px;
    z-index: 1110;
    width: min(260px, calc(100vw - 24px));
  }
}

/* Final icon overrides: keep legacy text rules from recoloring or resizing SVGs. */
.flow-summary-item > span:first-child {
  color: var(--accent-strong);
  font-size: inherit;
}

.flow-summary-item > span:first-child .flow-icon {
  width: 21px;
  height: 21px;
}

.mobile-bottom-nav button > span:first-child {
  display: grid;
  place-items: center;
  width: 32px;
  height: 27px;
  margin: 0 auto;
  font-size: inherit;
}

.mobile-bottom-nav button > span:first-child .mobile-nav-icon {
  width: 22px;
  height: 22px;
}

/* Dashboard number hierarchy: labels stay quiet while values remain legible. */
.metric-copy > span {
  font-size: 13px;
}

.metric-copy strong > span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.flow-summary-item strong {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
}

.flow-summary-item strong em {
  margin-left: 2px;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.dashboard-flow-summary {
  margin-bottom: 14px;
}

@media (max-width: 767px) {
  #dashboard .metric-grid {
    gap: 1px;
  }

  .metric-copy > span {
    font-size: 11px;
  }

  .metric-copy strong,
  .metric-copy strong > span {
    font-size: 23px;
    font-weight: 700;
  }

  .metric-copy strong small {
    font-size: 11px;
    font-weight: 600;
  }

  .dashboard-flow-summary {
    gap: 8px;
    margin-bottom: 14px;
  }

  .flow-summary-item {
    padding: 11px 4px;
  }

  .flow-summary-item strong {
    font-size: 18px;
    font-weight: 700;
  }

  .flow-summary-item strong em {
    font-size: 11px;
  }
}

/* ---------- 采购中心（一级采购 Hub 页） ---------- */
.purchase-hub-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 48px 18px 4px;
}

.purchase-hub-copy h2 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
}

.purchase-hub-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.purchase-hub-actions {
  margin-bottom: 18px;
}

.purchase-hub-panel + .purchase-hub-panel {
  margin-top: 18px;
}

.pc-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 0 2px;
}

.pc-stat {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.pc-stat:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(43, 83, 46, 0.1);
  transform: translateY(-1px);
}

.pc-stat span {
  color: var(--muted);
  font-size: 13px;
}

.pc-stat strong {
  color: var(--accent-deep);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.pc-stat small {
  color: var(--muted);
  font-size: 12px;
}

.pc-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}

.pc-filter-chips button {
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pc-filter-chips button:hover {
  border-color: var(--accent-strong);
  color: var(--accent-deep);
}

.pc-filter-chips button.is-active {
  border-color: var(--accent-strong);
  background: linear-gradient(135deg, #78c83e, #3daa37);
  color: #fff;
  font-weight: 600;
}

.pc-recent-list {
  display: grid;
  gap: 10px;
}

.pc-order {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pc-order:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(43, 83, 46, 0.08);
}

.pc-order-thumb .thumb,
.pc-order-thumb img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--accent-soft);
}

.pc-order-thumb .thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.pc-order-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pc-order-info strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.pc-order-info span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.pc-badge.is-pending {
  background: #fff4e0;
  color: #b97a12;
}

.pc-badge.is-buying {
  background: #e7f4ff;
  color: #1d74c4;
}

.pc-badge.is-receiving {
  background: #f0ebff;
  color: #6d4fd0;
}

.pc-badge.is-done {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.pc-order-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.pc-order-side strong {
  color: var(--accent-strong);
  font-size: 17px;
  font-weight: 800;
}

.pc-order-side small {
  color: var(--muted);
  font-size: 12px;
}

.pc-reminders {
  display: grid;
  gap: 10px;
}

.pc-reminder {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pc-reminder:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(43, 83, 46, 0.08);
}

.pc-reminder-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.pc-reminder-icon::before {
  font-size: 20px;
}

.pc-reminder-icon.is-cart { background: #e7f6df; }
.pc-reminder-icon.is-cart::before { content: "🛒"; }
.pc-reminder-icon.is-truck { background: #fff4e0; }
.pc-reminder-icon.is-truck::before { content: "🚚"; }
.pc-reminder-icon.is-clock { background: #e7f4ff; }
.pc-reminder-icon.is-clock::before { content: "⏰"; }
.pc-reminder-icon.is-bell { background: #fdeaea; }
.pc-reminder-icon.is-bell::before { content: "🔔"; }

.pc-reminder-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pc-reminder-copy strong {
  font-size: 14px;
}

.pc-reminder-copy small {
  color: var(--muted);
  font-size: 12px;
}

.pc-reminder-arrow {
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

@media (max-width: 767px) {
  .purchase-hub-copy h2 {
    font-size: 24px;
  }

  .pc-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .pc-stat {
    padding: 10px 4px;
  }

  .pc-stat strong {
    font-size: 20px;
  }

  .pc-order {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .pc-order-thumb .thumb,
  .pc-order-thumb img {
    width: 48px;
    height: 48px;
  }

  .pc-order-side strong {
    font-size: 15px;
  }
}

/* ---------- 视图返回按钮（返回采购中心） ---------- */
.view-back-btn {
  display: none;
}

@media (max-width: 767px) {
  .view-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    margin: 0 0 10px;
    padding: 0 16px 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--accent-deep);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(43, 83, 46, 0.08);
    cursor: pointer;
  }

  .view-back-btn .ui-icon {
    width: 20px;
    height: 20px;
  }

  .view-back-btn:active {
    background: var(--accent-soft);
  }
}

/* ---------- 新建材料采购单：明细卡片 + 底部浮动栏 ---------- */
.purchase-section {
  margin-top: 6px;
}

.purchase-section + .purchase-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.purchase-section-head {
  margin-bottom: 14px;
}

.purchase-section-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.purchase-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.purchase-entry-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.purchase-entry-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdf9;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.purchase-entry-card:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(43, 83, 46, 0.1);
}

.purchase-entry-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, #78c83e, #3daa37);
  color: #fff;
}

.purchase-entry-icon .ui-icon {
  width: 26px;
  height: 26px;
}

.purchase-entry-card:nth-child(2) .purchase-entry-icon {
  background: linear-gradient(135deg, #b0d568, #78b91e);
}

.purchase-entry-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.purchase-entry-copy strong {
  font-size: 15px;
}

.purchase-entry-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.purchase-entry-arrow {
  margin-left: auto;
  color: var(--accent-strong);
}

.purchase-entry-arrow .ui-icon {
  width: 20px;
  height: 20px;
}

.purchase-ocr-tip {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.purchase-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 10px;
}

.purchase-items-head h4 {
  margin: 0;
  font-size: 15px;
}

.purchase-item-list {
  display: grid;
  gap: 12px;
}

.purchase-item-card {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  padding-left: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.purchase-item-no {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.purchase-item-thumb {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.purchase-item-thumb:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.purchase-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.purchase-item-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.purchase-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.purchase-item-title input {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.purchase-item-match {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.purchase-item-match.is-matched {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.purchase-item-spec {
  width: 100%;
}

.purchase-item-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
}

.purchase-item-numbers label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.purchase-item-numbers input {
  width: 100%;
}

.purchase-item-subtotal {
  color: var(--accent-strong);
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.purchase-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.purchase-item-remove {
  color: #c4382f;
}

.purchase-add-item {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--accent-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.purchase-add-item:hover {
  background: var(--accent-soft);
}

.purchase-field {
  display: grid;
  gap: 6px;
}

.purchase-field > span {
  color: var(--muted);
  font-size: 12px;
}

.purchase-field-wide {
  grid-column: 1 / -1;
}

.purchase-submit-bar {
  position: sticky;
  bottom: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 28px rgba(43, 83, 46, 0.16);
}

.purchase-submit-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.purchase-submit-summary span {
  color: var(--muted);
  font-size: 12px;
}

.purchase-submit-summary span b {
  color: var(--ink);
}

.purchase-submit-summary strong {
  color: var(--accent-strong);
  font-size: 17px;
}

.purchase-submit-bar button {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #78c83e, #3daa37);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.purchase-submit-bar button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.purchase-crop-modal {
  max-width: 420px;
}

.purchase-crop-stage {
  display: grid;
  place-items: center;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent-soft);
}

.purchase-crop-stage img {
  width: 240px;
  height: 240px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.purchase-crop-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.purchase-crop-slider input {
  flex: 1;
}

@media (max-width: 767px) {
  .purchase-entry-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .purchase-entry-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 0;
    padding: 14px 12px;
  }

  .purchase-entry-icon {
    width: 44px;
    height: 44px;
  }

  .purchase-entry-arrow {
    position: absolute;
    right: 10px;
    bottom: 10px;
    margin: 0;
  }

  .purchase-item-card {
    grid-template-columns: 60px minmax(0, 1fr);
    padding: 12px;
    padding-left: 32px;
  }

  .purchase-item-thumb {
    width: 60px;
    height: 60px;
  }

  .purchase-item-numbers {
    grid-template-columns: 1fr 1fr;
  }

  .purchase-item-subtotal {
    grid-column: 1 / -1;
  }

  .purchase-submit-bar {
    position: fixed;
    right: 10px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 65;
  }
}

/* 采购公共信息表单：双列网格，覆盖旧版 6 列布局 */
#purchase .purchase-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 767px) {
  #purchase .purchase-form {
    grid-template-columns: 1fr;
  }

  #purchase .purchase-field-wide {
    grid-column: auto;
  }
}

/* ---------- 采购页窄屏修复 ---------- */
/* 1. 面板标题与「查看全部 / 全部数据」保持同一行（覆盖窄屏 grid 堆叠规则） */
@media (max-width: 680px) {
  .purchase-hub-panel .panel-head,
  #purchaseList .panel-head,
  #purchase .panel-head,
  #woodPurchase .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-template-columns: none;
  }
}

.purchase-hub-panel .panel-head .panel-link,
#purchaseList .panel-head .panel-link {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* 2. 状态筛选 chips 一行显示，超出可横向滑动 */
@media (max-width: 767px) {
  .pc-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .pc-filter-chips::-webkit-scrollbar {
    display: none;
  }

  .pc-filter-chips button {
    flex: 0 0 auto;
    padding: 7px 14px;
  }
}

/* 3. 采购单卡片防错位：长订单号省略，状态徽章与金额不再重叠 */
.pc-order-info {
  overflow: hidden;
}

.pc-order-info strong {
  min-width: 0;
}

.pc-orderno {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-badge {
  flex: 0 0 auto;
}

.pc-order-side {
  flex: 0 0 auto;
}

/* 4. 订单截图识别区紧凑化：一行小图 + 状态 + 按钮 */
.purchase-ocr-result .small-btn {
  justify-self: start;
}

@media (max-width: 767px) {
  .purchase-ocr-workspace {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
  }

  .purchase-ocr-source,
  .purchase-ocr-result {
    padding: 8px;
    gap: 6px;
  }

  .purchase-ocr-source > span {
    color: var(--muted);
    font-size: 12px;
  }

  .purchase-ocr-source > img {
    max-height: 110px;
  }

  .purchase-ocr-result-head strong {
    font-size: 13px;
  }

  .purchase-ocr-tip {
    font-size: 11px;
  }
}

/* 5. 底部浮动栏遮挡：采购页底部预留空间 */
@media (max-width: 767px) {
  #purchase {
    padding-bottom: calc(150px + env(safe-area-inset-bottom));
  }
}

/* ---------- 账户菜单重新布局（去掉灰色块，统一白底列表） ---------- */
.account-menu {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 12px;
}

.account-menu strong {
  display: block;
  margin-bottom: 4px;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}

.account-menu button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  box-shadow: none;
}

.account-menu button:hover,
.account-menu button:active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* ---------- 采购单列表筛选栏 ---------- */
.purchase-list-filters {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(110px, 1fr) minmax(110px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.purchase-list-date {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.purchase-list-date input {
  min-width: 0;
}

@media (max-width: 767px) {
  .purchase-list-filters {
    grid-template-columns: 1fr 1fr;
  }

  .purchase-list-filters #purchaseListSearch {
    grid-column: 1 / -1;
  }

  .purchase-list-filters #purchaseListReset {
    grid-column: 1 / -1;
  }
}

/* ---------- 采购中心入口卡片（与首页渐变按钮区分开：白底轻量风格） ---------- */
.hub-entry-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 108px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.hub-entry-card:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 12px 26px rgba(43, 83, 46, 0.14);
  transform: translateY(-2px);
}

.hub-entry-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.hub-entry-icon.is-wood {
  background: #f2f7e4;
  color: #78a91e;
}

.hub-entry-icon .ui-icon {
  width: 28px;
  height: 28px;
}

.hub-entry-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.hub-entry-copy strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.hub-entry-copy small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.hub-entry-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.hub-entry-arrow .ui-icon {
  width: 18px;
  height: 18px;
}

/* ---------- 材料档案：统计条 + 紧凑材料行（图一效果） ---------- */
.material-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.material-stat {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdf9;
}

.material-stat span {
  color: var(--muted);
  font-size: 12px;
}

.material-stat strong {
  color: var(--accent-deep);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}

.material-stat strong small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.material-row {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.material-row:hover {
  border-color: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(43, 83, 46, 0.08);
}

.material-row-thumb .thumb,
.material-row-thumb img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--accent-soft);
}

.material-row-thumb .thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.material-row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.material-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.material-row-title h3 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-row-title .status-pill {
  flex: 0 0 auto;
}

.material-row-main p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-row-side {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.material-row-side > span {
  color: var(--muted);
  font-size: 11px;
}

.material-row-side strong {
  color: var(--accent-deep);
  font-size: 19px;
  font-weight: 800;
  white-space: nowrap;
}

.material-row-side small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.material-row-arrow {
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

.view.mobile-editor-active .material-stats {
  display: none;
}

@media (max-width: 767px) {
  .hub-entry-card {
    min-height: 92px;
    padding: 16px 14px;
    gap: 12px;
  }

  .hub-entry-icon {
    width: 46px;
    height: 46px;
  }

  .hub-entry-copy strong {
    font-size: 16px;
  }

  .hub-entry-copy small {
    font-size: 12px;
  }

  .material-stats {
    gap: 6px;
  }

  .material-stat {
    padding: 9px 4px;
  }

  .material-stat strong {
    font-size: 18px;
  }

  .material-row {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px;
  }

  .material-row-thumb .thumb,
  .material-row-thumb img {
    width: 52px;
    height: 52px;
  }

  .material-row-side strong {
    font-size: 16px;
  }

  .material-row-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .material-row-title h3 {
    flex: 1 1 100%;
    overflow: visible;
    line-height: 1.35;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .material-row-arrow {
    display: none;
  }
}

/* 打样系列列表行布局（当前结构：信息 + 成本 + 编辑按钮，覆盖旧的四列网格规则） */
.sample-series-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "info edit"
    "cost cost";
  gap: 6px 12px;
  align-items: start;
  padding: 16px;
  border-radius: 16px;
}

.sample-series-row > div:first-child {
  grid-area: info;
}

.sample-series-row > .sample-summary-cost {
  grid-area: cost;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-items: start;
  gap: 6px 12px;
  white-space: normal;
}

.sample-series-row .sample-summary-cost > span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.sample-series-row .sample-summary-cost strong {
  font-size: 20px;
}

.sample-series-row .sample-summary-cost .link-status {
  margin-left: auto;
}

.sample-series-row > button {
  grid-area: edit;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
}

/* 编辑器返回按钮统一为箭头药丸样式（与产品/采购页一致，且所有宽度可见） */
.view-back-btn.editor-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0 16px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(43, 83, 46, 0.08);
  cursor: pointer;
}

.view-back-btn.editor-back-btn .ui-icon {
  width: 20px;
  height: 20px;
}

.view-back-btn.editor-back-btn:active {
  background: var(--accent-soft);
}

/* 进入玩具/材料编辑层时隐藏表单级头部，避免双返回按钮 */
.mobile-editor-header.is-hidden {
  display: none !important;
}

/* 打样面板：新增打样按钮与标题之间增加留白 */
#sampleCost .panel-head-actions {
  margin-top: 10px;
}

/* 木制采购：两级结构（批次列表级 / 新增批次级） */
#woodPurchase:not(.wood-creating) #woodPurchaseForm {
  display: none;
}

#woodPurchase.wood-creating > .panel.section-gap,
#woodPurchase.wood-creating > .view-back-btn,
#woodPurchase.wood-creating #woodCreateEntry {
  display: none !important;
}

.wood-create-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.wood-create-head strong {
  font-size: 18px;
}

/* 零件列表：空态提示 + 卡片行 */
#woodItemEditor:empty::after {
  content: "暂无零件，点击右上角「增加零件」添加";
  padding: 14px 12px;
  border: 1px dashed #d4dbc6;
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.wood-item-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.wood-item-card-thumb .thumb,
.wood-item-card-thumb img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--accent-soft);
}

.wood-item-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.wood-item-card-main strong,
.wood-item-card-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wood-item-card-main small {
  color: var(--muted);
  font-size: 12px;
}

.wood-sample-tag {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.wood-item-card-actions {
  display: grid;
  gap: 6px;
}

/* 零件底部弹窗 */
.wood-item-sheet {
  width: min(560px, 100%);
}

.wood-sheet-body {
  display: grid;
  gap: 10px;
}

.wood-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.wood-sheet-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}

.wood-sheet-grid input {
  min-width: 0;
  width: 100%;
}

.wood-sheet-actions {
  grid-template-columns: minmax(110px, 0.35fr) minmax(0, 1fr);
}

.wood-sheet-actions button {
  min-height: 48px;
  border-radius: 999px;
  font-weight: 800;
}

@media (max-width: 767px) {
  .wood-item-sheet-modal {
    place-items: end center;
    padding: 0;
  }

  .wood-item-sheet {
    width: 100%;
    max-height: 88dvh;
    border-radius: 24px 24px 0 0;
  }
}

/* 木制厂家：下拉选择 + 新增厂家按钮 */
.wood-factory-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.wood-factory-field select {
  min-width: 0;
  width: 100%;
}

.wood-factory-field button {
  min-height: 44px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 木制厂家：内嵌新增输入行 */
.wood-factory-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.wood-factory-add input {
  min-width: 0;
  width: 100%;
}

.wood-factory-add button {
  min-height: 44px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 采购中心：小屏两张入口大卡改单列，避免文字竖排挤压 */
@media (max-width: 767px) {
  .purchase-hub-actions.dashboard-quick-actions {
    grid-template-columns: 1fr;
  }

  .purchase-hub-actions .hub-entry-card {
    min-height: 84px;
  }
}

/* 最近采购单可点击查看详情 */
.pc-order {
  cursor: pointer;
}

.pc-order:focus-visible {
  outline: 2px solid var(--primary, #2e7d32);
  outline-offset: 2px;
}

.pd-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.pd-detail-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  font-size: 14px;
}

.pd-detail-row dt {
  color: var(--muted);
}

.pd-detail-row dd {
  margin: 0;
  word-break: break-all;
}

.pd-detail-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.pd-detail-head strong {
  display: block;
  font-size: 16px;
}

.pd-detail-head small {
  color: var(--muted);
}

/* 木制采购：新增批次按钮小屏铺满、不挤压换行 */
@media (max-width: 760px) {
  #woodCreateEntry .panel-head-actions {
    grid-template-columns: 1fr;
  }

  #openWoodCreate {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    white-space: nowrap;
  }

  /* 小屏甘特图改为进度列表，缩放控件不再显示 */
  .gantt-head-tools .gantt-zoom-controls {
    display: none;
  }

  .wood-gantt.is-mobile-list {
    width: 100%;
    min-width: 0;
    gap: 10px;
  }

  .wood-gantt.is-mobile-list .gantt-legend {
    width: auto;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }
}

#openWoodCreate {
  white-space: nowrap;
}

/* 小屏甘特图：批次进度卡片 */
.gantt-m-row {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.gantt-m-row:active {
  transform: scale(0.99);
}

.gantt-m-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gantt-m-title strong {
  font-size: 15px;
}

.gantt-m-dates {
  font-size: 12px;
  color: var(--muted);
}

.gantt-m-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #eef1e4;
  overflow: hidden;
}

.gantt-m-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.gantt-m-row.is-sample .gantt-m-track i {
  background: var(--highlight);
}

.gantt-m-row.is-bulk .gantt-m-track i {
  background: var(--accent);
}

.gantt-m-row.is-mixed .gantt-m-track i {
  background: linear-gradient(90deg, var(--highlight), var(--accent));
}

.gantt-m-status {
  font-size: 12px;
  font-weight: 700;
}

.gantt-m-row.is-overdue .gantt-m-status {
  color: #c0392b;
}

/* 木制采购页：小屏下面板标题与操作区上下排列，避免标题挤压换行、右侧空洞 */
@media (max-width: 680px) {
  #woodPurchase .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-right: 0;
  }

  #woodPurchase .panel-head h2 {
    white-space: nowrap;
  }

  #woodPurchase .panel-head-actions {
    width: 100%;
  }
}

/* 材料图片调整弹窗：整图 + 可拖动框 + 上传替代 */
.purchase-crop-full {
  position: relative;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  max-height: 52vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.purchase-crop-full img {
  display: block;
  width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.purchase-crop-frame {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--accent-strong, #2e9e32);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(9, 20, 9, 0.38);
  cursor: move;
  touch-action: none;
}

.purchase-crop-result {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 2px;
}

.purchase-crop-result > span {
  color: var(--muted);
  font-size: 13px;
}

.purchase-crop-result > img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.purchase-crop-result > button {
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- 经销商订单模块 ---------- */
.order-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.order-stat {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}

.order-stat b {
  display: block;
  font-size: 20px;
}

.order-stat span {
  font-size: 12px;
  color: var(--muted);
}

.order-stat.is-short b {
  color: #c0392b;
}

.order-status-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 10px 0 14px;
  padding-bottom: 2px;
}

.order-status-chips button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.order-status-chips button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.order-list {
  display: grid;
  gap: 12px;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 8px;
  cursor: pointer;
  background: #fff;
}

.order-card:active {
  transform: scale(0.99);
}

.order-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.order-card-head strong {
  font-size: 15px;
}

.order-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.order-badge.is-short {
  background: #fdecea;
  color: #c0392b;
}

.order-badge.is-ready {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.order-badge.is-working {
  background: #e8f0fe;
  color: #2456c8;
}

.order-badge.is-done {
  background: #eeeeee;
  color: var(--muted);
}

.order-card-dealer {
  font-size: 14px;
}

.order-card-toys {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-thumbs {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.order-thumbs .thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid #fff;
  margin-left: -8px;
  overflow: hidden;
  font-size: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
}

.order-thumbs .thumb:first-child {
  margin-left: 0;
}

.order-thumb-more {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  margin-left: -8px;
  border: 2px solid #fff;
}

.order-toy-summary {
  font-size: 14px;
  display: grid;
  min-width: 0;
}

.order-toy-summary small {
  color: var(--muted);
}

.order-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.order-card-foot small {
  color: var(--muted);
  font-size: 12px;
}

.order-eta {
  font-size: 12px;
  white-space: nowrap;
}

.order-eta b {
  font-size: 14px;
}

.order-eta.is-short {
  color: #c0392b;
}

.order-eta.is-done {
  color: var(--muted);
}

/* 订单详情 */
.order-detail-meta {
  display: grid;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 12px;
}

.order-eta-panel {
  border-radius: 14px;
  background: var(--accent-soft);
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.order-eta-panel > span {
  font-size: 12px;
  color: var(--muted);
}

.order-eta-panel strong {
  font-size: 22px;
  color: var(--accent-deep);
}

.order-eta-panel small {
  color: var(--muted);
  font-size: 12px;
}

.order-eta-panel.is-short {
  background: #fdecea;
}

.order-eta-panel.is-short strong {
  color: #c0392b;
}

.order-eta-panel.is-done {
  background: #f0f0f0;
}

.order-detail-status-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.order-detail-status-row select {
  flex: 1;
  min-width: 120px;
}

.order-detail-delete {
  color: #c0392b;
}

.order-detail-toys {
  display: grid;
  gap: 10px;
}

.order-detail-toy {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}

.order-detail-toy .thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 10px;
  background: var(--accent-soft);
}

.order-detail-toy span {
  display: grid;
}

.order-detail-toy small {
  color: var(--muted);
}

.order-need-list {
  display: grid;
  gap: 10px;
}

.order-need-row {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.order-need-row.is-short {
  border-color: #f0c1bb;
  background: #fff7f6;
}

.order-need-row .thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 10px;
  background: #fff;
}

.order-need-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.order-need-info strong {
  font-size: 14px;
}

.order-need-info small {
  color: var(--muted);
  font-size: 12px;
}

.order-need-nums {
  text-align: right;
  display: grid;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}

.order-need-nums b {
  color: #c0392b;
  font-size: 14px;
}

.order-need-nums em {
  color: var(--accent-strong);
  font-style: normal;
  font-weight: 700;
}

.order-short-count {
  color: #c0392b;
}

.order-goto-purchase {
  margin-top: 12px;
  width: 100%;
  min-height: 44px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* 新建订单 */
.order-item-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.order-item-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 84px auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}

.order-item-row .thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 10px;
  background: var(--accent-soft);
}

/* 产能配置 */
.assembly-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.assembly-stat {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}

.assembly-stat b {
  display: block;
  font-size: 18px;
}

.assembly-stat span {
  font-size: 11px;
  color: var(--muted);
}

.assembly-stat.is-short b {
  color: #c0392b;
}

.assembly-worker-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.assembly-worker-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.assembly-worker-row label { display: flex; align-items: center; gap: 8px; }
.assembly-worker-row label input { width: 110px; }
.assembly-worker-row label small { color: var(--muted); }

.schedule-week-field { max-width: 260px; margin-top: 14px; }
.schedule-list { display: grid; gap: 12px; }
.schedule-card { padding: 16px; border: 1px solid var(--line); border-left: 5px solid #9ba7a0; border-radius: 16px; background: #fff; }
.schedule-card.priority-紧急 { border-left-color: #d64b3c; }
.schedule-card.priority-高 { border-left-color: #e8a228; }
.schedule-card-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.schedule-card-main p, .schedule-card-main small { display: block; margin: 4px 0 0; color: var(--muted); }
.schedule-priority { padding: 5px 8px; border-radius: 999px; background: var(--accent-soft); font-size: 12px; font-weight: 700; }
.schedule-assign-row { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)) auto; gap: 8px; margin-top: 12px; align-items: end; }
.schedule-assign-row label { display: grid; gap: 4px; min-width: 0; }
.schedule-assign-row label > span { color: var(--muted); font-size: 11px; }
.schedule-assign-row select, .schedule-assign-row input, .permission-role-row select { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.permission-role-row { display: flex; gap: 8px; }

.gantt-scroll { width: 100%; overflow-x: auto; padding-bottom: 6px; }
.gantt-board { min-width: 900px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; }
.gantt-header { display: grid; grid-template-columns: 220px repeat(7, minmax(92px, 1fr)); border-bottom: 1px solid var(--line); background: #f4f8ef; }
.gantt-header > * { display: grid; place-items: center; min-height: 56px; padding: 7px; border-right: 1px solid var(--line); text-align: center; }
.gantt-header > *:last-child { border-right: 0; }
.gantt-header span { font-weight: 700; }
.gantt-header span small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }
.gantt-header span.is-today { color: var(--accent-deep); background: #e8f6df; }
.gantt-worker + .gantt-worker { border-top: 2px solid #dce6d6; }
.gantt-worker > h3 { margin: 0; padding: 9px 12px; color: var(--accent-deep); background: #fbfcf8; font-size: 14px; }
.gantt-row { display: grid; grid-template-columns: 220px minmax(644px, 1fr); min-height: 72px; border-top: 1px solid var(--line); }
.gantt-task-meta { position: relative; display: grid; align-content: center; gap: 2px; min-width: 0; padding: 9px 34px 9px 12px; border-right: 1px solid var(--line); }
.gantt-task-meta strong, .gantt-task-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-task-meta small { color: var(--muted); font-size: 10px; }
.gantt-cancel { position: absolute; top: 8px; right: 7px; padding: 2px; border: 0; color: #9b4a42; background: transparent; font-size: 11px; }
.gantt-track { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); align-items: center; padding: 10px 4px; background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(14.2857% - 1px), var(--line) calc(14.2857% - 1px), var(--line) 14.2857%); }
.gantt-bar { position: relative; display: grid; place-items: center; min-height: 42px; margin: 0 4px; overflow: hidden; border-radius: 10px; background: #dfe9d9; color: #263128; }
.gantt-bar.priority-紧急 { background: #f3d2ce; }
.gantt-bar.priority-高 { background: #f8e3b7; }
.gantt-bar > span { position: absolute; inset: 0 auto 0 0; background: rgba(72, 150, 70, .3); }
.gantt-bar > b { position: relative; z-index: 1; padding: 0 6px; font-size: 11px; white-space: nowrap; }
.schedule-efficiency { display: grid; gap: 10px; }
.schedule-efficiency-card { display: grid; grid-template-columns: minmax(140px, .5fr) minmax(0, 1.5fr); gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.schedule-efficiency-card > strong { padding: 8px 4px; }
.schedule-efficiency-card > div { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-efficiency-card span { display: grid; gap: 2px; min-width: 150px; padding: 8px 10px; border-radius: 10px; background: #f4f5ef; }
.schedule-efficiency-card span.is-fastest { color: var(--accent-deep); background: #e4f4dc; }
.schedule-efficiency-card span small { color: var(--muted); font-size: 10px; }

@media (max-width: 640px) {
  .assembly-worker-row { grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
  .assembly-worker-row label { justify-content: space-between; }
  .schedule-card-main { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .schedule-card-main > b, .schedule-card-main > button { grid-column: 2; justify-self: start; }
  .schedule-assign-row { grid-template-columns: 1fr 1fr; }
  .schedule-assign-row button { grid-column: 1 / -1; }
  .schedule-gantt-scroll { overflow-x: hidden; padding-bottom: 0; }
  .schedule-gantt-scroll .gantt-board { width: 100%; min-width: 0; }
  .schedule-gantt-scroll .gantt-header { grid-template-columns: 84px repeat(7, minmax(0, 1fr)); }
  .schedule-gantt-scroll .gantt-header > * { min-width: 0; min-height: 46px; padding: 4px 1px; font-size: 10px; }
  .schedule-gantt-scroll .gantt-header > strong { font-size: 9px; }
  .schedule-gantt-scroll .gantt-header span small { font-size: 8px; }
  .schedule-gantt-scroll .gantt-row { grid-template-columns: 84px minmax(0, 1fr); min-height: 60px; }
  .schedule-gantt-scroll .gantt-task-meta { padding: 6px 4px; }
  .schedule-gantt-scroll .gantt-task-meta strong { font-size: 10px; }
  .schedule-gantt-scroll .gantt-task-meta small { font-size: 8px; }
  .schedule-gantt-scroll .gantt-task-meta small:last-of-type { display: none; }
  .schedule-gantt-scroll .gantt-cancel { position: static; justify-self: start; font-size: 9px; }
  .schedule-gantt-scroll .gantt-track { width: auto; min-width: 0; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 6px 1px; }
  .schedule-gantt-scroll .gantt-bar { min-width: 0; min-height: 34px; margin: 0 1px; }
  .schedule-gantt-scroll .gantt-bar > b { max-width: 100%; overflow: hidden; padding: 0 2px; font-size: 8px; text-overflow: ellipsis; }
  .schedule-efficiency-card { grid-template-columns: 1fr; }
}

/* 全站紧凑视觉：搜索、筛选保持单行，普通控件和内容容器使用小圆角。 */
button:not(.account-menu-button),
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea,
.panel,
.metric,
.modal-card,
.table-wrap,
.permission-table-wrap,
.material-card,
.purchase-card,
.order-card,
.schedule-card,
.schedule-efficiency-card,
.gantt-board,
.login-card,
.category-manager-card,
.hub-entry-card,
.purchase-entry-card,
.wood-batch-card,
.wood-part-card,
.report-card,
.permission-detail-card {
  border-radius: 8px !important;
}

.filter-bar,
.product-toolbar,
.sample-picker-filters,
.purchase-picker-filters {
  align-items: center;
}

.filter-bar input,
.filter-bar select,
.product-toolbar input,
.sample-picker-filters input,
.sample-picker-filters select,
.purchase-picker-filters input,
.purchase-picker-filters select {
  min-width: 0;
  white-space: nowrap;
  font-size: 13px;
}

@media (max-width: 767px) {
  .filter-bar,
  .picker-filter,
  .purchase-list-filters,
  .sample-picker-filters,
  .purchase-picker-filters,
  .product-toolbar {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filter-bar::-webkit-scrollbar,
  .sample-picker-filters::-webkit-scrollbar,
  .purchase-picker-filters::-webkit-scrollbar,
  .product-toolbar::-webkit-scrollbar {
    display: none;
  }

  .filter-bar input:first-child,
  .picker-filter input:first-child,
  .purchase-list-filters input:first-child {
    grid-column: auto;
  }

  .filter-bar input,
  .product-toolbar input,
  .sample-picker-filters input,
  .purchase-picker-filters input {
    flex: 1 1 120px;
    min-width: 120px;
  }

  .filter-bar select,
  .sample-picker-filters select,
  .purchase-picker-filters select {
    flex: 0 1 88px;
    min-width: 78px;
    max-width: 92px;
  }

  .filter-bar input,
  .filter-bar select,
  .product-toolbar input,
  .sample-picker-filters input,
  .sample-picker-filters select,
  .purchase-picker-filters input,
  .purchase-picker-filters select {
    min-height: 38px;
    height: 38px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .chip-row,
  .pc-filter-chips {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .chip-row button,
  .pc-filter-chips button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 5px 11px;
    font-size: 12px;
  }
}

.assembly-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 8px;
  margin-bottom: 14px;
}

.assembly-reserve-field {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
}

/* 订单详情：材料弹窗 */
.order-need-row.is-clickable {
  cursor: pointer;
}

.order-material-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.order-material-link input {
  font-size: 12px;
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}

.order-material-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.order-material-actions button {
  flex: 1;
  min-height: 44px;
}

.order-material-form {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.order-material-form h3 {
  margin: 0;
  font-size: 15px;
}

.order-material-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.order-material-success {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 700;
}

/* ===== 生产管理 ===== */
.prod-stats {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.prod-delay {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: #fdf3e7;
  border: 1px solid #f3ddba;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12px;
}

.prod-delay strong {
  color: #b25b12;
}

.prod-delay span {
  color: var(--muted);
  min-width: 0;
}

.prod-worker-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.prod-worker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 8px 10px;
}

.prod-worker-row > strong {
  min-width: 64px;
  font-size: 13px;
}

.prod-worker-row select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 6px 8px;
  font-size: 12px;
}

.prod-worker-row .prod-assist {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.prod-worker-row .prod-assist input {
  width: 60px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
}

.prod-worker-row .prod-assist.is-hidden {
  display: none;
}

.prod-worker-row .prod-done {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.prod-worker-row .prod-done b {
  color: var(--accent-deep);
}

.prod-worker-row.is-static .prod-done {
  margin-left: 0;
}

.prod-calendar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.prod-cal-day {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  min-width: 72px;
}

.prod-cal-day.is-today {
  background: var(--accent);
  color: #fff;
}

.prod-cal-day span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.prod-cal-day.is-today span,
.prod-cal-day.is-today small {
  color: rgba(255, 255, 255, 0.85);
}

.prod-cal-day b {
  display: block;
  font-size: 16px;
  margin: 2px 0;
}

.prod-cal-day small {
  font-size: 10px;
  color: var(--muted);
}

.prod-recent-list {
  display: grid;
  gap: 8px;
}

.prod-recent-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
}

.prod-recent-row strong {
  font-size: 13px;
}

.prod-recent-row span {
  color: var(--ink);
  min-width: 0;
  flex: 1;
}

.prod-recent-row small {
  color: var(--muted);
}

.report-paste {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.report-import-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.daily-report-form,
.daily-report-toys {
  display: grid;
  gap: 12px;
}

.daily-report-toy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px 130px auto;
  gap: 8px;
  align-items: center;
}

.daily-report-toy-choice,
.daily-report-toy-row input,
.daily-report-form textarea,
.daily-report-share textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font: inherit;
  box-sizing: border-box;
}

.daily-report-toy-choice {
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-toy-picker {
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(760px, 100%);
  overflow: hidden;
}

.daily-toy-picker > input {
  min-height: 46px;
}

.daily-toy-groups {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.daily-toy-groups button { flex: 0 0 auto; }

.daily-toy-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.daily-toy-picker-list button {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.daily-toy-picker-list button:hover { border-color: var(--accent-deep); background: var(--accent-soft); }

.daily-report-toy-row label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.daily-report-share {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: var(--accent-soft);
}

.file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.report-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
  display: grid;
  gap: 8px;
}

.report-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.report-card-head select,
.report-card-head input {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
  min-width: 0;
}

.report-item-list {
  display: grid;
  gap: 6px;
}

.report-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 76px auto;
  gap: 6px;
  align-items: center;
}

.report-item-row select,
.report-item-row input {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 6px 8px;
  font-size: 12px;
  min-width: 0;
}

.report-card-misc {
  display: grid;
  gap: 6px;
}

.report-card-misc input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}

.report-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.inbound-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
}

.inbound-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.inbound-main strong {
  font-size: 14px;
}

.inbound-main small {
  color: var(--muted);
  font-size: 11px;
}

.inbound-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inbound-inputs label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.inbound-inputs input,
.inbound-inputs select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  width: 84px;
}

.inbound-inputs select {
  width: 96px;
}

.inbound-reason.is-hidden {
  display: none;
}

@media (max-width: 480px) {
  .prod-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .report-item-row {
    grid-template-columns: minmax(0, 1fr) 62px 70px auto;
    gap: 4px;
  }

  .report-item-row select,
  .report-item-row input {
    padding: 5px 6px;
    font-size: 11px;
  }

  .daily-report-toy-row {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .daily-report-toy-row button {
    grid-column: 1 / -1;
  }
}
