:root {
  --ink: #eef2f8;
  --muted: #8b8ba7;
  --line: rgba(255,255,255,.07);
  --panel: #111118;
  --soft: #141418;
  --soft-2: #18181f;
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --accent-glow: rgba(99,102,241,.3);
  --accent-2: #818cf8;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ok: #22c55e;
  --blue: #6366f1;
  --shadow: 0 8px 32px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.6);
  --radius: 10px;
  font-size: 15px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: #050509;
}

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

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 12px;
  background: #060609;
  border-right: 1px solid rgba(255,255,255,.07);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 22px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: .82rem;
  flex-shrink: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b7c5bf;
  font-size: 0.86rem;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-bottom {
  margin-top: auto;
  padding-top: 12px;
}

.nav-item {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: .9rem;
  font-weight: 500;
  transition: background .12s, color .12s;
}

.nav-item svg,
.icon-button svg,
.primary-action svg,
.search-box svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
}

.nav-item.active {
  color: #fff;
  background: rgba(99,102,241,.2);
}
.nav-item:hover:not(.active) {
  color: var(--ink);
  background: rgba(255,255,255,.05);
}

.main {
  min-width: 0;
  padding: 28px;
  background: #050509;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9fb0c3;
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  color: #edf4ff;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  color: #e3ecf8;
}

h3 {
  margin-bottom: 4px;
  font-size: 0.98rem;
  color: #e3ecf8;
}

.top-actions,
.toolbar,
.dialog-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.operator-login {
  min-width: 170px;
  color: #b2c2d3;
  font-size: 0.76rem;
  font-weight: 760;
  text-transform: uppercase;
}

.sync-badge {
  min-width: 220px;
  max-width: 360px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  color: var(--ink);
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}

.sync-badge strong {
  color: #eef5ff;
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sync-badge small {
  color: #afbfce;
  font-size: 0.7rem;
  font-weight: 620;
  text-transform: none;
}

.sync-badge.offline {
  border-color: rgba(245,158,11,.3);
  background: rgba(245,158,11,.08);
  color: #fde68a;
}

.sync-badge.offline strong { color: #fcd34d; }

.sync-badge.processing {
  border-color: rgba(99,102,241,.3);
  background: rgba(99,102,241,.08);
}

.sync-badge.error {
  border-color: rgba(239,68,68,.3);
  background: rgba(239,68,68,.08);
}

.sync-badge[hidden] {
  display: none !important;
}

.license-badge {
  min-width: 240px;
  border-color: rgba(34,197,94,.25);
  background: rgba(34,197,94,.07);
}

.license-badge strong {
  color: #86efac;
}

.license-badge.small {
  min-width: 180px;
}

.operator-login select {
  margin-top: 4px;
  min-height: 40px;
  text-transform: none;
  font-weight: 650;
}

.primary-action,
.text-button,
.icon-button,
.segmented button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-action {
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  font-weight: 600;
  transition: background .15s, box-shadow .15s;
}

.primary-action:hover {
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.secondary-action {
  padding: 0 14px;
  height: 36px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer;
  transition: background .15s;
}
.secondary-action:hover { background: rgba(255,255,255,.1); }

.full-width { width: 100%; box-sizing: border-box; }

.icon-button {
  width: 40px;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.1);
  transition: color .12s, background .12s;
}

.icon-button input {
  display: none;
}

.ghost:hover,
.text-button:hover {
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.07);
}

.text-button {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.1);
  font-weight: 600;
  transition: border-color .12s, background .12s;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
}

.locked-feature {
  opacity: 0.55;
  cursor: pointer;
}
.locked-feature::after {
  content: " 🔒";
  font-size: 11px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 6px;
  color: #f4f8ff;
}

.metric span {
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.metric.metric-action {
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.metric.metric-action:hover {
  border-color: rgba(99,102,241,.35);
  background: rgba(99,102,241,.07);
}

/* Dashboard view */
#dashboard-view {
  background: #080c14;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 16px;
}

#dashboard-view .metrics {
  gap: 10px;
}

#dashboard-view .metric {
  background: #0f1420;
  border-color: rgba(255,255,255,.08);
  color: var(--ink);
}

#dashboard-view .metric.metric-action:hover {
  border-color: rgba(99,102,241,.35);
  background: rgba(99,102,241,.07);
}

#dashboard-view .panel {
  background: #0f1420;
  border-color: rgba(255,255,255,.08);
}

#dashboard-view .panel h2,
#dashboard-view .panel h3,
#dashboard-view .panel h4 {
  color: #edf3fb;
}

#dashboard-view .eyebrow,
#dashboard-view .meta {
  color: #9fb0c3;
}

#dashboard-view .attention-card,
#dashboard-view .schedule-card,
#dashboard-view .bom-card {
  background: #131a26;
  border-color: rgba(255,255,255,.1);
}

