/* --------------------------------------------------------------------------
   UI polish 2026-10-16 (desktop + login), loaded after every other stylesheet.
   Colour marks state and action only: decorative gradients and position-based
   tints are flattened. Business hooks, ids and layout contracts stay as they are.
   -------------------------------------------------------------------------- */

/* ---------- Page canvas ---------- */
body.production-body,
.production-body .app-layout,
.production-body .content {
  background: var(--bg);
}

/* ---------- Sidebar ---------- */
.production-body .sidebar {
  background: var(--sidebar);
  box-shadow: none;
}

.production-body .brand-block {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 11px;
  align-items: center;
  padding: 18px 16px 16px;
  background: transparent;
}

.production-body .brand-logo {
  grid-row: 1 / span 3;
  width: 40px;
  height: 40px;
  margin: 0;
  filter: none;
}

.production-body .brand-title {
  line-height: 1.2;
  letter-spacing: 0;
}

.production-body .brand-name {
  grid-column: 2;
  margin-top: 2px;
  overflow: hidden;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-body .brand-role {
  grid-column: 2;
  margin-top: 0;
  color: #8fd9c6;
  font-weight: 600;
}

.production-body .side-menu {
  gap: 2px;
  padding: 10px 10px 12px;
}

.production-body .side-menu-heading {
  padding: 4px 10px;
  color: rgba(230, 244, 239, 0.42);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.production-body .side-menu-group + .side-menu-group {
  margin-top: 4px;
  padding-top: 8px;
}

.production-body .side-link {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 11px;
  padding: 0 10px 0 11px;
  color: rgba(239, 248, 245, 0.74);
  border: 0;
  border-radius: 10px;
  font-weight: 500;
}

.production-body .side-link:not(:has(.side-link-icon)) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.production-body .side-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  transform: none;
}

.production-body .side-link.active {
  color: #fff;
  background: rgba(111, 214, 189, 0.15);
  border: 0;
  box-shadow: inset 3px 0 0 #6fd6bd;
  font-weight: 600;
}

.side-link-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: rgba(214, 238, 230, 0.62);
}

.side-link-icon svg {
  width: 20px;
  height: 20px;
}

.production-body .side-link:hover .side-link-icon,
.production-body .side-link.active .side-link-icon {
  color: #8ee3cd;
}

.production-body .menu-badge {
  min-width: 22px;
  height: 22px;
  margin-left: 0;
  padding: 0 7px;
  color: #3b2600;
  background: #f2b84b;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.production-body .logout-button {
  color: rgba(239, 248, 245, 0.72);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}

.production-body .logout-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- Page heading ---------- */
.production-body .page-head {
  align-items: center;
  margin-bottom: 18px;
}

.production-body .page-head h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Panels ---------- */
.production-body .card-panel,
.production-body .profile-card,
.production-body .form-panel,
.production-body .stats-rank-card,
.production-body .drawing-library-card,
.production-body .stats-rank-card:nth-child(2n),
.production-body .stats-rank-card:nth-child(3n),
.production-body .drawing-library-card:nth-child(4n + 2),
.production-body .drawing-library-card:nth-child(4n + 3),
.production-body .drawing-library-card:nth-child(4n) {
  background: var(--surface);
  border-color: #dde4e0;
  box-shadow: 0 1px 2px rgba(20, 40, 34, 0.04);
}

.production-body .card-panel,
.production-body .profile-card,
.production-body .form-panel {
  border-radius: 14px;
}

.production-body .card-panel > h2,
.production-body .profile-card > h2,
.production-body .form-panel > h2,
.production-body .stats-rank-card > h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

/* KPI tiles keep a neutral surface; the numbers carry the emphasis. */
.production-body .stats-kpi,
.production-body .stats-kpi:nth-child(5n + 2),
.production-body .stats-kpi:nth-child(5n + 3),
.production-body .stats-kpi:nth-child(5n + 4),
.production-body .stats-kpi:nth-child(5n) {
  --ui-card-accent: transparent;
  background: var(--surface);
  border-color: #dde4e0;
  box-shadow: 0 1px 2px rgba(20, 40, 34, 0.04);
}

.production-body .dashboard-card,
.production-body .dashboard-card:nth-child(6n + 2),
.production-body .dashboard-card:nth-child(6n + 3),
.production-body .dashboard-card:nth-child(6n + 4),
.production-body .dashboard-card:nth-child(6n + 5),
.production-body .dashboard-card:nth-child(6n) {
  --ui-card-accent: transparent;
  background: var(--surface);
  box-shadow: none;
}

.production-body .dashboard-card:not(:disabled):hover {
  background: var(--brand-quiet);
}

.production-body .planning-create-panel,
.production-body .procurement-board {
  background: var(--surface);
}

