:root {
  --app-header-height: 109px;
  --ink: #1d2421;
  --muted: #747a75;
  --line: #ded9cf;
  --line-strong: #c9c0b2;
  --paper: #f3f0e9;
  --paper-deep: #ebe6dc;
  --white: #fffefa;
  --forest: #121b17;
  --forest-soft: #1d2a24;
  --sage: #536d5f;
  --sage-pale: #e2e9e3;
  --clay: #a66e52;
  --clay-pale: #f0e3da;
  --red: #9c4d43;
  --shadow: 0 18px 55px rgba(42, 48, 44, .08);
  --shadow-soft: 0 8px 24px rgba(42, 48, 44, .06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.55;
}

body.header-collapsed {
  --app-header-height: 54px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 252px;
  background: #000;
  color: #f6f1e8;
  padding: 34px 24px 24px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .05);
}

.brand {
  padding: 0 8px 34px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand img {
  display: block;
  width: 176px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.brand-caption {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #aab3ad;
  font-family: Georgia, "Times New Roman", serif;
}

.brand-caption span {
  font-size: 9px;
  letter-spacing: .2em;
}

.brand-caption small {
  font-size: 9px;
  white-space: nowrap;
}

nav {
  display: grid;
  gap: 6px;
  margin-top: 30px;
}

nav button {
  position: relative;
  display: grid;
  grid-template-columns: 31px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: #aeb8b2;
  text-align: left;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}

nav button:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .12);
  transform: translateX(2px);
}

nav button.active {
  color: var(--ink);
  background: #f4efe5;
  border-color: #f4efe5;
}

.nav-no {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10px;
  letter-spacing: .1em;
  color: #78867e;
}

nav button.active .nav-no {
  color: var(--clay);
}

.nav-label {
  font-size: 13px;
  letter-spacing: .04em;
}

.sidebar-foot {
  margin-top: auto;
  padding: 18px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  color: #9da8a1;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: .04em;
}

.save-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a6bda9;
  box-shadow: 0 0 0 4px rgba(166, 189, 169, .1);
}

.sidebar-foot small {
  display: block;
  margin-left: 15px;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

main {
  margin-left: 252px;
  min-height: 100vh;
}

header {
  min-height: var(--app-header-height);
  padding: 18px 30px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(243, 240, 233, .96);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  transition: min-height .2s ease, padding .2s ease;
}

.header-collapse-toggle {
  position: absolute;
  left: 50%;
  bottom: -15px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 12px;
  color: var(--muted);
  background: rgba(255, 254, 250, .98);
  border-color: var(--line);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 5px 12px rgba(42, 48, 44, .08);
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1;
}

.header-collapse-toggle:hover,
.header-collapse-toggle:focus-visible {
  color: var(--ink);
  background: var(--white);
  border-color: var(--line-strong);
  transform: translateX(-50%);
}

.header-collapse-toggle:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

.header-collapse-icon {
  font-size: 13px;
  line-height: 1;
}

body.header-collapsed header {
  padding-top: 7px;
  padding-bottom: 7px;
}

body.header-collapsed header .eyebrow,
body.header-collapsed header p,
body.header-collapsed header .page-quick-actions,
body.header-collapsed header .header-actions > :not(.operator-button) {
  display: none;
}

body.header-collapsed header h1 {
  overflow: hidden;
  font-size: 18px;
  letter-spacing: .05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.header-collapsed header .header-actions {
  margin-left: auto;
}

body.header-collapsed header .header-actions .operator-button {
  display: block;
  min-width: 0;
  min-height: 32px;
  padding: 5px 10px;
  text-align: center;
}

body.header-collapsed header .operator-button span,
body.header-collapsed header .operator-button small {
  display: none;
}

.page-heading {
  min-width: 0;
}

.page-quick-actions {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 190px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--clay);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9px;
  letter-spacing: .24em;
}

h1 {
  margin: 0;
  font-family: "Yu Mincho", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(27px, 3vw, 36px);
  font-weight: 400;
  letter-spacing: .08em;
  line-height: 1.25;
}

header p,
.shipment-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.header-actions,
.action-group {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

button,
.file-label {
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: .04em;
  transition: color .18s, background-color .18s, border-color .18s, transform .18s, box-shadow .18s;
}

button:hover,
.file-label:hover {
  transform: translateY(-1px);
}

.primary {
  color: #fff;
  background: var(--forest);
  border-color: var(--forest);
  box-shadow: 0 8px 18px rgba(18, 27, 23, .13);
}

.primary:hover {
  background: var(--clay);
  border-color: var(--clay);
  box-shadow: 0 10px 20px rgba(166, 110, 82, .16);
}

.ghost,
.file-label {
  color: var(--ink);
  background: rgba(255, 254, 250, .55);
}

.ghost:hover,
.file-label:hover {
  background: var(--white);
  border-color: #9f978a;
}

.danger-action {
  color: var(--red);
  border-color: rgba(156, 77, 67, .34);
}

.danger-action:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.file-label input {
  display: none;
}

.file-label.disabled {
  opacity: .55;
  cursor: not-allowed;
}

.file-label.primary {
  color: #fff;
  background: var(--forest);
  border-color: var(--forest);
}

.file-label.primary:hover {
  color: #fff;
  background: var(--clay);
  border-color: var(--clay);
}

.operator-button {
  display: grid;
  gap: 1px;
  min-width: 112px;
  padding: 6px 12px;
  text-align: left;
  line-height: 1.15;
}

.operator-button span,
.operator-button small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .12em;
}

.operator-button strong {
  font-size: 13px;
  letter-spacing: .08em;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(166, 110, 82, .22), transparent 34%),
    rgba(18, 27, 23, .78);
  backdrop-filter: blur(12px);
}

.login-screen[hidden] {
  display: none;
}

.login-panel {
  width: min(860px, 100%);
  padding: 34px;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-brand img {
  width: 138px;
  background: #000;
}

.login-brand span {
  color: var(--clay);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10px;
  letter-spacing: .22em;
}

.login-panel h2 {
  margin: 0;
  font-family: "Yu Mincho", "Songti SC", serif;
  font-weight: 400;
  letter-spacing: .08em;
}

.login-panel p,
.login-panel > small {
  color: var(--muted);
}

.login-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 24px 0 14px;
}

.login-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.login-progress-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: var(--clay);
  border-radius: 50%;
  animation: login-progress-pulse 1.2s ease-in-out infinite;
}

@keyframes login-progress-pulse {
  0%,
  100% {
    opacity: .35;
    transform: scale(.82);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-progress-dot {
    animation: none;
  }
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.login-card strong,
.login-card span,
.login-card small {
  display: block;
}

.login-card strong {
  font-size: 20px;
  letter-spacing: .08em;
}

.login-card span {
  margin: 3px 0 8px;
  color: var(--clay);
  font-size: 12px;
}

.login-card small {
  color: var(--muted);
}

.login-row {
  display: grid;
  gap: 8px;
}

.login-row input {
  min-width: 0;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}

.admin-fallback-card {
  grid-column: 1 / -1;
}

.readonly-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  color: var(--red);
  background: rgba(156, 77, 67, .08);
  border: 1px solid rgba(156, 77, 67, .24);
  font-size: 12px;
  letter-spacing: .08em;
}

body.is-readonly .page .primary,
body.is-readonly .page .danger-button,
body.is-readonly .page .danger-action {
  opacity: .5;
}

.page {
  display: none;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px 20px 64px;
}

.page.active {
  display: block;
  animation: page-in .28s ease-out;
}

.dashboard-brief {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) repeat(2, minmax(150px, .55fr));
  gap: 1px;
  margin-bottom: 18px;
  color: #f7f2e9;
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--forest);
  box-shadow: var(--shadow);
}

.brief-copy,
.brief-stat {
  background: var(--forest);
}

.brief-copy {
  padding: 25px 27px 26px;
}

.brief-copy span {
  color: #b9c2bc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8px;
  letter-spacing: .24em;
}

.brief-copy h2 {
  margin: 8px 0 4px;
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: .08em;
}

.brief-copy p {
  margin: 0;
  color: #aab4ae;
  font-size: 11px;
}