#dashboard-view .attention-card strong,
#dashboard-view .attention-card h3,
#dashboard-view .attention-card .meta,
#dashboard-view #my-active-jobs .attention-card,
#dashboard-view #my-active-jobs .attention-card strong,
#dashboard-view #my-active-jobs .attention-card .meta {
  color: #dce8f4;
}

#dashboard-view .quality-comparison > div {
  background: #131a26;
  border-color: rgba(255,255,255,.1);
}

#dashboard-view .capacity-row,
#dashboard-view .capacity-row strong,
#dashboard-view .capacity-row span,
#dashboard-view .time-balance-row-head,
#dashboard-view .time-balance-row-head strong,
#dashboard-view .time-balance-footer,
#dashboard-view .time-balance-footer strong,
#dashboard-view .scrap-kpi-details,
#dashboard-view .scrap-kpi-details strong {
  color: #d7e3ef;
}

#dashboard-view .time-balance-row-head .meta,
#dashboard-view .time-balance-footer .meta,
#dashboard-view .scrap-kpi-details .meta {
  color: #a8b9ca;
}

#dashboard-view .time-balance-footer > div {
  background: #131a26;
  border-color: rgba(255,255,255,.1);
}

#dashboard-view .time-balance-footer > div strong {
  color: #f2f8ff;
}

/* Match top area with dashboard dark skin when dashboard is active */
body:has(#dashboard-view.active) .main {
  background: #050509;
}

body:has(#dashboard-view.active) .topbar h1,
body:has(#dashboard-view.active) .topbar .eyebrow,
body:has(#dashboard-view.active) #session-user-label {
  color: #d7e3ef;
}

#dashboard-view .scrap-wheel {
  background: conic-gradient(#ef4444 calc(var(--scrap-pct, 0) * 1%), rgba(255,255,255,.08) 0);
}

#dashboard-view .scrap-wheel-inner {
  background: #050509;
  border-color: rgba(255,255,255,.1);
}

#dashboard-view .scrap-wheel-value {
  color: #f3f8ff;
}

#dashboard-view .time-balance-badge.neutral {
  color: var(--muted);
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
}

.dashboard-grid,
.costing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 16px;
}

.inventory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
}

.panel {
  padding: 16px;
}

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

.stack {
  display: grid;
  gap: 10px;
}

.attention-card,
.schedule-card,
.material-row,
.rate-row,
.operator-row,
.bom-card {
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: #16161f;
}

.attention-card,
.bom-card {
  padding: 12px;
}

.attention-card header,
.schedule-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.meta {
  color: #9fb0c3;
  font-size: 0.86rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 780;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag.planned {
  color: #a5b4fc;
  background: rgba(99,102,241,.14);
  border-color: rgba(99,102,241,.28);
}

.tag.running {
  color: #6dcf95;
  background: rgba(58, 158, 95, 0.16);
  border-color: rgba(58, 158, 95, 0.32);
}

.tag.hold,
.tag.warning {
  color: #f0b96a;
  background: rgba(212, 130, 42, 0.16);
  border-color: rgba(212, 130, 42, 0.32);
}

.tag.done {
  color: #9fb0c3;
  background: rgba(159, 176, 195, 0.12);
  border-color: rgba(159, 176, 195, 0.25);
}

.tag.danger {
  color: #f4a49f;
  background: rgba(212, 76, 66, 0.16);
  border-color: rgba(212, 76, 66, 0.32);
}

.capacity-list,
.rates-list,
.material-list,
.operator-list,
.operation-timer-list,
.workcenter-settings-list {
  display: grid;
  gap: 10px;
}

.capacity-row {
  display: grid;
  grid-template-columns: 130px 1fr 64px;
  gap: 10px;
  align-items: center;
}

.scrap-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 2px;
  text-align: center;
}

.quality-comparison {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.quality-comparison > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.scrap-wheel {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--danger) calc(var(--scrap-pct, 0) * 1%), rgba(255,255,255,.08) 0);
}

.scrap-wheel-inner {
  width: 78px;
  height: 78px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
}

.scrap-wheel-value {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
}

.scrap-kpi-details {
  display: grid;
  gap: 6px;
}

.time-balance-card {
  display: grid;
  gap: 12px;
}

.time-balance-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.time-balance-header h3 {
  margin: 2px 0 0;
  font-size: 1.02rem;
}

.time-balance-badge {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 780;
  border: 1px solid transparent;
  white-space: nowrap;
}

.time-balance-badge.over {
  color: #f4a49f;
  background: rgba(212, 76, 66, 0.18);
  border-color: rgba(212, 76, 66, 0.35);
}

.time-balance-badge.under {
  color: #6dcf95;
  background: rgba(58, 158, 95, 0.18);
  border-color: rgba(58, 158, 95, 0.35);
}

