:root {
  --bg: #eef3f2;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #17211f;
  --muted: #66736f;
  --line: #d9e2df;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --accent: #b45309;
  --danger: #b42318;
  --warn: #b7791f;
  --ok: #15803d;
  --shadow: 0 12px 30px rgba(18, 34, 30, 0.08);
}

.payroll-cost-dialog {
  width: min(1240px, calc(100vw - 32px));
  max-width: 1240px;
}

#payrollClosingDialog .record-form {
  max-height: calc(100vh - 40px);
  overflow: hidden;
}

.payroll-closing-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payroll-closing-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.payroll-closing-flow article {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.payroll-closing-flow article > span {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #e7eeec;
  color: var(--muted);
  font-weight: 800;
}

.payroll-closing-flow article div {
  display: grid;
  min-width: 0;
}

.payroll-closing-flow article small {
  color: var(--muted);
}

.payroll-closing-flow article.complete > span {
  background: #dcfce7;
  color: var(--ok);
}

.payroll-closing-flow article.warning > span,
.payroll-closing-flow article.waiting > span {
  background: #fef3c7;
  color: var(--warn);
}

.payroll-closing-flow article.blocked > span {
  background: #fee2e2;
  color: var(--danger);
}

.payroll-closing-issues {
  max-height: min(36vh, 360px);
  overflow-y: auto;
  padding-right: 4px;
}

.payroll-journal-preview-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: var(--surface-soft);
}

.payroll-journal-preview-summary > div {
  display: grid;
  gap: 2px;
}

.payroll-journal-preview-summary span,
.payroll-journal-preview-summary small {
  color: var(--muted);
  font-size: 12px;
}

.payroll-journal-preview-summary.has-error {
  border-left-color: var(--danger);
  background: #fff1f0;
}

.payroll-journal-preview-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payroll-journal-preview-table {
  min-width: 1180px;
}

.payroll-cost-warning.danger {
  border-left-color: var(--danger);
  background: #fff1f0;
  color: #8f1d16;
}

@media (max-width: 760px) {
  .payroll-closing-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payroll-closing-flow {
    grid-template-columns: 1fr;
  }

  .payroll-journal-preview-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .payroll-journal-preview-metrics {
    grid-template-columns: 1fr;
  }
}

.payroll-cost-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.payroll-cost-toolbar > div {
  display: flex;
  gap: 8px;
}

.payroll-cost-warning {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 4px solid #b7791f;
  background: #fff8e6;
  color: #714b12;
}

.payroll-cost-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0;
  border: 1px solid var(--border-color, #d9dde3);
  background: var(--border-color, #d9dde3);
}

.payroll-cost-metrics > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  background: #fff;
}

.payroll-cost-metrics span,
.payroll-cost-table small {
  color: var(--muted-text, #667085);
  font-size: 12px;
}

.payroll-cost-metrics strong {
  font-size: 19px;
}

.payroll-cost-table-wrap {
  max-height: min(52vh, 520px);
  overflow: auto;
  border: 1px solid var(--border-color, #d9dde3);
}

.payroll-cost-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.payroll-cost-table th,
.payroll-cost-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  text-align: right;
  white-space: nowrap;
}

.payroll-cost-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f8fa;
  font-size: 12px;
}

.payroll-cost-table th:first-child,
.payroll-cost-table td:first-child,
.payroll-cost-table th:nth-child(2),
.payroll-cost-table td:nth-child(2) {
  text-align: left;
}

.payroll-cost-table td:first-child,
.payroll-cost-table td:last-child {
  display: table-cell;
}

.payroll-cost-table td:first-child strong,
.payroll-cost-table td:first-child small,
.payroll-cost-table td:last-child small {
  display: block;
}

.empty-table-cell {
  padding: 28px !important;
  text-align: center !important;
  color: var(--muted-text, #667085);
}

@media (max-width: 800px) {
  .payroll-cost-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .payroll-cost-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: #e7efed;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  padding: 0 0 24px;
  color: var(--ink);
}

.login-brand span {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form .primary-action {
  width: 100%;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #12312d;
  color: #ecfdf8;
  padding: 20px 14px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f7f0df;
  color: #12312d;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b7cbc6;
  font-size: 13px;
  margin-top: 2px;
}

.module-nav {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
}

.nav-group {
  display: block;
  border-radius: 8px;
}

.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  border-radius: 8px;
  color: #9fb9b4;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  list-style: none;
  padding: 0 10px;
}

.nav-group-title::-webkit-details-marker {
  display: none;
}

.nav-group-title:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ecfdf8;
}

.nav-group-caret {
  color: #7fb5ad;
  font-size: 11px;
  transition: transform 0.16s ease;
}

.nav-group[open] .nav-group-caret {
  transform: rotate(180deg);
}

.nav-group-items {
  display: grid;
  gap: 4px;
  padding: 2px 0 4px 8px;
}

.nav-group:not([open]) .nav-group-items {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  color: #d9ebe7;
  background: transparent;
  padding: 0 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #1d4b45;
  color: #ffffff;
}

.nav-icon {
  display: grid;
  flex: 0 0 22px;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #9fd8ce;
  font-size: 12px;
  font-weight: 900;
}

.nav-item span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  min-width: 0;
  padding: 24px;
  padding-bottom: 88px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.icon-button,
.user-chip,
.primary-action,
.secondary-action,
.role-pill {
  min-height: 40px;
  border-radius: 8px;
}

.icon-button {
  position: relative;
  width: 40px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.alert-button.has-alerts {
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px #fecaca, var(--shadow);
}

#alertCenterCount {
  display: none;
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 900;
  line-height: 19px;
}

#alertCenterCount.visible {
  display: inline-block;
}

.alert-center-panel {
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 20;
  width: min(430px, calc(100vw - 28px));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(18, 34, 30, 0.18);
  padding: 12px;
}

.alert-center-panel.visible {
  display: grid;
  gap: 10px;
}

.global-search-panel {
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 22;
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 120px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.global-search-panel.visible {
  display: grid;
  gap: 12px;
}

.global-search-header {
  display: grid;
  gap: 4px;
}

.global-search-header strong {
  color: var(--ink);
  font-size: 15px;
}

.global-search-header span,
.global-search-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.global-search-input input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0 12px;
  font: inherit;
  font-weight: 800;
}

.global-search-results {
  display: grid;
  gap: 12px;
}

.global-search-group {
  display: grid;
  gap: 7px;
}

.global-search-group h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  margin: 0;
}

.global-search-group h3 span {
  color: var(--brand-strong);
}

.global-search-group button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
  text-align: left;
}

.global-search-group button:hover {
  border-color: var(--brand);
  background: #f8fafc;
}

.global-search-group button.exact-match {
  border-color: var(--brand);
  background: #ecfdf5;
}

.global-search-group button span {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.global-search-group button strong {
  color: var(--ink);
  font-size: 14px;
}

.global-search-group button em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-more {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.alert-center-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.alert-center-header div {
  display: grid;
  gap: 3px;
}

.alert-center-header strong {
  color: var(--ink);
  font-size: 15px;
}

.alert-center-header span,
.alert-center-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.alert-center-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.alert-center-tabs button {
  min-height: 30px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  padding: 0 9px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px;
  font-weight: 900;
}

.alert-center-tabs button span {
  margin-left: 5px;
  color: var(--brand-strong);
}

.alert-center-tabs button.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

.alert-center-tabs button.active span {
  color: #ffffff;
}

.alert-center-list {
  display: grid;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
}

.alert-center-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.alert-center-item.risk {
  background: #fff7f7;
}

.alert-center-item.warning {
  background: #fffbeb;
}

.alert-center-item.read {
  opacity: 0.62;
}

.alert-center-item > button:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.alert-center-item > button:first-child strong,
.alert-center-item > button:first-child small,
.alert-center-item > button:first-child em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-center-item > button:first-child strong {
  color: var(--ink);
  font-size: 13px;
}

.alert-center-item > button:first-child small,
.alert-center-item > button:first-child em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.user-chip {
  background: #f7f0df;
  color: #3b2e16;
  padding: 0 14px;
  font-weight: 700;
}

.user-account-select {
  border: 0;
  min-width: 132px;
  font: inherit;
  font-weight: 800;
}

.user-account-badge {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
}

.password-button,
.logout-button {
  min-height: 40px;
  padding: 0 12px;
}

.role-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
}

.role-pill {
  flex: 0 0 auto;
  background: var(--surface);
  color: var(--muted);
  padding: 0 18px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.role-pill.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  width: 100%;
  min-height: 126px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 18px;
  text-align: left;
  box-shadow: var(--shadow);
}

.metric:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0;
  font-size: 32px;
  line-height: 1;
}

.environment-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  padding: 8px 12px;
  border: 1px solid #b42318;
  border-radius: 6px;
  background: #fff1f0;
  color: #8f1d16;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(50, 30, 30, 0.18);
  pointer-events: none;
}

.dealer-dashboard .metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dealer-portal-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 132px;
  padding: 24px 26px;
  border-radius: 8px;
  background: #11645a;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.dealer-portal-banner .eyebrow,
.dealer-portal-banner p {
  margin: 0;
  color: #d8f1eb;
}

.dealer-portal-banner h2 {
  margin: 5px 0 8px;
  color: #ffffff;
  font-size: 24px;
}

.dealer-portal-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.dealer-portal-actions .primary-action {
  background: #ffffff;
  color: #0b554c;
}

.dealer-portal-actions .secondary-action {
  border-color: rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #ffffff;
}

.dealer-dashboard .content-grid {
  grid-template-columns: 1fr;
}

.dealer-dashboard .dealer-metric {
  min-height: 112px;
  border-top: 4px solid #3e8d7d;
  box-shadow: 0 5px 16px rgba(18, 58, 52, 0.08);
}

.dealer-order-row em {
  color: #0f6b5c;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  margin-bottom: 16px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.work-panel,
.table-section {
  min-width: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.work-panel {
  padding: 18px;
}

.recent-viewed-panel {
  grid-column: 1 / -1;
}

.table-section {
  padding: 18px;
}

.hidden-control {
  display: none !important;
}

.toolbar-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.search-control {
  display: grid;
  gap: 6px;
  min-width: 260px;
  max-width: 520px;
  flex: 1;
}

.search-control label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.search-control input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  padding: 0 12px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.list-export-status {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
  background: #ecfdf5;
  box-shadow: inset 0 0 0 1px #a7f3d0;
  color: #065f46;
  padding: 10px 12px;
  margin: -6px 0 16px;
}

.list-export-status.visible {
  display: flex;
}

.list-export-status div {
  display: grid;
  gap: 2px;
}

.list-export-status strong {
  font-size: 14px;
}

.list-export-status span {
  font-size: 13px;
  font-weight: 700;
}

.list-export-status a {
  text-decoration: none;
}

.advanced-query-panel {
  display: none;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: -6px 0 16px;
}

.advanced-query-panel.visible {
  display: block;
}

.advanced-query-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.advanced-query-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.advanced-query-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.advanced-query-grid input,
.advanced-query-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 0 10px;
}

.audit-query-panel {
  margin-top: 0;
}

.report-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.report-query-sections {
  display: grid;
  gap: 12px;
}

.report-query-section {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.report-query-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.report-query-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.advanced-query-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.secondary-action.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

.list-print-document {
  color: #111827;
}

.list-print-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.list-print-header h1 {
  margin: 0 0 6px;
  color: #111827;
  font-size: 24px;
}

.list-print-header span,
.list-print-header strong {
  color: #374151;
  font-size: 13px;
}

.list-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.list-print-table th,
.list-print-table td {
  border: 1px solid #d1d5db;
  padding: 6px 7px;
  text-align: left;
  vertical-align: top;
}

.list-print-table th {
  background: #f3f4f6;
  color: #111827;
  font-weight: 800;
}

.asset-print-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid #cbd8d3;
  margin-bottom: 16px;
}

.asset-print-summary div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-right: 1px solid #cbd8d3;
}

.asset-print-summary div:last-child {
  border-right: 0;
}

.asset-print-summary span {
  color: #4f615d;
  font-size: 11px;
  font-weight: 700;
}

.asset-print-summary strong {
  font-size: 16px;
}

.asset-register-table {
  font-size: 9px;
}

.asset-register-print {
  page: asset-register;
}

.asset-register-table th,
.asset-register-table td {
  padding: 5px;
}

.asset-register-table td:nth-child(n+7):nth-child(-n+10) {
  text-align: right;
  white-space: nowrap;
}

.asset-card-section {
  margin-bottom: 16px;
  break-inside: avoid;
}

.asset-card-section h2 {
  margin: 0;
  padding: 7px 10px;
  background: #e9f1ee;
  border: 1px solid #cbd8d3;
  color: #17211f;
  font-size: 14px;
}

.asset-card-section dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-left: 1px solid #cbd8d3;
}

.asset-card-section dl div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  min-height: 38px;
  border-right: 1px solid #cbd8d3;
  border-bottom: 1px solid #cbd8d3;
}

.asset-card-section dt,
.asset-card-section dd {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 7px 9px;
}

.asset-card-section dt {
  background: #f5f8f7;
  color: #4f615d;
  font-size: 12px;
  font-weight: 800;
}