.brief-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
}

.brief-stat span {
  color: #aab4ae;
  font-size: 10px;
  letter-spacing: .08em;
}

.brief-stat strong {
  margin: 5px 0 4px;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 400;
}

.brief-stat small {
  color: #9ba69f;
  font-size: 9px;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 13px;
  margin-bottom: 24px;
}

.metrics.compact {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.metric,
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.metric {
  position: relative;
  min-height: 144px;
  padding: 21px 22px 18px;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--clay);
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

.metric strong {
  display: block;
  margin: 18px 0 8px;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: clamp(24px, 2.7vw, 32px);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1;
}

.metrics.compact .metric {
  min-height: 132px;
}

.metrics.compact .metric strong {
  font-size: 26px;
}

.reimbursement-metric-card,
.settings-section-card {
  width: 100%;
  color: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.reimbursement-metric-card:hover,
.settings-section-card:hover {
  transform: translateY(-2px);
  border-color: rgba(178, 95, 65, .38);
  box-shadow: 0 18px 40px rgba(54, 45, 35, .12);
}

.reimbursement-metric-card:focus-visible,
.settings-section-card:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}

.reimbursement-metric-card.active,
.settings-section-card.active {
  border-color: rgba(178, 95, 65, .58);
  background: rgba(178, 95, 65, .08);
  box-shadow: 0 14px 32px rgba(54, 45, 35, .12);
}

.metric small {
  color: var(--sage);
  font-size: 10px;
}

.dashboard-metrics-primary {
  margin-bottom: 18px;
}

.dashboard-sales-statistics {
  margin-bottom: 20px;
}

.dashboard-sales-statistics .sales-statistics-panel {
  margin-bottom: 0;
}

.dashboard-metrics-secondary {
  margin-bottom: 20px;
}

.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 18px;
  margin-bottom: 20px;
}

.dashboard-chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 468px;
  padding: 22px;
}

.dashboard-chart-panel .compact-head,
.inventory-risk-panel .compact-head,
.personal-todo-panel .compact-head {
  margin-top: 0;
}

.dashboard-chart-canvas {
  position: relative;
  width: 100%;
  height: 250px;
  min-height: 250px;
  margin-bottom: 16px;
}

.dashboard-chart-empty {
  display: grid;
  place-items: center;
  min-height: 250px;
  margin-bottom: 16px;
  color: var(--muted);
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  font-size: 12px;
}

.compact-dashboard-table {
  margin-top: auto;
}

.compact-dashboard-table table {
  min-width: 520px;
}

.compact-dashboard-table.author-ranking-table table {
  min-width: 100%;
}

.dashboard-channel-list {
  display: grid;
  gap: 0;
  margin-top: auto;
}

.dashboard-channel-list .list-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.inventory-risk-panel,
.personal-todo-panel {
  margin-bottom: 20px;
}

.dashboard-risk-metrics {
  margin-bottom: 16px;
}

.personal-todo-grid {
  align-items: start;
}

.todo-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.todo-module-card {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  min-height: 150px;
  padding: 19px 20px 17px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
}

.todo-module-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--line-strong);
}

.todo-module-card.has-count {
  background: var(--white);
  border-color: rgba(166, 110, 82, .4);
  box-shadow: var(--shadow-soft);
}

.todo-module-card.has-count::before {
  background: var(--clay);
}

.todo-module-card-main {
  display: grid;
  align-content: start;
  gap: 12px;
}

.todo-module-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

.todo-module-count {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
}

.todo-module-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.todo-module-card-foot small {
  color: var(--muted);
  font-size: 10px;
}

.todo-module-card.has-count .todo-module-card-foot small {
  color: var(--sage);
}

.todo-module-card .mini-btn {
  min-width: 62px;
}

.todo-brief {
  grid-template-columns: minmax(280px, 1.8fr) minmax(150px, .55fr);
}

.sales-stat-year-grid,
.sales-stat-month-grid {
  margin-bottom: 0;
}

.sales-month-head {
  margin-top: 20px;
}

.sales-stat-empty {
  margin-top: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
}

.panel {
  padding: 24px;
}

.panel-head,
.section-head,
.shipment-head,
.shipment-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 13px;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.reimbursement-submit-selected {
  font-size: 14px;
}

.section-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.inline-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel-head,
.section-head {
  margin-bottom: 20px;
}

.section-head {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.page > .section-head:first-child:not(:has(.section-actions)):not(.shipping-flow-head):not(.inbound-flow-head):not(.sales-flow-head) {
  display: none;
}

.panel h2,
.section-head h2,
.shipment-title h2 {
  margin: 0;
  font-family: "Yu Mincho", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: .08em;
}

.section-head h2::after {
  content: " / DATA";
  color: var(--clay);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8px;
  letter-spacing: .16em;
  vertical-align: middle;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select {
  max-width: 220px;
}

.product-explorer {
  margin-bottom: 22px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) minmax(210px, 1.4fr) minmax(160px, .8fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 13px;
  padding: 15px;
  background: var(--forest);
  border: 1px solid var(--forest);
  box-shadow: var(--shadow-soft);
}

.filter-copy {
  display: grid;
  min-width: 0;
}

.filter-copy span {
  color: #aab4ae;
  font-size: 9px;
  letter-spacing: .12em;
}

.filter-copy strong {
  overflow: hidden;
  color: #fff;
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: .05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-bar input,
.filter-bar select {
  border-color: rgba(255, 255, 255, .18);
}

.filter-bar .ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, .26);
  background: transparent;
}

.filter-bar .ghost:hover {
  color: var(--ink);
  background: #fff;
}

.sales-filter {
  grid-template-columns: minmax(170px, 1fr) minmax(145px, .8fr) minmax(230px, 1.35fr) minmax(135px, .8fr) minmax(155px, .9fr) auto;
}

.product-metrics {
  margin-bottom: 13px;
}

.group-overviews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.summary-panel {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.summary-panel .panel-head {
  margin: 0;
  padding: 17px 18px;
}

.summary-panel .panel-head h2 {
  margin: 0;
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .06em;
}

.summary-panel .panel-head span {
  font-size: 9px;
}

.summary-panel table {
  min-width: 590px;
}

.settings-wide {
  margin-top: 28px;
}

.metrics.compact.settings-section-cards {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.settings-section-content {
  animation: page-in .2s ease;
}

.settings-section-panel .compact-head,
.settings-section-content .operation-history-head {
  margin-top: 0;
}

.compact-head {
  margin-top: 28px;
  margin-bottom: 12px;
}

.movement-history-head {
  margin-top: 34px;
}

.inbound-table .primary {
  white-space: nowrap;
}

.inbound-product {
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
  padding: 17px 18px;
  color: #fff;
  background: var(--forest);
  border-left: 3px solid var(--clay);
}

.inbound-product span,
.inbound-product small {
  color: #aab4ae;
  font-size: 10px;
}

.inbound-product strong {
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 19px;
  font-weight: 400;
  letter-spacing: .06em;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: border-color .18s, box-shadow .18s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(83, 109, 95, .1);
}

input:disabled {
  color: var(--muted);
  background: var(--paper);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.table-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  overflow: auto;
  box-shadow: var(--shadow-soft);
}

.inventory-table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - var(--app-header-height) - 223px);
  scroll-behavior: smooth;
}

body.header-collapsed .inventory-table-wrap {
  max-height: calc(100vh - var(--app-header-height) - 78px);
}

table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

.inventory-table {
  min-width: 1540px;
}

.inventory-compact-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 11px;
}

.inventory-compact-table th,
.inventory-compact-table td {
  padding: 9px 8px;
  white-space: normal;
  line-height: 1.35;
  vertical-align: top;
}

.inventory-compact-table th {
  font-size: 9px;
  letter-spacing: .02em;
}

.inventory-compact-table th:nth-child(1),
.inventory-compact-table td:nth-child(1) {
  width: 6%;
}

.inventory-compact-table th:nth-child(2),
.inventory-compact-table td:nth-child(2) {
  width: 7%;
}