.time-balance-badge.neutral {
  color: #9fb0c3;
  background: rgba(159, 176, 195, 0.12);
  border-color: rgba(159, 176, 195, 0.25);
}

.time-balance-rows {
  display: grid;
  gap: 10px;
}

.time-balance-row {
  display: grid;
  gap: 6px;
}

.time-balance-row-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: 0.86rem;
  color: var(--muted);
}

.time-balance-row-head strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.time-bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
}

.time-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.time-bar-fill.capacity {
  background: rgba(99,102,241,.14);
}

.time-bar-fill.planned {
  background: rgba(99,102,241,.7);
}

.time-bar-fill.actual {
  background: rgba(43, 122, 69, 0.84);
}

.time-bar-capacity {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  margin-left: -1px;
  border-radius: 999px;
  background: rgba(12, 15, 18, 0.8);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.time-balance-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.time-balance-footer > div {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--soft-2, #16212e);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--ink, #cdd9e5);
  display: grid;
  gap: 4px;
}

.time-balance-footer strong {
  font-size: 1rem;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: #6a7480;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: #3abf72;
}

.bar span.warn {
  background: #f0b429;
}

.bar span.danger {
  background: #d64545;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.schedule-tools,
.section-spacer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.section-spacer {
  margin-top: 18px;
}

.search-box {
  flex: 1 1 260px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.history-search {
  max-width: 320px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}

.segmented button {
  min-height: 30px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left;
  vertical-align: middle;
  color: var(--ink);
}

th {
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  background: rgba(255,255,255,.03);
}

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

td select,
.field-select {
  min-height: 34px;
  border: 1px solid #36506a;
  border-radius: 8px;
  padding: 0 8px;
  background: #1a2735;
  color: #e3ecf8;
}

.route-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.calendar-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: #111118;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

#schedule-view .calendar-wrap,
#schedule-view .schedule-board,
#schedule-view .machine-column,
#schedule-view .calendar-day,
#schedule-view .calendar-day header,
#schedule-view .calendar-day.closed header,
#schedule-view .calendar-event,
#schedule-view .calendar-empty,
#schedule-view .schedule-card {
  color: #dbe6f2;
}

.calendar-grid {
  min-width: 980px;
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
}

.calendar-day {
  min-height: 300px;
  border-right: 1px solid rgba(255,255,255,.08);
  background: #111118;
}

.calendar-day:last-child {
  border-right: 0;
}

.calendar-day.closed {
  background: #111118;
}

.calendar-day header {
  min-height: 58px;
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: #111118;
}

.calendar-day.closed header {
  background: #111118;
}

#schedule-view .calendar-day header strong {
  color: #dfeaf6;
}

#schedule-view .calendar-day.closed header strong,
#schedule-view .calendar-day.closed header span {
  color: #c1cfdd;
}

.calendar-day header strong,
.calendar-day header span {
  display: block;
}

.calendar-day header span {
  margin-top: 2px;
  color: #9fb0c3;
  font-size: 0.78rem;
}

.calendar-events {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.calendar-event {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 9px;
  background: #16161f;
  color: #dbe6f2;
  text-align: left;
}

.calendar-event.running {
  border-color: #86c79c;
  background: rgba(34,197,94,.08);
}

.calendar-event.hold {
  border-color: #cfa56d;
  background: rgba(245,158,11,.08);
}

.calendar-event.planned,
.schedule-card.planned {
  border-color: #58779d;
  background: rgba(99,102,241,.08);
  color: #dbe6f2;
}

.calendar-event span,
.calendar-event strong,
.calendar-event small {
  display: block;
}

.calendar-event span {
  color: #dfeaf6;
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-event strong {
  margin-top: 3px;
  font-size: 0.88rem;
}

.calendar-event small,
.calendar-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.calendar-empty {
  padding: 10px;
  border: 1px dashed rgba(255,255,255,.15);
  border-radius: 8px;
  background: #0d0d14;
  color: #93a6ba;
}

.schedule-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 14px;
  align-items: start;
}

.machine-column {
  min-height: 420px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: #111118;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

#schedule-view .machine-column {
  background: #111118;
  border-color: rgba(255,255,255,.08);
}

#schedule-view .machine-column header h3,
#schedule-view .machine-column header p,
#schedule-view .machine-column header .meta {
  color: #dbe6f2;
}

.machine-column header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.schedule-card {
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: #16161f;
}

.schedule-card.running {
  border-color: #86c79c;
  background: rgba(34,197,94,.08);
}

.schedule-card.hold {
  border-color: #cfa56d;
  background: rgba(245,158,11,.08);
}