.asset-card-section dd {
  font-size: 13px;
}

.master-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.master-layout.ledger-layout {
  grid-template-columns: 1fr;
}

.master-layout.ledger-layout .detail-panel {
  order: 2;
}

.master-layout.settings-layout {
  grid-template-columns: 1fr;
}

.master-layout.settings-layout .table-section {
  display: none;
}

.data-scope-notice {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px #bfdbfe;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.45;
}

.data-scope-notice.visible {
  display: flex;
}

.data-scope-notice strong {
  flex: 0 0 auto;
  font-weight: 900;
}

.data-scope-notice span {
  color: #1d4ed8;
}

.detail-panel {
  min-width: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
  align-self: start;
}

.detail-panel.report-detail-panel {
  position: sticky;
  top: 12px;
  max-height: min(760px, calc(100vh - 140px));
  overflow: auto;
}

.detail-panel h2 {
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.action-lock-card {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 14px 0 0;
  background: #ecfdf5;
  box-shadow: inset 0 0 0 1px #a7f3d0;
  color: #065f46;
}

.action-lock-card strong {
  font-size: 14px;
}

.action-lock-card span {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.action-lock-card.warn,
.action-lock-card.limited {
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #fde68a;
  color: #92400e;
}

.action-lock-card.locked {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px #cbd5e1;
  color: #475569;
}

.journal-rule-coverage-panel {
  display: grid;
  gap: 12px;
  border-radius: 8px;
  margin: 0 0 14px;
  padding: 14px;
  background: #f4faf7;
  box-shadow: inset 0 0 0 1px rgba(33, 103, 87, 0.22);
  color: var(--ink);
}

.journal-rule-coverage-panel.warning {
  background: #fff8f1;
  box-shadow: inset 0 0 0 1px rgba(174, 91, 31, 0.28);
}

.journal-rule-coverage-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.journal-rule-coverage-heading > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.journal-rule-coverage-heading strong {
  font-size: 16px;
}

.journal-rule-coverage-heading span,
.journal-rule-coverage-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.journal-rule-coverage-note {
  margin: 0;
}

.journal-rule-coverage-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.journal-rule-coverage-metrics article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.journal-rule-coverage-metrics article.warning {
  border-color: rgba(174, 91, 31, 0.3);
  background: #fffaf3;
}

.journal-rule-coverage-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.journal-rule-coverage-metrics strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chart-account-usage-card {
  display: grid;
  gap: 12px;
  border-radius: 8px;
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px #cbd5e1;
}

.chart-account-usage-card.locked {
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.chart-account-usage-card > div:first-child {
  display: grid;
  gap: 4px;
}

.chart-account-usage-card strong {
  font-size: 15px;
}

.chart-account-usage-card span,
.form-alert-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.chart-account-usage-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.chart-account-usage-metrics article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.chart-account-usage-metrics span {
  display: block;
  font-size: 12px;
}

.chart-account-usage-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  line-height: 1.1;
}

.period-check-list {
  display: grid;
  gap: 10px;
}

.period-check-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.period-check-owner-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  padding: 10px 12px;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 900;
}

.period-check-owner-summary span {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.period-check-item.high {
  border-left-color: #b42318;
  background: #fff7f5;
}

.period-check-item.medium {
  border-left-color: #b7791f;
  background: #fffbeb;
}

.period-check-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.period-check-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.period-check-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.period-check-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.period-check-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.period-check-level {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.period-check-target {
  min-width: 0;
}

.period-check-id {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
}

.period-check-main p,
.period-check-main em,
.period-check-suggestion {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.period-check-main p {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.period-check-main em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.period-check-suggestion {
  display: block;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 10px;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 800;
}

.period-check-open {
  justify-self: end;
  white-space: nowrap;
}

.period-check-disabled-action {
  justify-self: end;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.16);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.32);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.form-alert-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #fde68a;
  color: #92400e;
}

.form-alert-card strong {
  font-size: 14px;
}

.customer-title-alert {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #fff1e7;
  color: #8f2f12;
  border-left: 5px solid #ea580c;
  box-shadow: inset 0 0 0 1px rgba(234, 88, 12, 0.22);
  position: sticky;
  top: 10px;
  z-index: 4;
}

.customer-title-alert strong {
  font-size: 15px;
}

.customer-title-alert span,
.customer-title-alert li {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.customer-title-alert ul {
  margin: 0;
  padding-left: 18px;
}

.fact-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.fact-list div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.fact-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.fact-list dd {
  margin: 0;
  font-weight: 700;
}

.detail-tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0 12px;
  border-bottom: 1px solid var(--line);
}

.detail-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 900;
}

.detail-tab:hover,
.detail-tab.active {
  color: var(--ink);
}

.detail-tab.active {
  border-bottom-color: var(--accent);
}

.detail-tab-panel {
  min-height: 120px;
}

.payroll-report-center-dialog {
  width: min(1180px, calc(100vw - 48px));
}

.payroll-report-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.payroll-report-toolbar > div {
  display: flex;
  gap: 8px;
}

.payroll-report-tabs {
  margin-top: 8px;
}

.payroll-report-metrics {
  margin-bottom: 16px;
}

@media (max-width: 720px) {
  .payroll-report-center-dialog {
    width: calc(100vw - 20px);
  }

  .payroll-report-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f8fafc;
  color: #334155;
  box-shadow: inset 0 0 0 1px #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  vertical-align: middle;
}

.audit-action-badge strong {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  padding: 2px 6px;
  font-size: 11px;
}

.audit-action-badge.login {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.audit-action-badge.warning {
  background: #fffbeb;
  color: #92400e;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.audit-action-badge.edit {
  background: #ecfdf5;
  color: #047857;
  box-shadow: inset 0 0 0 1px #a7f3d0;
}

.audit-action-badge.risk {
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px #fecaca;
}

.audit-action-badge.approval {
  background: #f5f3ff;
  color: #6d28d9;
  box-shadow: inset 0 0 0 1px #ddd6fe;
}

.settings-summary-grid {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.settings-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.settings-card-header {
  display: grid;
  gap: 4px;
}

.settings-card-header strong {
  color: var(--ink);
  font-size: 15px;
}

.settings-card-header span,
.settings-form-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.settings-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.settings-card dl div {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.settings-card dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-card dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  word-break: break-word;
}

.backup-health-card {
  margin-top: 18px;
}

.backup-health-card dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.backup-health-card dd small {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.backup-health-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
}

.backup-health-badge.success { background: #dcfce7; color: #166534; }
.backup-health-badge.warning { background: #fef3c7; color: #92400e; }
.backup-health-badge.danger { background: #fee2e2; color: #991b1b; }
.backup-health-badge.neutral { background: #e5e7eb; color: #374151; }

.settings-form-section {
  gap: 10px;
}

.record-dialog {
  width: min(1120px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 22px 80px rgba(18, 34, 30, 0.22);
}

.compact-record-dialog {
  width: min(560px, calc(100vw - 28px));
}

.payroll-payment-dialog {
  width: min(900px, calc(100vw - 28px));
}

.payroll-register-dialog {
  width: min(1120px, calc(100vw - 28px));
}

.payroll-register-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) 1fr;
  align-items: end;
  gap: 12px;
  margin: 14px 0;
}

.payroll-register-toolbar > div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.payroll-register-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.payroll-register-summary > div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.payroll-register-summary > div:last-child {
  border-right: 0;
}

.payroll-register-summary span,
.payroll-register-summary small,
.payroll-register-table small {
  color: var(--muted);
  font-size: 12px;
}

.payroll-register-methods {
  grid-column: 1 / -1;
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px !important;
  border-top: 1px solid var(--line);
}

.payroll-register-table-wrap {
  max-height: min(54vh, 560px);
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.payroll-register-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 13px;
}

.payroll-register-table th,
.payroll-register-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.payroll-register-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
}

.payroll-register-table td:first-child {
  display: grid;
  gap: 3px;
}

.payroll-register-table td:last-child,
.payroll-register-table th:last-child {
  text-align: right;
}

.payroll-payment-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.payroll-payment-list {
  display: grid;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.payroll-payment-list-head,
.payroll-payment-row {
  display: grid;
  align-items: center;
  gap: 12px;
}

.payroll-payment-list-head {
  grid-template-columns: 1fr auto;
  padding: 11px 14px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.payroll-payment-list-head label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.payroll-payment-row {
  grid-template-columns: 20px minmax(150px, 1fr) minmax(180px, 1.4fr) 110px;
  min-height: 62px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.payroll-payment-row:last-child {
  border-bottom: 0;
}

.payroll-payment-row > span {
  display: grid;
  gap: 3px;
}

.payroll-payment-row small,
.payroll-bank-summary {
  color: var(--muted);
}

.payroll-payment-row b {
  text-align: right;
}

@media (max-width: 720px) {
  .payroll-register-toolbar,
  .payroll-register-summary {
    grid-template-columns: 1fr;
  }

  .payroll-register-toolbar > div {
    justify-content: stretch;
  }

  .payroll-register-toolbar > div button {
    flex: 1;
  }

  .payroll-register-summary > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .payroll-register-summary > div:last-child {
    border-bottom: 0;
  }

  .payroll-payment-controls {
    grid-template-columns: 1fr;
  }

  .payroll-payment-row {
    grid-template-columns: 20px 1fr auto;
  }

  .payroll-bank-summary {
    grid-column: 2 / -1;
  }
}

.payroll-generation-note {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.55;
}

.payroll-generation-note strong {
  color: var(--ink);
}

.payroll-breakdown .detail-line-item em {
  min-width: 100px;
  text-align: right;
}

.input-dialog {
  width: min(520px, calc(100vw - 28px));
}

.advance-preview-dialog {
  width: min(1060px, calc(100vw - 28px));
}

.accounting-trace-dialog {
  width: min(1180px, calc(100vw - 28px));
}

.input-form {
  display: grid;
  gap: 14px;
}

.record-dialog::backdrop {
  background: rgba(18, 34, 30, 0.38);
}

.record-form {
  padding: 18px;
  background: var(--surface);
}

.history-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.history-filter-bar {
  display: grid;
  gap: 10px;
  width: 100%;
}

.history-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-search-field {
  display: grid;
  gap: 6px;
  max-width: 520px;
}

.history-search-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-search-field input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  padding: 0 12px;
}

.history-tab {
  min-height: 34px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 700;
}

.history-tab span {
  color: var(--brand-strong);
  margin-left: 4px;
}

.history-tab.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

.history-tab.active span {
  color: #ffffff;
}

.record-dialog.production-order-dialog {
  width: min(1280px, calc(100vw - 28px));
}

.asset-history-summary {
  width: 100%;
}

.asset-history-overview th {
  width: 16%;
  color: var(--muted);
  background: var(--surface-soft);
  white-space: nowrap;
}

.asset-history-overview td {
  width: 34%;
}

.quick-filter-tabs,
.statement-range-panel,
.approval-task-tabs,
.approval-status-tabs {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-filter-tabs {
  margin: -2px 0 12px;
}

.quick-filter-tabs-grouped {
  align-items: stretch;
  gap: 10px 12px;
}

.quick-filter-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
}

.quick-filter-group-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-filter-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-filter-tabs-grouped .quick-filter-tab {
  min-height: 32px;
  padding: 0 10px;
}

.approval-task-tabs {
  margin: -2px 0 14px;
}

.approval-status-tabs {
  margin: -6px 0 14px;
}

.quick-filter-tabs.visible,
.statement-range-panel.visible,
.approval-task-tabs.visible,
.approval-status-tabs.visible {
  display: flex;
}

.statement-range-panel {
  align-items: end;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px;
}

.statement-range-title {
  display: grid;
  gap: 3px;
  min-width: min(100%, 260px);
  margin-right: auto;
}

.statement-range-title strong {
  color: var(--text);
  font-size: 14px;
}

.statement-range-title span {
  color: var(--muted);
  font-size: 12px;
}

.statement-range-panel .compact-field {
  min-width: 160px;
  margin: 0;
}

.statement-unbilled-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.statement-unbilled-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.asset-depreciation-panel {
  align-items: center;
}

.asset-depreciation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  flex: 1 1 440px;
}

.asset-depreciation-summary > span {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 7px 10px;
  border-left: 3px solid var(--brand);
  background: #ffffff;
}

.asset-depreciation-summary small {
  color: var(--muted);
  font-size: 11px;
}

.asset-depreciation-summary strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.asset-depreciation-summary .needs-attention {
  border-left-color: #c47a12;
}

@media (max-width: 900px) {
  .asset-depreciation-summary {
    grid-template-columns: 1fr;
    flex-basis: 100%;
  }
}

.quick-filter-tab,
.approval-task-tab,
.approval-status-tab {
  min-height: 36px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 800;
}

.quick-filter-tab {
  background: #ffffff;
  color: var(--text);
}

.approval-status-tab {
  min-height: 32px;
  background: #ffffff;
  font-size: 13px;
}

.quick-filter-tab span,
.approval-task-tab span,
.approval-status-tab span {
  color: var(--brand-strong);
  margin-left: 6px;
}

.quick-filter-tab.active,
.approval-task-tab.active,
.approval-status-tab.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

.quick-filter-tab.active span,
.approval-task-tab.active span,
.approval-status-tab.active span {
  color: #ffffff;
}

.master-empty-row td {
  padding: 28px 18px;
  text-align: center;
  background: #f8fbfa;
}

.master-empty-row strong,
.master-empty-row span {
  display: block;
}

.master-empty-row strong {
  color: var(--ink);
  font-size: 15px;
}

.master-empty-row span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px;
  font-weight: 800;
}

.history-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-section {
  display: grid;
  gap: 8px;
}

.preview-section h3 {
  margin: 6px 0 0;
  font-size: 15px;
}

.dialog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dialog-table th,
.dialog-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

.dialog-table th {
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
}

.accounting-trace-form {
  display: grid;
  gap: 14px;
}

.trace-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.trace-summary article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.trace-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trace-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.trace-table-wrap {
  max-height: 420px;
  overflow: auto;
}

.trace-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.report-trace-link {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.sectioned-form {
  grid-template-columns: 1fr;
  gap: 16px;
}

.leave-rule-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  border: 1px solid #bfd4c8;
  border-left: 4px solid #247451;
  background: #f5faf7;
  padding: 12px 14px;
}

.leave-rule-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.leave-rule-heading strong {
  color: #174d39;
  font-size: 14px;
}

.leave-rule-heading span,
.leave-rule-card p,
.leave-rule-grid span {
  color: var(--muted);
  font-size: 12px;
}

.leave-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.leave-rule-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.leave-rule-grid strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.leave-rule-card p {
  margin: 0;
  line-height: 1.5;
}

.leave-upload-field input[type="file"] {
  padding: 8px;
}

.leave-balance-dialog {
  width: min(1180px, calc(100vw - 28px));
}

.overtime-pay-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
}

.overtime-pay-dialog .record-form {
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.overtime-pay-dialog .section-title p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.overtime-pay-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.overtime-pay-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
}

.overtime-pay-summary span,
.overtime-pay-table small {
  color: var(--muted);
  font-size: 12px;
}

.overtime-pay-summary strong {
  font-size: 17px;
}

.overtime-pay-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.overtime-pay-table {
  min-width: 920px;
}

.overtime-pay-table td:nth-child(5) {
  min-width: 320px;
}

.overtime-pay-table td:nth-child(3),
.overtime-pay-table td:nth-child(5) {
  display: table-cell;
}

.overtime-pay-table td:nth-child(3) small,
.overtime-pay-table td:nth-child(5) small,
.overtime-pay-table td:nth-child(5) em {
  display: block;
  margin-top: 4px;
  line-height: 1.45;
}

.overtime-pay-table td:nth-child(5) em {
  color: var(--danger);
  font-size: 12px;
  font-style: normal;
}

.overtime-day-type {
  font-weight: 700;
}

.overtime-pay-empty {
  padding: 30px !important;
  text-align: center;
  color: var(--muted);
}

.overtime-request-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle, #f7f8f9);
}

.overtime-request-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.overtime-request-heading > div,
.overtime-request-metrics > div {
  display: grid;
  gap: 3px;
}

.overtime-request-heading span,
.overtime-request-metrics span,
.overtime-request-card p {
  color: var(--muted);
  font-size: 12px;
}

.overtime-request-heading b {
  flex: none;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--line);
  font-size: 12px;
}

.overtime-request-heading b.is-valid {
  color: #17653a;
  background: #dff3e7;
}

.overtime-request-heading b.is-invalid {
  color: #9d2b2b;
  background: #f8dfdf;
}

.overtime-request-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--line);
}

.overtime-request-metrics > div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
}