.inventory-compact-table th:nth-child(3),
.inventory-compact-table td:nth-child(3) {
  width: 10%;
}

.inventory-compact-table th:nth-child(4),
.inventory-compact-table td:nth-child(4) {
  width: 9%;
}

.inventory-compact-table th:nth-child(5),
.inventory-compact-table td:nth-child(5) {
  width: 9%;
}

.inventory-compact-table th:nth-child(6),
.inventory-compact-table td:nth-child(6),
.inventory-compact-table th:nth-child(7),
.inventory-compact-table td:nth-child(7),
.inventory-compact-table th:nth-child(9),
.inventory-compact-table td:nth-child(9),
.inventory-compact-table th:nth-child(11),
.inventory-compact-table td:nth-child(11),
.inventory-compact-table th:nth-child(12),
.inventory-compact-table td:nth-child(12) {
  width: 8%;
}

.inventory-compact-table th:nth-child(8),
.inventory-compact-table td:nth-child(8),
.inventory-compact-table th:nth-child(13),
.inventory-compact-table td:nth-child(13) {
  width: 7%;
}

.inventory-compact-table th:nth-child(10),
.inventory-compact-table td:nth-child(10) {
  width: 5%;
}

.inventory-compact-table .product-thumb {
  width: 84px;
  height: 84px;
  flex-basis: 84px;
}

.inventory-group-table th:nth-child(1),
.inventory-group-table td:nth-child(1) {
  width: 7%;
}

.inventory-group-table th:nth-child(2),
.inventory-group-table td:nth-child(2) {
  width: 10%;
}

.inventory-group-table th:nth-child(3),
.inventory-group-table td:nth-child(3) {
  width: 16%;
}

.inventory-group-table th:nth-child(4),
.inventory-group-table td:nth-child(4) {
  width: 14%;
}

.inventory-group-table th:nth-child(5),
.inventory-group-table td:nth-child(5) {
  width: 13%;
}

.inventory-group-table th:nth-child(6),
.inventory-group-table td:nth-child(6),
.inventory-group-table th:nth-child(7),
.inventory-group-table td:nth-child(7),
.inventory-group-table th:nth-child(8),
.inventory-group-table td:nth-child(8) {
  width: 9%;
}

.inventory-group-table th:nth-child(9),
.inventory-group-table td:nth-child(9) {
  width: 6%;
}

.inventory-group-table th:nth-child(10),
.inventory-group-table td:nth-child(10) {
  width: 8%;
}

.inventory-group-table th:nth-child(11),
.inventory-group-table td:nth-child(11) {
  width: 7%;
}

.thumb-button {
  display: block;
  width: max-content;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.thumb-button:hover {
  transform: none;
  box-shadow: none;
}

.thumb-button:hover .product-thumb,
.thumb-button:focus-visible .product-thumb {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(166, 110, 82, .14);
}

.product-code-link {
  padding-left: 0;
  font-size: 12px;
}

.product-code-link:hover,
.product-code-link:focus-visible {
  color: var(--clay);
  text-decoration: underline;
}

.inventory-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin-top: 4px;
}

.inventory-row-actions .link-btn {
  font-size: 10px;
}

.stock-history-button {
  min-height: 30px;
  padding: 5px 9px;
  white-space: nowrap;
}

.sales-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 138px;
}

.stock-lines {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.clamp-2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #e9e4dc;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.select-cell {
  width: 42px;
  min-width: 42px;
  padding-right: 8px;
  text-align: center;
}

.select-cell input {
  width: auto;
  min-height: 0;
}

.rate-cell {
  font-variant-numeric: tabular-nums;
}

.note-cell {
  max-width: 220px;
  white-space: normal;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #7a786f;
  background: #eeeae1;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
}

tbody tr {
  transition: background-color .15s;
}

tbody tr:hover {
  background: #f7f3eb;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.product-cell-action {
  width: 100%;
  min-height: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
}

.product-cell-action:hover {
  color: inherit;
  background: transparent;
  transform: none;
  box-shadow: none;
}

.product-cell-action:hover .product-cell b,
.product-cell-action:focus-visible .product-cell b {
  color: var(--forest);
  text-decoration: underline;
}

.product-thumb {
  display: flex;
  flex: 0 0 54px;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image-empty span {
  color: #9c978c;
  font-size: 9px;
  letter-spacing: .08em;
}

td b {
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 4px 9px;
  color: #455e50;
  background: var(--sage-pale);
  border: 1px solid #cbd8ce;
  border-radius: 99px;
  font-size: 10px;
  letter-spacing: .04em;
  white-space: nowrap;
}

.tag.info {
  color: #245f8f;
  background: #e6f1f8;
  border-color: #b8d5e8;
}

.tag.success {
  color: #455e50;
  background: var(--sage-pale);
  border-color: #cbd8ce;
}

.tag.warn {
  color: #865b45;
  background: var(--clay-pale);
  border-color: #e6cbbd;
}

.tag.danger {
  color: var(--red);
  background: #f2dfdc;
  border-color: #e5c2bd;
}

.tag.reimbursement-approval-huahua {
  color: #111;
  background: #b8dcae;
  border-color: #76a86b;
}

.tag.reimbursement-approval-yunmu {
  color: #111;
  background: #b8d8f0;
  border-color: #6f9fca;
}

.tag.reimbursement-rejected {
  color: #111;
  background: #f4df91;
  border-color: #c8a943;
}

.tag.neutral {
  color: #68655f;
  background: #f0eee9;
  border-color: #d8d4cc;
}

.tag.info,
.tag.success,
.tag.warn,
.tag.danger,
.tag.neutral,
.tag.warehouse-japan,
.tag.warehouse-france,
.tag.warehouse-hangzhou {
  font-size: 15px;
  font-weight: 700;
}

.tag.warehouse-japan {
  color: #9f2f28;
  background: #f8e3e0;
  border-color: #dfaaa4;
}

.tag.warehouse-france {
  color: #245f8f;
  background: #e6f1f8;
  border-color: #9fc7e0;
}

.tag.warehouse-hangzhou {
  color: #356649;
  background: #e5f1e7;
  border-color: #abcbb2;
}

.workflow-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.workflow-card h2,
.workflow-card p {
  margin: 0;
}

.workflow-card p {
  color: var(--muted);
}

.shipping-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.shipping-entry-card {
  position: relative;
  min-height: 168px;
  overflow: hidden;
}

.shipping-entry-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--sage);
}

.shipping-entry-card .tag {
  justify-self: start;
}

.shipping-entry-card .primary {
  width: 100%;
  margin-top: auto;
}

.procurement-entry-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: auto;
}

.procurement-entry-action p {
  flex: 1 1 auto;
  min-width: 0;
}

.shipping-entry-card.procurement-entry-card .primary {
  flex: 0 0 104px;
  width: 104px;
  min-height: 44px;
  margin-top: 0;
  padding: 10px 14px;
}

.purchase-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.purchase-type-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 150px;
  padding: 21px 22px 18px;
  text-align: left;
  cursor: pointer;
  border-color: var(--line);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.purchase-type-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--sage);
  opacity: .8;
}

.purchase-type-card .tag {
  justify-self: start;
}

.purchase-type-card:hover,
.purchase-type-card.active {
  border-color: var(--clay);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.purchase-type-card.active::before {
  background: var(--clay);
  opacity: 1;
}

.purchase-editor {
  margin: 18px 0;
}

.purchase-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.purchase-summary div {
  padding: 13px 14px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}

.purchase-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.purchase-summary b {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}

.receipt-dropzone {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 116px;
  margin: 14px 0;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  background: var(--white);
  border: 1px dashed var(--line-strong);
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}

.receipt-dropzone strong {
  color: var(--ink);
}

.receipt-dropzone.dragging,
.receipt-dropzone:hover {
  border-color: var(--clay);
  background: var(--clay-pale);
}

.receipt-dropzone:focus-visible,
.product-image-editor:focus-visible,
.purchase-line-image-field:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

.receipt-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.reimbursement-receipts {
  grid-template-columns: minmax(220px, 1fr);
  min-width: 260px;
  margin: 0;
}

.reimbursement-receipts .receipt-preview {
  grid-template-columns: 48px 1fr auto;
  padding: 8px;
}

.reimbursement-receipts .receipt-thumb-btn,
.reimbursement-receipts .receipt-preview img,
.reimbursement-receipts .receipt-file-icon {
  width: 48px;
  height: 48px;
}

.receipt-preview {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--white);
  border: 1px solid var(--line);
}

