/* ==========================================================================
   Production Dashboard — Y2J Machinery
   Palette: validated categorical/status/sequential set (see dataviz skill)
   ========================================================================== */

:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --surface-page:   #f9f9f7;
  --surface-card:   #ffffff;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border-hairline: rgba(11,11,11,0.10);

  --series-1: #2a78d6; /* blue */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* green */
  --series-7: #4a3aa7; /* violet */
  --series-8: #e34948; /* red */

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --sidebar-bg: #12141a;
  --sidebar-fg: #e7e7e5;
  --sidebar-fg-muted: #9a9a97;
  --sidebar-active: rgba(255,255,255,0.08);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --surface-page:   #0d0d0d;
    --surface-card:   #1f1f1e;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border-hairline: rgba(255,255,255,0.10);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #1a1a19;
  --surface-page:   #0d0d0d;
  --surface-card:   #1f1f1e;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --gridline:       #2c2c2a;
  --baseline:       #383835;
  --border-hairline: rgba(255,255,255,0.10);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", "Leelawadee UI", "Tahoma", sans-serif;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--series-1);
  color: white;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.brand-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-fg-muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: transparent;
  border: none;
  color: var(--sidebar-fg-muted);
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item .nav-icon { font-size: 8px; color: var(--series-1); }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--sidebar-fg); }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }

.sidebar-footer {
  padding: 12px 8px 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11.5px;
}
.footer-label { color: var(--sidebar-fg); font-weight: 600; }
.footer-sub { color: var(--sidebar-fg-muted); margin-top: 2px; }

/* Main */
.main { flex: 1; min-width: 0; padding: 22px 28px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.topbar-title { font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.data-badge {
  font-size: 11.5px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 999px;
}
.theme-toggle {
  border: 1px solid var(--border-hairline);
  background: var(--surface-card);
  border-radius: 8px;
  width: 34px; height: 34px;
  cursor: pointer;
  font-size: 15px;
}
.role-picker {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
}
.role-picker select {
  font: inherit; font-size: 12.5px; color: var(--text-primary);
  background: var(--surface-card); border: 1px solid var(--border-hairline);
  border-radius: 8px; padding: 6px 8px;
}

.view { display: none; flex-direction: column; gap: 18px; }
.view.active { display: flex; }

/* Stat tiles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.stat-tile {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-label { font-size: 12.5px; color: var(--text-secondary); }
.stat-value { font-size: 30px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* Cards */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  overflow: hidden;
}
.card-header { padding: 16px 20px 10px; }
.card-header h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.card-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--text-secondary); }
.card-body { padding: 6px 20px 20px; }
.card-body p { font-size: 13.5px; line-height: 1.7; color: var(--text-secondary); }
.muted-note { color: var(--text-muted) !important; font-size: 12.5px !important; }

/* Charts */
.chart-wrap { position: relative; height: 340px; margin-top: 8px; }
.chart-wrap-lg { height: 420px; }
.chart-wrap-md { height: 260px; }

.overview-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.legend-row {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 10px; font-size: 12.5px; color: var(--text-secondary);
}
.legend-row .legend-swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px;
}

.status-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12.5px; }
.status-chip.status-good { color: var(--status-good); }
.status-chip.status-warning { color: #a06a00; }
.status-chip.status-critical { color: var(--status-critical); }
:root[data-theme="dark"] .status-chip.status-warning { color: var(--status-warning); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .status-chip.status-warning { color: var(--status-warning); }
}

/* Table */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-weight: 600; color: var(--text-secondary);
  border-bottom: 1px solid var(--gridline);
  padding: 9px 10px; white-space: nowrap;
}
.data-table td {
  padding: 9px 10px; border-bottom: 1px solid var(--gridline);
  color: var(--text-primary); white-space: nowrap;
}
.data-table tbody tr:hover { background: var(--surface-1); }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill-good { background: color-mix(in srgb, var(--status-good) 15%, transparent); color: var(--status-good); }
.pill-warning { background: color-mix(in srgb, var(--status-warning) 22%, transparent); color: #a06a00; }
.pill-critical { background: color-mix(in srgb, var(--status-critical) 15%, transparent); color: var(--status-critical); }
.pill-doFirst { background: color-mix(in srgb, var(--series-8) 15%, transparent); color: var(--series-8); }
.pill-schedule { background: color-mix(in srgb, var(--series-1) 15%, transparent); color: var(--series-1); }
.pill-delegate { background: color-mix(in srgb, var(--series-4) 20%, transparent); color: #8a6a00; }
.pill-eliminate { background: color-mix(in srgb, var(--text-muted) 20%, transparent); color: var(--text-secondary); }

/* Filter row */
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 13px; }
.filter-row select {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary); font-family: inherit; font-size: 13px;
}

/* Gantt */
.gantt-wrap { overflow-x: auto; }
.gantt { min-width: 800px; }
.gantt-row { display: grid; grid-template-columns: 176px 1fr; align-items: center; min-height: 40px; }
.gantt-row-label {
  font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  padding-right: 10px; position: sticky; left: 0; background: var(--surface-card);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.gantt-row-label span { min-width: 0; }
.ms-row-edit { margin: 0; flex: none; }
.gantt-track {
  position: relative; height: 26px; background: var(--surface-1);
  border-radius: 6px; border: 1px solid var(--gridline);
}
.gantt-bar {
  position: absolute; top: 3px; height: 20px; border-radius: 4px;
  font-size: 10.5px; color: white; display: flex; align-items: center;
  padding: 0 6px; white-space: nowrap; overflow: hidden;
  cursor: default;
}
.gantt-header { display: grid; grid-template-columns: 176px 1fr; margin-bottom: 6px; }
.gantt-header-weeks { display: grid; font-size: 10.5px; color: var(--text-muted); }
.gantt-week-tick { border-left: 1px dashed var(--gridline); padding-left: 4px; }

/* Make or Buy form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
  margin-bottom: 14px;
}
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12px; color: var(--text-secondary); }
.form-field input, .form-field select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary); font-family: inherit; font-size: 13.5px;
  width: 100%;
}
.form-field input[type="range"] {
  padding: 0; border: none; background: transparent; accent-color: var(--series-1); height: 20px;
}
.form-field label span { font-weight: 700; color: var(--text-primary); }
.btn-primary {
  background: var(--series-1); color: white; border: none;
  padding: 10px 22px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-primary:hover { filter: brightness(1.08); }

.mob-result {
  margin: 16px 0; padding: 16px; border-radius: 10px;
  background: var(--surface-1); border: 1px solid var(--border-hairline);
  font-size: 13.5px; line-height: 1.8;
}
.mob-result .recommend {
  font-size: 15px; font-weight: 700; margin-bottom: 6px;
}
.mob-result .recommend.make { color: var(--series-1); }
.mob-result .recommend.buy { color: var(--series-2); }

/* Work Orders — role actions, toolbar, save status, modals */
.wo-card-header, .card-header-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }
.save-status {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary);
  margin: -6px 0 12px;
}
.save-status .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--status-good); flex: none; }
.save-status.stale .dot { background: var(--status-warning); }

.btn-secondary {
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border-hairline);
  padding: 9px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-secondary:hover { filter: brightness(0.97); }
:root[data-theme="dark"] .btn-secondary:hover,
:root:where(:not([data-theme="light"])) .btn-secondary:hover { filter: brightness(1.15); }

.btn-chip {
  font: inherit; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--series-1);
  cursor: pointer; white-space: nowrap; margin: 2px 3px 2px 0;
}
.btn-chip:hover { filter: brightness(0.97); }
:root[data-theme="dark"] .btn-chip:hover,
:root:where(:not([data-theme="light"])) .btn-chip:hover { filter: brightness(1.2); }
.wo-actions-cell { white-space: nowrap; }

.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  align-items: center; justify-content: center; padding: 16px; z-index: 30;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface-card); border: 1px solid var(--border-hairline); border-radius: 12px;
  padding: 20px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,0.35);
}
.modal h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.modal .form-field { gap: 5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Toast notifications */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 50;
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--surface-card); color: var(--text-primary); border: 1px solid var(--border-hairline);
  border-left: 3px solid var(--series-1); border-radius: 8px; padding: 10px 16px;
  font-size: 13px; box-shadow: 0 8px 24px -8px rgba(0,0,0,0.35);
  opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-good { border-left-color: var(--status-good); }
.toast-warn { border-left-color: var(--status-warning); }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* Quick search box (Work Orders) */
.wo-search {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary); font-family: inherit; font-size: 13.5px;
  min-width: 220px;
}