#schedule-view .schedule-card strong,
#schedule-view .schedule-card .meta,
#schedule-view .schedule-card span,
#schedule-view .schedule-card small {
  color: #dbe6f2;
}

#schedule-view .schedule-card.running strong,
#schedule-view .schedule-card.running .meta,
#schedule-view .schedule-card.running span,
#schedule-view .schedule-card.running small {
  color: #e9f6ee;
}

#schedule-view .schedule-card.planned strong,
#schedule-view .schedule-card.planned .meta,
#schedule-view .schedule-card.planned span,
#schedule-view .schedule-card.planned small {
  color: #dbe6f2;
}

.hours {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.83rem;
}

.material-row,
.rate-row,
.operator-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.stock-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, auto));
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.rate-pair {
  display: grid;
  gap: 4px;
  text-align: right;
}

.workcenter-settings-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(120px, 1fr) repeat(3, minmax(110px, 0.8fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-2);
}

#settings-view .workcenter-settings-row,
#settings-view .operator-row {
  border-color: rgba(255,255,255,.1);
  background: #16161f;
  color: #dbe6f2;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.operator-permissions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.operator-permissions label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: center;
  color: var(--muted);
}

#settings-view .operator-permissions label {
  color: #c7d3df;
}

#settings-view .monitor-scroll-panel .empty-state,
#settings-view .operator-list .empty-state,
#settings-view .workcenter-settings-list .empty-state {
  border-color: rgba(255,255,255,.15);
  background: #0d0d14;
  color: #93a6ba;
}

#settings-view .text-button,
#settings-view .primary-action,
#settings-view .icon-button {
  border-color: #32485f;
  background: rgba(255,255,255,.07);
  color: #f0f5fb;
}

#settings-view .text-button:hover,
#settings-view .primary-action:hover,
#settings-view .icon-button:hover {
  background: rgba(255,255,255,.12);
}

.print-label-sheet {
  display: none;
}

.cost-breakdown {
  display: grid;
  gap: 12px;
}

.cost-comparison-header,
.cost-line {
  display: grid;
  grid-template-columns: 1fr repeat(2, minmax(80px, auto));
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.cost-comparison-header {
  font-size: 0.82rem;
  font-weight: 740;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
}

.cost-line.total {
  border: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(99,102,241,.1);
  font-weight: 820;
}

.cost-diff {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 2px;
}

.cost-profit {
  color: var(--ok);
}

.cost-loss {
  color: var(--danger);
}

.dialog {
  width: min(760px, calc(100vw - 24px));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
  background: #0d0d14;
  color: var(--ink);
}

#job-dialog {
  width: min(1100px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

#user-database-dialog {
  width: min(1080px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.dialog::backdrop {
  background: rgba(10, 18, 16, 0.58);
}

.dialog-form {
  padding: 18px;
  background: #0d0d14;
}

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

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

.invite-form {
  background: rgba(99,102,241,.06);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.inline-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(251, 191, 36, .1);
  border: 1px solid rgba(251, 191, 36, .3);
  color: #fbbf24;
  font-size: .85rem;
  line-height: 1.45;
  margin-bottom: 8px;
}

.inline-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
  fill: currentColor;
}

.form-grid.form-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid.form-grid-4 .col-2 {
  grid-column: span 2;
}

.form-grid.form-grid-4 .col-4,
.form-grid.form-grid-4 label.wide,
.form-grid.form-grid-4 .wide {
  grid-column: 1 / -1;
}

.new-material-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}

.material-inline-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.material-inline-actions select {
  flex: 1 1 auto;
  min-width: 0;
}

.material-inline-actions .text-button {
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 6px;
  color: #aebdcb;
  font-size: 0.84rem;
  font-weight: 720;
}

label.wide {
  grid-column: 1 / -1;
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-field input {
  width: auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-accordion {
  padding: 0;
  overflow: hidden;
}

.settings-accordion > summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  user-select: none;
}

.settings-accordion > summary::-webkit-details-marker {
  display: none;
}

.settings-accordion[open] > summary {
  border-bottom: 1px solid #2b3a4a;
}

.settings-accordion-body {
  padding: 16px;
}

.settings-summary-note {
  color: #9fb0c3;
  font-size: 0.82rem;
  text-align: right;
  max-width: 260px;
}

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

#settings-view .panel,
#settings-view .settings-monitor-panel,
#settings-view .settings-panel {
  background: #111118;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  color: #dbe6f2;
}

#settings-view h2,
#settings-view h3,
#settings-view h4,
#settings-view strong,
#settings-view .panel-header,
#settings-view .meta,
#settings-view .eyebrow {
  color: #dbe6f2;
}

.settings-monitor-panel {
  min-height: 0;
}

.monitor-scroll-panel {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.weekday-settings {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, minmax(68px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#settings-view .weekday-settings {
  border-color: rgba(255,255,255,.1);
  background: #122030;
}

.weekday-settings legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 720;
}

#settings-view .weekday-settings legend {
  color: #aebdcb;
}