.receipt-thumb-btn {
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.receipt-preview img,
.receipt-file-icon {
  width: 64px;
  height: 64px;
  object-fit: cover;
  background: var(--paper-deep);
}

.receipt-thumb-btn img {
  display: block;
}

.receipt-file-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  border: 0;
  cursor: default;
}

button.receipt-file-icon {
  cursor: pointer;
}

.receipt-file-icon-pdf {
  color: #7c2d2d;
  background: #f8e8e5;
  border: 1px solid #e5b8b0;
}

.receipt-file-icon span {
  font-weight: 700;
  letter-spacing: .08em;
}

.receipt-preview strong,
.receipt-preview span {
  display: block;
}

.receipt-preview-meta {
  min-width: 0;
}

.receipt-preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 8px;
}

.receipt-preview span,
.receipt-empty {
  color: var(--muted);
  font-size: 12px;
}

.receipt-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 28px;
  background: rgba(18, 27, 23, .72);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: blur(4px);
}

.receipt-preview-overlay::backdrop {
  background: transparent;
  backdrop-filter: none;
}

.receipt-preview-overlay.active {
  display: grid;
}

.receipt-preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, 94vw);
  height: min(860px, 92vh);
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line-strong);
  box-shadow: 0 28px 90px rgba(18, 27, 23, .32);
}

.receipt-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: #fff;
  background: var(--forest);
}

.receipt-preview-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-preview-frame {
  min-height: 0;
  background: var(--paper);
}

.receipt-preview-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.receipt-preview-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.purchase-editor-table input {
  min-width: 92px;
}

.purchase-existing-product {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  min-width: 180px;
}

.purchase-existing-product select {
  width: 100%;
  min-width: 180px;
  font-size: 12px;
  padding: 7px 8px;
}

.purchase-existing-product span {
  font-size: 11px;
  line-height: 1.35;
}

.purchase-editor-table th,
.purchase-editor-table td {
  vertical-align: top;
}

.shipping-flow-head {
  margin-bottom: 16px;
}

.flow-return-bar {
  display: flex;
  justify-content: flex-start;
  margin: -4px 0 14px;
}

.flow-return-bar .mini-btn {
  border-color: var(--line-strong);
}

.shipping-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}

.segmented button {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.segmented button.active {
  color: #fff;
  background: var(--forest);
  border-color: var(--forest);
}

.compact-input {
  width: 92px;
  min-width: 0;
}

.inbound-pricing-panel {
  overflow-x: auto;
}

.inbound-pricing-toolbar {
  display: grid;
  grid-template-columns: var(--inbound-pricing-grid);
  min-width: var(--inbound-pricing-min-width);
  align-items: center;
}

.inbound-pricing-actions {
  grid-column: var(--inbound-pricing-action-start) / -1;
  justify-content: flex-start;
  flex-wrap: nowrap;
  min-width: max-content;
}

.inbound-pricing-table {
  min-width: var(--inbound-pricing-min-width);
  table-layout: fixed;
}

.shipment-final-panel .receipt-dropzone {
  margin-top: 18px;
}

.inbound-flow-head {
  margin-bottom: 16px;
}

.strong-link {
  font-weight: 700;
}

.inbound-note {
  margin-top: 12px;
}

.inbound-check-table th,
.inbound-check-table td {
  vertical-align: middle;
}

.inbound-check-input {
  width: 78px;
}

.inbound-unbalanced {
  background: rgba(178, 95, 65, .08);
}

.sales-flow-head {
  margin-bottom: 16px;
}

.sales-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.sales-entry-card {
  position: relative;
  min-height: 168px;
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.sales-entry-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--sage);
}

.sales-entry-card:hover {
  transform: translateY(-2px);
  border-color: rgba(178, 95, 65, .38);
  box-shadow: 0 18px 40px rgba(54, 45, 35, .12);
}

.sales-entry-card .tag {
  justify-self: start;
}

.sales-entry-card .primary {
  width: 100%;
  margin-top: auto;
}

.table-footnote {
  color: var(--sage);
  font-size: 11px;
}

.sales-section-panel,
.sales-statistics-panel {
  margin-bottom: 20px;
}

.sales-archive-toolbar {
  align-items: flex-start;
}

.sales-archive-toolbar .section-actions {
  justify-content: flex-start;
}

.sales-year-switcher {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.sales-stat-card.active,
.sales-month-card.active {
  border-color: rgba(178, 95, 65, .48);
  background: rgba(178, 95, 65, .06);
}

.sales-stat-summary {
  margin-bottom: 20px;
}

.table-footnote {
  margin-top: 10px;
  text-align: right;
}

.sales-filter-tabs {
  max-width: 100%;
  overflow-x: auto;
}

.sales-search-input {
  min-width: 220px;
}

.sales-history-filters {
  flex: 1 1 760px;
  min-width: min(760px, 100%);
}

.sales-history-filters .sales-search-input {
  flex: 1 1 100%;
  width: auto;
}

.sales-history-filters input[type="date"].compact-input {
  flex: 0 0 140px;
  width: 140px;
  min-width: 140px;
}

.sales-history-filters select.compact-input {
  flex: 0 0 116px;
  width: 116px;
  min-width: 116px;
}

.sales-register-layout {
  display: grid;
  grid-template-columns: minmax(320px, .72fr) minmax(460px, 1.28fr);
  gap: 16px;
  align-items: start;
}

.sales-product-browser,
.sales-current-order {
  min-width: 0;
}

.sales-bulk-discount {
  margin-bottom: 10px;
}

.sales-bulk-discount select {
  width: 100%;
}

.sales-product-list,
.sales-cart-list {
  display: grid;
  gap: 10px;
  overflow-x: auto;
}

.sales-product-list {
  max-height: 64vh;
  overflow: auto;
  padding-right: 4px;
}

.sales-product-card,
.sales-cart-line {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--white);
  border: 1px solid var(--line);
}

.sales-product-card {
  grid-template-columns: 58px minmax(0, 1fr) auto;
}

.sales-product-copy,
.sales-cart-line > div {
  min-width: 0;
}

.sales-product-copy strong,
.sales-product-copy span,
.sales-product-copy small,
.sales-cart-line strong,
.sales-cart-line span,
.sales-cart-line small {
  display: block;
}

.sales-product-copy span,
.sales-product-copy small,
.sales-cart-line span,
.sales-cart-line small {
  color: var(--muted);
  font-size: 11px;
}