.production-body .planning-section-head > div > span {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.production-body .planning-list-card,
.production-body .planning-list-card:nth-child(4n + 2),
.production-body .planning-list-card:nth-child(4n + 3),
.production-body .planning-list-card:nth-child(4n) {
  background: var(--surface);
}

.production-body .planning-list-card.active {
  background: var(--brand-quiet);
}

.production-body .planning-dispatch-card:nth-child(4n + 2),
.production-body .planning-dispatch-card:nth-child(4n + 3),
.production-body .planning-dispatch-card:nth-child(4n),
.production-body .operation-dispatch-row:nth-child(4n + 2),
.production-body .operation-dispatch-row:nth-child(4n + 3),
.production-body .operation-dispatch-row:nth-child(4n) {
  border-color: var(--line);
  background: var(--surface);
}

/* ---------- Controls ---------- */
.production-body .primary-button,
.production-body .small-primary {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: none;
}

.production-body .primary-button:hover,
.production-body .small-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.production-body .primary-button,
.production-body .ghost-button,
.production-body .danger-button,
.production-body .small-primary,
.production-body .action-btn,
.production-body .icon-button,
.production-body .small-ghost {
  font-weight: 600;
}

.production-body .ghost-button,
.production-body .action-btn,
.production-body .small-ghost,
.production-body .icon-button {
  background: var(--surface);
}

.production-body :is(.primary-button, .ghost-button, .danger-button, .small-primary, .small-ghost, .action-btn):disabled {
  color: #8b9994;
  background: #edf1ef;
  border-color: #dce3df;
}

.production-body .field-block,
.production-body .form-grid label,
.production-body .confirm-input-wrap {
  font-weight: 600;
}

.production-body .segmented-control button,
.production-body .stats-switch-row button {
  font-weight: 600;
}

.production-body .segmented-control button.active,
.production-body .stats-switch-row button.active {
  color: var(--brand-strong);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 40, 34, 0.12);
}

/* ---------- Tables ---------- */
.production-body .table-scroll {
  border-color: #dde4e0;
  border-radius: 12px;
  box-shadow: none;
}

.production-body .data-table th {
  color: #52635d;
  background: #f4f7f5;
  border-bottom-color: #dde4e0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.production-body .data-table td {
  font-variant-numeric: tabular-nums;
}

.production-body .data-table tbody tr:nth-child(even) {
  background: transparent;
}

.production-body .data-table tbody tr:hover {
  background: #f3f8f6;
  box-shadow: inset 3px 0 0 rgba(8, 123, 103, 0.45);
}

.production-body .table-total,
.production-body .status-pill,
.production-body .blue-badge,
.production-body .account-status,
.production-body .legacy-tag,
.production-body .resource-chip,
.production-body .quality-gap {
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Operator report ---------- */
.production-body #viewSubmit .team-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  color: var(--text-soft);
  background: var(--surface);
  border-color: var(--line);
  border-radius: 999px;
}

.production-body #viewSubmit .team-strip::before {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  content: "";
  background: var(--brand);
  border-radius: 50%;
}

.production-body #operatorReportForm .operator-main-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.operator-quantity-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.operator-quantity-row > label,
.operator-quantity-main {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.production-body #btnFillRemaining {
  margin-top: 0;
  white-space: nowrap;
}

.operator-quantity-row .input {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.operator-quantity-row #operatorReportQuantity {
  font-size: 22px;
}

.production-body #operatorSelfCheckHint {
  margin: 10px 2px 0;
  color: var(--text-soft);
  font-size: 13px;
}

.production-body #operatorReportForm .operator-extra-panel {
  margin-top: 14px;
  padding: 12px 14px;
  background: transparent;
}

.production-body #operatorReportForm .operator-extra-panel summary {
  font-weight: 600;
}

.production-body #operatorReportForm .form-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.production-body #operatorReportForm .form-actions .primary-button {
  min-width: 132px;
}

/* ---------- Line change: the whole form fits above the records ---------- */
.production-body #adjustmentForm .form-grid {
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(0, 2.4fr);
}

.production-body #adjustmentForm .form-grid > label:nth-child(3) {
  grid-column: auto;
}

.production-body #adjustmentForm .form-grid > label:nth-child(4) {
  grid-column: 1 / -1;
}

.production-body #adjustmentForm .form-grid > label:nth-child(5) {
  grid-column: 1 / span 2;
}

.production-body #adjustmentForm .form-grid > label:nth-child(6) {
  grid-column: 3;
}

.production-body #adjustmentForm textarea {
  min-height: 72px;
}

.production-body #adjustmentForm #adjustmentContent {
  min-height: 84px;
}

@media (max-width: 760px) {
  .operator-quantity-row,
  .production-body #operatorReportForm .operator-main-grid,
  .production-body #adjustmentForm .form-grid {
    grid-template-columns: 1fr;
  }

  .production-body #adjustmentForm .form-grid > label:nth-child(n) {
    grid-column: auto;
  }

  .production-body .side-link.active {
    box-shadow: inset 0 -3px 0 #6fd6bd;
  }
}

/* ---------- Dark summary panels: one calm surface, no sheen or glow ---------- */
.production-body :is(.dashboard-command, .profile-desktop-hero, .drill-hero) {
  background: #14322b;
  border-color: #1d453b;
  box-shadow: none;
}

.production-body .dashboard-command {
  border-radius: 14px;
}

