:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d9e0e8;
  --primary: #176b87;
  --primary-strong: #0f5065;
  --accent: #b45f3c;
  --green: #1f8a5f;
  --red: #c2413a;
  --warn: #c98718;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.nav-button,
.panel,
.modal-card,
input,
select {
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: #152832;
  color: #eff7fa;
  padding: 18px 14px;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  margin-bottom: 12px;
}

.brand-mark {
  width: 58px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 58px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 176, 255, 0.34)) drop-shadow(0 1px 2px rgba(255, 255, 255, 0.28));
}

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

.nav-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #d7e3e8;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  margin: 2px 0;
}

.nav-button:hover,
.nav-button.active {
  background: #24424f;
  color: #ffffff;
}

.nav-button:hover {
  transform: translateX(2px);
}

.nav-icon {
  width: 22px;
  text-align: center;
}

.nav-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #b7c7ce;
  font-size: 12px;
  text-transform: uppercase;
}

.nav-child {
  padding-left: 42px;
}

.main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.main::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.topbar {
  min-height: 82px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 24px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

.topbar p {
  color: var(--muted);
  margin-top: 6px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--muted);
}

.user-box select,
.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

.content {
  padding: 22px 24px 34px;
}

.content-enter {
  animation: contentFade 220ms ease;
}

@keyframes contentFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}

.panel:hover {
  box-shadow: 0 10px 28px rgba(22, 42, 55, 0.06);
}