.sales-product-controls {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.sales-cart-line {
  grid-template-columns: 54px minmax(150px, 1fr) auto 92px minmax(120px, .8fr) minmax(90px, .7fr) auto;
  min-width: 720px;
}

.sales-cart-line.has-warning {
  border-color: #e6cbbd;
  background: var(--clay-pale);
}

.sales-line-warning {
  color: var(--red) !important;
}

.sales-line-qty {
  display: grid;
  grid-template-columns: 32px 58px 32px;
  gap: 4px;
  align-items: center;
}

.sales-line-qty .compact-input {
  width: 58px;
}

.sales-line-discount {
  display: grid;
  gap: 4px;
}

.sales-line-amount {
  display: grid;
  gap: 2px;
  justify-items: end;
  text-align: right;
}

.sales-line-amount strong {
  font-size: 14px;
}

.sales-current-order .settlement-summary {
  margin: 14px 0;
}

.sales-checkout-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sales-quick-groups {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}

.sales-quick-groups > div {
  display: grid;
  gap: 6px;
}

.sales-quick-groups span {
  color: var(--muted);
  font-size: 12px;
}

.compact-dropzone {
  min-height: 96px;
  margin-top: 10px;
}

.sales-note-field {
  margin-top: 12px;
}

.sales-note-field textarea {
  min-height: 88px;
  resize: vertical;
}

.sales-submit-actions {
  justify-content: flex-end;
}

.sale-action-panel {
  margin-top: 16px;
  border-color: var(--clay);
}

.sale-action-panel.danger-panel {
  border-color: rgba(156, 77, 67, .45);
}

.sales-extra-summary-card {
  appearance: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sales-extra-summary-card:hover,
.sales-extra-summary-card:focus-visible {
  border-color: var(--clay);
  box-shadow: 0 10px 24px rgba(48, 38, 30, .08);
}

.extra-sales-panel table {
  min-width: 940px;
}

.extra-sale-form-panel {
  max-width: 1120px;
}

.extra-sale-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.danger-button {
  background: var(--red);
  border-color: var(--red);
}

.image-viewer-dialog {
  width: min(920px, calc(100vw - 44px));
  max-width: none;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

.image-viewer-dialog::backdrop {
  background: rgba(18, 27, 23, .72);
  backdrop-filter: blur(8px);
}

.image-viewer-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  min-height: 100vh;
  padding: 0;
  border: 0;
  background: transparent;
}

.image-viewer-backdrop:hover {
  transform: none;
  box-shadow: none;
}

.image-viewer-panel {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}

.image-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 38px;
}

.image-viewer-toolbar strong {
  color: var(--clay);
  font-size: 14px;
  letter-spacing: .08em;
}

.image-viewer-panel img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  background: var(--paper);
}

.stock-history-summary {
  margin-bottom: 4px;
}

.stock-history-table-wrap table {
  min-width: 760px;
}

.success-panel {
  display: grid;
  gap: 10px;
  padding: 8px 0;
}

.success-panel strong {
  font-size: 18px;
}