/* Responsive */
.topbar { flex-wrap: wrap; row-gap: 10px; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .overview-charts { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; align-items: center; }
  .brand { border-bottom: none; margin-bottom: 0; }
  .nav { flex-direction: row; }
  .footer-label, .footer-sub { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .role-picker select { max-width: 140px; }
}
@media (max-width: 480px) {
  .data-badge { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .role-picker span, .role-picker { font-size: 11px; }
  .wo-search { min-width: 0; flex: 1 1 160px; }
  .modal { max-width: 100%; }
}

/* Pilot Test */
.modal { max-height: calc(100vh - 32px); overflow-y: auto; }
.pilot-stat-grid { grid-template-columns: repeat(4, 1fr); }
.pilot-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.pilot-kpi-name { white-space: normal !important; min-width: 220px; max-width: 360px; }
.pilot-kpi-method { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; white-space: normal; }
.pilot-inline {
  width: 90px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary); font-family: inherit; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.form-field input:disabled { opacity: .75; }
.pilot-feedback-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pilot-feedback-form input {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary); font-family: inherit; font-size: 13.5px;
}
.pilot-feedback-form input:first-child { flex: 2 1 260px; }
.pilot-feedback-form input:nth-child(2) { flex: 1 1 160px; }
.pilot-quote { border-left: 3px solid var(--series-1); padding: 6px 12px; margin: 8px 0; }
.pilot-quote-text { font-size: 13.5px; color: var(--text-primary); line-height: 1.6; }
.pilot-quote-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
[hidden] { display: none !important; }
@media (max-width: 980px) { .pilot-stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .pilot-stat-grid { grid-template-columns: 1fr; } }

/* Print: only the Pilot results, for attaching to the award submission */
@media print {
  body.printing-pilot .sidebar,
  body.printing-pilot .topbar,
  body.printing-pilot .view:not(#view-pilot),
  body.printing-pilot .pilot-toolbar,
  body.printing-pilot .pilot-edit-only,
  body.printing-pilot .pilot-backup-card,
  body.printing-pilot .save-status,
  body.printing-pilot .toast-container { display: none !important; }
  body.printing-pilot #view-pilot { display: flex !important; }
  body.printing-pilot .main { padding: 0; }
  body.printing-pilot .card, body.printing-pilot .stat-tile { break-inside: avoid; }
  body.printing-pilot .pilot-inline { border: none; background: transparent; padding: 0; }
}

/* Department workspaces */
.dept-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.dept-tab {
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-hairline); background: var(--surface-card); color: var(--text-secondary);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.dept-tab:hover { color: var(--text-primary); }
.dept-tab.active { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.dept-tab-count {
  font-size: 11px; min-width: 20px; padding: 1px 6px; border-radius: 999px; text-align: center;
  background: color-mix(in srgb, var(--text-muted) 20%, transparent); color: inherit;
}
.dept-tab.active .dept-tab-count { background: rgba(255,255,255,0.25); }
.dept-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); }
.dept-save { padding: 0 20px; margin: 0 0 6px; }
.dept-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.dept-doc-card {
  font: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary);
}
.dept-doc-card:hover { border-color: var(--series-1); }
.dept-doc-card.active { border-color: var(--series-1); box-shadow: inset 0 0 0 1px var(--series-1); background: color-mix(in srgb, var(--series-1) 8%, var(--surface-card)); }
.dept-doc-abbr { font-size: 11px; font-weight: 700; color: var(--series-1); letter-spacing: .04em; }
.dept-doc-name { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.dept-doc-purpose { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.dept-doc-meta { font-size: 11.5px; color: var(--text-muted); margin-top: auto; padding-top: 4px; }
.dept-title-cell { white-space: normal !important; min-width: 200px; max-width: 340px; }
.mono-cell { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.muted-inline { font-size: 12.5px; color: var(--text-muted); }
.modal-wide { max-width: 620px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.modal-grid .form-field:has(textarea) { grid-column: 1 / -1; }
.form-field textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary); font-family: inherit; font-size: 13.5px; width: 100%; resize: vertical;
}
.form-field select:disabled, .form-field textarea:disabled { opacity: .75; }
.bom-actions { margin: 10px 0 6px; }
.bom-inline {
  padding: 5px 7px; border-radius: 6px; border: 1px solid var(--border-hairline);
  background: var(--surface-1); color: var(--text-primary); font-family: inherit; font-size: 13px; width: 100%;
}
.bom-code { min-width: 90px; }
.bom-part { min-width: 240px; }
.bom-qty { width: 70px; }
.bom-history-title { margin: 18px 0 6px; font-size: 13.5px; }
.bom-history { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); line-height: 1.9; }
@media (max-width: 720px) { .modal-grid { grid-template-columns: 1fr; } }

/* Concept Demo link — top of the sidebar, under the brand */
.demo-link {
  display: block; margin: 0 4px 14px; padding: 9px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; text-decoration: none; line-height: 1.4;
  color: #fff; background: color-mix(in srgb, var(--series-1) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--series-1) 60%, transparent);
}
.demo-link:hover { background: color-mix(in srgb, var(--series-1) 45%, transparent); }
@media (max-width: 720px) {
  .demo-link { margin: 0 8px; flex: none; white-space: nowrap; }
}

/* ---- Document view: paper form (always paper-white, like a printed page) ---- */
.link-btn {
  font: inherit; color: var(--text-primary); background: none; border: none; padding: 0;
  text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--baseline); text-underline-offset: 3px;
}
.link-btn:hover { color: var(--series-1); text-decoration-color: currentColor; }
.attach-count { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.dwg-chip { font-family: ui-monospace, Consolas, monospace; }
.dwg-chip-pending { color: #a06a00; }

.docview-backdrop { align-items: flex-start; overflow-y: auto; padding: 20px 12px 40px; }
.docview-wrap { width: 100%; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.docview-actions {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  position: sticky; top: 0; z-index: 2; padding: 8px; border-radius: 10px;
  background: color-mix(in srgb, var(--surface-card) 92%, transparent); border: 1px solid var(--border-hairline);
}
.paper {
  --p-ink: #1a1a1a; --p-muted: #5d5d5d; --p-line: #cfcfcf; --p-soft: #f4f4f2; --p-accent: #1f5fa8;
  background: #fff; color: var(--p-ink); border-radius: 4px; padding: 32px 36px 24px;
  box-shadow: 0 10px 40px -12px rgba(0,0,0,.45); font-size: 13px; line-height: 1.55;
  color-scheme: light;
}
.paper-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding-bottom: 12px; border-bottom: 2px solid var(--p-ink); }
.paper-brand { display: flex; gap: 12px; align-items: center; }
.paper-logo {
  width: 46px; height: 46px; border-radius: 8px; background: var(--p-accent, #1f5fa8); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none;
}
.paper-logo-img { max-width: 110px; max-height: 56px; object-fit: contain; flex: none; }
.paper-company { font-size: 16px; font-weight: 800; }
.paper-company-en { font-size: 12.5px; font-weight: 600; }
.paper-address { font-size: 11px; color: var(--p-muted); }
.paper-dept { font-size: 12px; color: var(--p-muted); }
.paper-docbox { border: 1px solid var(--p-ink); padding: 6px 12px; text-align: right; min-width: 170px; }
.paper-docno-label { font-size: 10.5px; color: var(--p-muted); }
.paper-docno { font-family: ui-monospace, Consolas, monospace; font-weight: 800; font-size: 15px; }
.paper-docdate { font-size: 11.5px; }
.paper-titlebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0 10px; }
.paper-title { font-size: 18px; font-weight: 800; }
.paper-title-en { font-size: 11.5px; color: var(--p-muted); letter-spacing: .03em; }
.paper-stamp {
  border: 2.5px solid; border-radius: 6px; padding: 4px 12px; font-weight: 800; font-size: 13px;
  transform: rotate(-4deg); white-space: nowrap;
}
.stamp-good { color: #1b7a1b; }
.stamp-critical { color: #b42323; }
.stamp-warning { color: #9a6500; }
.stamp-info { color: #1f5fa8; }
.stamp-neutral { color: #5d5d5d; }
.paper-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 12px; font-size: 11.5px; }
.flow-step { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--p-line); color: var(--p-muted); }
.flow-step.done { background: var(--p-soft); color: var(--p-ink); }
.flow-step.current { background: var(--p-ink); border-color: var(--p-ink); color: #fff; font-weight: 700; }
.flow-step.off { margin-left: 8px; }
.flow-arrow { color: var(--p-line); }
.paper-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--p-line); border-left: 1px solid var(--p-line); }
.paper-row { display: grid; grid-template-columns: 38% 1fr; border-right: 1px solid var(--p-line); border-bottom: 1px solid var(--p-line); }
.paper-row-wide { grid-column: 1 / -1; grid-template-columns: 19% 1fr; }
.paper-label { background: var(--p-soft); padding: 6px 10px; font-size: 12px; color: var(--p-muted); font-weight: 600; }
.paper-value { padding: 6px 10px; word-break: break-word; }
.paper-value a { color: var(--p-accent); }
.paper-empty { color: #9a9a9a; }
.paper-section-title { font-weight: 800; font-size: 13px; margin: 16px 0 6px; padding-left: 8px; border-left: 3px solid var(--p-accent); }
.paper-textbox { border: 1px solid var(--p-line); min-height: 52px; padding: 8px 10px; }
.paper-related { display: flex; flex-wrap: wrap; gap: 6px; }
.rel-chip {
  font: inherit; font-size: 12px; border: 1px solid var(--p-line); background: #fff; color: var(--p-ink);
  border-radius: 6px; padding: 3px 9px; cursor: pointer; text-align: left;
}
.rel-chip:hover { border-color: var(--p-accent); color: var(--p-accent); }
.rel-dir { color: var(--p-muted); font-size: 11px; }
.rel-status { color: var(--p-muted); }
.paper-attach { display: flex; flex-wrap: wrap; gap: 10px; }
.attach-item { display: flex; gap: 8px; align-items: center; border: 1px solid var(--p-line); border-radius: 6px; padding: 6px; max-width: 100%; }
.attach-item img { width: 96px; height: 72px; object-fit: cover; border-radius: 4px; display: block; }
.attach-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: var(--p-soft); border-radius: 4px; font-weight: 800; font-size: 12px; color: var(--p-muted); }
.attach-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-width: 0; }
.attach-meta a { color: var(--p-accent); word-break: break-all; }
.paper .btn-chip { background: #fff; color: var(--p-accent); border-color: var(--p-line); }
.dwg-preview { border: 1px solid var(--p-line); min-height: 60px; display: flex; align-items: center; justify-content: center; padding: 8px; background: var(--p-soft); }
.dwg-preview img { max-width: 100%; max-height: 560px; }
.dwg-preview iframe { width: 100%; height: 520px; border: none; background: #fff; }
.paper-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12.5px; }
.paper-table th, .paper-table td { border: 1px solid var(--p-line); padding: 5px 7px; text-align: left; vertical-align: top; }
.paper-table th { background: var(--p-soft); font-weight: 700; color: var(--p-ink); }
.paper-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.paper-table-compact { font-size: 12px; }
.paper-select { font: inherit; font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--p-line); border-radius: 4px; background: #fff; color: var(--p-ink); max-width: 100%; }
.print-only { display: none; }
.paper.pdf-capture .paper-select { display: none; }
.paper.pdf-capture .print-only { display: inline; }
.paper-sigs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 26px; }
.sig-box { text-align: center; font-size: 12px; }
.sig-line { border-bottom: 1px dotted var(--p-ink); min-height: 34px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2px; }
.sig-label { font-weight: 700; margin-top: 4px; }
.sig-date { color: var(--p-muted); font-size: 11px; margin-top: 2px; }
.paper-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 6px; border-top: 1px solid var(--p-line); font-size: 10.5px; color: var(--p-muted); }

/* Drawing registration */
.dwg-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer;
  border: 2px dashed var(--baseline); border-radius: 10px; padding: 18px; font-size: 13.5px; color: var(--text-secondary);
}
.dwg-drop.over, .dwg-drop:hover { border-color: var(--series-1); background: color-mix(in srgb, var(--series-1) 8%, transparent); }
.dwg-drop-icon { font-size: 22px; color: var(--series-1); }
.dwg-row { border: 1px solid var(--border-hairline); border-radius: 8px; padding: 10px; margin-top: 8px; }
.dwg-row-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; word-break: break-all; }
.dwg-row-fields { display: grid; grid-template-columns: 2fr 2fr 1.2fr 0.6fr; gap: 8px; }