.overtime-request-card p {
  margin: 0;
  line-height: 1.5;
}

.overtime-emergency-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.overtime-emergency-fields[hidden] {
  display: none;
}

.overtime-request-errors {
  display: grid;
  gap: 4px;
  color: var(--danger);
  font-size: 12px;
}

@media (max-width: 760px) {
  .overtime-pay-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overtime-request-metrics,
  .overtime-emergency-fields {
    grid-template-columns: 1fr;
  }
}

.attendance-calendar-dialog {
  width: min(1220px, calc(100vw - 28px));
}

.attendance-settings-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
}

.attendance-settings-dialog .record-form {
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.attendance-settings-dialog .section-title > div > p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.attendance-settings-section {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.attendance-settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.attendance-settings-heading strong,
.attendance-settings-heading span {
  display: block;
}

.attendance-settings-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.attendance-settings-time-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.attendance-week-rule {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.attendance-week-rule > div {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 9px 11px;
}

.attendance-week-rule span,
.attendance-week-rule strong {
  display: block;
}

.attendance-week-rule span {
  color: var(--muted);
  font-size: 12px;
}

.attendance-week-rule strong {
  margin-top: 3px;
}

.attendance-holiday-table-wrap {
  max-height: 330px;
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
}

.attendance-holiday-table {
  min-width: 820px;
}

.attendance-holiday-table thead {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #eef3f1;
}

.attendance-holiday-table th:nth-child(1),
.attendance-holiday-table td:nth-child(1) {
  width: 145px;
}

.attendance-holiday-table th:nth-child(3),
.attendance-holiday-table td:nth-child(3) {
  width: 150px;
}

.attendance-holiday-table th:nth-child(4),
.attendance-holiday-table td:nth-child(4) {
  width: 120px;
}

.attendance-holiday-table th:last-child,
.attendance-holiday-table td:last-child {
  width: 50px;
  text-align: center;
}

.attendance-holiday-table input,
.attendance-holiday-table select {
  width: 100%;
  min-height: 34px;
}

.attendance-holiday-table input:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  opacity: 1;
}

.attendance-holiday-type {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #b8d5ca;
  background: #edf7ee;
  padding: 3px 8px;
  color: #1f6338;
  font-size: 12px;
  font-weight: 800;
}

.attendance-monthly-dialog {
  width: min(1380px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
}

.attendance-monthly-form {
  max-height: calc(100vh - 40px);
  overflow: hidden;
}

.attendance-monthly-controls {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(135px, 0.8fr) minmax(120px, 0.8fr) repeat(4, minmax(105px, 0.7fr));
  gap: 10px;
}

.attendance-monthly-controls .form-field {
  min-width: 0;
}

.attendance-monthly-status {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 38px;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.attendance-monthly-status strong {
  color: var(--ink);
}

.attendance-monthly-status .has-missing {
  color: var(--danger);
}

.attendance-monthly-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.attendance-monthly-filter {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.attendance-monthly-filter button {
  min-height: 32px;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 5px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.attendance-monthly-filter button:last-child {
  border-right: 0;
}

.attendance-monthly-filter button.active {
  background: #12312d;
  color: #fff;
}

.attendance-import-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.attendance-import-toolbar input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.attendance-import-toolbar label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.attendance-csv-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 12px;
}

.attendance-csv-summary span,
.attendance-csv-notices p {
  color: var(--muted);
  font-size: 12px;
}

.attendance-settlement-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid;
  margin: 18px 22px 0;
  padding: 12px 14px;
}

.attendance-settlement-dialog {
  width: min(900px, calc(100vw - 48px));
  max-height: min(780px, calc(100vh - 48px));
  overflow: auto;
  background: #fff;
}

.attendance-settlement-dialog .dialog-heading {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 18px 22px 15px;
}

.attendance-settlement-dialog .dialog-heading > div {
  min-width: 0;
}

.attendance-settlement-dialog .dialog-heading .eyebrow {
  margin: 0 0 5px;
}

.attendance-settlement-dialog .dialog-heading h2 {
  font-size: 21px;
  line-height: 1.3;
}

.attendance-settlement-person {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.attendance-settlement-person strong {
  color: var(--ink);
}

.attendance-settlement-dialog .dialog-heading .icon-button {
  flex: 0 0 36px;
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.attendance-settlement-result.is-ready {
  border-color: #8cc7a0;
  background: #edf7ee;
  color: #1f6338;
}

.attendance-settlement-result.is-blocked {
  border-color: #e6b0aa;
  background: #fff1ef;
  color: #9a2f27;
}

.attendance-settlement-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 22px 0;
}

.attendance-settlement-metrics > div {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.attendance-settlement-metrics span,
.attendance-settlement-metrics strong {
  display: block;
}

.attendance-settlement-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.attendance-settlement-metrics strong {
  margin-top: 4px;
  font-size: 16px;
}

.attendance-settlement-section {
  margin: 16px 22px 0;
}

.attendance-settlement-heading {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}

.attendance-settlement-heading span {
  color: var(--muted);
  font-size: 12px;
}

.attendance-settlement-blockers {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.attendance-settlement-blockers > div {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  border: 1px solid #ead4d1;
  background: #fff8f7;
  padding: 9px 10px;
}

.attendance-settlement-blockers b {
  color: var(--danger);
}

.attendance-settlement-blockers span,
.attendance-settlement-blockers small,
.attendance-settlement-sources span {
  display: block;
}

.attendance-settlement-blockers small,
.attendance-settlement-sources span,
.attendance-settlement-empty {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.attendance-settlement-sources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.attendance-settlement-sources > div {
  border: 1px solid var(--line);
  padding: 10px;
}

.attendance-settlement-dialog > .dialog-actions {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 12px 22px 14px;
}

.attendance-csv-notices {
  display: grid;
  gap: 5px;
  max-height: 280px;
  overflow: auto;
  margin-top: 10px;
}

.attendance-csv-notices p {
  margin: 0;
  border-left: 3px solid #d9a441;
  background: #fff8e1;
  padding: 7px 9px;
}

.attendance-csv-notices p.is-error {
  border-color: var(--danger);
  background: #fff0f0;
  color: var(--danger);
}

.attendance-monthly-table-wrap {
  min-height: 260px;
  max-height: min(52vh, 520px);
  margin-top: 10px;
  overflow: auto;
  border: 1px solid var(--line);
}

.attendance-monthly-table {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
  table-layout: fixed;
}

.attendance-monthly-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3f1;
}

.attendance-monthly-table th,
.attendance-monthly-table td {
  height: 42px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 5px 7px;
  vertical-align: middle;
}

.attendance-monthly-table th:nth-child(1) { width: 104px; }
.attendance-monthly-table th:nth-child(2),
.attendance-monthly-table th:nth-child(3),
.attendance-monthly-table th:nth-child(4),
.attendance-monthly-table th:nth-child(5) { width: 106px; }
.attendance-monthly-table th:nth-child(6) { width: 120px; }
.attendance-monthly-table th:nth-child(7),
.attendance-monthly-table th:nth-child(8) { width: 90px; }

.attendance-monthly-table td:first-child strong,
.attendance-monthly-table td:first-child span {
  display: block;
  text-align: center;
}

.attendance-monthly-table td:first-child span {
  color: var(--muted);
  font-size: 11px;
}

.attendance-monthly-table td:first-child small {
  display: block;
  max-width: 90px;
  margin: 2px auto 0;
  overflow: hidden;
  color: #9a2f27;
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-monthly-table input,
.attendance-monthly-table select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 4px 6px;
}

.attendance-monthly-table output {
  display: block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.attendance-monthly-table .is-leave-row td {
  background: #eef7ff;
}

.attendance-monthly-table .needs-correction-row td {
  background: #fff8e1;
}

.attendance-monthly-table .is-resolved-row td {
  background: #edf7ee;
}

.attendance-card-upload {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 1fr);
  align-items: end;
  gap: 14px;
  margin-top: 10px;
}

.attendance-card-upload small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 500;
}

.attendance-card-upload > div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.attendance-card-upload > div span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-calendar-controls {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.attendance-calendar-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.attendance-calendar-metrics > div {
  min-width: 0;
  background: var(--surface-soft);
  padding: 9px 10px;
}

.attendance-calendar-metrics span,
.attendance-calendar-metrics strong {
  display: block;
}

.attendance-calendar-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.attendance-calendar-metrics strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.attendance-calendar-scroll {
  min-width: 0;
  max-height: min(58vh, 540px);
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
}

.attendance-calendar-weekdays,
.attendance-calendar-grid {
  display: grid;
  min-width: 900px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.attendance-calendar-weekdays {
  background: #eef3f1;
  border-bottom: 1px solid var(--line);
}

.attendance-calendar-weekdays span {
  padding: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.attendance-calendar-day {
  min-width: 0;
  min-height: 82px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.attendance-calendar-day:nth-child(7n) {
  border-right: 0;
}

.attendance-calendar-day.is-empty {
  background: #f6f7f7;
}

.attendance-calendar-day > strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.attendance-calendar-entries {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.attendance-calendar-entry {
  display: grid;
  gap: 1px;
  width: 100%;
  min-height: 34px;
  border-left: 3px solid #78909c;
  border-radius: 4px;
  background: #f2f5f6;
  padding: 4px 6px;
  color: #37474f;
  text-align: left;
}

.attendance-calendar-entry span,
.attendance-calendar-entry small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-calendar-entry span {
  font-size: 11px;
  font-weight: 800;
}

.attendance-calendar-entry small {
  font-size: 10px;
}

.attendance-calendar-entry.status-normal,
.attendance-abnormal-list .status-normal {
  border-color: #2e7d32;
  background: #e8f5e9;
  color: #1b5e20;
}

.attendance-calendar-entry.status-leave,
.attendance-abnormal-list .status-leave {
  border-color: #1976d2;
  background: #e3f2fd;
  color: #0d47a1;
}

.attendance-calendar-entry.status-warning,
.attendance-abnormal-list .status-warning {
  border-color: #d97706;
  background: #fff7dc;
  color: #8a4b00;
}

.attendance-calendar-entry.status-danger,
.attendance-abnormal-list .status-danger {
  border-color: #c62828;
  background: #ffebee;
  color: #9b1c1c;
}

.attendance-calendar-more {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.attendance-abnormal-section {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.attendance-abnormal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attendance-abnormal-heading > div {
  display: grid;
  gap: 2px;
}

.attendance-abnormal-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.attendance-abnormal-heading span,
.attendance-calendar-empty {
  color: var(--muted);
  font-size: 12px;
}

.attendance-abnormal-heading b {
  color: var(--danger);
  font-size: 13px;
}

.attendance-abnormal-list {
  display: grid;
  margin-top: 8px;
  border: 1px solid var(--line);
}

.attendance-abnormal-list button {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) 90px minmax(220px, 1.5fr);
  gap: 10px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 7px 10px;
  color: var(--ink);
  text-align: left;
}

.attendance-abnormal-list button:last-child {
  border-bottom: 0;
}

.attendance-abnormal-list strong {
  border-left: 3px solid currentColor;
  padding: 3px 6px;
  font-size: 12px;
}

.attendance-abnormal-list small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.attendance-calendar-empty {
  margin: 8px 0 0;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.leave-balance-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
  gap: 12px;
  margin: 14px 0;
}

.leave-balance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.leave-balance-summary > div {
  min-width: 0;
  background: var(--surface-soft);
  padding: 11px 12px;
}

.leave-balance-summary span,
.leave-balance-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.leave-balance-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.leave-balance-summary strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
}

.leave-balance-warning,
.leave-balance-loading {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 4px solid var(--warn);
  background: #fff8e5;
  color: #7a4a00;
  line-height: 1.5;
  font-weight: 700;
}

.leave-balance-loading {
  border-left-color: var(--brand);
  background: var(--surface-soft);
  color: var(--muted);
}

.leave-balance-table-wrap {
  max-height: min(54vh, 500px);
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
}

.leave-balance-table {
  min-width: 920px;
}

.leave-balance-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.leave-balance-table tbody th {
  color: var(--ink);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .attendance-monthly-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attendance-settings-time-grid,
  .attendance-week-rule {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attendance-settings-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .attendance-monthly-status {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .attendance-card-upload {
    grid-template-columns: 1fr;
  }

  .attendance-import-toolbar {
    justify-content: flex-start;
  }

  .attendance-monthly-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .attendance-settlement-metrics,
  .attendance-settlement-sources {
    grid-template-columns: 1fr;
  }

  .attendance-settlement-dialog {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
  }

  .attendance-settlement-dialog .dialog-heading,
  .attendance-settlement-dialog > .dialog-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .attendance-settlement-result,
  .attendance-settlement-metrics,
  .attendance-settlement-section {
    margin-left: 14px;
    margin-right: 14px;
  }

  .attendance-settlement-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .attendance-card-upload > div {
    justify-content: flex-start;
  }

  .attendance-calendar-controls,
  .leave-balance-controls,
  .leave-balance-summary {
    grid-template-columns: 1fr;
  }

  .attendance-calendar-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attendance-abnormal-list button {
    grid-template-columns: 1fr auto;
  }

  .attendance-abnormal-list small {
    grid-column: 1 / -1;
  }
}

.field-help {
  color: var(--muted);
  font-size: 12px;
}

.leave-attachment-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.leave-attachment-field div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.leave-attachment-field span {
  color: var(--muted);
  font-size: 12px;
}

.leave-attachment-field strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.attachment-preview-dialog {
  width: min(920px, calc(100vw - 32px));
  max-width: none;
  max-height: min(860px, calc(100vh - 32px));
  overflow: hidden;
  background: #ffffff;
}

.attachment-preview-dialog .dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 16px 18px;
}

.attachment-preview-dialog .dialog-heading > div {
  min-width: 0;
}

.attachment-preview-dialog .dialog-heading .eyebrow {
  margin: 0 0 4px;
}

.attachment-preview-dialog .dialog-heading h2 {
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-dialog .dialog-heading .icon-button {
  flex: 0 0 38px;
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: none;
}

.attachment-preview-dialog .attachment-preview {
  display: grid;
  place-items: center;
  height: min(66vh, 640px);
  min-height: 360px;
  max-height: none;
  overflow: auto;
  background: #eef1f0;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.attachment-preview-dialog .attachment-preview img {
  display: block;
  max-width: 100%;
  max-height: calc(min(66vh, 640px) - 32px);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(18, 34, 30, 0.12);
  object-fit: contain;
}

.attachment-preview-dialog .attachment-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.attachment-preview-dialog .dialog-actions {
  margin: 0;
  padding: 12px 18px;
}

.form-section {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.form-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.form-section h3 {
  margin: 0;
  color: var(--brand-strong);
  font-size: 15px;
}

.form-tabs {
  display: flex;
  gap: 6px;
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line);
}

.form-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 900;
}

.form-tab:hover,
.form-tab.active {
  color: var(--ink);
}

.form-tab.active {
  border-bottom-color: var(--accent);
}

.form-tab-panel {
  display: none;
  grid-column: 1 / -1;
  gap: 12px;
}

.form-tab-panel.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-tab-panel .form-section {
  grid-column: 1 / -1;
}

.product-price-form-section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-price-form-section .form-section-heading {
  grid-column: 1 / -1;
}

.statutory-payroll-panel {
  align-items: start;
}

.statutory-payroll-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.statutory-payroll-heading h3,
.statutory-payroll-heading p {
  margin: 0;
}

.statutory-payroll-heading h3 {
  font-size: 15px;
}

.statutory-payroll-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.statutory-payroll-preview {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.statutory-payroll-preview > div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: #f8faf9;
  padding: 12px;
}

.statutory-payroll-preview span,
.statutory-payroll-preview small {
  color: var(--muted);
  font-size: 12px;
}

.statutory-payroll-preview strong {
  font-size: 20px;
}

.statutory-warning {
  grid-column: 1 / -1;
  margin: 0;
  border-left: 3px solid #b78103;
  background: #fff8e5;
  color: #714f00;
  padding: 9px 11px;
  font-size: 12px;
}

.company-title-section {
  grid-column: 1 / -1;
}

.company-title-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.company-title-list {
  display: grid;
  gap: 8px;
}

.company-title-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 110px minmax(180px, 1.2fr) 64px minmax(140px, 1fr) 72px;
  gap: 8px;
  align-items: end;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.company-title-row.needs-data {
  background: #fff7ed;
  border-left: 5px solid #ea580c;
  box-shadow: inset 0 0 0 1px rgba(234, 88, 12, 0.35);
}

.company-title-warning {
  grid-column: 1 / -1;
  margin: 0;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  border-radius: 999px;
  background: #fed7aa;
  color: #8f2f12;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.company-title-warning-box {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: #fff1e7;
  color: #8f2f12;
  border-left: 5px solid #ea580c;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(234, 88, 12, 0.22);
  position: sticky;
  top: 8px;
  z-index: 5;
}

.form-field.company-title-default-field input[type="radio"] {
  width: 16px;
  max-width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  justify-self: center;
  accent-color: var(--accent);
  box-shadow: none;
}

.company-title-default-field {
  display: grid;
  grid-template-rows: auto 42px;
  justify-items: center;
  align-content: start;
  align-items: center;
  gap: 6px;
  min-width: 56px;
  min-height: 65px;
}

.company-title-default-field span {
  width: 100%;
  text-align: center;
  line-height: 1.2;
}

.line-editor {
  display: none;
  margin-top: 18px;
}

.line-editor.active-line-editor {
  display: block;
}

.production-material-editor {
  display: none;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.production-material-editor.active-production-material-editor {
  display: block;
}

.production-material-source {
  max-width: 760px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.production-material-list {
  display: grid;
  gap: 8px;
}

.adjustment-editor {
  display: none;
  margin-top: 18px;
}

.adjustment-editor.active-adjustment-editor {
  display: block;
}

.compact-title {
  margin-bottom: 10px;
}

.line-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.line-list,
.adjustment-list {
  display: grid;
  gap: 8px;
}

.line-row,
.adjustment-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.15fr) 86px 92px 108px minmax(220px, 1fr) 108px 40px;
  gap: 8px;
  align-items: end;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.adjustment-row {
  grid-template-columns: 180px minmax(240px, 1fr) 130px 40px;
}

.stock-count-line-row {
  grid-template-columns: minmax(220px, 1.15fr) minmax(260px, 1.25fr) 104px 104px 96px minmax(220px, 1fr) 40px;
}

.sample-line-row {
  grid-template-columns: minmax(240px, 1.25fr) 90px 110px minmax(150px, .7fr) minmax(220px, 1fr) 40px;
}

.sample-movement-field {
  display: none;
}

.sample-line-row.sample-exchange-line {
  grid-template-columns: 120px minmax(220px, 1.2fr) 90px 100px minmax(140px, .65fr) minmax(200px, 1fr) 40px;
}

.sample-line-row.sample-exchange-line .sample-movement-field {
  display: flex;
}

.sample-salesperson-summary-table {
  min-width: 720px !important;
}

.sample-salesperson-link {
  font-size: 15px;
  font-weight: 800;
}

.sample-salesperson-history-dialog {
  width: min(960px, calc(100vw - 32px));
}

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

.sample-history-metrics article {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 13px 14px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

.sample-history-metrics span {
  color: var(--ink-muted);
  font-size: 13px;
}

.sample-history-metrics strong {
  font-size: 20px;
}

.sample-history-table-wrap {
  max-height: min(480px, 55vh);
  overflow: auto;
  border: 1px solid var(--line);
}

.sample-history-table-wrap table {
  min-width: 760px;
}

.sample-history-table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

@media (max-width: 720px) {
  .sample-history-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sample-scope-notice {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid #287a62;
  background: #eef8f4;
  padding: 10px 12px;
  color: #245448;
}

.sample-scope-notice strong { flex: 0 0 auto; }
.sample-scope-notice span { font-size: 13px; }

.product-sales-visible-field {
  grid-column: 1 / -1;
}

.binary-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  width: fit-content;
  padding: 0 12px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 700;
}

.binary-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.visit-location-card {
  grid-column: 1 / -1;
  border: 1px solid #b9d8ce;
  border-radius: 8px;
  background: #f4faf8;
  padding: 14px 16px;
}

.visit-location-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.visit-location-heading h3 { margin: 2px 0 0; font-size: 17px; }
.visit-location-summary { margin: 12px 0 4px; font-weight: 700; color: #245448; }
.visit-location-help { margin: 0; color: var(--muted); font-size: 13px; }
.visit-location-error { border-color: #d98b82; background: #fff5f4; }
.visit-location-error .visit-location-help { color: var(--danger); }

@media (max-width: 640px) {
  .visit-location-heading { align-items: flex-start; flex-direction: column; }
  .visit-location-heading .secondary-action { width: 100%; }
}

.line-remove {
  width: 40px;
  min-height: 40px;
  border-radius: 8px;
  background: #fee4e2;
  color: var(--danger);
  font-weight: 900;
}

.line-amount-field strong {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
}

.line-storage-quantity-field strong {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px;
}

.return-line-hint {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.return-line-hint span:not(:empty) {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: #ffffff;
  padding: 4px 8px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.sales-return-history {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.sales-return-history .form-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.sales-return-history .form-section-heading h3,
.sales-return-history .form-section-heading p { margin: 0; }
.sales-return-history .form-section-heading p { margin-top: 4px; color: var(--muted); font-size: 13px; }

.return-history-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px 170px;
  gap: 10px;
}

.return-history-results {
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.return-history-row {
  display: grid;
  grid-template-columns: 150px minmax(240px, 1fr) 260px 94px;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.return-history-row:last-child { border-bottom: 0; }
.return-history-source,
.return-history-product,
.return-history-quantity { display: flex; gap: 3px; flex-direction: column; min-width: 0; }
.return-history-source span,
.return-history-product span,
.return-history-quantity span { color: var(--muted); font-size: 12px; }
.return-history-product strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.return-history-quantity { display: grid; grid-template-columns: repeat(3, auto); gap: 8px; align-items: center; }
.return-history-empty { padding: 24px; color: var(--muted); text-align: center; }
.return-unlinked-notice { border-left: 4px solid #d18b00; background: #fff8e6; padding: 10px 12px; color: #6d5316; }

@media (max-width: 900px) {
  .return-history-filters { grid-template-columns: 1fr 1fr; }
  .return-history-filters .form-field:first-child { grid-column: 1 / -1; }
  .return-history-row { grid-template-columns: 1fr auto; }
  .return-history-product, .return-history-quantity { grid-column: 1 / -1; }
}

.line-customer-price-field {
  justify-self: start;
  width: 96px;
  max-width: 96px;
  min-width: 86px;
}

.line-customer-price-field input {
  padding-inline: 8px;
}

.shipment-line-row {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.shipment-line-row > .product-autocomplete-field {
  grid-column: 1 / 5;
  grid-row: 1;
}

.shipment-line-row > .line-quantity-field {
  grid-column: 5 / 7;
  grid-row: 1;
}

.shipment-line-row > .line-unit-field {
  grid-column: 7 / 9;
  grid-row: 1;
}

.shipment-line-row > .line-price-field {
  grid-column: 9 / 11;
  grid-row: 1;
}

.shipment-line-row > .line-customer-price-field:not(.hidden-control) {
  grid-column: 11 / 13;
  grid-row: 1;
  justify-self: stretch;
  width: auto;
  max-width: none;
}

.shipment-line-row > .line-display-name-field {
  grid-column: 1 / 5;
  grid-row: 2;
}

.shipment-line-row > .line-note-field {
  grid-column: 5 / 11;
  grid-row: 2;
}

.shipment-line-row > .line-amount-field {
  grid-column: 11 / 12;
  grid-row: 2;
}

.shipment-line-row > .line-remove {
  grid-column: 12 / 13;
  grid-row: 2;
}

.shipment-line-row > .line-reference-panel,
.shipment-line-row > .line-price-warning {
  grid-column: 1 / -1;
}

.shipment-storage-line-row > .product-autocomplete-field {
  grid-column: 1 / 4;
}

.shipment-storage-line-row > .line-quantity-field {
  grid-column: 4 / 5;
}

.shipment-storage-line-row > .line-delivery-quantity-field {
  grid-column: 5 / 7;
  grid-row: 1;
}

.shipment-storage-line-row > .line-storage-quantity-field {
  grid-column: 7 / 8;
  grid-row: 1;
}

.shipment-storage-line-row > .line-unit-field {
  grid-column: 8 / 10;
}

.shipment-storage-line-row > .line-price-field {
  grid-column: 10 / 12;
}

.shipment-storage-line-row > .line-customer-price-field:not(.hidden-control) {
  grid-column: 11 / 13;
}

.shipment-storage-line-row:has(> .line-customer-price-field:not(.hidden-control)) > .line-price-field {
  grid-column: 10 / 11;
}

.shipment-storage-line-row > .line-display-name-field {
  grid-column: 1 / 5;
}

.shipment-storage-line-row > .line-note-field {
  grid-column: 5 / 10;
}

.shipment-storage-line-row > .line-amount-field {
  grid-column: 10 / 12;
}

.line-reference-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.line-reference-panel > strong {
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 900;
}

.line-reference-panel > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-price-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reference-price-grid span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 8px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px;
  font-weight: 800;
}

.reference-price-grid em {
  color: var(--ink);
  font-style: normal;
  font-weight: 900;
}

.reference-price-grid .reference-last-price {
  background: #fffbeb;
  color: #92400e;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.form-field {
  display: grid;
  gap: 6px;
}

.party-autocomplete-field {
  position: relative;
}

.party-autocomplete-field input {
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

.party-suggestion-list {
  display: none;
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 238px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
  padding: 5px;
}

.party-suggestion-list.active {
  display: grid;
  gap: 3px;
}

.party-suggestion-option,
.party-suggestion-empty {
  min-height: 34px;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.party-suggestion-option {
  cursor: pointer;
}

.party-suggestion-option:hover,
.party-suggestion-option.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.party-suggestion-empty {
  color: var(--muted);
}

.form-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-field span small {
  display: block;
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 700;
}

.advanced-permission-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.advanced-permission-details summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.advanced-permission-details .form-grid {
  margin-top: 12px;
}

.form-field input,
.form-field select,
.form-field textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  padding: 0 12px;
  width: 100%;
}

.line-price.input-error {
  border-color: #b42318;
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.12);
}

.line-price-warning {
  grid-column: 1 / -1;
  display: block;
  border-radius: 6px;
  background: #fff1f0;
  color: #b42318;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.line-price-warning:empty {
  display: none;
}

.sales-order-storage-notice {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-left: 4px solid #287a62;
  border-radius: 6px;
  background: #eef8f4;
  color: #245448;
  padding: 8px 10px;
}

.sales-order-storage-notice[hidden] {
  display: none;
}

.sales-order-storage-notice > div {
  display: grid;
  gap: 2px;
}

.sales-order-storage-notice strong {
  font-size: 13px;
}

.sales-order-storage-notice span {
  font-size: 12px;
  line-height: 17px;
}

.sales-order-storage-notice .secondary-action {
  flex: 0 0 auto;
  white-space: nowrap;
}

.commission-calculation-dialog {
  width: min(1120px, calc(100vw - 32px));
}

.commission-shipment-preview-dialog {
  width: min(920px, calc(100vw - 32px));
}

.commission-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.commission-summary-grid > div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.commission-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.commission-summary-grid strong {
  font-size: 15px;
}

.commission-detail-scroll {
  max-height: 52vh;
  overflow: auto;
}

.commission-detail-scroll table {
  min-width: 860px;
}

.commission-formula-note {
  border-radius: 8px;
  background: #ecfdf3;
  color: #067647;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .commission-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-field textarea {
  padding-top: 10px;
  resize: vertical;
}

.company-title-field-status {
  display: block;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.company-title-field-status[hidden] {
  display: none;
}

.company-title-field-status.ok {
  color: #047857;
}

.company-title-field-status.warn {
  color: #b45309;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.permission-field {
  grid-column: 1 / -1;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.user-permission-access-section .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.user-permission-access-section .permission-field {
  grid-column: auto;
}

.user-permission-access-section .permission-field:first-child {
  grid-column: 1 / -1;
}

.user-permission-access-section .permission-field:first-child .permission-checkbox-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.permission-module-groups {
  display: grid;
  gap: 10px;
}

.permission-module-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px;
}

.permission-module-group h4 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.permission-module-group .permission-checkbox-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.permission-field-header {
  display: grid;
  gap: 3px;
}

.permission-field-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.permission-field-header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.permission-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.permission-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.permission-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.module-action-permission-field {
  margin: 12px 0;
}

.module-action-groups,
.module-action-list {
  display: grid;
  gap: 10px;
}

.module-action-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.module-action-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.module-action-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(430px, 4fr);
  align-items: center;
  gap: 12px;
  min-height: 38px;
  border-top: 1px solid var(--line);
  padding: 6px 2px;
}

.module-action-row:first-child {
  border-top: 0;
}

.module-action-row strong {
  font-size: 13px;
}

.module-action-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.module-action-options label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 800;
}

.module-action-options input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

@media (max-width: 760px) {
  .module-action-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

.detail-lines {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.detail-lines-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.detail-line-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.detail-line-item strong,
.detail-line-item span,
.detail-line-item p {
  overflow-wrap: anywhere;
}

.detail-line-item span,
.detail-line-item p {
  color: var(--muted);
  font-size: 13px;
}

.detail-line-item p {
  grid-column: 1 / -1;
  margin: 0;
}

.internal-batch-allocation {
  display: grid;
  gap: 5px;
  grid-column: 1 / -1;
  margin-top: 6px;
}

.internal-batch-allocation span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.internal-batch-allocation div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.internal-batch-allocation em {
  border-radius: 8px;
  background: #edf8f4;
  color: var(--brand-strong);
  padding: 4px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px #bee4d7;
}

.detail-line-item em {
  color: var(--brand-strong);
  font-style: normal;
  font-weight: 900;
}

.detail-line-item.warning-line {
  background: #fff3ef;
  box-shadow: inset 0 0 0 1px #efc9bf;
}

.detail-line-item.warning-line em {
  color: var(--danger);
}

.return-detail-line > div {
  display: grid;
  gap: 4px;
}

.return-detail-line span {
  display: block;
}

.completion-trace-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.completion-trace-summary span {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.detail-line-item.material-movement-line {
  background: #fff3ef;
  box-shadow: inset 0 0 0 1px #efc9bf;
}

.detail-line-item.finished-movement-line {
  background: #edf8f4;
  box-shadow: inset 0 0 0 1px #bee4d7;
}

.batch-trace-dialog {
  max-width: min(1080px, calc(100vw - 28px));
}

.batch-trace-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.batch-trace-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
  border-radius: 8px;
  background: #edf8f4;
  padding: 12px;
  box-shadow: inset 0 0 0 1px #bee4d7;
}

.batch-trace-current span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.batch-trace-current strong {
  font-size: 20px;
}

.batch-trace-card {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  padding: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.batch-trace-card span,
.batch-trace-card em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.batch-trace-card strong {
  font-size: 18px;
}

.batch-trace-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.batch-trace-subsection {
  border-radius: 8px;
  padding: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.batch-trace-subsection h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.batch-trace-subsection.finished {
  background: #edf8f4;
}

.batch-trace-subsection.material {
  background: #fff3ef;
}

.batch-trace-summary-table {
  table-layout: fixed;
  width: 100%;
}

.batch-trace-summary-table col:nth-child(1) {
  width: 52%;
}

.batch-trace-summary-table col:nth-child(2) {
  width: 28%;
}

.batch-trace-summary-table col:nth-child(3) {
  width: 20%;
}

.batch-trace-summary-table th,
.batch-trace-summary-table td {
  vertical-align: middle;
}

.batch-trace-summary-table th:nth-child(3),
.batch-trace-summary-table td:nth-child(3) {
  text-align: right;
}

.batch-trace-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.batch-trace-actions {
  margin-top: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.shortage-dialog {
  max-width: min(980px, calc(100vw - 28px));
}

.shortage-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.shortage-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 140px;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.shortage-card strong {
  display: block;
  margin-bottom: 4px;
}

.shortage-card span,
.shortage-card p {
  color: var(--muted);
  font-size: 13px;
}

.shortage-card p {
  margin: 4px 0 0;
}

.production-output-line-row {
  grid-template-columns: minmax(280px, 1.4fr) 150px 130px minmax(240px, 1fr) 40px;
}

.production-product-meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  min-height: 38px;
  margin-top: -2px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf9;
  color: var(--ink);
  font-size: 13px;
}

.production-product-meta span {
  display: inline-flex;
  gap: 6px;
}

.production-product-meta strong {
  color: var(--muted);
}

.production-product-meta .production-product-meta-empty {
  color: var(--muted);
}

.production-product-meta .production-product-meta-warning {
  color: #9a3412;
  font-weight: 800;
}

.production-material-line-row {
  grid-template-columns: minmax(230px, 1.35fr) 120px 120px 135px 135px 90px minmax(190px, 1fr) 40px;
}

.asset-warranty-replace {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.asset-warranty-replace input {
  display: none;
}

.purchase-asset-dialog {
  width: min(1080px, calc(100vw - 28px));
}

.purchase-asset-card {
  display: block;
}

.purchase-asset-select {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.purchase-asset-select input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.purchase-asset-select small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.purchase-asset-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) 150px 180px;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  transition: opacity 120ms ease;
}

.purchase-asset-fields.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

.purchase-asset-fields .form-field-wide {
  grid-column: 1 / -1;
}

.production-complete-dialog {
  max-width: min(1040px, calc(100vw - 28px));
}

.asset-count-dialog {
  width: min(1240px, calc(100vw - 28px));
}

.asset-count-table-wrap {
  max-height: min(58vh, 620px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.asset-count-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 13px;
}

.asset-count-table th,
.asset-count-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.asset-count-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  white-space: nowrap;
}

.asset-count-table td:first-child {
  min-width: 190px;
}

.asset-count-table td:first-child strong,
.asset-count-table td:first-child small {
  display: block;
}

.asset-count-table td:first-child small {
  margin-top: 3px;
  color: var(--muted);
}

.asset-count-table select,
.asset-count-table input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 8px;
  background: var(--surface);
  color: var(--ink);
}

.completion-alert {
  display: grid;
  gap: 4px;
  margin: 12px 0 16px;
  border-radius: 8px;
  padding: 12px;
}

.completion-alert strong,
.completion-alert span {
  display: block;
}

.completion-alert span {
  color: var(--muted);
  font-size: 13px;
}

.completion-alert.ready {
  background: #dff4ef;
  color: var(--brand-strong);
}

.completion-alert.danger {
  background: #fff3ef;
  color: #a23b2b;
}

.completion-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.record-count {
  color: var(--muted);
  font-weight: 800;
}

.production-shortage-summary {
  display: none;
  margin: 12px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.production-shortage-summary.visible {
  display: block;
}

.inventory-overview {
  display: none;
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 14px;
}

.inventory-overview.visible {
  display: block;
}

.inventory-overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.inventory-overview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.customer-visit-overview-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.customer-visit-overview-controls label {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.customer-visit-overview-controls label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.customer-visit-overview-controls input,
.customer-visit-overview-controls select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 7px 10px;
  color: var(--ink);
  font: inherit;
}

.customer-visit-missing,
.customer-visit-complete {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  border-left: 4px solid #d97706;
  background: #fff8e6;
  padding: 10px 12px;
  color: #8a4b0f;
}

.customer-visit-complete {
  border-left-color: #138a72;
  background: #edf9f5;
  color: #0b6b59;
}

.customer-visit-daily-detail {
  margin-top: 12px;
}

.customer-visit-overview-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.inventory-overview-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.inventory-overview-metrics article {
  display: grid;
  gap: 4px;
  min-height: 96px;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.inventory-overview-metrics span,
.inventory-overview-metrics small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inventory-overview-metrics strong {
  color: var(--brand-strong);
  font-size: 30px;
  line-height: 1;
}

.inventory-overview-metrics article.warning {
  background: #fff8e6;
}

.inventory-overview-metrics article.danger {
  background: #fff3ef;
}

.report-filter-note {
  display: inline-flex;
  max-width: 100%;
  margin: 8px 0 0;
  border: 1px solid #b9d8ce;
  border-radius: 6px;
  background: #eef8f4;
  color: #21483d;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.report-metrics article {
  min-width: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 12px;
}

.report-metrics span,
.report-metrics small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-metrics strong {
  display: block;
  margin: 6px 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.report-table-stack {
  display: grid;
  gap: 10px;
}

.report-validation-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(0, 1.4fr);
  gap: 12px;
  align-items: start;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.report-validation-panel.warning {
  border-color: rgba(174, 91, 31, 0.35);
  background: #fff8f1;
}

.report-validation-panel.ok {
  border-color: rgba(33, 103, 87, 0.26);
  background: #f4faf7;
}

.report-validation-panel span,
.report-validation-panel small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-validation-panel strong {
  display: block;
  margin: 4px 0;
  color: var(--ink);
  font-size: 18px;
}

.report-validation-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #7a3f14;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.report-validation-empty {
  margin: 0;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 800;
}

.report-table-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.report-table-overview-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.report-table-overview-item:hover,
.report-table-overview-item.active {
  border-color: rgba(33, 103, 87, 0.35);
  background: #f4faf7;
  box-shadow: var(--shadow-soft);
}

.report-table-overview-item span,
.report-table-overview-item strong,
.report-table-overview-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-table-overview-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.report-table-overview-item strong {
  margin-top: 4px;
  font-size: 18px;
}

.report-table-overview-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.report-table-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: #eef3f1;
  box-shadow: inset 0 0 0 1px var(--line);
}

.report-table-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.report-table-tab:hover,
.report-table-tab.active {
  background: var(--surface);
  color: var(--brand-strong);
  box-shadow: var(--shadow-soft);
}

.report-table-tab small {
  color: inherit;
  font-size: 11px;
  font-weight: 800;
}

.report-table-panel {
  display: none;
}

.report-table-panel.active {
  display: block;
}

.report-table-card {
  min-width: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 12px;
}

.report-table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-table-card-header > div {
  min-width: 0;
}

.report-table-card-header h3 {
  margin: 0;
  font-size: 15px;
}

.report-table-card-header small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-table-card-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}

.report-table-card-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.report-table-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.report-table-card summary::-webkit-details-marker {
  display: none;
}

.report-table-card summary::after {
  content: "V";
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.report-table-card:not([open]) summary::after {
  content: ">";
}

.report-table-card summary span {
  font-size: 15px;
  font-weight: 900;
}

.report-table-card summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.report-table-scroll {
  margin-top: 10px;
  max-height: 300px;
  overflow: auto;
}

.report-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
}

.report-table-panel:not(.expanded) .report-extra-row {
  display: none;
}

.report-actions {
  justify-content: flex-start;
  margin: 14px 0 0;
}

.report-print-document {
  color: #17211f;
}

.accounting-report-print {
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
}

.formal-accounting-print {
  max-width: 820px;
  margin: 0 auto;
}

.report-print-header {
  position: relative;
  align-items: flex-start;
  border-bottom: 2px solid #17211f;
  padding-bottom: 10px;
}

.report-print-header h1 {
  margin-bottom: 6px;
  font-size: 24px;
}

.report-print-header strong {
  color: #34423f;
  font-size: 13px;
}

.report-print-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin: 12px 0 14px;
  border: 1px solid #cfd8d5;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfc;
}

.report-print-meta div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.report-print-meta span {
  color: #5a6b67;
  font-size: 12px;
  font-weight: 900;
}

.report-print-meta strong {
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.report-print-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.formal-print-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-print-metrics article {
  min-width: 0;
  border: 1px solid #cfd8d5;
  border-radius: 6px;
  padding: 10px;
  break-inside: avoid;
}

.report-print-metrics span,
.report-print-metrics small {
  display: block;
  color: #5a6b67;
  font-size: 12px;
  font-weight: 800;
}

.report-print-metrics strong {
  display: block;
  margin: 5px 0;
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.report-print-table {
  margin-top: 18px;
  break-inside: auto;
}

.formal-report-note {
  margin: 8px 0 14px;
  border-left: 3px solid #17211f;
  padding: 8px 10px;
  background: #f7f9f8;
  color: #4f615d;
  font-size: 12px;
  line-height: 1.6;
}

.report-print-validation {
  margin: 10px 0 14px;
  border: 1px solid #cfd8d5;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfc;
  break-inside: avoid;
}

.report-print-validation.warning {
  border-color: #d0a076;
  background: #fff8f1;
}

.report-print-validation.ok {
  border-color: #abc6bb;
  background: #f4faf7;
}

.report-print-validation strong,
.report-print-validation span {
  display: block;
}

.report-print-validation strong {
  font-size: 13px;
}

.report-print-validation span,
.report-print-validation li,
.report-print-validation p {
  color: #4f615d;
  font-size: 12px;
  line-height: 1.5;
}

.report-print-validation ul,
.report-print-validation p {
  margin: 6px 0 0;
}

.report-print-table-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid #17211f;
  padding-bottom: 4px;
}

.report-print-table-title h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.report-print-table-title span {
  color: #5a6b67;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.accounting-report-print .print-table {
  font-size: 11px;
  table-layout: fixed;
  width: 100%;
}

.accounting-report-print .print-table th {
  border-top: 1px solid #17211f;
  border-bottom: 1px solid #17211f;
  background: #f2f5f4;
}

.accounting-report-print .print-table td,
.accounting-report-print .print-table th {
  padding: 5px 6px;
  vertical-align: top;
}

.accounting-report-print .print-table td:nth-child(n+4) {
  white-space: nowrap;
}

.accounting-report-print .wide-report-table .print-table {
  font-size: 10px;
}

.accounting-report-print .wide-report-table .print-table td,
.accounting-report-print .wide-report-table .print-table th {
  padding: 4px 5px;
  word-break: break-word;
}

.formal-accounting-print .report-print-header {
  justify-content: center;
  text-align: center;
}

.formal-accounting-print .report-print-header strong {
  position: absolute;
  right: 0;
}

.formal-accounting-print .report-print-table-title {
  margin-top: 20px;
  border-bottom-width: 2px;
}

.formal-accounting-print .formal-statement-table {
  border-collapse: collapse;
  font-size: 12px;
}

.formal-accounting-print .formal-statement-table th {
  background: #fff;
}

.formal-accounting-print .formal-statement-table td,
.formal-accounting-print .formal-statement-table th {
  border-left: 0;
  border-right: 0;
}

.formal-accounting-print .formal-statement-table td:last-child,
.formal-accounting-print .formal-statement-table th:last-child {
  text-align: right;
}

.formal-accounting-print .formal-statement-table tr:last-child td {
  border-bottom: 2px solid #17211f;
  font-weight: 900;
}

.long-report-table {
  page-break-inside: auto;
}

.long-report-table tr {
  page-break-inside: avoid;
}

.inventory-priority-list {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.inventory-alert-panel {
  display: none;
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 14px;
}

.inventory-alert-panel.visible {
  display: block;
}

.inventory-alert-list {
  display: grid;
  gap: 8px;
}

.inventory-alert-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.inventory-alert-item strong,
.inventory-alert-item span {
  display: block;
}

.inventory-alert-item strong {
  font-size: 14px;
}

.inventory-alert-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.inventory-alert-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 5px;
}

.inventory-alert-item.resolved {
  opacity: 0.68;
}

.inventory-alert-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.inventory-alert-actions .compact-action,
.inventory-alert-panel [data-alert-toggle-resolved] {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.muted-action {
  color: var(--muted);
  background: #ffffff;
}

.inventory-alert-item.danger {
  background: #fff3ef;
}

.inventory-alert-item.warning {
  background: #fff8e6;
}

.inventory-alert-item.info {
  background: #eef8f6;
}

.batch-balance-panel {
  display: none;
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 14px;
}

.batch-balance-panel.visible {
  display: block;
}

.batch-balance-table {
  table-layout: fixed;
}

.batch-balance-table th:nth-child(1),
.batch-balance-table td:nth-child(1) {
  width: 24%;
}

.batch-balance-table th:nth-child(3),
.batch-balance-table td:nth-child(3) {
  width: 22%;
}

.batch-balance-table th:nth-child(4),
.batch-balance-table td:nth-child(4) {
  text-align: right;
  width: 9%;
}

.batch-balance-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ledger-query-panel {
  display: none;
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 14px;
}

.ledger-query-panel.visible {
  display: block;
}

.ledger-query-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.ledger-query-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ledger-query-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.ledger-query-summary article {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.ledger-query-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ledger-query-summary strong {
  color: var(--brand-strong);
  font-size: 20px;
}

.list-pagination-panel,
.ledger-pagination-panel {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.list-pagination-panel.visible,
.ledger-pagination-panel.visible {
  display: flex;
}

.list-pagination-info,
.ledger-pagination-info {
  display: grid;
  gap: 2px;
}

.list-pagination-info strong,
.ledger-pagination-info strong {
  font-size: 14px;
}

.list-pagination-info span,
.ledger-pagination-info span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.list-pagination-controls,
.ledger-pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.list-pagination-controls label,
.ledger-pagination-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.list-pagination-controls select,
.ledger-pagination-controls select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 8px;
}

.list-pagination-controls button:disabled,
.ledger-pagination-controls button:disabled {
  cursor: default;
  opacity: 0.45;
}

.column-settings-panel {
  display: none;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.column-settings-panel.visible {
  display: block;
}

.column-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.column-settings-header strong,
.column-settings-header span {
  display: block;
}

.column-settings-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
}

.column-settings-actions {
  display: flex;
  gap: 6px;
}

.column-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.column-setting-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--line);
}

.column-setting-item input {
  accent-color: var(--brand);
}

.inventory-priority-table th:nth-child(3),
.inventory-priority-table th:nth-child(4),
.inventory-priority-table th:nth-child(5),
.inventory-priority-table td:nth-child(3),
.inventory-priority-table td:nth-child(4),
.inventory-priority-table td:nth-child(5) {
  text-align: right;
}

.shortage-summary-badge {
  border-radius: 999px;
  background: #fff3ef;
  color: #a23b2b;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.shortage-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-table {
  margin-top: 8px;
}

.compact-table table {
  min-width: 900px;
}

.compact-table th,
.compact-table td {
  padding: 10px 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.primary-action {
  background: var(--brand);
  color: #ffffff;
  padding: 0 18px;
  font-weight: 800;
}

.secondary-action {
  background: var(--surface-soft);
  color: var(--brand-strong);
  padding: 0 14px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 700;
}

.compact-action {
  align-self: center;
  min-height: 34px;
  padding: 0 12px;
}

.danger-action {
  color: #a23b2b;
  background: #fff3ef;
  box-shadow: inset 0 0 0 1px #efc9bf;
}

.print-dialog {
  max-width: min(1120px, calc(100vw - 28px));
}

.print-dialog-body {
  max-width: 1060px;
}

.print-company-field {
  margin-bottom: 12px;
  max-width: 360px;
}

.print-date-field,
.print-warehouse-field {
  margin-bottom: 12px;
  max-width: 240px;
}

.print-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.print-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.print-option input {
  width: 18px;
  height: 18px;
}

.print-document {
  background: #fff;
  color: #17211f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.print-header,
.print-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.print-header {
  align-items: start;
  border-bottom: 2px solid #17211f;
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.print-header p,
.print-header h1 {
  margin: 0;
}

.print-header span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.print-header h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.print-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  font-size: 14px;
}

.print-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #cbd8d3;
  border-left: 1px solid #cbd8d3;
  margin-bottom: 14px;
}

.print-info-grid div {
  display: grid;
  grid-template-columns: 86px 1fr;
  min-height: 38px;
  border-right: 1px solid #cbd8d3;
  border-bottom: 1px solid #cbd8d3;
}

.print-info-grid strong,
.print-info-grid span {
  display: flex;
  align-items: center;
  padding: 7px 8px;
}

.print-info-grid strong {
  background: #f1f6f4;
  color: #4f615d;
  font-size: 12px;
}

.print-info-grid span {
  font-size: 13px;
}

.print-note {
  display: grid;
  grid-template-columns: 86px 1fr;
  border: 1px solid #d9e3df;
  margin-bottom: 14px;
}

.print-note strong {
  background: #f1f6f4;
  color: #4f615d;
  font-size: 12px;
  padding: 8px;
}

.print-note span {
  padding: 8px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.print-table th,
.print-table td {
  border: 1px solid #cbd8d3;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.print-table th {
  background: #e9f1ee;
  font-size: 12px;
  text-align: center;
}

.billing-detail-table {
  font-size: 12px;
}

.billing-detail-table th:nth-child(4),
.billing-detail-table td:nth-child(4) {
  min-width: 220px;
}

.billing-detail-table th:nth-child(5),
.billing-detail-table td:nth-child(5),
.billing-detail-table th:nth-child(6),
.billing-detail-table td:nth-child(6) {
  text-align: center;
}

.billing-detail-table th:nth-child(7),
.billing-detail-table td:nth-child(7),
.billing-detail-table th:nth-child(8),
.billing-detail-table td:nth-child(8) {
  text-align: right;
}

.supplier-payment-detail-table,
.supplier-payment-table {
  font-size: 12px;
}

.supplier-payment-detail-table th:nth-child(5),
.supplier-payment-detail-table td:nth-child(5),
.supplier-payment-detail-table th:nth-child(6),
.supplier-payment-detail-table td:nth-child(6),
.supplier-payment-detail-table th:nth-child(7),
.supplier-payment-detail-table td:nth-child(7),
.supplier-payment-table th:nth-child(4),
.supplier-payment-table td:nth-child(4) {
  text-align: right;
}

.supplier-payment-section {
  margin-top: 14px;
}

.supplier-payment-section h3 {
  font-size: 14px;
  margin: 0 0 6px;
}

.print-line-subtext {
  display: block;
  color: #6c7c78;
  font-size: 12px;
  margin-top: 3px;
}

.print-empty-row td {
  height: 28px;
}

.print-accounting {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #cbd8d3;
  border-left: 1px solid #cbd8d3;
  margin-top: 14px;
}

.print-accounting div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-right: 1px solid #cbd8d3;
  border-bottom: 1px solid #cbd8d3;
}

.print-accounting span,
.print-accounting strong {
  padding: 8px;
  text-align: right;
}

.print-accounting span {
  background: #f1f6f4;
  color: #4f615d;
}

.print-terms {
  display: grid;
  gap: 4px;
  border: 1px solid #cbd8d3;
  margin-top: 14px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.6;
}

.print-terms p {
  margin: 0;
}

.payroll-slip-document {
  max-width: 820px;
  margin: 0 auto;
}

.payroll-slip-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 20px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 2px solid #17211f;
}

.payroll-slip-header p,
.payroll-slip-header h1 {
  margin: 0;
}

.payroll-slip-header p {
  color: #4f615d;
  font-size: 14px;
  margin-bottom: 4px;
}

.payroll-slip-header h1 {
  font-size: 27px;
  letter-spacing: 0;
}

.payroll-slip-period {
  display: grid;
  gap: 3px;
  min-width: 150px;
  text-align: right;
}

.payroll-slip-period span {
  color: #4f615d;
  font-size: 12px;
}

.payroll-slip-period strong {
  font-size: 21px;
}

.payroll-slip-info {
  grid-template-columns: repeat(2, 1fr);
}

.payroll-slip-table th:nth-child(3),
.payroll-slip-table th:nth-child(4),
.payroll-slip-table td:nth-child(3),
.payroll-slip-table td:nth-child(4) {
  width: 130px;
  text-align: right;
}

.payroll-slip-table td:nth-child(2) {
  color: #4f615d;
}

.payroll-slip-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
  border: 1px solid #cbd8d3;
}

.payroll-slip-summary div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-right: 1px solid #cbd8d3;
  text-align: right;
}

.payroll-slip-summary div:last-child {
  border-right: 0;
}

.payroll-slip-summary span {
  color: #4f615d;
  font-size: 12px;
}

.payroll-slip-summary strong {
  font-size: 18px;
}

.payroll-slip-summary .payroll-slip-net {
  background: #e9f1ee;
}

.payroll-slip-summary .payroll-slip-net strong {
  font-size: 22px;
}

.payroll-slip-private-note {
  margin: 14px 0 0;
  color: #4f615d;
  font-size: 12px;
}

.payroll-slip-signature {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: end;
  gap: 12px;
  width: 300px;
  margin: 44px 0 0 auto;
  color: #4f615d;
}

.payroll-slip-signature strong {
  display: block;
  min-height: 28px;
  border-bottom: 1px solid #17211f;
}

.quote-print-document {
  padding: 34px;
}

.quote-print-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  border-bottom: 3px solid #17211f;
  padding-bottom: 20px;
  margin-bottom: 22px;
}

.quote-print-header p,
.quote-print-header h1 {
  margin: 0;
}

.quote-print-header p {
  font-size: 18px;
  font-weight: 900;
}

.quote-print-header h1 {
  margin-top: 12px;
  font-size: 34px;
  letter-spacing: 0;
}

.quote-print-header span {
  display: block;
  margin-top: 5px;
  color: #52615e;
  font-size: 13px;
}

.quote-print-date-card {
  min-width: 190px;
  border: 1px solid #17211f;
  padding: 14px;
  text-align: right;
}

.quote-print-date-card strong,
.quote-print-date-card span {
  display: block;
}

.quote-print-date-card strong {
  font-size: 18px;
  margin-bottom: 8px;
}

.quote-print-date-card span {
  margin-top: 8px;
  color: #52615e;
  font-size: 12px;
}

.quote-summary {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}

.quote-recipient {
  display: grid;
  gap: 7px;
  border-left: 4px solid #17211f;
  padding-left: 14px;
}

.quote-recipient span,
.quote-meta-list dt {
  color: #52615e;
  font-size: 12px;
  font-weight: 800;
}

.quote-recipient strong {
  font-size: 22px;
}

.quote-recipient em {
  color: #52615e;
  font-style: normal;
}

.quote-meta-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.quote-meta-list div {
  display: grid;
  grid-template-columns: 96px 1fr;
  border-bottom: 1px solid #d7e0dc;
  padding-bottom: 7px;
}

.quote-meta-list dt,
.quote-meta-list dd {
  margin: 0;
}

.quote-meta-list dd {
  text-align: right;
  font-weight: 800;
}

.quote-message {
  border: 1px solid #d7e0dc;
  background: #f8faf9;
  padding: 12px;
  margin-bottom: 14px;
}

.quote-print-document .print-table {
  margin-top: 18px;
}

.quote-print-document .print-table th {
  background: #17211f;
  color: #fff;
}

.quote-print-document .print-table td {
  padding: 10px 8px;
}

.quote-total-panel {
  display: grid;
  gap: 8px;
  justify-content: end;
  margin-top: 16px;
}

.quote-total-panel div {
  display: grid;
  grid-template-columns: 110px 150px;
  gap: 18px;
  text-align: right;
}

.quote-total-panel span {
  color: #52615e;
}

.quote-total-panel strong {
  font-size: 15px;
}

.quote-grand-total {
  border-top: 2px solid #17211f;
  padding-top: 8px;
}

.quote-grand-total strong {
  font-size: 22px;
}

.quote-terms {
  margin-top: 20px;
  border-top: 1px solid #d7e0dc;
  padding-top: 14px;
  color: #3e4c49;
  font-size: 12px;
  line-height: 1.7;
}

.quote-terms strong {
  display: block;
  margin-bottom: 6px;
}

.quote-terms ol {
  margin: 0;
  padding-left: 18px;
}

.quote-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  margin-top: 44px;
}

.quote-signatures div {
  border-top: 1px solid #17211f;
  padding-top: 9px;
}

.quote-signatures span,
.quote-signatures strong {
  display: block;
  text-align: center;
}

.quote-signatures span {
  color: #52615e;
}

.quote-signatures strong {
  min-height: 24px;
  margin-top: 6px;
}

.order-summary-document {
  padding: 24px;
}

.picking-list-document {
  padding: 24px;
}

.order-summary-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  border-bottom: 2px solid #17211f;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.order-summary-header p,
.order-summary-header h1 {
  margin: 0;
}

.order-summary-header p {
  color: #52615e;
  font-size: 13px;
  font-weight: 800;
}

.order-summary-header h1 {
  margin-top: 4px;
  font-size: 28px;
}

.order-summary-header div:last-child {
  display: grid;
  gap: 4px;
  text-align: right;
}

.order-summary-header strong {
  font-size: 22px;
}

.order-summary-header span {
  color: #52615e;
  font-size: 12px;
}

.order-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.order-summary-stats div {
  border: 1px solid #cbd8d3;
  padding: 10px;
}

.order-summary-stats span,
.order-summary-stats strong {
  display: block;
}

.order-summary-stats span {
  color: #52615e;
  font-size: 12px;
}

.order-summary-stats strong {
  margin-top: 4px;
  font-size: 22px;
}

.order-summary-section {
  margin-top: 16px;
}

.order-summary-section h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.order-summary-table th {
  background: #17211f;
  color: #fff;
}

.order-summary-table th,
.order-summary-table td {
  padding: 7px 6px;
  font-size: 12px;
}

.order-detail-table th:nth-child(6),
.order-detail-table td:nth-child(6) {
  min-width: 150px;
}

.order-detail-table th:nth-child(10),
.order-detail-table td:nth-child(10) {
  min-width: 160px;
}

.order-summary-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 38px;
}

.order-summary-footer div {
  border-top: 1px solid #17211f;
  padding-top: 8px;
  text-align: center;
  color: #52615e;
}

.picking-summary-table th:nth-child(1),
.picking-summary-table th:nth-child(2),
.picking-summary-table td:nth-child(1),
.picking-summary-table td:nth-child(2),
.picking-detail-table th:last-child,
.picking-detail-table td:last-child {
  width: 46px;
  text-align: center;
}

.pick-check-cell {
  min-width: 34px;
  height: 26px;
  position: relative;
}

.pick-check-cell::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border: 1px solid #17211f;
  margin: 2px auto;
}

.picking-summary-table td:nth-child(5),
.picking-detail-table td:nth-child(5) {
  min-width: 150px;
}

.print-signatures {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 42px;
}

.print-signatures div {
  border-top: 1px solid #17211f;
  padding-top: 8px;
  text-align: center;
  color: #4f615d;
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  @page asset-register {
    size: A4 landscape;
    margin: 10mm;
  }

  body * {
    visibility: hidden !important;
  }

  #printDialog,
  #printDialog * {
    visibility: visible !important;
  }

  #printDialog {
    position: static;
    inset: auto;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    border: 0;
    box-shadow: none;
    padding: 0;
    overflow: visible;
  }

  #printDialog::backdrop,
  .no-print {
    display: none !important;
  }

  .print-dialog-body,
  .print-document {
    max-width: none;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .report-print-table {
    break-inside: auto;
  }

  .report-print-table-title,
  .report-print-metrics article,
  .formal-report-note {
    break-inside: avoid;
  }

  .print-table thead {
    display: table-header-group;
  }

  .print-table tfoot {
    display: table-footer-group;
  }

  .wide-report-table .print-table {
    font-size: 9px;
  }
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-item,
.document-row {
  width: 100%;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
}

.task-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 10px 12px;
}

.task-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #dff4ef;
  color: var(--brand-strong);
  font-weight: 800;
}

.task-copy strong,
.task-copy span {
  display: block;
}

.task-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.task-count {
  color: var(--accent);
  font-weight: 800;
}

.flow {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 8px 0 18px;
}

.flow-step {
  min-width: 54px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 8px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--line);
}

.flow-step.done {
  background: #dff4ef;
  color: var(--brand-strong);
}

.flow-step.active {
  background: #f7f0df;
  color: #6f4708;
}

.flow-line {
  height: 2px;
  background: var(--line);
}

.document-list {
  display: grid;
  gap: 8px;
}

.document-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 12px;
}

.focus-row {
  grid-template-columns: minmax(130px, 0.7fr) minmax(180px, 1fr) auto;
}

.focus-row span,
.focus-row strong,
.focus-row em {
  min-width: 0;
}

.recent-viewed-row {
  grid-template-columns: 120px minmax(180px, 0.9fr) minmax(220px, 1.2fr) auto;
}

.recent-viewed-row small {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-row span {
  color: var(--muted);
  font-size: 13px;
}

.document-row em {
  color: var(--brand-strong);
  font-style: normal;
  font-weight: 800;
}

.workflow-guide-list {
  display: grid;
  gap: 12px;
}

.workflow-guide-card {
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.workflow-guide-header strong,
.workflow-guide-header span {
  display: block;
}

.workflow-guide-header strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.workflow-guide-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.workflow-guide-card ol {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.workflow-guide-card li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.workflow-guide-card li > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 900;
}

.workflow-guide-card p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.responsive-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.approvals-table {
  table-layout: fixed;
  min-width: 980px;
}

.approvals-table th:nth-child(1),
.approvals-table td:nth-child(1) {
  width: 138px;
}

.approvals-table th:nth-child(2),
.approvals-table td:nth-child(2) {
  width: 150px;
}

.approvals-table th:nth-child(3),
.approvals-table td:nth-child(3) {
  width: 210px;
}

.approvals-table th:nth-child(5),
.approvals-table td:nth-child(5) {
  width: 96px;
  text-align: right;
}

.approvals-table th:nth-child(6),
.approvals-table td:nth-child(6) {
  width: 104px;
}

.userPermissions-table {
  table-layout: fixed;
  min-width: 620px;
}

.userPermissions-table th:nth-child(1),
.userPermissions-table td:nth-child(1) {
  width: 150px;
}

.userPermissions-table th:nth-child(2),
.userPermissions-table td:nth-child(2) {
  width: 180px;
}

.userPermissions-table th:nth-child(3),
.userPermissions-table td:nth-child(3) {
  width: 150px;
}

.userPermissions-table th:nth-child(4),
.userPermissions-table td:nth-child(4) {
  width: 110px;
}

.userPermissions-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-summary-cell {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stockLedger-table {
  table-layout: fixed;
  min-width: 1120px;
}

.stockLedger-table th:nth-child(1),
.stockLedger-table td:nth-child(1) {
  width: 132px;
}

.stockLedger-table th:nth-child(2),
.stockLedger-table td:nth-child(2) {
  width: 108px;
}

.stockLedger-table th:nth-child(3),
.stockLedger-table td:nth-child(3) {
  width: 150px;
}

.stockLedger-table th:nth-child(4),
.stockLedger-table td:nth-child(4) {
  width: 220px;
}

.stockLedger-table th:nth-child(5),
.stockLedger-table td:nth-child(5) {
  width: 130px;
}

.stockLedger-table th:nth-child(6),
.stockLedger-table td:nth-child(6),
.stockLedger-table th:nth-child(7),
.stockLedger-table td:nth-child(7) {
  width: 88px;
  text-align: right;
}

.stockLedger-table th:nth-child(8),
.stockLedger-table td:nth-child(8) {
  width: 160px;
}

.stockLedger-table td {
  overflow-wrap: anywhere;
  vertical-align: middle;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  min-height: 24px;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  font-size: inherit;
  font-weight: inherit;
}

.table-sort-button em {
  color: var(--brand-strong);
  font-size: 10px;
  font-style: normal;
  line-height: 1;
}

.table-sort-button.active span {
  color: var(--brand-strong);
}

.list-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--brand-strong);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.list-status-badge.status-draft {
  background: #f3f4f6;
  color: #4b5563;
  box-shadow: inset 0 0 0 1px #d1d5db;
}

.list-status-badge.status-waiting {
  background: #fff7d6;
  color: #9a5b00;
  box-shadow: inset 0 0 0 1px #f4d58d;
}

.list-status-badge.status-credit {
  background: #e0f2fe;
  color: #075985;
  box-shadow: inset 0 0 0 1px #7dd3fc;
}

.list-status-badge.status-ok {
  background: #dcfce7;
  color: #166534;
  box-shadow: inset 0 0 0 1px #86efac;
}

.list-status-badge.status-danger {
  background: #fee4e2;
  color: #b42318;
  box-shadow: inset 0 0 0 1px #fda29b;
}

.list-status-badge.status-muted {
  background: #e5e7eb;
  color: #374151;
  box-shadow: inset 0 0 0 1px #9ca3af;
}

.list-status-badge.status-neutral {
  background: #eef8f6;
  color: var(--brand-strong);
  box-shadow: inset 0 0 0 1px #bee4d7;
}

.list-number-cell {
  display: block;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.status.danger {
  background: #fee4e2;
  color: var(--danger);
}

.status.warn {
  background: #fef0c7;
  color: var(--warn);
}

.status.ok {
  background: #dcfce7;
  color: var(--ok);
}

.clickable-row {
  cursor: pointer;
}

.table-link {
  border-radius: 6px;
  background: transparent;
  color: var(--brand-strong);
  padding: 2px 0;
  font-weight: 800;
  text-align: left;
}

.table-link:hover {
  color: var(--brand);
  text-decoration: underline;
}

.clickable-row:hover,
.selected-row {
  background: #eef8f6;
}

.mobile-tabs {
  display: none;
}

.delivery-route-create-section {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.delivery-route-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.delivery-route-selection-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.delivery-route-selection-toolbar > strong {
  align-self: center;
  white-space: nowrap;
  color: var(--brand-strong);
}

.delivery-route-search-field {
  min-width: 0;
}

.delivery-route-shipment-list {
  display: grid;
  gap: 8px;
  max-height: min(46vh, 440px);
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
}

.delivery-route-shipment-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.delivery-route-shipment-option:has(input:checked) {
  border-color: #72b7aa;
  background: #eef8f6;
}

.delivery-route-shipment-option > span,
.delivery-route-shipment-option > span > * {
  display: block;
  min-width: 0;
}

.delivery-route-shipment-option em {
  margin-top: 2px;
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
}

.delivery-route-shipment-option small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-route-stop-list {
  display: grid;
  gap: 8px;
}

.delivery-route-stop {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.delivery-route-stop > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #e7eeec;
  color: var(--brand-strong);
  font-weight: 800;
}

.delivery-route-stop > div {
  display: grid;
  min-width: 0;
}

.delivery-route-stop small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 18px 14px 86px;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 24px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dealer-dashboard .metrics-grid {
    grid-template-columns: 1fr;
  }

  .dealer-portal-banner {
    align-items: stretch;
    flex-direction: column;
    padding: 20px;
  }

  .dealer-portal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .inventory-overview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-overview-actions {
    justify-content: flex-start;
  }

  .customer-visit-overview-controls {
    justify-content: flex-start;
  }

  .customer-visit-overview-controls label {
    flex: 1 1 160px;
  }

  .inventory-overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ledger-query-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-query-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ledger-query-actions {
    justify-content: flex-start;
  }

  .ledger-query-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-pagination-panel,
  .ledger-pagination-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .list-pagination-controls,
  .ledger-pagination-controls {
    justify-content: flex-start;
  }

  .inventory-alert-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inventory-alert-actions {
    justify-content: flex-start;
  }

  .content-grid {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .master-layout {
    grid-template-columns: 1fr;
  }

  .delivery-route-settings,
  .delivery-route-selection-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .delivery-route-selection-toolbar > strong {
    justify-self: start;
  }

  .delivery-route-stop {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .delivery-route-stop .secondary-action {
    grid-column: 2;
    justify-self: start;
  }

  .batch-trace-sections {
    grid-template-columns: 1fr;
  }

  .toolbar-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .search-control {
    min-width: 0;
  }

  .mobile-tabs {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    border-radius: 8px;
    background: #12312d;
    padding: 6px;
    box-shadow: var(--shadow);
  }

  .mobile-tab {
    min-height: 44px;
    border-radius: 8px;
    background: transparent;
    color: #cde5e0;
    font-weight: 800;
  }

  .mobile-tab.active {
    background: #ecfdf8;
    color: #12312d;
  }
}

@media (max-width: 620px) {
  .topbar {
    gap: 10px;
  }

  .user-chip {
    max-width: 88px;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions .icon-button {
    display: none;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .inventory-overview-metrics {
    grid-template-columns: 1fr;
  }

  .ledger-query-grid,
  .advanced-query-grid,
  .ledger-query-summary {
    grid-template-columns: 1fr;
  }

  .advanced-query-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric {
    min-height: 104px;
    padding: 14px;
  }

  .metric strong {
    font-size: 26px;
  }

  .task-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .task-count {
    grid-column: 2;
  }

  .flow {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .flow-line {
    display: none;
  }

  .document-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .workflow-guide-card li {
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: start;
  }

  .workflow-guide-card li button {
    grid-column: 2;
    justify-self: start;
  }

  .recent-viewed-row {
    grid-template-columns: 1fr;
  }

  .recent-viewed-row small {
    white-space: normal;
  }

  table {
    min-width: 560px;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .fact-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .period-check-item {
    grid-template-columns: 1fr;
  }

  .period-check-owner-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .period-check-owner-summary span {
    text-align: left;
  }

  .period-check-open {
    justify-self: start;
  }

  .period-check-disabled-action {
    justify-self: start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .leave-rule-grid {
    grid-template-columns: 1fr;
  }

  .leave-rule-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .leave-attachment-field {
    align-items: flex-start;
    flex-direction: column;
  }

  .attachment-preview-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .attachment-preview-dialog .dialog-heading {
    padding: 13px 14px;
  }

  .attachment-preview-dialog .attachment-preview {
    height: 62vh;
    min-height: 280px;
    padding: 8px;
  }

  .attachment-preview-dialog .attachment-preview img {
    max-height: calc(62vh - 16px);
  }

  .attachment-preview-dialog .dialog-actions {
    padding: 10px 14px;
  }

  .company-title-row {
    grid-template-columns: 1fr;
  }

  .user-permission-access-section .form-grid {
    grid-template-columns: 1fr;
  }

  .permission-checkbox-grid {
    grid-template-columns: 1fr;
  }

  .line-row {
    grid-template-columns: 1fr;
  }

  .sample-scope-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .shipment-line-row > .product-autocomplete-field,
  .shipment-line-row > .line-quantity-field,
  .shipment-line-row > .line-delivery-quantity-field,
  .shipment-line-row > .line-storage-quantity-field,
  .shipment-line-row > .line-unit-field,
  .shipment-line-row > .line-price-field,
  .shipment-line-row > .line-customer-price-field:not(.hidden-control),
  .shipment-line-row > .line-display-name-field,
  .shipment-line-row > .line-note-field,
  .shipment-line-row > .line-amount-field,
  .shipment-line-row > .line-remove,
  .shipment-line-row > .line-reference-panel,
  .shipment-line-row > .line-price-warning {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    max-width: none;
  }

  .sales-order-storage-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .shortage-card {
    grid-template-columns: 1fr;
  }

  .purchase-asset-fields {
    grid-template-columns: 1fr;
  }

  .purchase-asset-fields .form-field-wide {
    grid-column: 1;
  }

  .completion-preview-grid {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
.investment-rule-list {
  display: grid;
  gap: 10px;
}

.investment-rules-section {
  grid-template-columns: 1fr;
}

.investment-rules-section .form-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.investment-rules-section .form-section-heading h3,
.investment-rules-section .form-section-heading p {
  margin: 0;
}

.investment-rules-section .form-section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.investment-rule-row {
  display: grid;
  grid-template-columns: minmax(140px, .8fr) minmax(220px, 1.5fr) minmax(130px, .7fr) 38px;
  gap: 10px;
  align-items: end;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #d9dee7);
}

.investment-rule-row:last-child {
  border-bottom: 0;
}

.investment-rule-row .icon-button {
  width: 38px;
  height: 38px;
}

@media (max-width: 760px) {
  .investment-rule-row {
    grid-template-columns: 1fr;
  }
}

.asset-document-dialog {
  width: min(1040px, calc(100vw - 28px));
}

.asset-document-form {
  gap: 18px;
}

.asset-document-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.asset-document-list {
  max-height: 310px;
  overflow: auto;
}

.asset-document-list th:last-child,
.asset-document-list td:last-child {
  width: 72px;
  text-align: center;
}

.asset-document-upload {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.asset-document-upload h3,
.asset-document-upload p {
  margin: 0;
}

.asset-document-upload-grid {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(280px, 1.3fr);
  gap: 12px;
  margin-top: 12px;
}

.asset-document-upload-grid .form-field-wide {
  grid-column: auto;
}

.danger-link {
  border: 0;
  background: transparent;
  color: #b42318;
  font: inherit;
  cursor: pointer;
}

.danger-link:hover {
  text-decoration: underline;
}

.product-sales-visibility-dialog {
  width: min(920px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.product-visibility-form {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 16px;
  height: 100%;
  max-height: none;
  box-sizing: border-box;
  overflow: hidden;
  overscroll-behavior: contain;
}

.product-visibility-title {
  margin: 0;
}

.product-visibility-title h2,
.product-visibility-title p {
  margin-bottom: 0;
}

.product-visibility-scope,
.product-visibility-filters {
  display: grid;
  gap: 12px;
  align-items: end;
}

.product-visibility-scope {
  grid-template-columns: minmax(260px, 1fr) auto;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.product-visibility-filters {
  grid-template-columns: minmax(200px, .75fr) minmax(300px, 1.25fr);
}

.product-visibility-scope label,
.product-visibility-filters label {
  display: grid;
  gap: 12px;
}

.product-visibility-scope label,
.product-visibility-filters label {
  gap: 7px;
}

.product-visibility-scope label > span,
.product-visibility-filters label > span,
.product-visibility-count > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.product-visibility-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  white-space: nowrap;
}

.product-visibility-count strong {
  color: var(--accent);
  font-size: 20px;
}

.product-visibility-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  padding-right: 4px;
}

.product-visibility-brand-group {
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.product-visibility-brand-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--soft, #f6f8f8);
}

.product-visibility-brand-heading span {
  color: var(--muted);
  font-size: 12px;
}

.product-visibility-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.product-visibility-row:last-child {
  border-bottom: 0;
}

.product-visibility-row:hover {
  background: #f7fbfa;
}

.product-visibility-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

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

.product-visibility-row small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-visibility-row.disabled {
  cursor: not-allowed;
  opacity: .55;
}

.product-visibility-actions {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .product-visibility-form {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  .product-visibility-scope,
  .product-visibility-filters {
    grid-template-columns: 1fr;
  }

  .product-visibility-count {
    justify-content: flex-start;
  }

  .asset-document-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .asset-document-upload-grid {
    grid-template-columns: 1fr;
  }
}