.warehouse-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.product-warehouse-overview {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.business-line-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.business-line-card {
  min-height: 58px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .58);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.business-line-card:hover,
.business-line-card.active {
  border-color: var(--clay);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.business-line-card span,
.business-line-card small {
  display: block;
}

.business-line-card span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.business-line-card strong {
  display: block;
  margin: 4px 0 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1;
}

.business-line-card small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: start;
}

.product-detail-hero .product-thumb {
  width: 180px;
  height: 180px;
  flex-basis: 180px;
}

.detail-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 10px;
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 15px;
  font-weight: 500;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-row {
  padding: 9px 10px;
  background: #f7f4ec;
  border: 1px solid var(--line);
}

.detail-row span,
.detail-row b {
  display: block;
}

.detail-row span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.detail-row b {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  word-break: break-word;
}

.detail-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.reimbursement-detail-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.reimbursement-detail-actions:empty {
  display: none;
}

.reimbursement-summary {
  margin-bottom: 18px;
}

.my-reimbursement-summary {
  margin-top: 28px;
}

.my-reimbursement-summary .compact-head {
  margin-top: 0;
}

.my-reimbursement-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.my-reimbursement-summary-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.my-reimbursement-summary-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 17px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.my-reimbursement-summary-card-head div,
.my-reimbursement-summary-identity,
.my-reimbursement-summary-amount {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.my-reimbursement-summary-card-head span,
.my-reimbursement-summary-identity span {
  color: var(--muted);
  font-size: 10px;
}

.my-reimbursement-summary-card-head strong {
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 18px;
  font-weight: 400;
}

.my-reimbursement-summary-card-head b {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 17px;
  font-weight: 400;
  text-align: right;
}

.my-reimbursement-summary-list {
  max-height: 360px;
  overflow-y: auto;
}

.my-reimbursement-summary-item {
  display: grid;
  grid-template-columns: minmax(72px, .65fr) minmax(130px, 1.7fr) minmax(88px, .75fr);
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.my-reimbursement-summary-item:last-child {
  border-bottom: 0;
}

.my-reimbursement-summary-identity {
  align-items: flex-start;
}

.my-reimbursement-summary-amount {
  align-items: flex-end;
  text-align: right;
}

.my-reimbursement-summary-empty {
  padding: 38px 18px;
}

.reimbursement-claim-table {
  min-width: 1120px;
}

.claim-business-cell {
  min-width: 230px;
  max-width: 360px;
}

.claim-business-cell strong,
.claim-business-cell small {
  display: block;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.claim-business-cell strong {
  color: var(--ink);
  font-size: 13px;
}

.claim-business-cell small {
  color: var(--muted);
  margin-top: 3px;
}

.reimbursement-detail-table table {
  min-width: 1040px;
}

.reimbursement-detail-table th,
.reimbursement-detail-table td {
  vertical-align: top;
}

.reimbursement-detail-table td:nth-child(3) {
  min-width: 220px;
}

.reimbursement-detail-table td:nth-child(6) {
  width: 320px;
}

.reimbursement-voucher {
  max-width: 300px;
  word-break: break-word;
}

.reimbursement-pay-section {
  margin-top: 18px;
}

.reimbursement-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.batch-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.batch-detail-table table {
  min-width: 760px;
  font-size: 11px;
}

.batch-detail-table th,
.batch-detail-table td {
  padding: 10px;
}

.inventory-stocktake-module {
  margin-bottom: 16px;
  padding: 18px;
}

.inventory-stocktake-head {
  margin-bottom: 12px;
}

.inventory-stocktake-module.is-collapsed .inventory-stocktake-head {
  margin-bottom: 0;
}

.inventory-stocktake-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inventory-stocktake-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.inventory-stocktake-summary span {
  color: var(--muted);
  font-size: 10px;
}

.inventory-stocktake-summary strong {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 20px;
  font-weight: 400;
}

.inventory-stocktake-toggle {
  min-width: 76px;
}

.inventory-stocktake-controls {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.inventory-stocktake-controls label {
  color: var(--muted);
  font-size: 10px;
}

.inventory-stocktake-controls input {
  min-height: 34px;
  padding: 7px 9px;
}

.inventory-stocktake-table {
  min-width: 840px;
  table-layout: fixed;
  font-size: 10px;
}

.inventory-stocktake-table th,
.inventory-stocktake-table td {
  padding: 9px 8px;
}

.inventory-stocktake-table th:nth-child(1) { width: 12%; }
.inventory-stocktake-table th:nth-child(2) { width: 24%; }
.inventory-stocktake-table th:nth-child(n+3) { width: 9%; }

.inventory-stocktake-table .number {
  text-align: center;
  white-space: nowrap;
}

.inventory-stocktake-table tfoot td {
  background: var(--paper-deep);
  font-weight: 600;
}

.inventory-stocktake-total {
  color: var(--forest);
  font-weight: 700;
}

.inventory-sticky-tools {
  position: sticky;
  top: var(--app-header-height);
  z-index: 3;
  margin: -8px -2px 8px;
  padding: 6px 2px 8px;
  background: rgba(243, 240, 233, .98);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.inventory-toolbar-summary {
  display: none;
  align-items: center;
  gap: 10px 16px;
  min-height: 42px;
  padding: 8px 12px;
  color: #fff;
  background: var(--forest);
  border-left: 3px solid var(--clay);
  box-shadow: var(--shadow-soft);
}

.inventory-toolbar-summary strong {
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .05em;
}

.inventory-toolbar-summary span {
  color: #d7ddd9;
  font-size: 11px;
}

.inventory-toolbar-summary small {
  margin-left: auto;
  color: #9ba69f;
  font-size: 9px;
}

body.header-collapsed .inventory-toolbar-details {
  display: none;
}

body.header-collapsed .inventory-toolbar-summary {
  display: flex;
}

.warehouse-card {
  width: 100%;
  min-height: 150px;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.warehouse-card:hover,
.warehouse-card.active {
  border-color: var(--clay);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.compact-warehouse-card {
  min-height: 92px;
  padding: 13px 15px 12px;
}

.compact-warehouse-card span {
  font-size: 10px;
}

.compact-warehouse-card strong {
  margin: 8px 0 5px;
  font-size: 24px;
}

.compact-warehouse-card small {
  font-size: 9px;
}

.warehouse-card em {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.compact-warehouse-card em {
  margin-top: 5px;
  font-size: 9px;
}

.compact-filter {
  margin: 0 0 16px;
}

.compact-product-head {
  display: none;
}

.product-filter-bar {
  grid-template-columns: minmax(210px, 1.1fr) minmax(160px, .75fr) minmax(170px, .8fr) minmax(230px, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
}

.product-filter-bar input,
.product-filter-bar select {
  min-height: 34px;
  padding: 7px 9px;
}

.empty-thumb {
  display: grid;
  place-items: center;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 11px;
}

.section-actions {
  flex-wrap: wrap;
}

.check-row input:disabled {
  cursor: not-allowed;
}

.empty {
  padding: 48px;
  color: var(--muted);
  text-align: center;
}

.bar-row {
  display: grid;
  grid-template-columns: 104px 1fr 82px;
  align-items: center;
  gap: 13px;
  margin: 18px 0;
  font-size: 12px;
}

.bar-row b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-weight: 400;
  text-align: right;
}

.bar {
  height: 3px;
  background: #e2ded5;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--clay);
}

.list {
  display: grid;
  gap: 0;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item b {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 14px;
  font-weight: 400;
}

.muted {
  color: var(--muted);
}

.danger-text {
  color: var(--red) !important;
}

.link-btn {
  min-height: 0;
  padding: 3px 6px;
  color: var(--clay);
  background: transparent;
  border: 0;
  font-size: 11px;
}

.link-btn:hover {
  color: var(--forest);
  background: transparent;
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.danger-link {
  color: var(--red);
}

.danger-link:hover {
  color: var(--red);
}

.success-link {
  color: var(--sage);
}

.success-link:hover {
  color: var(--forest);
}

.action-note {
  display: inline-block;
  padding: 3px 6px;
  font-size: 11px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
}

.product-image-editor {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: center;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.product-image-preview {
  display: grid;
  place-items: center;
  width: 220px;
  aspect-ratio: 1;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.product-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-image-empty-state {
  display: grid;
  gap: 7px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.product-image-empty-state strong {
  color: var(--ink);
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .05em;
}

.product-image-empty-state span,
.product-image-controls p,
.product-image-controls > span {
  font-size: 10px;
  line-height: 1.7;
}

.product-image-controls {
  display: grid;
  gap: 9px;
}

.product-image-controls > strong {
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: .06em;
}

.product-image-controls p {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
}

.product-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-image-actions [hidden] {
  display: none;
}

.purchase-line-image-field {
  display: grid;
  gap: 6px;
  min-width: 132px;
}

.purchase-line-image-preview {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--paper-deep);
}

.purchase-line-image-upload {
  width: 100%;
  justify-content: center;
}

.purchase-line-image-status:empty {
  display: none;
}

.purchase-line-image-hint {
  font-size: 9px;
  line-height: 1.5;
}

.sales-metrics,
.finance-metrics,
.settlement-metrics,
.sales-query-metrics {
  margin-bottom: 20px;
}

.sales-metrics .metric strong,
.finance-metrics .metric strong,
.settlement-metrics .metric strong,
.sales-query-metrics .metric strong {
  font-size: 21px;
  line-height: 1.2;
}

.finance-filter-panel {
  margin-bottom: 20px;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.finance-tabs {
  display: flex;
  gap: 8px;
  margin: -4px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.finance-tabs .active {
  color: var(--ink);
  background: var(--paper-deep);
  border-color: var(--line-strong);
  box-shadow: inset 0 -2px 0 var(--sage);
}

.finance-cost-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.finance-cost-chart-panel {
  min-height: 350px;
}

.finance-cost-chart-panel.wide {
  grid-column: 1 / -1;
}

.finance-cost-chart-panel .dashboard-chart-canvas,
.finance-cost-chart-panel .dashboard-chart-empty {
  height: 250px;
  min-height: 250px;
  margin-bottom: 0;
}

.finance-cost-table {
  min-width: 1220px;
}

.operating-cost-import-table {
  min-width: 980px;
}

.duplicate-row {
  background: rgba(177, 122, 52, .08);
}

.import-errors {
  margin-bottom: 16px;
  padding: 14px 16px;
  color: var(--red);
  background: rgba(145, 61, 47, .07);
  border: 1px solid rgba(145, 61, 47, .22);
}

.import-errors ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.finance-filters {
  width: 100%;
  justify-content: flex-start;
}

.finance-filters .sales-search-input {
  min-width: 230px;
  flex: 1 1 260px;
}

.finance-filters select.compact-input,
.finance-filters input.compact-input {
  width: auto;
  min-width: 126px;
}

.finance-breakdown-table {
  min-width: 860px;
}

.finance-sales-table {
  min-width: 1360px;
}

.selected-row {
  background: rgba(222, 211, 193, .28);
}

.reconciliation-table {
  margin-bottom: 26px;
}

.reconciliation-table table {
  min-width: 820px;
}

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 13px;
  margin-bottom: 26px;
}

.delivery-card {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.delivery-card-head,
.delivery-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.delivery-card-head {
  padding: 16px 18px;
  color: #fff;
  background: var(--forest);
}

.delivery-card-head > div {
  display: grid;
  gap: 2px;
}

.delivery-card-head span {
  color: #aab4ae;
  font-size: 9px;
  letter-spacing: .08em;
}

.delivery-card-head strong {
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: .06em;
}

.delivery-products {
  display: grid;
  gap: 0;
  padding: 4px 18px;
}

.delivery-product {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.delivery-product:last-child {
  border-bottom: 0;
}

.delivery-product > div {
  display: grid;
  gap: 2px;
}

.delivery-product strong {
  font-size: 12px;
  font-weight: 600;
}

.delivery-product span {
  color: var(--muted);
  font-size: 10px;
}

.delivery-thumb {
  display: flex;
  flex: 0 0 48px;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
}

.delivery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.delivery-contact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 14px 18px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.delivery-contact.missing {
  color: var(--red);
  background: #f7ece9;
}

.delivery-contact div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.delivery-contact .wide {
  grid-column: 1 / -1;
}

.delivery-contact span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .06em;
}

.delivery-contact strong {
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 500;
}

.delivery-card-foot {
  padding: 13px 18px;
}

.delivery-empty {
  grid-column: 1 / -1;
}

.delivery-hint,
.customer-fields,
.fee-fields {
  padding: 13px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.delivery-hint {
  display: grid;
  gap: 3px;
}

.delivery-hint strong,
.customer-fields-head strong {
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .05em;
}

.delivery-hint span,
.customer-fields-head span {
  color: var(--muted);
  font-size: 10px;
}

.customer-fields {
  display: grid;
  gap: 13px;
}

.fee-fields {
  display: grid;
  gap: 13px;
}

.fee-hint {
  display: grid;
  gap: 2px;
  padding: 10px 11px;
  color: var(--sage);
  background: var(--sage-pale);
  border-left: 3px solid var(--sage);
}

.fee-hint.warn {
  color: #865b45;
  background: var(--clay-pale);
  border-left-color: var(--clay);
}

.fee-hint strong {
  font-size: 11px;
  font-weight: 600;
}

.fee-hint span {
  font-size: 10px;
  line-height: 1.6;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 9px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, .55);
  border: 1px dashed var(--line);
  font-size: 11px;
  line-height: 1.5;
}

.check-row input {
  width: auto;
  min-height: 0;
}

.customer-fields-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.settlement-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 1px;
  margin-bottom: 18px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--forest);
}

.settlement-summary div {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: var(--forest);
}

.settlement-summary span {
  color: #aab4ae;
  font-size: 9px;
  letter-spacing: .06em;
}

.settlement-summary strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 400;
}

.reconciliation-hint {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px 13px;
  padding: 12px 14px;
  background: var(--sage-pale);
  border-left: 3px solid var(--sage);
}

.reconciliation-hint.difference {
  background: #f7ece9;
  border-left-color: var(--red);
}

.reconciliation-hint span,
.reconciliation-hint small {
  color: var(--muted);
  font-size: 9px;
}

.reconciliation-hint strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 400;
}

dialog {
  width: min(780px, 92vw);
  max-height: min(92vh, 980px);
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  box-shadow: 0 28px 90px rgba(18, 27, 23, .24);
}

dialog.wide-modal {
  width: min(1500px, calc(100vw - 56px));
}

dialog::backdrop {
  background: rgba(18, 27, 23, .62);
  backdrop-filter: blur(4px);
}

#modalForm {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 980px);
  padding: 0;
}

#modalBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 26px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 20px 26px;
  color: #fff;
  background: var(--forest);
}

.modal-head h2 {
  margin: 0;
  font-family: "Yu Mincho", "Songti SC", serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: .08em;
}

.modal-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 17px 26px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 24px rgba(18, 27, 23, .06);
}

.wide-modal #modalBody {
  padding: 26px 34px;
}

.wide-modal .table-wrap {
  max-height: min(64vh, 720px);
}

.wide-modal .table-wrap table {
  min-width: 1180px;
}

.wide-modal .table-wrap select,
.wide-modal .table-wrap input {
  min-width: 0;
}

.icon-btn {
  min-height: 0;
  padding: 0 5px;
  color: inherit;
  background: transparent;
  border: 0;
  font-size: 22px;
}

.icon-btn:hover {
  background: transparent;
  transform: none;
}

.line-list {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  overflow-x: auto;
}

.purchase-line,
.package-line,
.sale-line {
  display: grid;
  align-items: center;
  gap: 8px;
}

.purchase-line {
  grid-template-columns: minmax(180px, 1.6fr) .55fr .8fr .8fr 32px;
}

.package-line {
  grid-template-columns: minmax(180px, 1.8fr) .65fr 1fr 32px;
}

.bulk-inbound-line {
  grid-template-columns: minmax(240px, 1.8fr) .55fr .85fr .75fr;
}

.bulk-product-check {
  justify-content: flex-start;
  color: var(--ink);
}

.bulk-product-check span {
  display: grid;
  gap: 2px;
}

.bulk-product-check small {
  color: var(--muted);
}

.sale-line {
  grid-template-columns: minmax(180px, 1.8fr) .65fr .9fr 32px;
}

.mini-btn {
  min-height: 32px;
  padding: 5px 9px;
}

.shipment-list {
  display: grid;
  gap: 18px;
}

.shipment-card {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.shipment-head {
  padding: 22px 22px 16px;
}

.shipment-title {
  justify-content: flex-start;
  margin-bottom: 5px;
}

.shipment-progress {
  height: 3px;
  margin: 0 22px;
  overflow: hidden;
  background: #e1ddd4;
}

.shipment-progress i {
  display: block;
  height: 100%;
  background: var(--clay);
}

.shipment-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding: 16px 22px 20px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .04em;
}

.shipment-stats b {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 400;
}

.table-wrap.embedded {
  border: 0;
  border-top: 1px solid var(--line);
  box-shadow: none;
}

#toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  padding: 12px 17px;
  color: #fff;
  background: var(--forest);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 2px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  font-size: 12px;
}

#toast.show {
  opacity: 1;
  transform: none;
}

@media (max-width: 1180px) {
  .sidebar {
    width: 220px;
    padding-inline: 18px;
  }

  main {
    margin-left: 220px;
  }

  .brand img {
    width: 158px;
  }

  .metrics.compact {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .sales-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-cost-chart-grid {
    grid-template-columns: 1fr;
  }

  .finance-cost-chart-panel.wide {
    grid-column: auto;
  }

  .finance-tabs {
    overflow-x: auto;
  }

  .dashboard-analytics-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-brief {
    grid-template-columns: 1.4fr 1fr 1fr;
  }

  .dashboard-brief.todo-brief {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .filter-copy {
    grid-column: 1 / -1;
  }

  .group-overviews {
    grid-template-columns: 1fr;
  }

  .delivery-grid {
    grid-template-columns: 1fr;
  }

  .shipment-stats {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .purchase-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-warehouse-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .business-line-overview {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .product-filter-bar {
    grid-template-columns: 1fr 1fr;
  }

}

@media (max-width: 900px) {
  .business-line-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .todo-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    --app-header-height: 95px;
  }

  body.header-collapsed {
    --app-header-height: 50px;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    width: auto;
    height: 86px;
    padding: 5px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    border-right: 0;
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  nav {
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    margin-top: 0;
  }

  nav button {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    min-height: 58px;
    padding: 6px 2px;
    text-align: center;
  }

  nav button:hover {
    transform: none;
  }

  .nav-no {
    display: none;
  }

  .nav-label {
    font-size: 9px;
    letter-spacing: 0;
  }

  main {
    margin-left: 0;
    padding-bottom: 86px;
  }

  .purchase-card-grid,
  .warehouse-overview {
    grid-template-columns: 1fr;
  }

  .shipping-entry-grid {
    grid-template-columns: 1fr;
  }

  .inventory-table-wrap {
    overflow-x: auto;
  }

  .inventory-compact-table {
    min-width: 980px;
  }

  .business-line-overview {
    grid-template-columns: 1fr;
  }

  .product-detail-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  header {
    min-height: var(--app-header-height);
    padding: 15px 15px 13px;
    align-items: flex-end;
  }

  .header-collapse-toggle {
    bottom: -14px;
    min-height: 28px;
    padding: 4px 10px;
  }

  body.header-collapsed header {
    align-items: center;
    padding: 6px 13px;
  }

  body.header-collapsed header h1 {
    font-size: 17px;
  }

  body.header-collapsed .inventory-table-wrap {
    max-height: calc(100vh - var(--app-header-height) - 182px);
  }

  .inventory-toolbar-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
    min-height: 50px;
    padding: 7px 10px;
  }

  .inventory-toolbar-summary small {
    display: none;
  }

  .inventory-stocktake-module {
    padding: 14px;
  }

  .inventory-stocktake-head {
    align-items: flex-start;
  }

  .inventory-stocktake-head-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 6px;
  }

  .inventory-stocktake-controls {
    grid-template-columns: 1fr 1fr;
  }

  .inventory-stocktake-controls label,
  .inventory-stocktake-controls input {
    grid-column: 1 / -1;
  }

  .inventory-stocktake-controls .primary {
    grid-column: 1 / -1;
  }

  .eyebrow {
    font-size: 7px;
  }

  h1 {
    font-size: 24px;
  }

  header p {
    display: none;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .page-quick-actions {
    display: none;
  }

  .header-actions .ghost,
  .header-actions .file-label {
    display: none;
  }

  .header-actions .operator-button {
    display: grid;
    min-width: 92px;
    padding: 6px 9px;
  }

  .login-panel {
    padding: 24px 18px;
  }

  .login-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-cards {
    grid-template-columns: 1fr;
  }

  .page {
    padding: 22px 13px 52px;
  }

  .dashboard-brief {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-brief.todo-brief {
    grid-template-columns: 1fr;
  }

  .brief-copy {
    grid-column: 1 / -1;
    padding: 20px;
  }

  .brief-stat {
    padding: 16px;
  }

  .metrics,
  .metrics.compact {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .my-reimbursement-summary-grid {
    grid-template-columns: 1fr;
  }

  .my-reimbursement-summary-item {
    grid-template-columns: minmax(90px, .75fr) minmax(150px, 1.5fr) minmax(100px, .75fr);
  }

  .sales-entry-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-chart-panel {
    min-height: 420px;
  }

  .dashboard-chart-canvas,
  .dashboard-chart-empty {
    height: 220px;
    min-height: 220px;
  }

  .sales-archive-toolbar .section-actions,
  .sales-year-switcher {
    width: 100%;
  }

  .metric,
  .metrics.compact .metric {
    min-height: 120px;
    padding: 16px 14px 14px;
  }

  .warehouse-overview {
    grid-template-columns: 1fr;
  }

  .purchase-summary {
    grid-template-columns: 1fr 1fr;
  }

  .purchase-editor-table {
    overflow-x: auto;
  }

  .metric strong,
  .metrics.compact .metric strong {
    margin-top: 15px;
    font-size: 20px;
  }

  .panel {
    padding: 17px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .filter-copy {
    grid-column: auto;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .product-image-editor {
    grid-template-columns: 1fr;
  }

  .product-image-preview {
    width: min(100%, 280px);
  }

  .delivery-card-head,
  .delivery-card-foot,
  .customer-fields-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .delivery-contact {
    grid-template-columns: 1fr;
  }

  .delivery-contact .wide {
    grid-column: auto;
  }

  .settlement-summary {
    grid-template-columns: 1fr 1fr;
  }

  .reconciliation-hint {
    grid-template-columns: 1fr;
  }

  .sales-register-layout {
    grid-template-columns: 1fr;
  }

  .extra-sale-grid {
    grid-template-columns: 1fr;
  }

  .sales-product-list {
    max-height: none;
  }

  dialog {
    width: 96vw;
  }

  dialog.wide-modal {
    width: 98vw;
  }

  #modalForm {
    padding: 0;
  }

  #modalBody {
    padding: 20px;
  }

  .modal-head {
    margin: 0;
    padding: 18px 20px;
  }

  .modal-actions {
    margin: 0;
    padding: 15px 20px;
  }

  .wide-modal #modalBody {
    padding: 20px;
  }

  .wide-modal .table-wrap {
    max-height: min(66vh, 680px);
  }

  .purchase-line,
  .package-line,
  .sale-line {
    min-width: 590px;
  }

  .shipment-head {
    align-items: flex-start;
    padding: 17px;
  }

  .shipment-stats {
    grid-template-columns: 1fr 1fr;
    padding: 13px 17px 17px;
  }

  .shipment-progress {
    margin: 0 17px;
  }

  .bar-row {
    grid-template-columns: 80px 1fr 66px;
    gap: 8px;
  }
}

@media (max-width: 520px) {
  .todo-module-grid {
    grid-template-columns: 1fr;
  }

  .my-reimbursement-summary-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .my-reimbursement-summary-amount {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
}

/* Japanese handmade research library */
.research-hero { display:flex; justify-content:space-between; gap:24px; padding:28px 30px; margin-bottom:18px; background:linear-gradient(135deg,#18251f,#33493c); color:#f7f1e7; border-radius:2px; }
.research-hero h2 { margin:6px 0 8px; font-family:Georgia,"Times New Roman",serif; font-size:clamp(26px,4vw,42px); font-weight:400; }
.research-hero p,.research-hero-note span { margin:0; color:#cad4cd; }
.research-hero-note { align-self:end; max-width:280px; padding-left:20px; border-left:1px solid rgba(255,255,255,.24); }
.research-hero-note strong,.research-hero-note span { display:block; }
.research-hero-note strong { margin-bottom:6px; color:#f6d8bd; }
.research-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:18px; }
.research-stat { min-height:108px; padding:16px; border:1px solid var(--line); border-radius:2px; background:var(--white); text-align:left; cursor:pointer; transition:border-color .2s,transform .2s,box-shadow .2s; }
.research-stat:hover,.research-stat.active { border-color:var(--sage); box-shadow:var(--shadow-soft); transform:translateY(-1px); }
.research-stat span,.research-stat small { display:block; color:var(--muted); }
.research-stat strong { display:block; margin:4px 0 2px; font-family:Georgia,"Times New Roman",serif; font-size:28px; font-weight:400; color:var(--forest); }
.research-toolbar { display:flex; align-items:end; flex-wrap:wrap; gap:9px; padding:14px; border:1px solid var(--line); background:rgba(255,254,250,.72); }
.research-toolbar label:not(.research-search) { min-width:130px; }
.research-toolbar label > span { display:block; margin:0 0 4px; color:var(--muted); font-size:11px; }
.research-toolbar input,.research-toolbar select { min-height:38px; padding:7px 10px; border:1px solid var(--line-strong); border-radius:2px; background:var(--white); }
.research-search { flex:1 1 260px; }
.research-search input { width:100%; }
.research-file-button { display:inline-flex; align-items:center; justify-content:center; min-height:38px; padding:0 13px; color:var(--ink); border:1px solid var(--line-strong); background:var(--white); cursor:pointer; }
.research-file-button input { display:none; }
.research-toolbar-note { padding:10px 14px 0; color:var(--muted); font-size:12px; }
.research-content-head { display:flex; justify-content:space-between; align-items:end; gap:16px; margin:28px 0 12px; }
.research-content-head h3 { margin:3px 0 0; font-family:Georgia,"Times New Roman",serif; font-size:25px; font-weight:400; }
.research-content-head > span { color:var(--muted); font-size:12px; }
.research-card-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
.research-card { min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:2px; background:var(--white); box-shadow:var(--shadow-soft); }
.research-card-image { position:relative; display:grid; place-items:center; aspect-ratio:4/3; overflow:hidden; background:linear-gradient(135deg,#e8e4da,#cbd6ce); color:#647368; font-family:Georgia,"Times New Roman",serif; font-size:42px; }
.research-card-image img { position:absolute; inset:0; width:100%; height:100%; padding:10px; box-sizing:border-box; object-fit:contain; object-position:center; }
.research-card-body { padding:16px; }
.research-card-topline,.research-card-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.research-card-topline { color:var(--clay); font-size:11px; }
.research-card-topline em { padding:2px 7px; border-radius:20px; background:var(--sage-pale); color:var(--sage); font-style:normal; }
.research-card h3 { margin:10px 0 2px; color:var(--forest); font-size:18px; line-height:1.35; }
.research-card h3 small { display:block; margin-top:3px; color:var(--muted); font-size:12px; font-weight:400; }
.research-location,.research-summary,.research-long-copy { margin:5px 0; color:var(--muted); font-size:12px; }
.research-summary { min-height:38px; color:var(--ink); }
.research-detail-list { display:grid; gap:7px; margin-top:13px; padding-top:11px; border-top:1px solid var(--line); }
.research-detail-list div { display:grid; grid-template-columns:72px 1fr; gap:8px; }
.research-detail-list span { color:var(--muted); font-size:11px; }
.research-detail-list b { min-width:0; font-size:12px; font-weight:500; overflow-wrap:anywhere; }
.research-long-section { margin-top:12px; }
.research-long-section > span { display:block; margin-bottom:4px; color:var(--clay); font-size:11px; }
.research-contact { margin-top:12px; padding:8px 10px; background:var(--paper); color:var(--muted); font-size:12px; }
.research-links { display:flex; flex-wrap:wrap; gap:8px 12px; margin-top:13px; }
.research-links a,.research-card-footer a { color:var(--sage); text-decoration:none; }
.research-links a:hover,.research-card-footer a:hover { color:var(--clay); text-decoration:underline; }
.research-evidence { margin-top:12px; padding-top:10px; border-top:1px dashed var(--line-strong); color:var(--muted); font-size:11px; }
.research-evidence summary { cursor:pointer; color:var(--sage); }
.research-evidence p { margin:8px 0; line-height:1.6; }
.research-evidence div { display:grid; gap:4px; }
.research-evidence a { color:var(--sage); overflow-wrap:anywhere; }
.research-card-footer { margin-top:15px; padding-top:11px; border-top:1px solid var(--line); color:var(--muted); font-size:10px; }
.research-pagination { display:flex; justify-content:center; align-items:center; gap:14px; margin:22px 0 4px; color:var(--muted); font-size:12px; }
.research-pagination button:disabled { cursor:not-allowed; opacity:.45; }
.research-empty { display:grid; place-items:center; min-height:230px; padding:28px; border:1px dashed var(--line-strong); background:rgba(255,254,250,.58); text-align:center; }
.research-empty strong,.research-empty span { display:block; }
.research-empty strong { color:var(--forest); font-family:Georgia,"Times New Roman",serif; font-size:20px; font-weight:400; }
.research-empty span { margin:6px 0 14px; color:var(--muted); }
.research-empty.error strong { color:var(--red); }
@media (max-width:1100px) { .research-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:760px) { .research-hero { display:block; padding:22px; } .research-hero-note { max-width:none; margin-top:22px; padding:14px 0 0; border-top:1px solid rgba(255,255,255,.24); border-left:0; } .research-stats { grid-template-columns:repeat(2,minmax(0,1fr)); } .research-card-grid { grid-template-columns:1fr; } .research-content-head { align-items:start; } }