/* Form designer */
.fs-logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fs-logo-preview { width: 120px; height: 64px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--border-hairline); border-radius: 8px; }
.fs-logo-preview img { max-width: 110px; max-height: 56px; }
.fs-logo-row label.btn-secondary { display: inline-block; }
.modal-grid-wide { grid-column: 1 / -1; }
.fs-check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-secondary); }

@media (max-width: 720px) {
  .paper { padding: 18px 14px; }
  .paper-head, .paper-titlebar { flex-direction: column; align-items: stretch; }
  .paper-docbox { text-align: left; }
  .paper-grid { grid-template-columns: 1fr; }
  .paper-row-wide { grid-template-columns: 38% 1fr; }
  .paper-sigs { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .dwg-row-fields { grid-template-columns: 1fr 1fr; }
  .paper-table { display: block; overflow-x: auto; }
}

@media print {
  body.printing-doc .app-shell,
  body.printing-doc .toast-container,
  body.printing-doc .modal-backdrop:not(#docViewBackdrop),
  body.printing-doc .docview-actions { display: none !important; }
  body.printing-doc { background: #fff !important; }
  body.printing-doc #docViewBackdrop { display: block !important; position: static; background: none; padding: 0; overflow: visible; }
  body.printing-doc .docview-wrap { max-width: none; }
  body.printing-doc .paper { box-shadow: none; border-radius: 0; padding: 0; }
  body.printing-doc .paper-select { display: none; }
  body.printing-doc .print-only { display: inline; }
  body.printing-doc .paper-row, body.printing-doc tr, body.printing-doc .sig-box, body.printing-doc .attach-item { break-inside: avoid; }
  @page { size: A4; margin: 12mm; }
}

/* ---- Login ---- */
.app-shell[hidden] { display: none !important; }
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(ellipse at top, color-mix(in srgb, var(--series-1) 18%, var(--surface-page)), var(--surface-page) 60%);
}
.login-card {
  width: 100%; max-width: 560px; background: var(--surface-card); border: 1px solid var(--border-hairline);
  border-radius: 16px; padding: 24px; box-shadow: 0 20px 50px -24px rgba(0,0,0,.45);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-title { font-size: 19px; font-weight: 800; }
.login-sub { font-size: 13px; color: var(--text-secondary); }
.login-step { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin: 12px 0 8px; }
.login-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.login-user {
  font: inherit; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  padding: 10px; border-radius: 10px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary);
}
.login-user:hover { border-color: var(--series-1); }
.login-user.active { border-color: var(--series-1); box-shadow: inset 0 0 0 1px var(--series-1); }
.login-user-text { display: flex; flex-direction: column; min-width: 0; }
.login-user-text strong { font-size: 13.5px; }
.login-user-text span { font-size: 11.5px; color: var(--text-muted); }
.login-avatar {
  width: 34px; height: 34px; border-radius: 999px; flex: none; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--series-1) 22%, transparent); color: var(--series-1); font-weight: 800;
}
.login-avatar.small { width: 28px; height: 28px; font-size: 13px; }
.login-pin-row { display: flex; gap: 8px; }
.login-pin-row input {
  flex: 1; font: inherit; font-size: 20px; letter-spacing: .4em; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary); min-width: 0;
}
.login-error { color: var(--status-critical); font-size: 13px; margin: 6px 0 0; }
/* grouped user picker */
.login-card:has(.login-sec) { max-width: 820px; }
.login-users { display: block; max-height: min(56vh, 620px); overflow-y: auto; padding-right: 4px; }
.login-search {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; padding: 9px 12px; margin-bottom: 4px;
  border-radius: 10px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary);
}
.login-sec { margin-top: 12px; }
.login-sec h4 {
  margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px; position: sticky; top: 0; background: var(--surface-card); padding: 4px 0; z-index: 1;
}
.login-sec h4 span { font-weight: 600; font-size: 11px; color: var(--text-muted); border: 1px solid var(--border-hairline); border-radius: 999px; padding: 0 7px; }
.login-sec-recent h4 { color: var(--series-1); }
.login-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.login-user { position: relative; }
.login-user[hidden], .login-sec[hidden] { display: none; }
.login-user[data-sec="1"] { --sec: var(--series-1); } .login-user[data-sec="2"] { --sec: var(--series-2); }
.login-user[data-sec="3"] { --sec: var(--series-3); } .login-user[data-sec="4"] { --sec: var(--series-4); }
.login-user[data-sec="5"] { --sec: var(--series-5); } .login-user[data-sec="6"] { --sec: var(--series-6); }
.login-user[data-sec="7"] { --sec: var(--series-7); } .login-user[data-sec="8"] { --sec: var(--series-8); }
.login-user .login-avatar { background: color-mix(in srgb, var(--sec, var(--series-1)) 20%, transparent); color: var(--sec, var(--series-1)); }
.login-user-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-tag { margin-left: auto; flex: none; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: var(--sec, var(--series-1)); border: 1px solid currentColor; }
.login-empty { font-size: 13px; color: var(--text-muted); text-align: center; margin: 16px 0; }
.login-pin { padding-top: 4px; border-top: 1px solid var(--border-hairline); margin-top: 10px; }
.login-hint { font-size: 12.5px; color: var(--text-muted); margin: 16px 0 0; line-height: 1.6; }

/* ---- User chip (topbar) ---- */
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border-hairline); background: var(--surface-card);
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-text strong { font-size: 12.5px; }
.user-chip-text span { font-size: 11px; color: var(--text-muted); }
.user-chip .btn-chip { margin: 0; }