.panel-head {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.folder-tab-group {
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.folder-tab-button {
  align-self: stretch;
  min-width: 180px;
  border: 1px solid var(--line);
  border-bottom-color: #ffffff;
  border-radius: 8px 8px 0 0;
  padding: 10px 16px;
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 -1px 0 rgba(23, 107, 135, 0.12) inset;
}

.folder-tab-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.folder-tab-button:hover {
  background: #f4fafc;
  transform: translateY(-1px);
}

.folder-tab-button.active:hover {
  background: var(--primary-strong);
}

.panel-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.segmented button {
  min-width: 42px;
  border: 0;
  border-radius: 5px;
  padding: 7px 12px;
  background: transparent;
  color: #475467;
  cursor: pointer;
}

.segmented button.active {
  background: var(--primary);
  color: #fff;
}

.panel-body {
  padding: 16px;
}

.month-folders {
  display: grid;
  gap: 14px;
}

.month-folder {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.month-folder-head {
  min-height: 52px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.month-folder-head:has(.fold-toggle) {
  position: relative;
  padding-left: 54px;
}

.month-folder-head .fold-toggle {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.month-folder-head strong {
  display: block;
}

.month-folder-head span,
.hint,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.month-folder table {
  border-radius: 0;
}

.process-book-card .month-folder-head {
  justify-content: flex-start;
}

.process-book-title {
  min-width: 240px;
  flex: 1;
}

.process-book-title span {
  display: block;
  margin-top: 3px;
}

.process-book-body {
  padding: 0;
}

.business-section {
  margin: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.business-section-head {
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.business-section-head strong {
  font-size: 14px;
  letter-spacing: .02em;
}

.business-section table {
  border-radius: 0;
}

.kk-material-section table {
  table-layout: fixed;
}

.kk-material-section th,
.kk-material-section td {
  padding: 9px 10px;
}

.kk-material-section th:nth-child(1),
.kk-material-section td:nth-child(1) {
  width: 15%;
}

.kk-material-section th:nth-child(2),
.kk-material-section td:nth-child(2) {
  width: 38%;
}

.kk-material-section th:nth-child(3),
.kk-material-section td:nth-child(3) {
  width: 8%;
  white-space: nowrap;
}

.kk-material-section th:nth-child(4),
.kk-material-section td:nth-child(4) {
  width: 8%;
  white-space: nowrap;
}

.kk-material-section th:nth-child(5),
.kk-material-section td:nth-child(5) {
  width: 19%;
}

.kk-material-section th:nth-child(6),
.kk-material-section td:nth-child(6) {
  width: 12%;
}

.section-restore-row {
  margin: 12px 12px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.month-folder.kk-closed {
  border-color: #9bd6bb;
  background: #f2fbf6;
}

.month-folder.kk-closed > .month-folder-head {
  background: #e7f7ef;
}

.month-folder.kk-closed > .month-folder-head strong::after {
  content: " · Closed";
  color: var(--green);
  font-weight: 700;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.finance-lpb-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.finance-lpb-stats .kpi {
  padding: 13px 14px;
  background: #fbfdff;
}

.finance-lpb-stats .kpi strong {
  font-size: 20px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.finance-lpb-stats .kpi.warn {
  border-color: #f0d3a2;
  background: #fffaf0;
}

.finance-lpb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #cddfe7;
  border-radius: 8px;
  background: #f7fbfd;
}

.finance-lpb-toolbar > div:first-child {
  display: grid;
  gap: 4px;
}

.finance-lpb-toolbar span,
.finance-lpb-toolbar small {
  color: var(--muted);
  font-size: 13px;
}

.finance-lpb-toolbar .action-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wide-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.wide-table-wrap table {
  border-radius: 0;
}

.finance-lpb-wrap {
  max-width: 100%;
}

.finance-lpb-table {
  min-width: 1940px;
  table-layout: auto;
}

.finance-lpb-table th,
.finance-lpb-table td {
  padding: 10px 12px;
  vertical-align: top;
}

.finance-lpb-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

.finance-lpb-table .cell-code {
  width: 108px;
  max-width: 126px;
}

.finance-lpb-table .cell-check {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.finance-lpb-table .cell-check input {
  width: 16px;
  height: 16px;
}

.finance-lpb-table .cell-customer {
  width: 150px;
  max-width: 180px;
}

.finance-lpb-table .cell-product {
  width: 260px;
  min-width: 240px;
}

.finance-lpb-table .cell-product strong,
.finance-lpb-table .cell-product span,
.finance-lpb-table .cell-product small,
.finance-lpb-table td small {
  display: block;
}

.finance-lpb-table .cell-product span,
.finance-lpb-table .cell-note span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.finance-lpb-table .cell-product small,
.finance-lpb-table td small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.finance-lpb-table .cell-number {
  width: 112px;
}

.finance-lpb-table .cell-money {
  width: 128px;
  text-align: right;
  white-space: nowrap;
}

.finance-lpb-table .cell-money.strong {
  font-weight: 700;
  color: #193542;
}

.finance-lpb-table .cell-note {
  width: 220px;
  min-width: 200px;
}

.vertical-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.payment-allocation-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.payment-allocation-summary .kpi {
  padding: 13px 14px;
  background: #fbfdff;
}

.payment-allocation-summary .kpi strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.payment-allocation-summary .kpi.warn {
  border-color: #f0d3a2;
  background: #fffaf0;
}

.allocation-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(140px, 0.8fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

.toolbar .filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.primary,
.secondary,
.danger {
  border: 0;
  border-radius: 6px;
  padding: 9px 13px;
  cursor: pointer;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-strong);
}

.secondary {
  background: #eef3f6;
  color: #1f3440;
}

.danger {
  background: #f8e7e5;
  color: var(--red);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: center;
  vertical-align: middle;
  min-width: 0;
  overflow-wrap: anywhere;
}

th,
td.truncate-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.truncate-cell .tag,
td.truncate-cell .inline-input,
td.truncate-cell .inline-select {
  max-width: 100%;
}

td .inline-input,
td .inline-select {
  text-align: center;
}

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 600;
  text-align: center;
}

tr:last-child td {
  border-bottom: 0;
}

tr.schedule-order-start td {
  border-top: 2px solid #c9dce3;
}

tr.schedule-order-continuation td {
  background: #fbfdfe;
}

tr.schedule-order-continuation td:first-child,
tr.schedule-order-continuation td:nth-child(2) {
  color: var(--muted);
}

tr.schedule-item-group-start td {
  border-top: 8px solid #eef5f8;
  border-bottom-color: transparent;
  background: #fbfdfe;
}

tr.schedule-item-group-start td[rowspan] {
  box-shadow: inset 0 -1px 0 var(--line);
}

tr.schedule-item-group-start.schedule-item-group-end td {
  box-shadow: inset 0 -1px 0 var(--line);
}

tr.schedule-item-group-start td:first-child {
  border-left: 4px solid var(--primary);
}

tr.schedule-item-group-continuation td {
  background: #fbfdfe;
  border-top: 0;
  border-bottom-color: transparent;
  box-shadow: none;
}

tr.schedule-item-group-continuation td:first-child {
  border-left: 0;
}

tr.schedule-item-group-start + tr.schedule-item-group-continuation td {
  padding-top: 6px;
}

tr.schedule-item-group-end td {
  box-shadow: inset 0 -1px 0 var(--line);
}

.merged-status-cell,
.merged-schedule-cell {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.merged-schedule-cell {
  font-weight: 600;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef3f6;
  color: #31505d;
}

.tag.green {
  background: #e4f5ee;
  color: var(--green);
}

.tag.red {
  background: #f9e7e5;
  color: var(--red);
}

.tag.warn {
  background: #fbf0d6;
  color: var(--warn);
}

.tag.blue {
  background: #e7f0ff;
  color: #1d4ed8;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip-remove {
  margin-left: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.action-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-left {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: center;
  border-radius: 7px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #eef3f6;
  color: #31505d;
}

.notice.warn {
  background: #fbf0d6;
  color: #8a5d00;
}

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

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

.detail-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

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

.detail-row strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfcfd;
}

.mini-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 5px 8px;
  cursor: pointer;
}

.fold-toggle {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.inline-select {
  width: 100%;
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 7px;
  background: #fff;
  color: var(--ink);
}

.inline-input {
  width: 100%;
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 7px;
  background: #fff;
  color: var(--ink);
}

.inline-input.compact-number {
  min-width: 70px;
  max-width: 86px;
}

.inline-input.compact-input {
  min-width: 78px;
  max-width: 110px;
}

.order-info {
  max-width: 100%;
}

.order-info summary {
  display: grid;
  grid-template-columns: minmax(86px, 0.9fr) minmax(90px, 1fr) minmax(110px, 1.2fr);
  gap: 8px;
  align-items: center;
  cursor: pointer;
  list-style-position: inside;
}

.order-info summary span,
.order-info summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
}

.order-info-grid b {
  color: var(--ink);
  font-weight: 500;
}

.status-with-action {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.schedule-split-cell {
  display: grid;
  gap: 6px;
  min-width: 260px;
  align-items: start;
}

.schedule-split-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  padding: 8px;
  border: 1px solid #dbe5ec;
  border-radius: 7px;
  background: #f8fafc;
}

.schedule-split-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.schedule-qty-input {
  width: 100%;
  min-width: 110px;
}

.schedule-no-select {
  min-width: 150px;
}

.schedule-field {
  display: grid;
  gap: 2px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.schedule-field span {
  font-weight: 600;
}

.info-button {
  min-width: 58px;
}

.process-round {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.info-modal {
  padding: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.info-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.info-row span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.info-row strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.info-table {
  margin-top: 6px;
}

.report-subhead {
  margin: 18px 0 8px;
  font-size: 15px;
}

.report-total-row td {
  background: #eef3f6;
  font-weight: 700;
}

.daily-report {
  display: grid;
  gap: 18px;
  padding: 4px 2px 0;
}

.daily-report-kpis,
.monthly-report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.report-kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafb 100%);
  min-height: 88px;
}

.report-kpi span,
.report-kpi em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.report-kpi strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.report-kpi.metric-text strong {
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
}

.report-metric-table {
  min-width: 680px;
}

.report-metric-table th,
.report-metric-table td {
  vertical-align: middle;
}

.unit-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef3f6;
  color: #1f3440;
  font-weight: 700;
  font-size: 12px;
}

.daily-report-section,
.monthly-report-folder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

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

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

.report-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.daily-line-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.daily-line-report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.daily-line-report-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
}

.daily-line-report-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid #edf1f3;
}

.daily-line-report-card span {
  color: var(--muted);
  font-size: 12px;
}

.daily-line-report-card b {
  color: var(--ink);
  font-weight: 700;
}

.report-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.monthly-report-folder {
  display: grid;
  gap: 14px;
}

.monthly-report-table {
  min-width: 720px;
}

.department-dispatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.department-dispatch-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.department-dispatch-card:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(15, 47, 58, 0.12);
  transform: translateY(-1px);
}

.department-dispatch-card strong,
.department-dispatch-card span {
  display: block;
}

.department-dispatch-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.department-work-order {
  display: grid;
  gap: 12px;
}

.department-work-summary {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) minmax(140px, 0.7fr) minmax(220px, 1.7fr);
  gap: 10px;
  padding: 0 12px;
}

.department-work-summary .mini-card {
  min-height: 76px;
}

.department-work-summary .mini-card strong {
  overflow-wrap: anywhere;
}

.paint-materials {
  display: grid;
  gap: 10px;
}

.paint-material-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 82px 78px auto;
  gap: 8px;
  align-items: center;
}

.paint-line-cards {
  display: grid;
  gap: 12px;
  padding: 12px;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
}

.paint-line-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.paint-line-head {
  display: grid;
  grid-template-columns: minmax(88px, 0.45fr) minmax(150px, 0.75fr) minmax(110px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.paint-line-head strong {
  align-self: center;
  font-size: 15px;
}

.paint-line-summary {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.paint-line-body {
  display: grid;
  gap: 12px;
}

.compact-field label,
.paint-card-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.compact-field input,
.compact-field select {
  width: 100%;
}

.paint-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  margin-bottom: 12px;
}

.paint-card-section {
  margin-bottom: 12px;
}

.paint-output-row {
  display: grid;
  grid-template-columns: minmax(140px, 190px) auto minmax(160px, 1fr);
  gap: 10px;
  align-items: end;
}

.paint-unit-pill {
  display: inline-flex;
  align-items: center;
  min-height: 37px;
  border-radius: 999px;
  padding: 6px 12px;
  background: #eef3f6;
  color: #31505d;
  font-size: 13px;
}

.lamination-outputs {
  display: grid;
  gap: 10px;
}

.lamination-output-row {
  display: grid;
  grid-template-columns: 92px 110px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.schedule-complete {
  border-color: rgba(32, 132, 96, 0.4);
  background: #f0faf5;
}

.schedule-complete .month-folder-head {
  background: #e4f5ee;
}

tr.replenish-complete-row td {
  background: #eef9f3;
}

tr.replenish-complete-row td:first-child {
  border-left: 3px solid var(--green);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

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

.flow-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 12px;
  background: #fbfcfd;
  min-height: 88px;
}

.flow-step strong {
  display: block;
  margin-bottom: 6px;
}

.flow-step span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.38);
  padding: 16px;
  animation: modalFade 160ms ease;
}

.hidden {
  display: none;
}

.modal-card {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  animation: modalLift 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalLift {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

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

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: #eef3f6;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.form-grid.compact {
  padding: 18px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-row input {
  width: 100%;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #475467;
  font-size: 13px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
  flex-wrap: wrap;
}

.movement-note {
  margin: 14px 16px 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: #eef3f6;
  color: #31505d;
  font-size: 13px;
}

.movement-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 16px 0;
  padding: 14px;
  min-width: 0;
}

.movement-section legend {
  padding: 0 8px;
  color: #1f3440;
  font-weight: 700;
}

.movement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.login-panel {
  max-width: 460px;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.auth-grid.single {
  grid-template-columns: minmax(320px, 520px);
  justify-content: center;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
}

.bar {
  display: grid;
  grid-template-columns: 92px 1fr 88px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.bar-track {
  height: 12px;
  background: #edf2f5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

.stacked-panels {
  display: grid;
  gap: 16px;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  #nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .kpi-grid,
  .dashboard-grid,
  .auth-grid,
  .flow,
  .detail-grid,
  .movement-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .panel-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  #nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .paint-line-head,
  .paint-work-grid,
  .paint-output-row,
  .paint-material-row,
  .lamination-output-row,
  .paint-line-cards {
    grid-template-columns: 1fr;
  }

  .paint-line-summary {
    white-space: normal;
  }
}