.production-body .dashboard-command::before,
.production-body .dashboard-command::after {
  content: none;
}

/* ---------- Readable minimum sizes ----------
   Secondary labels were 9-11px; on a scaled 1440 canvas they fall below 10px.
   Raise them without changing which text is shown. */
.production-body :is(
  .operation-progress-node > small, .operation-scroll-hint, .operation-health-meta,
  .piece-trace-table td:first-child b, .unit-operator-choice em, .dispatch-ai-provider,
  .dispatch-ai-recommendation p, .dispatch-ai-recommendation em, .dispatch-ai-operation small,
  .dispatch-ai-operation p, .dispatch-ai-trigger b, .dashboard-wip-section-head small,
  .dashboard-wip-stage-name small, .dashboard-wip-stage-total small, .dashboard-wip-stage-percent small,
  .dashboard-wip-example-list small, .dashboard-wip-example-list strong, .dashboard-wip-quiet,
  .dashboard-wip-stage-columns, .dashboard-wip-department-list > span, .dashboard-wip-stage-risk > small,
  .dashboard-wip-risk-ring small) {
  font-size: 11px;
}

.production-body :is(
  .operation-assignee-grid small, .assignment-overdue-toggle small, .security-badge,
  .operation-progress-missing p, .operation-progress-empty span, .operation-health-head,
  .operation-health-head b, .batch-participant-strip, .trace-outcome, .piece-trace-panel-head,
  .profile-meta-strip span, .profile-security-status small, .order-plan-source span,
  .operation-detail-ring span, .operation-detail-metrics span, .operation-detail-config span,
  .routing-requirement-toggle small, .planning-list-top em, .unit-match-main small,
  .unit-match-coverage small, .unit-operation-match-card header small, .unit-operator-choice small,
  .operation-claim-state, .planning-source-pill, .planning-team-pill, .planning-dispatch-kind small,
  .planning-dispatch-main p, .planning-dispatch-qty span, .planning-dispatch-due span,
  .planning-person-task-chip, .dispatch-ai-panel-head p, .dispatch-ai-recommendation strong,
  .dispatch-ai-recommendation span, .dispatch-ai-operator-candidates, .dispatch-ai-operation > span,
  .dispatch-ai-operation .input, .dispatch-ai-panel-actions p, .dispatch-ai-loading, .dispatch-ai-empty) {
  font-size: 12px;
}

.production-body :is(
  .assignment-route-step small, .operation-dispatch-action-copy span, .capability-summary-copy small,
  .capability-selected-count, .permission-toggle small, .result-mini-line, .progress-mini-line,
  .result-issue, .rank-subtitle, .resource-compact-line, .resource-summary-grid span,
  .resource-file-lines span, .version-history, .version-history-head, .version-history-empty,
  .file-status-card span, .order-scope-tabs button span, .operation-progress-order > span,
  .operation-overall, .operation-route-count, .operation-progress-meta, .dashboard-progress-pagination,
  .operation-progress-tooltip, .meta-box span, .card-meta span, .workspace-file-row span,
  .version-main > span, .planning-list-meta, .planning-due,
  .planning-selected-head .status-badge, .planning-dispatch-card .status-badge, .unit-coverage-state,
  .unit-capability-actions p, .unit-operation-match-card > header > b, .unit-operation-unmatched,
  .planning-bom-preview-tools > span, .planning-bom-preview-toggle, .planning-dispatch-kind > span,
  .planning-empty-card p, .unit-summary-card span, .procurement-summary-card span,
  .unit-summary-card small, .procurement-summary-card small, .procurement-task-date span,
  .procurement-task-main p, .procurement-task-state small, .procurement-task-date em,
  .task-center-tabs button > small, .material-evidence-item > span, .material-evidence-item small,
  .material-evidence-item em, .planning-list-operation b, .person-rank-scale, .person-rank-value,
  .person-rank-name, .person-rank-foot, .dashboard-trace-chain small, .dashboard-trace-chain em,
  .dashboard-trace-mark-audit > span, .dashboard-trace-events span, .dashboard-trace-events small,
  .trace-code-preview span, .trace-code-preview small, .bom-import-summary span,
  .bom-import-summary small, .bom-level, .bom-import-action, .integrity-reason-title > span,
  .profile-filter-bar label, .profile-identity-block span, .profile-identity-block small,
  .profile-security-note p, .dashboard-progress-toolbar > label > span:first-child,
  .dashboard-card-top em, .dashboard-alert-line button) {
  font-size: 12px;
}

.production-body .piece-trace-table :is(th, td) {
  font-size: 12px;
}

/* ---------- Login ---------- */
.login-body {
  background: var(--bg);
}

.login-body .login-card {
  background: var(--surface);
  border-color: #dde4e0;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(23, 48, 40, 0.08);
  backdrop-filter: none;
}

.login-body .login-title h1 {
  font-weight: 700;
  letter-spacing: 0;
}

.login-body .primary-button {
  background: var(--brand);
  border-color: var(--brand);
  border-radius: 10px;
  box-shadow: none;
}

.login-body .primary-button:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}