.weekday-settings label {
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}

#settings-view .weekday-settings label {
  border-color: rgba(255,255,255,.1);
  background: #1a2735;
  color: #dbe6f2;
}

.weekday-settings input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: rgba(255,255,255,.04);
}

select {
  background: #1a2735;
  color: #e3ecf8;
}

input::placeholder,
textarea::placeholder {
  color: #8495a7;
}

#job-dialog .eyebrow {
  color: #8ea4bc;
}

#job-dialog h2,
#job-dialog h3,
#job-dialog h4,
#job-dialog strong {
  color: #f2f7fc;
}

#job-dialog .meta {
  color: #9fb0c0;
}

#job-dialog .dialog-header {
  padding-bottom: 14px;
  border-bottom: 1px solid #213243;
}

#job-dialog .form-grid {
  gap: 14px;
}

#job-dialog .checkbox-field {
  color: #c7d3df;
}

#job-dialog .empty-state {
  border-color: #314657;
  background: #14202c;
  color: #a5b5c5;
}

textarea {
  resize: vertical;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem;
  margin-bottom: .75rem;
}
.industry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .75rem .5rem;
  border: 1.5px solid var(--border, #334a61);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  font-size: .82rem;
  line-height: 1.3;
}
.industry-card:hover { border-color: var(--accent, #3b82f6); background: rgba(59,130,246,.07); }
.industry-card.selected { border-color: var(--accent, #3b82f6); background: rgba(59,130,246,.14); }
.industry-card .industry-icon { font-size: 1.6rem; line-height: 1; }
.industry-card small { color: var(--muted, #8fa3be); font-size: .74rem; }
.fasteners-check {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .85rem;
  color: var(--muted, #8fa3be);
  cursor: pointer;
  margin-top: .5rem;
}
.fasteners-check input { margin-top: .15rem; flex-shrink: 0; }

.pinpad-dialog {
  width: min(520px, calc(100vw - 24px));
  background: #0d1520;
  border-color: #334a61;
  color: #eef5ff;
}

.pinpad-dialog-form {
  gap: 16px;
}

.pinpad-header {
  align-items: flex-start;
}

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

.pinpad-display span {
  min-height: 68px;
  border-radius: 10px;
  border: 1px solid #42627e;
  background: #101b28;
  color: #7f93aa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
}

.pinpad-display span.filled {
  color: #eaf3ff;
  border-color: #6992b8;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.pinpad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 10px;
}

.pinpad-key {
  min-height: 64px;
  border-radius: 12px;
  border: 1px solid #4a6782;
  background: #111118;
  color: #eef5ff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.pinpad-key:hover {
  background: #203145;
}

.pinpad-key.tertiary {
  background: #202d3c;
  color: #cfe0f2;
}

.pinpad-actions {
  justify-content: space-between;
}

.operation-timers {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #253647;
  border-radius: 8px;
  background: #0d0d14;
}

.timer-header,
.timer-card header,
.timer-log {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.timer-header {
  margin-bottom: 10px;
}

.timer-card {
  border: 1px solid #2b3d50;
  border-radius: 8px;
  padding: 12px;
  background: #111118;
  color: #e5edf6;
}

.timer-card h4 {
  margin: 0 0 3px;
}

.inline-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #335072;
  border-radius: 8px;
  background: #122334;
  color: #d8e6f3;
  font-weight: 700;
}

.route-card textarea {
  min-height: 74px;
}

#job-dialog .text-button,
#job-dialog .icon-button {
  border-color: #32485f;
  background: rgba(255,255,255,.07);
  color: #f0f5fb;
}

#job-dialog .text-button:hover,
#job-dialog .icon-button:hover {
  background: rgba(255,255,255,.12);
}

#job-dialog .icon-button.ghost {
  background: #1b2a3a;
}

#job-dialog select:disabled,
#job-dialog input:disabled,
#job-dialog textarea:disabled {
  background: #43505f;
  color: #f0f4f8;
  border-color: #556270;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.timer-log-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.timer-log {
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  color: var(--muted);
  font-size: 0.83rem;
}

.timer-log-detail,
.timer-log-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timer-log-detail {
  flex-wrap: wrap;
}

.timer-log-detail small {
  flex-basis: 100%;
  color: #64705f;
  font-weight: 680;
}

.timer-log-actions {
  flex-shrink: 0;
}

.timer-log strong {
  color: var(--ink);
}

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

.price-history-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: #111118;
}

.price-history-list {
  display: grid;
  gap: 8px;
}

.price-history-row {
  padding: 10px;
  border-radius: 8px;
  background: #16161f;
  border: 1px solid rgba(255,255,255,.1);
  color: #dbe6f2;
}

.price-history-row strong {
  color: var(--ink);
}

.price-history-row small {
  display: block;
  margin-top: 4px;
  color: #64705f;
  font-weight: 680;
}

.compact-empty {
  padding: 10px;
}

.empty-state {
  padding: 18px;
  border-radius: 8px;
  background: #0d1520;
  border: 1px dashed #2a3f55;
  color: #8495a7;
}

.print-sheet {
  display: none;
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 82px 1fr;
  }

  .brand div:not(.brand-mark),
  .nav-item span {
    display: none;
  }

  .brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .nav-item {
    justify-content: center;
  }

  .dashboard-grid,
  .inventory-layout,
  .costing-layout,
  .settings-grid,
  .settings-monitor-row,
  .quality-comparison {
    grid-template-columns: 1fr;
  }

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

  .schedule-board {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  body {
    background: #fff;
  }

  body > :not(.print-sheet):not(.print-label-sheet) {
    display: none !important;
  }

  .print-sheet,
  .print-label-sheet {
    display: block;
  }

  .print-label {
    width: 50mm;
    height: 30mm;
    border: 1px solid #111;
    padding: 2.2mm;
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 1.3mm;
    font-family: Arial, sans-serif;
    color: #111;
    background: #fff;
  }

  .print-label h1 {
    margin: 0;
    font-size: 4mm;
    line-height: 1.05;
  }

  .print-label p {
    margin: 0;
    font-size: 3.2mm;
    line-height: 1.15;
  }

  .print-work-order {
    width: 194mm;
    min-height: 128mm;
    padding: 8mm;
    border: 1.2px solid #111;
    color: #111;
    background: #fff;
    font-size: 10pt;
    line-height: 1.25;
    overflow: visible;
    break-after: avoid;
    page-break-after: avoid;
  }

  .print-work-order h1,
  .print-work-order h2,
  .print-work-order p {
    margin: 0;
  }

  .print-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(78mm, 1.1fr) auto;
    gap: 2mm 5mm;
    align-items: center;
    padding-bottom: 4mm;
    border-bottom: 1px solid #111;
  }

  .print-header p,
  .print-key-grid span {
    color: #333;
    font-size: 8pt;
    font-weight: 700;
    text-transform: uppercase;
  }

  .print-header h1 {
    font-size: 24pt;
    line-height: 1;
    margin-top: 1mm;
  }

  .print-status {
    border: 1px solid #111;
    padding: 2mm 4mm;
    font-size: 11pt;
    font-weight: 800;
    text-transform: uppercase;
    justify-self: end;
    align-self: start;
  }

  .print-header-barcode {
    align-self: center;
  }

  .print-header-barcode img {
    width: 100%;
    max-width: 100%;
    height: 12mm;
    object-fit: contain;
    display: block;
  }

  .print-key-grid {
    display: grid;
    grid-template-columns: 34mm 26mm 1fr 1fr;
    gap: 3mm;
    margin: 4mm 0;
  }

  .print-key-grid div,
  .print-two-col > div,
  .print-notes {
    border: 1px solid #999;
    padding: 2.2mm;
  }

  .print-key-grid strong,
  .print-key-grid span {
    display: block;
  }

  .print-key-grid strong {
    margin-top: 1mm;
    font-size: 12pt;
  }

  .print-two-col {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 3mm;
    margin-bottom: 4mm;
  }

  .print-work-order h2 {
    margin-bottom: 1.5mm;
    font-size: 10pt;
    text-transform: uppercase;
  }

  .print-operations {
    margin: 0 0 4mm 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid #111;
  }

  .print-operations li {
    padding: 2mm 0;
    border-bottom: 1px solid #999;
  }
  .print-operations li { page-break-inside: avoid; }
  .print-drawing-page { page-break-before: always; }

  .print-op-head,
  .print-footer {
    display: flex;
    justify-content: space-between;
    gap: 5mm;
  }

  .print-op-meta,
  .print-notes p {
    color: #222;
  }

  .print-op-note {
    margin-top: 1mm;
    color: #111;
    font-size: 9pt;
    font-weight: 700;
  }

  .print-footer {
    margin-top: 4mm;
    padding-top: 3mm;
    border-top: 1px solid #111;
    font-size: 8.5pt;
  }

  .print-drawing-page {
    width: 194mm;
    height: 281mm;
    padding: 0;
    border: 0;
    background: #fff;
    page-break-before: always;
    break-before: page;
  }

  .print-drawing-page h2 {
    margin: 0 0 3mm 0;
    font-size: 11pt;
    text-transform: uppercase;
  }

  .print-drawing-page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  .print-drawing-pages,
  .print-drawing-page iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
  }
}