/* ---- Confidentiality ---- */
.conf-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; color: #9a6500; background: color-mix(in srgb, var(--status-warning) 18%, transparent); }
.paper-conf { text-align: center; font-weight: 800; letter-spacing: .08em; color: #b42323; border: 2px solid #b42323; padding: 3px; margin: -8px 0 12px; font-size: 12.5px; }
.paper-history { font-size: 12px; }
.paper-history .paper-table { margin-top: 8px; }
.doc-meta { font-size: 12px; color: var(--text-muted); margin: 0; }
.doc-meta strong { color: var(--text-secondary); }
.vis-custom { border: 1px dashed var(--baseline); border-radius: 8px; padding: 10px; display: grid; gap: 10px; }
.vis-group { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.vis-group-title { width: 100%; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.vis-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-primary); }

/* ---- Admin ---- */
.admin-note { font-size: 12px; color: var(--text-muted); margin: 10px 0 14px; padding: 8px 10px; border-radius: 8px; background: var(--surface-1); border: 1px solid var(--border-hairline); }
.row-muted td { opacity: .55; }
.modal-xwide { max-width: 900px; }
.ue-section-title { font-size: 13px; font-weight: 800; margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ue-perm-tools { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; }
.ue-perm-tools select { font: inherit; font-size: 12px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary); }
.fs-check.inline { font-weight: 400; font-size: 12px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 10px; }
.perm-dept { border: 1px solid var(--border-hairline); border-radius: 8px; padding: 8px 10px; }
.perm-dept-title { font-size: 12.5px; font-weight: 800; color: var(--series-1); margin-bottom: 4px; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; padding: 3px 0; border-top: 1px solid var(--gridline); }
.perm-row:first-of-type { border-top: none; }
.perm-row span { min-width: 0; }
.perm-select { font: inherit; font-size: 12px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary); flex: none; max-width: 170px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.team-card { border: 1px solid var(--border-hairline); border-radius: 10px; padding: 12px; background: var(--surface-1); }
.team-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.team-members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.audit-detail { white-space: normal !important; min-width: 280px; max-width: 520px; font-size: 12.5px; color: var(--text-secondary); }

/* ---- Plans ---- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.plan-card { border: 1px solid var(--border-hairline); border-radius: 12px; padding: 14px; background: var(--surface-1); display: flex; flex-direction: column; gap: 6px; }
.plan-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-vis { font-size: 11.5px; color: var(--text-muted); }
.plan-title { margin: 2px 0 0; font-size: 14.5px; line-height: 1.4; }
.plan-detail { margin: 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.plan-meta { font-size: 12px; color: var(--text-muted); }
.plan-overdue { color: var(--status-critical); font-weight: 700; }
.plan-progress { height: 8px; border-radius: 999px; background: var(--gridline); overflow: hidden; margin-top: 4px; }
.plan-progress span { display: block; height: 100%; background: var(--series-1); border-radius: 999px; }
.plan-pct { font-size: 11.5px; color: var(--text-secondary); text-align: right; margin-top: -2px; font-variant-numeric: tabular-nums; }
.plan-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.plan-items label { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.plan-items input { margin-top: 3px; }
.plan-done { text-decoration: line-through; color: var(--text-muted); }
.plan-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--gridline); }

@media (max-width: 720px) {
  .user-chip-text span { display: none; }
  .perm-grid { grid-template-columns: 1fr; }
  .login-users { grid-template-columns: 1fr; }
  .login-grid { grid-template-columns: 1fr 1fr; }
  .login-users { max-height: none; }
}

/* ---- Procure-to-Pay tracker ---- */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th.num { text-align: right; }
.p2p-stepper { display: inline-flex; gap: 3px; align-items: center; }
.p2p-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--gridline); border: 1px solid var(--baseline); }
.p2p-dot.done { background: var(--status-good); border-color: var(--status-good); }
.p2p-dot.cur { width: 12px; height: 12px; background: var(--series-1); border-color: var(--series-1); }
.p2p-dot.cur.risk { background: var(--status-warning); border-color: var(--status-warning); }
.p2p-dot.cur.late { background: var(--status-critical); border-color: var(--status-critical); }
.p2p-dot.cancel { opacity: .35; }
.p2p-issues { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.p2p-issue { border: 1px solid var(--border-hairline); border-left: 4px solid var(--status-warning); border-radius: 8px; padding: 8px 12px; background: var(--surface-1); }
.p2p-issue-critical { border-left-color: var(--status-critical); }
.p2p-issue-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 13px; }
.p2p-issue-sev { font-size: 11.5px; font-weight: 800; color: #a06a00; }
.p2p-issue-critical .p2p-issue-sev { color: var(--status-critical); }
.p2p-issue-item { color: var(--text-secondary); }
.p2p-issue-text { font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.p2p-issue-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.p2p-issue-meta strong { color: var(--text-secondary); }
.p2p-bar-cell { min-width: 140px; }
.p2p-bar-track { position: relative; height: 12px; background: var(--surface-1); border: 1px solid var(--gridline); border-radius: 4px; }
.p2p-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 3px; }
.p2p-bar.over { background: var(--status-critical); }
.p2p-sla { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-primary); }
.p2p-over { font-size: 10.5px; font-weight: 800; color: var(--status-critical); }
.p2p-late-num { color: var(--status-critical); font-weight: 800; }
.p2p-case-list { white-space: normal !important; font-size: 12px; color: var(--text-secondary); max-width: 260px; }
.p2p-tl-done td:first-child { border-left: 3px solid #1b7a1b; }
.p2p-tl-ok td:first-child, .p2p-tl-risk td:first-child, .p2p-tl-late td:first-child { border-left: 3px solid #1f5fa8; background: #eef4fb; }
.p2p-tl-late td:first-child { border-left-color: #b42323; background: #fbeeee; }
.p2p-sheet-issue { margin-bottom: 6px; color: #9a6500; font-weight: 700; }
.p2p-sheet-issue.critical { color: #b42323; }
.p2p-sheet-issue span { font-weight: 400; color: #5d5d5d; font-size: 12px; }

.p2p-stack { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 1500px) { .p2p-stack { grid-template-columns: 1fr 1fr; } }

/* ---- Storage location (Google Sheets sync) ---- */
.sync-chip { font-size: 11.5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-hairline); background: var(--surface-card); color: var(--text-secondary); white-space: nowrap; }
.sync-chip.sync-saving { color: #a06a00; }
.sync-chip.sync-offline { color: var(--status-critical); border-color: color-mix(in srgb, var(--status-critical) 40%, transparent); }
.sync-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: var(--surface-page); }
.sync-overlay[hidden] { display: none !important; }
.sync-overlay-box { display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: 14px; color: var(--text-secondary); }
.sync-spinner { width: 34px; height: 34px; border-radius: 999px; border: 3px solid var(--gridline); border-top-color: var(--series-1); animation: y2jspin 0.9s linear infinite; }
@keyframes y2jspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sync-spinner { animation: none; } }
.sync-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface-card); border: 1px solid var(--series-1); box-shadow: 0 12px 30px -12px rgba(0,0,0,.45); font-size: 13px; max-width: calc(100vw - 32px); }
.storage-status { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.storage-mode { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.storage-sheets { background: color-mix(in srgb, var(--status-good) 12%, transparent); }
.storage-local { background: color-mix(in srgb, var(--status-warning) 15%, transparent); }
.storage-actions { margin: 8px 0 4px; }
.storage-steps { margin: 6px 0 12px; padding-left: 20px; font-size: 13px; line-height: 1.8; color: var(--text-secondary); }
.storage-steps .pilot-toolbar { margin: 4px 0; }
.storage-steps a.btn-secondary { text-decoration: none; display: inline-block; }

/* ---- Organisation: companies, logos, departments ---- */
.brand-mark.has-logo { background: #fff; padding: 3px; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.company-picker select { max-width: 220px; }
.org-head { padding: 12px 0 6px; }
.org-logo { width: 46px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--series-1); color: #fff; font-weight: 800; font-size: 11.5px; overflow: hidden; }
.org-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.org-logo-big span { font-weight: 800; font-size: 18px; color: #1f5fa8; }
.dp-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.dp-types .vis-group { border: 1px solid var(--border-hairline); border-radius: 8px; padding: 8px 10px; flex-direction: column; flex-wrap: nowrap; }

.bom-sheet-link { text-decoration: none; display: inline-flex; align-items: center; }

/* ---- BOM & requisitions / service / reports ------------------------------ */
.bx-tabs { margin: 16px 0 14px; }
.bx-itemno { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.bx-group-row td { background: var(--surface-1); border-top: 1px solid var(--border-hairline); }
.bx-assy-row td { background: color-mix(in srgb, var(--series-1) 5%, transparent); }
.bx-selected td { background: color-mix(in srgb, var(--series-1) 14%, transparent) !important; }
.bx-done-row td { opacity: 0.6; }
.bx-link { font: inherit; background: none; border: 0; padding: 0; color: var(--series-1); cursor: pointer; text-align: left; }
.bx-link:hover { text-decoration: underline; }
.bx-indent { display: inline-block; }
.bx-low { color: #a06a00; }
.bx-neg { color: var(--status-critical); font-weight: 600; }
.bx-late { border-color: var(--status-critical); color: var(--status-critical); }
.bx-tile-warn { border-left: 3px solid var(--status-warning); }
.bx-tile-bad { border-left: 3px solid var(--status-critical); }
.bx-detail-card { margin-top: 16px; }
.bx-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .bx-detail-grid { grid-template-columns: 1fr; } }
.bx-h4 { margin: 14px 0 6px; font-size: 13.5px; color: var(--text-primary); }
.bx-h4:first-child { margin-top: 0; }
.bx-kv th { width: 34%; text-align: left; color: var(--text-secondary); font-weight: 600; vertical-align: top; }
.bx-list { margin: 4px 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.bx-docgroup { margin-bottom: 8px; }
.bx-docgroup-title { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin: 6px 0 4px; }
.bx-reqchips { margin-bottom: 10px; font-size: 13px; }
.bx-pick input.bx-qty, .bx-issue, .bx-return { width: 78px; text-align: right; }
.bx-submit-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.bx-submit-row .form-field { min-width: 220px; }
.bx-bar { display: inline-block; width: 70px; height: 7px; border-radius: 4px; background: var(--gridline); vertical-align: middle; overflow: hidden; }
.bx-bar span { display: block; height: 100%; background: var(--status-good); }
.bx-log { font-size: 12.5px; max-height: 180px; overflow: auto; border-top: 1px solid var(--border-hairline); padding-top: 6px; }
.bx-userlist { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.bx-flow { margin: 4px 0 8px; }
.bx-p2p-chip { font-size: 11.5px; }
.rp-sections { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0; }
.rp-save-row { border-top: 1px solid var(--border-hairline); padding-top: 10px; }
.rp-block { margin-bottom: 18px; }
.rp-block-title { margin: 0 0 8px; font-size: 14px; color: var(--text-primary); border-left: 3px solid var(--series-1); padding-left: 8px; }
.rp-sub { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin: 10px 0 4px; }
.rp-kpis { grid-template-columns: repeat(3, 1fr); }
.rp-paper-meta { font-size: 12px; color: #555; margin: 4px 0 12px; }
.paper .rp-block-title { color: #111; }
.paper .stat-tile { background: #fff; border: 1px solid #ddd; color: #111; }
.paper .stat-value { color: #111; }
@media (max-width: 640px) {
  .bx-pick input.bx-qty, .bx-issue, .bx-return { width: 60px; }
  .rp-kpis { grid-template-columns: 1fr 1fr; }
}
#bxReqBody { max-width: 1180px; }
#bxReqBody td:nth-child(3) { min-width: 180px; }

.grp-line { font-size: 12.5px; margin-top: 6px; line-height: 1.7; }
.grp-label { color: var(--text-secondary); font-weight: 600; }
.ic-ok { color: var(--status-good); font-weight: 600; }

/* ---- customizable overview ------------------------------------------------- */
.ov-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ov-grid > .card { margin: 0; }
.ov-full { grid-column: 1 / -1; }
.ov-w-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ov-w-tools { display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; }
.ov-editing .ov-w { outline: 2px dashed var(--border-hairline); outline-offset: 2px; }
.ov-add-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ov-empty { margin: 4px 0; }
.ov-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ov-tile { font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.ov-tile:hover { border-color: var(--series-1); }
.ov-go { font: inherit; font-size: 12.5px; background: none; border: 0; color: var(--series-1); cursor: pointer; padding: 8px 0 0; }
.ov-go:hover { text-decoration: underline; }
.ov-flow { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding: 4px 2px 8px; }
.ov-flow-step { font: inherit; position: relative; flex: 1 1 0; min-width: 118px; display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 12px 10px; border-radius: 10px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary); cursor: pointer; }
.ov-flow-step:hover { border-color: var(--series-1); }
.ov-flow-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.ov-flow-n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.ov-flow-note { font-size: 11.5px; color: var(--text-muted); }
.ov-flow-arrow { align-self: center; font-size: 22px; color: var(--text-muted); }
.ov-bottleneck { border: 2px solid var(--status-critical); }
.ov-flow-flag { position: absolute; top: -9px; right: 8px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--status-critical); color: #fff; }
.ov-rows { display: flex; flex-direction: column; gap: 10px; }
.ov-row-head { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.ov-row-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ov-row-done { opacity: 0.6; }
.ov-bar { position: relative; height: 10px; border-radius: 5px; background: var(--gridline); margin-top: 5px; }
.ov-bar > span { display: block; height: 100%; border-radius: 5px; background: var(--series-1); }
.ov-bar > em { position: absolute; right: 0; top: -17px; font-style: normal; font-size: 11px; color: var(--text-secondary); }
.ov-bar-critical > span { background: var(--status-critical); }
.ov-bar-warning > span { background: var(--status-warning); }
.ov-bar-good > span { background: var(--status-good); }
.ov-mark { position: absolute; top: -3px; bottom: -3px; width: 0; }
.ov-mark-min { border-left: 2px dashed var(--text-muted); }
.ov-mark-dem { border-left: 3px solid var(--text-primary); }
.ov-health { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ov-gauge { width: 190px; flex: 0 0 auto; }
.ov-gauge-n { font-size: 40px; font-weight: 700; fill: var(--text-primary); }
.ov-gauge-sub { font-size: 11px; fill: var(--text-muted); }
.ov-health-side { flex: 1 1 220px; font-size: 13px; }
.ov-health-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ov-cols { width: 100%; max-height: 200px; }
.ov-cols g { cursor: default; }
.ov-cols g:hover rect[rx] { filter: brightness(1.1); }
.ov-col-n { font-size: 12px; font-weight: 700; fill: var(--text-primary); }
.ov-col-l { font-size: 10.5px; fill: var(--text-secondary); }
.ov-mini { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ov-mini > div { display: flex; flex-direction: column; }
.ov-mini-n { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.ov-mini-l { font-size: 11.5px; color: var(--text-muted); }
.ov-stack { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; }
.ov-stack-seg { display: block; min-width: 6px; }
.ov-tone-warning { background: var(--status-warning); }
.ov-tone-info { background: var(--series-1); }
.ov-tone-critical { background: var(--status-critical); }
.ov-tone-good { background: var(--status-good); }
.ov-tone-neutral { background: var(--text-muted); }
.ov-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--text-secondary); margin-top: 6px; align-items: center; }
.ov-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.ov-claims { margin-top: 10px; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.ov-activity { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.ov-heat-wrap { overflow-x: auto; }
.ov-heat { border-collapse: separate; border-spacing: 3px; font-size: 11.5px; }
.ov-heat th { font-weight: 600; color: var(--text-secondary); text-align: left; white-space: nowrap; padding-right: 6px; }
.ov-heat thead th { text-align: center; color: var(--text-muted); font-weight: 400; }
.ov-heat td { padding: 0; }
.ov-cell { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: middle; }
.ov-l0 { background: var(--gridline); }
.ov-l1 { background: color-mix(in srgb, var(--series-1) 30%, var(--surface-card)); }
.ov-l2 { background: color-mix(in srgb, var(--series-1) 55%, var(--surface-card)); }
.ov-l3 { background: color-mix(in srgb, var(--series-1) 78%, var(--surface-card)); }
.ov-l4 { background: var(--series-1); }
.ov-feed { list-style: none; margin: 0; padding: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; border-left: 1px solid var(--border-hairline); padding-left: 14px; }
.ov-pilot-empty p { font-size: 13px; color: var(--text-secondary); }
.ov-tip { position: fixed; z-index: 40; max-width: 320px; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; background: var(--text-primary); color: var(--surface-card); pointer-events: none; box-shadow: 0 6px 18px -6px rgba(0,0,0,0.35); }
@media (max-width: 900px) {
  .ov-grid { grid-template-columns: 1fr; }
  .ov-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-activity { grid-template-columns: 1fr; }
  .ov-feed { border-left: 0; padding-left: 0; }
}
@media (max-width: 480px) {
  .ov-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ov-grid > .card { min-width: 0; }

/* ---- R&D Workbench ---------------------------------------------------------- */
.rd-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .rd-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rd-gantt { overflow-x: auto; font-size: 12.5px; }
.rd-g-row { display: grid; grid-template-columns: 240px minmax(520px, 1fr); align-items: center; min-height: 28px; border-bottom: 1px solid var(--gridline); }
.rd-g-head { border-bottom: 1px solid var(--baseline); min-height: 24px; }
.rd-g-phase { background: var(--surface-1); font-weight: 700; }
.rd-g-label { padding: 4px 10px 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-g-track { position: relative; height: 100%; min-height: 26px; }
.rd-tick { position: absolute; top: 4px; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; transform: translateX(-2px); border-left: 1px solid var(--gridline); padding-left: 3px; }
.rd-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--status-critical); z-index: 1; }
.rd-bar { position: absolute; top: 7px; height: 13px; border-radius: 4px; overflow: hidden; min-width: 4px; }
.rd-bar > span { display: block; height: 100%; background: rgba(0,0,0,0.28); }
.rd-ms { position: absolute; top: 6px; width: 13px; height: 13px; transform: translateX(-6px) rotate(45deg); border-radius: 2px; }
.rd-tone-info { background: var(--series-1); }
.rd-tone-good { background: var(--status-good); }
.rd-tone-warning { background: var(--status-warning); }
.rd-tone-critical { background: var(--status-critical); }
.rd-tone-neutral { background: var(--text-muted); }
.rd-tasks input.bom-inline[type="date"] { width: 140px; }
.rd-actions { margin-top: 10px; }
.rd-step { text-align: center; font-weight: 700; }
.rd-ok { color: var(--status-good); }
.rd-no { color: var(--status-warning); }
.rd-skip { color: var(--text-muted); }
.rd-step .muted-inline { font-weight: 400; font-size: 10.5px; }
.rd-dots { display: flex; gap: 4px; margin-top: 5px; }
.rd-dot { width: 22px; height: 6px; border-radius: 3px; background: var(--gridline); }
.rd-dot.rd-ok { background: var(--status-good); }
.rd-dot.rd-no { background: var(--status-warning); }
.rd-stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--gridline); margin-top: 5px; }
.rd-stack > span { display: block; height: 100%; }
@media (max-width: 640px) { .rd-g-row { grid-template-columns: 150px minmax(420px, 1fr); } }

.rd-answer { margin-top: 4px; font-size: 12.5px; color: var(--status-good); }

/* ---- devices: phone & tablet ------------------------------------------------ */
.menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; margin-right: 10px; border-radius: 10px; border: 1px solid var(--border-hairline); background: var(--surface-card); color: var(--text-primary); font-size: 20px; cursor: pointer; flex: none; }
.density-toggle { font-weight: 700; font-size: 13px; }
.nav-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 44; }
.bottom-bar { display: none; }
html[data-density="large"] body { zoom: 1.14; }
html[data-density="compact"] body { zoom: 0.9; }

/* tablets and phones: the menu slides in from the left */
@media (max-width: 1024px) {
  .app-shell { flex-direction: column; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 86vw; flex-direction: column; overflow-y: auto; align-items: stretch;
    z-index: 45; transform: translateX(-105%); box-shadow: 0 0 32px rgba(0,0,0,0.4); padding-bottom: 24px; }
  .sidebar.open { transform: none; }
  html.nav-anim .sidebar { transition: transform 0.2s ease; }
  .sidebar .brand { border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 12px; }
  .sidebar .nav { flex-direction: column; }
  .sidebar .footer-label, .sidebar .footer-sub { display: block; }
  .menu-toggle { display: inline-flex; }
  .topbar { position: sticky; top: 0; z-index: 20; background: var(--surface-page); margin: -16px -16px 14px; padding: 10px 16px; border-bottom: 1px solid var(--border-hairline); }
  .topbar-title { flex: 1 1 0; min-width: 0; font-size: 17px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .topbar-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 1024px) and (min-width: 721px) {
  .main { padding: 16px 20px 60px; }
  .topbar { margin: -16px -20px 14px; padding: 10px 20px; }
}
/* phones: bottom shortcut bar, 2-up number tiles, full-width dialogs */
@media (max-width: 720px) {
  .bottom-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface-card); border-top: 1px solid var(--border-hairline);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px -8px rgba(0,0,0,0.25); }
  .bb-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 11px; cursor: pointer; border-radius: 8px; }
  .bb-item .bb-icon { font-size: 18px; line-height: 1.1; }
  .bb-item.active { color: var(--series-1); font-weight: 700; background: color-mix(in srgb, var(--series-1) 10%, transparent); }
  .main { padding: 16px 12px 88px; }
  .topbar { margin: -16px -12px 12px; padding: 8px 12px; }
  .topbar-title { font-size: 15.5px; line-height: 1.3; }
  .topbar-actions { width: 100%; }
  .stat-grid, .pilot-stat-grid, .rd-stat-grid, .ov-hero { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .stat-tile { padding: 10px 12px; }
  .stat-tile .stat-value { font-size: 22px; }
  .stat-tile .stat-note { font-size: 11px; }
  .card-header h3 { font-size: 15px; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: 100% !important; width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; }
  .dept-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .dept-tab { flex: none; }
  .demo-link { display: block; }
}
/* touch screens: 16px fields stop iPad/iPhone from zooming in, bigger tap targets */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  .btn-chip { padding: 6px 12px; }
  .nav-item { padding: 13px 12px; }
}
@media print { .bottom-bar, .menu-toggle, .nav-overlay { display: none !important; } }

/* ---- part-number standard ---- */
.pc-chip { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; margin: 2px 3px 0 0; border-radius: 4px; background: color-mix(in srgb, var(--series-1) 12%, transparent); color: var(--series-1); white-space: nowrap; font-family: inherit; }
.pc-chip.pc-type { background: color-mix(in srgb, var(--series-4) 16%, transparent); color: #8a6a00; }
:root[data-theme="dark"] .pc-chip.pc-type { color: var(--series-4); }
.rd-names { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; padding: 8px; border-radius: 8px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary); }
.rd-file-btn { cursor: pointer; }
.rd-dwg-scroll { max-height: 320px; overflow: auto; }
.rd-legacy { margin-top: 8px; font-size: 13px; }
.rd-legacy summary { cursor: pointer; color: var(--text-secondary); }

.pc-chip.pc-brand { background: color-mix(in srgb, var(--series-7) 14%, transparent); color: var(--series-7); }
.pc-chip.pc-std { background: color-mix(in srgb, var(--series-3) 16%, transparent); color: var(--series-3); }

/* ---- e-signature ---- */
.es-canvas { width: 100%; max-width: 600px; aspect-ratio: 3 / 1; border: 1px dashed var(--border-hairline); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.es-current img, .es-preview img { max-height: 60px; background: #fff; border-radius: 6px; padding: 4px; border: 1px solid var(--border-hairline); vertical-align: middle; }
.es-preview { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.sig-img { max-height: 46px; max-width: 100%; }
.sig-signed .sig-line { border-bottom-style: solid; min-height: 50px; }
.sig-name { font-size: 12px; margin-top: 2px; }
.sig-ok { font-size: 10.5px; color: #1b7f4b; }
.sig-warn { font-size: 10.5px; color: #c0392b; font-weight: 700; }
.sig-changed .sig-img { opacity: 0.45; }

/* ---- collapsible BOM tree ---- */
.bx-tog { font: inherit; width: 24px; height: 24px; margin-right: 4px; padding: 0; border-radius: 6px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--series-1); cursor: pointer; font-size: 13px; line-height: 1; vertical-align: middle; }
.bx-tog:hover { border-color: var(--series-1); }
.bx-tog-space { display: inline-block; width: 28px; color: var(--text-muted); text-align: center; }
.bx-tree-tools { margin-top: -4px; }
@media (pointer: coarse) { .bx-tog { width: 32px; height: 32px; } .bx-tog-space { width: 36px; } }

/* BOM import from Google Sheets */
.modal.bs-modal { max-width: 720px; max-height: 88vh; overflow: auto; }
.bs-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.bs-err { border: 1px solid var(--status-critical); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.bs-err ul, .bs-lists ul { margin: 4px 0 0; padding-left: 18px; }
.bs-lists { max-height: 40vh; overflow: auto; font-size: 13px; }
.bs-lists h4 { margin: 8px 0 0; font-size: 13px; }
.bs-lists code { font-size: 12px; }
.bom-sheet-edited { border-color: var(--status-warning); }

/* Overview: ranked decisions for today */
.ov-decide-sum { margin: 0 0 10px; color: var(--text-secondary); }
.ov-decide-sum strong { font-size: 1.25em; color: var(--text-primary); }
.ov-decide-crit { color: var(--status-critical); font-weight: 600; }
.ov-decide { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ov-decide-item { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border-hairline); border-left: 4px solid var(--status-warning); border-radius: 10px; background: var(--surface-1); }
.ov-decide-critical { border-left-color: var(--status-critical); }
.ov-decide-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--status-warning); color: #1b1b1b; }
.ov-decide-critical .ov-decide-no { background: var(--status-critical); color: #fff; }
.ov-decide-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ov-decide-text strong { font-size: 15px; }
.ov-decide-text span { color: var(--text-secondary); font-size: 13px; }
.ov-decide-go { white-space: nowrap; }
.ov-decide-ok { padding: 14px; border-radius: 10px; border: 1px solid var(--status-good); color: var(--status-good); font-weight: 600; }
@media (max-width: 720px) {
  .ov-decide-item { grid-template-columns: 28px 1fr; }
  .ov-decide-go { grid-column: 2; justify-self: start; }
}

/* Schedule: week calendar, people, tags, notifications */
.plan-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-top: 12px; }
.plan-modes, .plan-weekbar, .plan-tagbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.plan-tagbar { margin-top: 8px; }
.btn-chip.active { background: var(--series-1); color: #fff; border-color: var(--series-1); }
.plan-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.plan-day { border: 1px solid var(--border-hairline); border-radius: 10px; padding: 8px; background: var(--surface-1); min-height: 180px; display: flex; flex-direction: column; gap: 6px; }
.plan-today { border-color: var(--series-1); box-shadow: inset 0 3px 0 var(--series-1); }
.plan-day-head { display: flex; gap: 6px; align-items: baseline; color: var(--text-secondary); font-size: 13px; }
.plan-day-head strong { font-size: 18px; color: var(--text-primary); }
.plan-day-empty { color: var(--text-muted); font-size: 12px; }
.plan-day-add { margin-top: auto; border: 1px dashed var(--border-hairline); background: none; color: var(--text-muted); border-radius: 8px; padding: 2px; cursor: pointer; }
.plan-day-add:hover { color: var(--text-primary); border-color: var(--text-muted); }
.plan-chip { text-align: left; border: 0; border-left: 4px solid var(--series-1); border-radius: 8px; padding: 6px 8px; background: var(--surface-card); color: var(--text-primary); cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.plan-chip-warning { border-left-color: var(--status-warning); }
.plan-chip-good { border-left-color: var(--status-good); opacity: .75; }
.plan-chip-neutral { border-left-color: var(--text-muted); }
.plan-chip-time { font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.plan-chip-title { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plan-chip-tags { font-size: 11px; color: var(--series-1); }
.plan-people { display: flex; flex-wrap: wrap; gap: 4px; }
.plan-person { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-page); border: 1px solid var(--border-hairline); }
.plan-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-tag { font-size: 12px; color: var(--series-1); }
.plan-people-pick { display: flex; flex-wrap: wrap; gap: 4px 12px; max-height: 120px; overflow: auto; }
.plan-when { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.plan-activity { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.notify-wrap { position: relative; }
.notify-btn { position: relative; }
.notify-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--status-critical); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.notify-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(360px, 92vw); max-height: 70vh; overflow: auto; z-index: 40; background: var(--surface-card); border: 1px solid var(--border-hairline); border-radius: 12px; box-shadow: 0 12px 32px -12px rgba(0,0,0,.4); padding: 10px; }
.notify-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.notify-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.notify-item { width: 100%; text-align: left; border: 0; background: none; color: inherit; font: inherit; padding: 8px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.notify-item:hover { background: var(--surface-page); }
.notify-new { background: rgba(42,120,214,.10); }
.notify-late .notify-text { color: var(--status-critical); }
.notify-title { font-weight: 600; font-size: 13px; }
.notify-text { font-size: 13px; color: var(--text-secondary); }
.notify-at { font-size: 11px; color: var(--text-muted); }
@media (max-width: 1024px) { .plan-week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .plan-week { grid-template-columns: 1fr; } .plan-day { min-height: 0; } .plan-when { grid-template-columns: 1fr 1fr; } }

/* BOM Manager tree */
.bom-tree-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.bom-group-row td { background: var(--surface-page); border-top: 2px solid var(--border-hairline); }
.bom-assy-row td { font-weight: 600; }
.bom-part-cell { display: flex; align-items: center; gap: 4px; min-width: 220px; }
.bom-part-cell .bom-part { flex: 1; }
.bom-indent { display: inline-flex; align-items: center; flex-shrink: 0; }

/* Login: which data this device is using */
.login-conn { border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.login-conn-ok { border: 1px solid var(--status-good); color: var(--status-good); }
.login-conn-warn { border: 1px solid var(--status-warning); background: rgba(250,178,25,.10); color: var(--text-primary); }
.login-conn-warn span { color: var(--text-secondary); }
.login-conn-row { display: flex; gap: 6px; }
.login-conn-row input { flex: 1; min-width: 0; }
.login-conn-err { color: var(--status-critical); }

.login-conn-demo { border: 1px solid var(--series-1); background: rgba(42,120,214,.10); }
.login-conn-demo span { color: var(--text-secondary); }

.login-build { margin-top: 10px; font-size: 11px; color: var(--text-muted); text-align: center; }
.login-build a { color: inherit; }
.login-code-toggle { align-self: flex-start; }

/* Master schedule: rows (department / person) × days */
.plan-master-wrap { overflow-x: auto; margin-top: 12px; }
.plan-master { display: grid; grid-template-columns: 170px repeat(7, minmax(120px, 1fr)); min-width: 1010px; border: 1px solid var(--border-hairline); border-radius: 10px; overflow: hidden; }
.pm-head { background: var(--surface-page); padding: 8px; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid var(--border-hairline); }
.pm-head strong { color: var(--text-primary); font-size: 16px; }
.pm-corner { font-weight: 700; }
.pm-row-head { padding: 8px; border-top: 1px solid var(--border-hairline); background: var(--surface-1); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pm-row-head span { color: var(--text-muted); font-size: 12px; }
.pm-count { font-weight: 600; }
.pm-busy { color: var(--status-critical) !important; }
.pm-cell { border-top: 1px solid var(--border-hairline); border-left: 1px solid var(--border-hairline); padding: 4px; min-height: 58px; display: flex; flex-direction: column; gap: 4px; }
.pm-today { background: rgba(42,120,214,.06); }
.pm-cell .plan-chip { padding: 4px 6px; }
.pm-cell .plan-chip-title { -webkit-line-clamp: 2; font-size: 12px; }
.plan-master-list { margin-top: 12px; display: flex; flex-direction: column; gap: 14px; }
.pm-group h4 { margin: 0 0 6px; }

/* ---- stock ledger / stock entry (stockx.js) ---- */
.sx-subtabs { margin-bottom: 12px; }
.sx-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.sx-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-secondary, #555); }
.sx-form .sx-wide { grid-column: 1 / -1; }
.sx-items { margin: 8px 0; }
.sx-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.sx-whline { font-size: 0.75rem; }
/* ---- job cards (jobcard.js) ---- */
.jc-sum { margin: 8px 0 12px; }
.jc-wip td { background: rgba(255, 184, 0, 0.08); }
.jc-btns { white-space: nowrap; }
.jc-btns .jc-qty { width: 64px; }
.jc-routing { margin-top: 16px; }
.jc-routing summary { cursor: pointer; font-weight: 600; }
.jc-mine { margin: 8px 0 14px; }

.jc-cost { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 14px 0; }
.jc-cost-t th, .jc-cost-t td { padding: 6px 8px; }
.jc-op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.jc-op { border: 1px solid var(--border, #ddd); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.jc-op-wip { border-color: #e0a800; background: rgba(255, 184, 0, 0.07); }
.jc-op-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 1.05rem; }
.jc-op-time { font-size: 0.9rem; }
.jc-op-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.jc-big { min-height: 44px; padding: 8px 16px; font-size: 1rem; }
.jc-op-btns .jc-qty { width: 70px; min-height: 40px; }
.jc-op-btns .jc-reason { min-height: 40px; max-width: 100%; }
.jc-free-t { margin-top: 16px; }

.jc-table .jc-who { min-width: 150px; }
.jc-table td { vertical-align: top; }
.jc-btns { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; white-space: normal; min-width: 220px; }
.jc-qtylab { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; }
@media (max-width: 1024px) {
  .jc-table thead { display: none; }
  .jc-table, .jc-table tbody, .jc-table tr, .jc-table td { display: block; width: 100%; }
  .jc-table tr { border: 1px solid var(--border, #333); border-radius: 10px; margin-bottom: 10px; padding: 8px; }
  .jc-table td { border: 0; padding: 4px 6px; text-align: left; }
  .jc-table td:first-child { display: none; }
}
.jc-table td.jc-btns { display: flex; flex-wrap: wrap; }
.jc-btns .jc-reason { width: auto; flex: 1 1 160px; min-width: 0; }

/* ---- machine history, QR, scanner (serial.js) ---- */
.sn-modal { max-width: 760px; width: 100%; }
.sn-mhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sn-mhead h3 { margin: 0; }
.sn-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin: 10px 0; }
.sn-serial { font-family: var(--font-display, inherit); font-size: 26px; font-weight: 700; letter-spacing: 0.02em; }
.sn-cost { margin-top: 6px; font-size: 13.5px; }
.sn-qr { width: 120px; height: 120px; flex: none; background: #fff; border-radius: 8px; padding: 4px; box-sizing: border-box; }
.sn-qr svg { width: 100%; height: 100%; }
.sn-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sn-timeline { list-style: none; margin: 0; padding: 0 0 0 6px; border-left: 2px solid var(--gridline); max-height: 55vh; overflow-y: auto; }
.sn-timeline li { display: flex; gap: 10px; padding: 8px 0 8px 8px; position: relative; font-size: 13.5px; }
.sn-ic { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-1); border: 1px solid var(--border-hairline); display: inline-flex; align-items: center; justify-content: center; flex: none; margin-left: -22px; font-size: 13px; }
.sn-t { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sn-cam { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 55vh; }
.sn-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sn-aim { position: absolute; inset: 18% 22%; border: 3px solid rgba(242, 166, 13, 0.9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25); }
.sn-manual { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 13px; }
.jc-hist { margin-right: 10px; }

.bx-picked td { background: color-mix(in srgb, var(--status-good) 10%, transparent); }

/* ---- my inbox (mytasks.js) ---- */
.mt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.mt-stat { background: var(--surface-1); border: 1px solid var(--border-hairline); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.mt-stat b { font-family: var(--font-display, inherit); font-size: 28px; line-height: 1.1; }
.mt-stat span { font-size: 12.5px; color: var(--text-secondary); }
.mt-stat-bad b { color: var(--status-critical); }
.mt-filters { margin-bottom: 10px; }
.mt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mt-item button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface-card); border: 1px solid var(--border-hairline); border-left: 4px solid var(--baseline); border-radius: 12px; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--text-primary); min-height: 56px; }
.mt-item button:hover { border-color: var(--accent, #f2a60d); }
.mt-warning button { border-left-color: var(--status-warning); }
.mt-critical button { border-left-color: var(--status-critical); }
.mt-ic { font-size: 20px; width: 28px; text-align: center; flex: none; }
.mt-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mt-body b { overflow: hidden; text-overflow: ellipsis; }
.mt-tag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-1); color: var(--text-secondary); flex: none; }
.mt-go { font-size: 22px; color: var(--text-muted); flex: none; }
.mt-empty { text-align: center; color: var(--status-good); font-weight: 600; padding: 18px 0; }
@media (max-width: 600px) { .mt-tag { display: none; } .mt-stat b { font-size: 22px; } }

/* ---- master schedule on a real calendar ---- */
.gantt { min-width: 900px; }
.gantt-row, .gantt-header { grid-template-columns: 210px 1fr; }
.ms-controls { flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.ms-controls label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.ms-corner { font-size: 12px; color: var(--text-muted); align-self: end; padding-bottom: 4px; }
.ms-months { display: grid; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.ms-months > div { border-left: 1px solid var(--baseline); padding: 0 4px 2px; white-space: nowrap; overflow: hidden; }
.ms-this-week { color: var(--status-critical); font-weight: 700; }
.ms-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--status-critical); opacity: 0.75; z-index: 2; }
.ms-section { margin: 12px 0 4px; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); border-bottom: 1px solid var(--gridline); padding-bottom: 4px; }
.gantt-row-label b { display: block; font-size: 13px; }
.gantt-row-label small { display: block; font-size: 11px; color: var(--text-muted); }
.ms-wo-link { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.ms-wo-link:hover b { color: var(--series-1); text-decoration: underline; }
.ms-span { background: repeating-linear-gradient(45deg, var(--gridline) 0 4px, transparent 4px 8px) !important; border: 1px dashed var(--baseline); height: 10px !important; top: 50% !important; transform: translateY(-50%); opacity: 0.9; }
.ms-step { z-index: 1; font-size: 10px; }
.ms-hold { outline: 2px solid var(--status-critical); }
.ms-wip { outline: 2px solid var(--accent, #f2a60d); }
.ms-due { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 14px; color: var(--text-primary); z-index: 3; }
.ms-due-late { color: var(--status-critical); }
.ms-late .gantt-row-label b { color: var(--status-critical); }
.ms-finished { opacity: 0.6; }
.ms-phases { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.ms-phase-row { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 8px; align-items: center; }
.ms-phase-row label { display: flex; flex-direction: column; font-size: 11.5px; color: var(--text-muted); gap: 2px; }
.ms-phase-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
@media (max-width: 600px) { .ms-phase-row { grid-template-columns: 1fr 1fr; } .ms-phase-name { grid-column: 1 / -1; } }
.gantt-row, .gantt-header { grid-template-columns: 250px 1fr; }
.gantt-row { min-height: 46px; }
.gantt-row-label { flex-wrap: nowrap; align-items: center; }
.gantt-row-label > span { flex: 1; min-width: 0; }
.gantt-row-label b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.ms-edit-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-secondary); cursor: pointer; font-size: 15px; }
.ms-edit-ic:hover { border-color: var(--accent, #f2a60d); color: var(--text-primary); }
.ms-phase-row { grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr); }
.ms-phase-row input { width: 100%; min-width: 0; box-sizing: border-box; }

/* ---- manual ordering (plans + master schedule) ---- */
.ord-btn { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-secondary); cursor: pointer; font-size: 11px; line-height: 1; padding: 0; }
.ord-btn:hover:not(:disabled) { border-color: var(--accent, #f2a60d); color: var(--text-primary); }
.ord-btn:disabled { opacity: 0.3; cursor: default; }
.ms-ord, .plan-move { display: inline-flex; gap: 3px; flex: none; }
.plan-move { margin-left: auto; }
.plan-sortbar { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; }
.plan-sortbar select[hidden] { display: none; }

/* ---- never wider than the screen (phones) ---- */
.card select, .card input:not([type="checkbox"]):not([type="radio"]), .modal select, .modal input:not([type="checkbox"]):not([type="radio"]) { max-width: 100%; }
.filter-row { flex-wrap: wrap; min-width: 0; }
.filter-row > * { min-width: 0; }
.btn-chip { white-space: normal; max-width: 100%; text-align: left; }
.jc-cost { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.jc-cost > div { min-width: 0; }
@media (max-width: 700px) {
  .tv-head { flex-wrap: wrap; }
  .tv-right { flex-wrap: wrap; gap: 0.5em; }
  .tv-clock { font-size: 1.1em; }
  .tv-kpis { grid-template-columns: 1fr 1fr; }
}

.rd-ord { white-space: nowrap; }
.rd-ord .ord-btn + .ord-btn { margin-left: 3px; }

/* ---- executive cost & delivery card ---- */
.ov-ec-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; margin-bottom: 12px; }
.ov-ec-tile { background: var(--surface-1); border: 1px solid var(--border-hairline); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.ov-ec-tile span { font-size: 12.5px; color: var(--text-secondary); }
.ov-ec-tile b { font-family: var(--font-display, inherit); font-size: 24px; }
.ov-ec-tile small { font-size: 11.5px; color: var(--text-muted); }
.ov-ec-bad b { color: var(--status-critical); }
.ov-ec-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.ov-ec-h { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.ov-ec-r { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--gridline); font-size: 13px; }
.ov-ec-tv { margin-top: 12px; width: 100%; }
@media (max-width: 800px) { .ov-ec-grid { grid-template-columns: 1fr; } }
.ms-phase-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.ms-phase-name { gap: 6px; }
.ms-phase-name .ms-name { flex: 1; min-width: 0; }
.ms-color { width: 34px; height: 34px; padding: 0; border: 1px solid var(--border-hairline); border-radius: 8px; background: none; flex: none; cursor: pointer; }
.ms-phase-tools { display: inline-flex; gap: 3px; align-self: end; padding-bottom: 4px; }
@media (max-width: 600px) { .ms-phase-row { grid-template-columns: 1fr 1fr; } .ms-phase-name, .ms-phase-tools { grid-column: 1 / -1; } }
.ms-phase-row .ms-phase-name { display: flex; align-items: center; }
.ms-phase-row .ms-phase-name .ms-color { width: 36px !important; min-width: 36px; max-width: 36px; flex: 0 0 36px; height: 36px; }
.ms-phase-row .ms-phase-name .ms-name { flex: 1 1 auto; width: auto !important; min-width: 0; }

.footer-dev { color: var(--sidebar-fg-muted); margin-top: 4px; font-size: 11px; }
.login-emp { font-weight: 700; color: var(--sec, var(--series-1)); font-variant-numeric: tabular-nums; }
.login-emp-row { display: flex; gap: 8px; flex-wrap: wrap; }
.login-emp-row input { flex: 1 1 160px; min-width: 0; font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border-hairline); background: var(--surface-1); color: var(--text-primary); }
.login-emp .btn-chip { margin-top: 10px; }
.login-users[hidden], .login-step[hidden], .login-emp[hidden] { display: none; }
.login-modes { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--border-hairline); margin: 4px 0 10px; }
.login-mode { flex: 1; font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.login-mode:hover { color: var(--text-primary); }
.login-mode.active { background: var(--surface-card); color: var(--text-primary); box-shadow: 0 1px 4px rgba(0,0,0,.25), inset 0 0 0 1px var(--accent, var(--series-1)); }
.wf-table input.wf-name { min-width: 150px; } .wf-order { white-space: nowrap; } .wf-who summary { cursor: pointer; font-size: 12.5px; color: var(--text-secondary); max-width: 260px; } .wf-who label { display: block; font-size: 12.5px; margin: 2px 0; } .wf-preview { margin: 10px 0; } .wf-actions { margin-top: 10px; }