@media (max-width: 720px) {
  .shell {
    display: block;
    padding-bottom: 76px;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
  }

  .brand {
    display: none;
  }

  .nav {
    display: contents;
  }

  .nav-bottom {
    margin-top: 0;
    padding-top: 0;
  }

  .nav-item {
    min-height: 52px;
    padding: 0;
  }

  .main {
    padding: 18px 14px 24px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 40px 40px;
  }

  .top-actions .primary-action,
  .operator-login {
    grid-column: 1 / -1;
  }

  .primary-action {
    min-width: 0;
  }

  .metrics,
  .schedule-board,
  .form-grid,
  .form-grid.form-grid-4,
  .new-material-fields,
  .weekday-settings,
  .workcenter-settings-row,
  .time-balance-footer {
    grid-template-columns: 1fr;
  }

  .form-grid.form-grid-4 .col-2,
  .form-grid.form-grid-4 .col-4 {
    grid-column: 1 / -1;
  }

  .metric strong {
    font-size: 1.55rem;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segmented button {
    flex: 1 0 auto;
  }

  .capacity-row {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 560px;
  }

  .dialog {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    border-radius: 0;
    max-height: 100dvh;
    overflow-y: auto;
  }

  .dialog-form {
    padding: 16px;
  }

  .dialog-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface, #1a2332);
    padding-bottom: 12px;
    margin-bottom: 0;
  }

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

  .costing-layout,
  .inventory-layout,
  .settings-monitor-row {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-actions button,
  .top-actions label {
    min-height: 40px;
  }
}

.saved-confirmation {
  color: var(--ok) !important;
  font-weight: 600;
}

.danger-text {
  color: var(--danger) !important;
}

.ok-text {
  color: var(--ok) !important;
}

tr.row-overdue td {
  background: rgba(200, 40, 40, 0.07);
}

.wo-comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
}

.wo-comment {
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 8px 12px;
}

.wo-comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.wo-comment-body {
  margin: 0;
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.wo-comment-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-end;
}

.wo-comment-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 48px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: inherit;
  padding: 6px 10px;
  font-size: 0.88rem;
  font-family: inherit;
}

.bom-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.bom-line:last-child {
  border-bottom: 0;
}

.bom-line-label {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.bom-line strong {
  flex-shrink: 0;
  color: var(--ink);
}

.tag.priority-high {
  color: #7a3a00;
  background: #fff0d6;
  border-color: #f5c07a;
}

.tag.priority-urgent {
  color: #7a1a1a;
  background: #fdeaea;
  border-color: #f5a0a0;
}

.tag.priority-low {
  color: #3a4a5a;
  background: #e8edf3;
  border-color: #b0bfcc;
}

@media (max-width: 720px) {
  input,
  select,
  textarea {
    min-height: 44px;
    padding: 12px 13px;
  }

  .billing-warning-banner {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .dialog-form {
    padding: 12px;
  }

  .dialog {
    padding: 16px 12px;
  }
}

.feature-upsell-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 106, 0, 0.07);
  border: 1px solid rgba(255, 106, 0, 0.2);
  border-radius: 8px;
  color: #c8a07a;
  font-size: 0.88rem;
  flex-wrap: wrap;
  margin-top: 4px;
}
.feature-upsell-cta strong { color: #ff9040; }
.feature-upsell-cta button { color: #ff7a20; font-weight: 600; }

.api-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  background: rgba(40, 100, 180, 0.12);
  border-bottom: 1px solid rgba(60, 130, 220, 0.3);
  color: #90b8e8;
  font-size: 0.88rem;
}
.api-status-banner[hidden] { display: none; }
.api-status-banner::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid #90b8e8;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.billing-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(200, 40, 40, 0.15);
  border-bottom: 1px solid rgba(200, 40, 40, 0.4);
  color: #f5a0a0;
  font-size: 0.92rem;
  flex-wrap: wrap;
}

.billing-warning-banner.trial-expiring {
  background: rgba(200, 130, 0, 0.15);
  border-bottom-color: rgba(200, 130, 0, 0.4);
  color: #f5c07a;
}

.billing-warning-banner a,
.billing-warning-banner button.text-button {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

/* License paywall — full-area block when subscription expired */
.license-paywall {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(15, 25, 35, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.license-paywall[hidden] { display: none; }
.license-paywall-card {
  background: rgba(255,255,255,.04);
  border: 1px solid #2d3f52;
  border-radius: 12px;
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.license-paywall-card .paywall-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f87171;
  font-size: 24px;
}
.license-paywall-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #edf4fb;
}
.license-paywall-card p {
  margin: 0;
  font-size: 14px;
  color: #8495a7;
  line-height: 1.6;
}
.license-paywall-card .btn-renew {
  display: inline-block;
  padding: 12px 28px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 4px;
}

/* ── Utility text colors ── */
.warn-text { color: var(--warn) !important; }

/* ── Onboarding checklist float ── */
.onboarding-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.onboarding-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(99,102,241,.45);
}
.onboarding-toggle:hover { background: var(--accent-strong); }
.onboarding-icon { font-size: 16px; }
.onboarding-count {
  background: rgba(255,255,255,.25);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
}
.onboarding-panel {
  background: #1a2332;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 0;
  width: 280px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.onboarding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 14px;
}
.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}
.onboarding-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.onboarding-steps li:hover { background: rgba(255,255,255,.04); }
.onboarding-steps li.done { color: var(--muted); text-decoration: line-through; }
.onboarding-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.2);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.onboarding-check.done {
  background: var(--ok);
  border-color: var(--ok);
}
@media (max-width: 720px) {
  .onboarding-float { bottom: 84px; right: 12px; }
  .onboarding-panel { width: 260px; }
}

/* ── Load chart & OEE bar cells ── */
.load-bar-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 90px;
}
.load-bar-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.load-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}
.load-bar-label {
  font-size: 12px;
  font-weight: 600;
}
.load-bar-pct {
  font-size: 11px;
  color: var(--muted);
}

/* ── Mobile operator UX ── */
@media (max-width: 720px) {
  .text-button, .compact-button {
    min-height: 36px;
    padding: 6px 12px;
  }

  .data-table td, .data-table th {
    padding: 8px 6px;
    font-size: 13px;
  }

  .panel {
    padding: 12px;
  }

  .section-title-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .dialog-header h2 {
    font-size: 1rem;
  }

  /* Operator action buttons fill full width on small screens */
  .timer-log-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .timer-log-actions .primary-action,
  .timer-log-actions .text-button,
  .timer-log-actions .compact-button {
    width: 100%;
    min-height: 44px;
    font-size: 15px;
    justify-content: center;
  }

  .timer-card {
    padding: 14px 12px;
  }

  /* Metric cards stack cleanly */
  .metric-value {
    font-size: 1.4rem;
  }
}
.license-paywall-card .btn-renew:hover { background: #1d4ed8; }

/* ── Mobile PWA polish (768px breakpoint) ── */
@media (max-width: 768px) {
  /* Better touch targets on sidebar nav */
  .nav-item {
    min-height: 48px;
  }

  /* Job/operator/material cards: taller touch targets */
  .attention-card,
  .schedule-card,
  .operator-row article,
  .material-row {
    min-height: 56px;
    padding: 12px;
  }

  /* Primary action and text-button minimum tap targets */
  .primary-action,
  .text-button {
    min-height: 44px;
  }

  /* Toolbars wrap on small screens */
  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Dialogs should use full phone width */
  .dialog {
    width: calc(100vw - 16px) !important;
    max-height: 94vh;
  }

  /* Side panels stack vertically */
  .costing-layout,
  .inventory-layout {
    flex-direction: column;
  }

  /* Table rows: tappable on mobile */
  #jobs-table tr[data-open-job] {
    cursor: pointer;
    touch-action: pan-y;
    transition: background 0.15s;
    user-select: none;
  }

  /* Compact buttons: bigger tap target on mobile */
  .compact-button {
    min-height: 40px;
    padding: 8px 12px;
  }

  /* Forms: larger inputs for fingers */
  input:not([type=checkbox]):not([type=radio]),
  select,
  textarea {
    font-size: 16px; /* prevents iOS auto-zoom */
  }

  /* Main content: bottom padding for home bar + mobile quick bar */
  #main-content, main, .view-content, .pane {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

/* ── iOS safe-area for all screen sizes (notch / Dynamic Island) ── */
body {
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ── Swipe feedback flash ── */
@keyframes swipe-right-flash {
  0% { background: transparent; }
  30% { background: rgba(34,197,94,0.18); }
  100% { background: transparent; }
}
@keyframes swipe-left-flash {
  0% { background: transparent; }
  30% { background: rgba(239,68,68,0.13); }
  100% { background: transparent; }
}
.swipe-right-flash { animation: swipe-right-flash 0.4s ease-out; }
.swipe-left-flash  { animation: swipe-left-flash  0.4s ease-out; }

/* ── Mobile quick-action bar ── */
#mobile-quick-bar {
  display: none;
}
@media (max-width: 768px) {
  #mobile-quick-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--sidebar-bg, #17211f);
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 200;
    justify-content: space-around;
    align-items: center;
  }
  #mobile-quick-bar button {
    flex: 1;
    height: 56px;
    background: none;
    border: none;
    color: var(--muted, #8a9ba8);
    font-size: 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
  }
  #mobile-quick-bar button.active { color: var(--accent, #4ade80); }
  #mobile-quick-bar button svg { width: 22px; height: 22px; fill: currentColor; }
}
