:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #101820;
  --muted: #5f6772;
  --accent: #cf7f00;
  --accent-strong: #9c5f00;
  --brand-dark: #101820;
  --danger: #b42318;
  --good: #1e7a4f;
  --warn: #b87000;
  --bad: #c53030;
  --line-a: #f7f0e1;
  --line-b: #f4f6f8;
  --stroke: #d0d8e1;
  --control-radius: 999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
  background: #ffffff;
  color: var(--ink);
}

.startup-loading {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.startup-loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.startup-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--stroke);
  border-radius: 0.9rem;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.1);
}

.startup-loading-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.startup-loading-spinner {
  width: 1.65rem;
  height: 1.65rem;
  border: 3px solid #f2dfbe;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: startup-spin 0.8s linear infinite;
}

@keyframes startup-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem;
}

#homeView {
  padding-top: 1.7rem;
}

#homeView .topbar {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

#homeView .topbar > div:first-of-type {
  margin-right: auto;
}

#homeView main {
  display: grid;
  gap: 1.55rem;
}

#managerHome,
#supervisorHome {
  display: grid;
  gap: 1.55rem;
}

#homeView section h2 {
  margin: 0 0 0.85rem;
}

#homeView .panel {
  padding: 1rem;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.72rem;
  margin-bottom: 0.82rem;
  padding: 0.52rem 0.68rem;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: #f7f9fb;
  flex-wrap: wrap;
}

.topbar h1 {
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.56rem);
  font-weight: 800;
  line-height: 1.12;
}

.topbar p {
  margin: 0.1rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.topbar .tabs {
  margin-left: auto;
}

.app-mode-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.home-btn {
  width: auto;
  min-width: 72px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--control-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 0.3rem;
  background: #d0dbe5;
  padding: 0.26rem;
  border-radius: 999px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid transparent;
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #37485b;
  cursor: pointer;
  background: transparent;
}

.tab-btn.active {
  background: var(--brand-dark);
  color: #ffffff;
  border-color: var(--brand-dark);
  box-shadow: 0 2px 8px rgba(16, 24, 32, 0.28);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.data-subtabs {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.data-subtab-btn {
  border: 1px solid var(--stroke);
  background: #eef3f7;
  color: #2e3e4e;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
}

.data-subtab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.data-section {
  display: none;
}

.data-section.active {
  display: block;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

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

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
textarea,
select {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: var(--panel);
}

select,
input[type="date"],
input[type="time"],
input[type="month"] {
  border-radius: var(--control-radius);
}

input[type="checkbox"],
input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

button {
  border: 0;
  border-radius: var(--control-radius);
  padding: 0.6rem 0.8rem;
  background: var(--brand-dark);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

#homeView.dashboard-page button:not(:disabled):hover,
#lineWorkspace button:not(:disabled):hover {
  filter: brightness(0.96);
}

#homeView.dashboard-page button:not(:disabled):not(.ghost-btn):not(.danger):not(.table-edit-pill):not(.data-subtab-btn):not(.shift-option):not(.line-group-toggle):not(.tab-btn):not(.supervisor-action-delete):hover,
#lineWorkspace button:not(:disabled):not(.ghost-btn):not(.danger):not(.table-edit-pill):not(.data-subtab-btn):not(.shift-option):not(.line-group-toggle):not(.tab-btn):not(.supervisor-action-delete):hover,
#manageSupervisorsModal .supervisor-action-save:not(:disabled):hover,
#homeView.dashboard-page .tab-btn.active:not(:disabled):hover,
#lineWorkspace .tab-btn.active:not(:disabled):hover {
  background: #2a3440;
  border-color: #2a3440;
  filter: none;
}

#homeView.dashboard-page button:not(:disabled):active,
#lineWorkspace button:not(:disabled):active {
  filter: brightness(0.92);
}

.ghost-btn {
  border: 1px solid var(--stroke);
  background: #f4f6f8;
  color: var(--ink);
}

.ghost-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--brand-dark);
}

.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shift-toggle {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  border: 1px solid var(--stroke);
  border-radius: var(--control-radius);
  overflow: hidden;
  background: #f2f5f8;
}

.shift-option {
  border: 0;
  padding: 0.5rem 0.7rem;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  flex: 1 1 0;
  white-space: nowrap;
}

.shift-option.active {
  background: var(--accent);
  color: var(--brand-dark);
}

.crew-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.layout-tool-row {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.kpi-grid article {
  border: 1px solid var(--stroke);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--panel);
}

.kpi-grid h3 {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.kpi-grid p {
  margin: 0.25rem 0 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.line-map {
  position: relative;
  min-height: 760px;
  border: 1px solid var(--stroke);
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #f5f7f9 0%, #eef2f5 100%);
  overflow: hidden;
  padding: 0.5rem;
}

.day-viz-canvas {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.75rem;
}

.day-viz-shell {
  border: 1px solid var(--stroke);
  border-radius: 0.8rem;
  background: #f7fbff;
  overflow-x: auto;
  overflow-y: hidden;
}

.day-viz-inner {
  min-width: 1080px;
  padding: 0.55rem 0.6rem 0.65rem;
  display: grid;
  gap: 0.45rem;
}

.day-viz-axis-row,
.day-viz-swimlane {
  display: grid;
  grid-template-columns: 130px minmax(820px, 1fr);
  gap: 0.45rem;
  align-items: stretch;
}

.day-viz-axis-label,
.day-viz-lane-label {
  border: 1px solid #dbe4ec;
  border-radius: 0.6rem;
  background: #eef4f9;
  color: #334558;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  display: grid;
  place-items: center;
  padding: 0.5rem 0.4rem;
}

.day-viz-lane-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.14rem;
  padding: 0.46rem 0.56rem;
}

.day-viz-lane-title {
  font-size: 0.74rem;
  font-weight: 800;
  color: #314456;
  line-height: 1.1;
}

.day-viz-lane-total {
  font-size: 0.68rem;
  font-weight: 600;
  color: #5f7386;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.day-viz-axis-track,
.day-viz-lane-track {
  position: relative;
  border: 1px solid #dbe4ec;
  border-radius: 0.65rem;
  overflow: hidden;
}

.day-viz-axis-track {
  height: 44px;
  background: linear-gradient(180deg, #f3f7fb 0%, #eef3f8 100%);
}

.day-viz-lane-track {
  height: 76px;
  background: linear-gradient(180deg, #fdfefe 0%, #f7fbfd 100%);
}

.day-viz-axis-line,
.day-viz-hour-line {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid #deebf3;
}

.day-viz-axis-line.major,
.day-viz-hour-line.major {
  border-left-color: #c8d7e4;
}

.day-viz-axis-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  width: 0;
  height: 100%;
}

.day-viz-axis-tick.major span {
  position: absolute;
  top: 0.35rem;
  left: 0;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  color: #566b7f;
  white-space: nowrap;
}

.day-viz-lane-empty {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: #6f8192;
  font-style: italic;
}

.day-viz-block {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: 0.55rem;
  border-left: 3px solid #3ca0cf;
  border: 1px solid transparent;
  background: rgba(193, 226, 243, 0.88);
  color: #1b4f71;
  padding: 0.24rem 0.4rem;
  overflow: hidden;
  min-width: 8px;
  box-shadow: 0 1px 3px rgba(16, 40, 58, 0.08);
  z-index: 2;
}

.day-viz-block.shift {
  border-left-color: #1f7a8c;
  border-color: rgba(31, 122, 140, 0.22);
  background: rgba(182, 220, 227, 0.9);
  color: #154c57;
}

.day-viz-block.run-setup {
  border-left-color: #3178b8;
  border-color: rgba(49, 120, 184, 0.24);
  background: rgba(194, 219, 247, 0.9);
  color: #153b5c;
}

.day-viz-block.run-main {
  border-left-color: #1a8c68;
  border-color: rgba(26, 140, 104, 0.24);
  background: rgba(191, 239, 220, 0.88);
  color: #165a45;
}

.day-viz-block.break {
  border-left-color: #b7791f;
  border-color: rgba(183, 121, 31, 0.24);
  background: rgba(254, 236, 204, 0.9);
  color: #7a4b0e;
}

.day-viz-block.downtime {
  border-left-color: #b83232;
  border-color: rgba(184, 50, 50, 0.24);
  background: rgba(250, 215, 215, 0.9);
  color: #7c1d1d;
}

.day-viz-title {
  display: block;
  font-weight: 700;
  font-size: 0.74rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-viz-sub {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.64rem;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-viz-empty {
  padding: 1rem;
  color: #647687;
  font-size: 0.9rem;
  border: 1px solid var(--stroke);
  border-radius: 0.8rem;
  background: #f7fbff;
}

.day-glance {
  border: 1px solid var(--stroke);
  border-radius: 0.8rem;
  background: #f9fcff;
  padding: 0.75rem;
}

.day-glance-head h3 {
  margin: 0;
  font-size: 0.98rem;
  color: #293b4d;
}

.day-glance-head p {
  margin: 0.24rem 0 0;
  color: #5f7488;
  font-size: 0.78rem;
}

.day-glance-grid {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.day-glance-card {
  border: 1px solid #d9e6f1;
  border-radius: 0.72rem;
  padding: 0.62rem;
  background: #ffffff;
}

.day-glance-card h4 {
  margin: 0;
  font-size: 0.82rem;
  color: #2d4155;
}

.day-glance-meta {
  margin: 0.16rem 0 0.48rem;
  font-size: 0.7rem;
  color: #667c90;
}

.day-glance-stack {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #d6e3ef;
  background: #eef4f9;
  display: flex;
}

.day-glance-seg {
  display: block;
  height: 100%;
}

.day-glance-seg.run-main {
  background: #54b691;
}

.day-glance-seg.run-setup {
  background: #6ea6db;
}

.day-glance-seg.break {
  background: #e3bf6f;
}

.day-glance-seg.downtime {
  background: #e27c7c;
}

.day-glance-seg.unassigned {
  background: #c5d1db;
}

.day-glance-seg.fallback {
  width: 100%;
  background: #dbe7f2;
}

.day-glance-legend {
  margin-top: 0.52rem;
  display: grid;
  gap: 0.24rem;
}

.day-glance-legend-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #475d71;
}

.day-glance-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.day-glance-dot.run-main {
  background: #54b691;
}

.day-glance-dot.run-setup {
  background: #6ea6db;
}

.day-glance-dot.break {
  background: #e3bf6f;
}

.day-glance-dot.downtime {
  background: #e27c7c;
}

.day-glance-dot.unassigned {
  background: #9fb0c0;
}

.day-glance-legend-item strong {
  color: #2f4458;
  font-variant-numeric: tabular-nums;
}

.day-glance-run-list {
  display: grid;
  gap: 0.42rem;
}

.day-glance-run-tile {
  border: 1px solid #d9e4ee;
  border-radius: 0.66rem;
  padding: 0.34rem 0.42rem;
  background: #f8fbfe;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(172px, 36%);
  align-items: center;
  gap: 0.4rem;
}

.day-glance-run-main {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.38rem;
}

.day-glance-light {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.day-glance-light.green {
  background: #5fc794;
  border-color: #3ea476;
}

.day-glance-light.amber {
  background: #efbe62;
  border-color: #cf9c3f;
}

.day-glance-light.red {
  background: #e78686;
  border-color: #c95f5f;
}

.day-glance-run-copy {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.day-glance-run-title {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.1;
  color: #2b4054;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-glance-run-rate {
  font-size: 0.78rem;
  line-height: 1.1;
  color: #60778c;
  font-variant-numeric: tabular-nums;
}

.day-glance-run-callouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.18rem;
}

.day-glance-run-callout {
  border: 1px solid #e2ebf4;
  border-radius: 0.42rem;
  padding: 0.22rem 0.3rem;
  display: grid;
  gap: 0.06rem;
  background: #ffffff;
  text-align: right;
}

.day-glance-run-callout span {
  font-size: 0.58rem;
  color: #51687c;
  line-height: 1;
}

.day-glance-run-callout strong {
  font-size: 0.67rem;
  color: #2f4559;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  white-space: nowrap;
}

.day-glance-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.day-glance-list li {
  border: 1px solid #e0e9f2;
  border-radius: 0.55rem;
  padding: 0.42rem 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.day-glance-list li span {
  font-size: 0.74rem;
  color: #415668;
}

.day-glance-list li strong {
  font-size: 0.74rem;
  color: #2b4155;
  font-variant-numeric: tabular-nums;
}

.day-glance-empty {
  margin: 0;
  font-size: 0.76rem;
  color: #61788c;
}

@media (max-width: 1000px) {
  .day-viz-inner {
    min-width: 840px;
  }

  .day-viz-axis-row,
  .day-viz-swimlane {
    grid-template-columns: 108px minmax(620px, 1fr);
  }

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

@media (max-width: 760px) {
  .day-viz-axis-label,
  .day-viz-lane-label {
    font-size: 0.72rem;
    padding: 0.4rem 0.3rem;
  }

  .day-viz-inner {
    min-width: 760px;
  }

  .day-glance-grid {
    grid-template-columns: 1fr;
  }

  .day-glance-run-tile {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .day-glance-run-callouts {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .day-glance-run-callout {
    text-align: left;
  }
}

.stage-card {
  position: absolute;
  border: 2px solid #7f8d9c;
  border-radius: 0.4rem;
  padding: 0.45rem 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--line-b);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  overflow: hidden;
  z-index: 2;
}

.flow-guide {
  position: absolute;
  z-index: 1;
  border-radius: 999px;
  pointer-events: none;
  --flow-track: #8da0b5;
  --flow-track-strong: #6f859a;
  --flow-segment-length: 18px;
  --flow-segment-gap: 10px;
  --flow-segment-step: calc(var(--flow-segment-length) + var(--flow-segment-gap));
}

.line-map.layout-editing .flow-guide:not(.auto-flow) {
  pointer-events: auto;
  cursor: move;
}

.flow-guide.auto-flow {
  pointer-events: none;
  transform-origin: 0 50%;
}

.flow-guide.flow-line::before,
.flow-guide.flow-arrow::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background-image: repeating-linear-gradient(
    90deg,
    var(--flow-track) 0 var(--flow-segment-length),
    transparent var(--flow-segment-length) var(--flow-segment-step)
  );
  background-position: 0 50%;
  border-radius: 999px;
  opacity: 0.9;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.flow-guide.flow-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--flow-track-strong);
  transition: opacity 0.2s ease;
}

.line-map.flow-running .flow-guide.flow-line::before,
.line-map.flow-running .flow-guide.flow-arrow::before {
  animation: flow-guide-lines 0.85s linear infinite;
  filter: drop-shadow(0 0 2px rgba(126, 157, 186, 0.45));
}

.line-map.flow-running .flow-guide.flow-arrow::after {
  animation: flow-guide-arrow 0.9s ease-in-out infinite;
}

.line-map.flow-static .flow-guide.flow-line::before,
.line-map.flow-static .flow-guide.flow-arrow::before {
  animation: none;
  opacity: 0.78;
}

.line-map.layout-editing .flow-guide.flow-line::before,
.line-map.layout-editing .flow-guide.flow-arrow::before,
.line-map.layout-editing .flow-guide.flow-arrow::after {
  animation: none;
  filter: none;
  opacity: 1;
}

@keyframes flow-guide-lines {
  from {
    background-position: 0 50%;
  }

  to {
    background-position: var(--flow-segment-step) 50%;
  }
}

@keyframes flow-guide-arrow {
  0%,
  100% {
    opacity: 0.68;
  }

  50% {
    opacity: 1;
  }
}

.flow-guide.flow-shape {
  border-radius: 0;
  background: transparent;
}

.flow-shape-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.flow-guide-delete {
  display: none;
}

.line-map.layout-editing .flow-guide-delete {
  display: inline-flex;
  position: absolute;
  left: 0;
  top: -16px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: #c53030;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
}

.flow-guide-resize {
  display: none;
}

.line-map.layout-editing .flow-guide-resize {
  display: inline-block;
  position: absolute;
  right: 0;
  bottom: -3px;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, transparent 0 40%, #4d6175 42% 48%, transparent 50% 60%, #4d6175 62% 68%, transparent 70% 100%);
  cursor: nwse-resize;
}

.flow-guide-rotate {
  display: none;
}

.line-map.layout-editing .flow-guide-rotate {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: -12px;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  cursor: grab;
}

.stage-card.status-good {
  border-color: #3e8c61;
  box-shadow: inset 0 0 0 1px #ccead7;
}

.stage-card.status-warn {
  border-color: #b7791f;
  box-shadow: inset 0 0 0 1px #fbe9c8;
}

.stage-card.status-bad {
  border-color: #7f8d9c;
}

.stage-card.group-main {
  background: linear-gradient(180deg, #fdf7eb 0%, #f6ecd8 100%);
}

.stage-card.group-prep {
  background: linear-gradient(180deg, #f2f7fb 0%, #eaf1f7 100%);
}

.stage-card.group-main .stage-crew-pill {
  border-color: #bca888;
  background: #fff7ea;
  color: #5c4628;
}

.stage-card.group-prep .stage-crew-pill {
  border-color: #7a8da2;
  background: #f4f8fc;
  color: #203348;
}

.stage-card.kind-transfer {
  border-style: dashed;
  background: transparent;
  border-color: #9ba8b5;
  justify-content: center;
}

.stage-card.kind-transfer::before {
  content: "";
  position: absolute;
  top: 50%;
  right: -14px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 14px solid #9ba8b5;
  transform: translateY(-50%);
}

.stage-card:hover {
  transform: translateY(-2px);
}

.line-map.layout-editing .stage-card {
  cursor: move;
  user-select: none;
}

.line-map.layout-editing .stage-card:hover {
  transform: none;
}

.stage-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, transparent 0 40%, #4d6175 42% 48%, transparent 50% 60%, #4d6175 62% 68%, transparent 70% 100%);
  cursor: nwse-resize;
}

.stage-card.selected {
  box-shadow: 0 0 0 3px rgba(207, 127, 0, 0.24);
}

.stage-card.bottleneck {
  box-shadow: none;
}

.stage-card.live-downtime-warning {
  border-color: #cc8a23;
  background: linear-gradient(180deg, #fff8ec 0%, #ffeecf 100%);
  box-shadow: 0 0 0 2px rgba(214, 150, 48, 0.24), 0 0 20px rgba(214, 150, 48, 0.24), inset 0 0 0 1px #f7e2b1;
}

.stage-card.live-downtime-critical {
  border-color: #c54f4f;
  background: linear-gradient(180deg, #fff5f5 0%, #ffe8e8 100%);
  box-shadow: 0 0 0 2px rgba(201, 79, 79, 0.28), 0 0 22px rgba(201, 79, 79, 0.3), inset 0 0 0 1px #f5c6c6;
}

.stage-card.live-downtime-warning .stage-title {
  color: #6a430f;
}

.stage-card.live-downtime-critical .stage-title {
  color: #7a2a2a;
}

.stage-card.live-downtime-warning .stage-crew-pill {
  border-color: #d7a964;
  background: #fff3de;
  color: #714810;
}

.stage-card.live-downtime-critical .stage-crew-pill {
  border-color: #db9c9c;
  background: #fdeaea;
  color: #852f2f;
}

.stage-card.live-downtime-warning.kind-transfer {
  background: rgba(255, 241, 218, 0.5);
}

.stage-card.live-downtime-critical.kind-transfer {
  background: rgba(254, 226, 226, 0.48);
}

.stage-card.live-downtime-warning.kind-transfer::before {
  border-left-color: #cc8a23;
}

.stage-card.live-downtime-critical.kind-transfer::before {
  border-left-color: #c54f4f;
}

.bottleneck-tag {
  border-radius: 999px;
  padding: 0.12rem 0.4rem;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: #fff2df;
  color: #b45309;
  border: 1px solid #f4b469;
}

.stage-tag-row {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin-top: 0.18rem;
}

.stage-tag-row .status-tag {
  margin-top: 0;
}

.stage-title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(0.8rem, 1.15vw, 2rem);
  line-height: 1.15;
  max-width: 100%;
}

.stage-meta {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.15rem;
  font-size: 0.63rem;
  line-height: 1.15;
  color: #2e3f4e;
}

.stage-meta.compact {
  font-size: 0.62rem;
}

.stage-card.compact .stage-title {
  font-size: clamp(0.76rem, 0.82vw, 1rem);
  max-width: 100%;
}

.stage-card.compact .stage-meta {
  font-size: 0.58rem;
  margin-top: 0.3rem;
}

.status-tag {
  align-self: flex-start;
  margin-top: 0.3rem;
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.status-tag.good {
  background: #dbf5e5;
  color: var(--good);
}

.status-tag.warn {
  background: #fff1d7;
  color: #b7791f;
}

.status-tag.bad {
  background: #fde2e2;
  color: #c53030;
}

.stage-card.compact .status-tag {
  margin-top: 0.18rem;
  font-size: 0.54rem;
  padding: 0.1rem 0.35rem;
}

.stage-live-pill {
  align-self: auto;
  margin-top: 0;
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.stage-pill-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.24rem;
}

.stage-crew-pill {
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  border: 1px solid #8090a1;
  background: #eef3f8;
  color: #2e4256;
}

.stage-live-pill.warning {
  background: #fce8c5;
  color: #845415;
  border: 1px solid #e6be80;
}

.stage-live-pill.critical {
  background: #fcdede;
  color: #9a3434;
  border: 1px solid #eaa9a9;
}

.stage-card.compact .stage-live-pill {
  font-size: 0.52rem;
  padding: 0.1rem 0.35rem;
}

.stage-card.compact .stage-crew-pill {
  font-size: 0.52rem;
  padding: 0.1rem 0.35rem;
}

.trend-chart {
  width: 100%;
  border: 1px solid #d5dee6;
  border-radius: 0.65rem;
  background: #f9fbfd;
  padding: 0.35rem 0.5rem 0.5rem;
}

.trend-svg {
  width: 100%;
  height: auto;
  display: block;
}

.grid {
  stroke: #e5ebf1;
  stroke-width: 1;
}

.axis-line {
  stroke: #9cabbb;
  stroke-width: 1.2;
}

.axis {
  fill: #64768a;
  font-size: 11px;
  font-weight: 600;
}

.bar-down {
  fill: rgba(198, 48, 48, 0.25);
}

.bar-units {
  fill: rgba(16, 24, 32, 0.22);
}

.line-util {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.3;
}

.line-rate {
  fill: none;
  stroke: #1f4f8a;
  stroke-width: 2.2;
  stroke-dasharray: 6 4;
}

.line-down-avg {
  fill: none;
  stroke: #a73838;
  stroke-width: 2.2;
  stroke-dasharray: 8 5;
}

.trend-avg-callout-bg {
  fill: #ffffff;
  stroke: #8fa2b5;
  stroke-width: 1.5;
}

.trend-avg-callout-bg.units {
  fill: #eaf2fb;
  stroke: #1f4f8a;
}

.trend-avg-callout-bg.down {
  fill: #fce9e9;
  stroke: #a73838;
}

.trend-avg-callout-text {
  font-size: 12px;
  font-weight: 800;
  fill: #1f2935;
}

.trend-avg-callout-text.units {
  fill: #1f4f8a;
}

.trend-avg-callout-text.down {
  fill: #a73838;
}

.line-etc {
  fill: none;
  stroke: #1f4f8a;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.dot-util {
  fill: var(--accent);
}

.dot-rate {
  fill: #1f4f8a;
}

.legend {
  font-size: 11px;
  font-weight: 700;
}

.legend.units {
  fill: #1f2935;
}

.legend.rate {
  fill: #1f4f8a;
}

.legend.util {
  fill: var(--accent);
}

.legend.down {
  fill: #a73838;
}

.legend.down-avg {
  fill: #a73838;
}

.legend.etc {
  fill: #1f4f8a;
}

.empty-chart {
  color: #5f6c7a;
  font-size: 0.9rem;
  padding: 1rem;
}

.line-trend-shell {
  display: grid;
  gap: 0.8rem;
}

.line-trend-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.line-trend-toolbar .muted {
  margin: 0;
}

.line-trend-range {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.line-trend-range .ghost-btn {
  min-width: 96px;
}

.line-trend-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.62rem;
}

.line-trend-kpis article {
  border: 1px solid #d9e2ec;
  border-radius: 0.72rem;
  background: linear-gradient(180deg, #fefefe 0%, #f6f9fc 100%);
  padding: 0.58rem 0.62rem;
}

.line-trend-kpis h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5c6f84;
}

.line-trend-kpis p {
  margin: 0.18rem 0 0;
  font-size: 1.72rem;
  font-weight: 700;
  color: #101820;
  line-height: 1.08;
}

.line-trend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.line-trend-panel {
  border: 1px solid #d9e2ec;
  border-radius: 0.72rem;
  background: #ffffff;
  padding: 0.72rem;
}

.line-trend-panel h3 {
  margin: 0 0 0.58rem;
  font-size: 1rem;
}

.line-trend-chart {
  min-height: 360px;
}

.line-trend-svg .axis {
  font-size: 13px;
  font-weight: 700;
}

.line-trend-svg .legend {
  font-size: 13px;
}

.line-trend-svg .grid {
  stroke-width: 1.1;
}

.line-trend-svg .axis-line {
  stroke-width: 1.35;
}

.line-trend-svg .line-rate,
.line-trend-svg .line-util,
.line-trend-svg .line-down-avg {
  stroke-width: 2.7;
}

.line-trend-reasons {
  display: grid;
  gap: 0.4rem;
}

.line-trend-reason-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.58rem;
  border: 1px solid #dce5ee;
  background: #f8fbfd;
}

.line-trend-reason-item span {
  color: #33475d;
  font-weight: 600;
}

.line-trend-reason-item strong {
  color: #8a4f00;
  font-weight: 700;
}

.line-trend-empty {
  margin: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 26, 38, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: min(1280px, 97vw);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #ccd7e2;
  border-radius: 0.9rem;
  box-shadow: 0 24px 60px rgba(9, 18, 30, 0.25);
  padding: 0.9rem;
}

.stage-settings-modal-card {
  width: min(780px, 95vw);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.55rem;
}

.modal-head h2 {
  margin: 0;
  font-size: 2rem;
}

.trend-controls {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.modal-title-block {
  max-width: min(740px, 100%);
}

.modal-title-block .muted {
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: 1.1rem;
  line-height: 1.28;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

#trendMonthLabel {
  min-width: 170px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #33475a;
}

.data-layout {
  display: grid;
  gap: 1rem;
}

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

#dashboardTable {
  min-width: 880px;
}

.entry-cards {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.entry-card {
  border: 1px solid #d8e0e8;
  border-radius: 0.55rem;
  padding: 0.55rem 0.65rem;
  background: #f8fbfd;
}

.entry-card h4 {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
}

.entry-card p {
  margin: 0;
  font-size: 0.82rem;
  color: #415263;
}

.line-card {
  border: 1px solid #ccd8e4;
  border-radius: 0.75rem;
  padding: 0.95rem;
  background: #f8fbfd;
  min-height: 168px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.line-card.line-card-live-active {
  border-color: #67bb95;
  background: #f6fcf9;
}

.line-card.line-card-live-warning {
  border-color: #d99a42;
  background: #fffaf3;
}

.line-card.line-card-live-critical {
  border-color: #d76464;
  background: #fff6f6;
}

.line-card.line-card-unavailable {
  border-color: #e6b8b8;
  background: #fff4f4;
}

.line-card.line-card-unavailable h3 {
  color: #8d2323;
}

.line-card.line-card-empty {
  border-style: dashed;
}

.line-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
}

.line-card p {
  margin: 0 0 0.9rem;
  color: #5f6c7a;
}

.line-shift-tracker {
  --tracker-cell-size: 8px;
  --tracker-cell-gap: 2px;
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid #d4e0eb;
  border-radius: 0.55rem;
  background: #ffffff;
  overflow: hidden;
}

.line-shift-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--tracker-cell-size));
  grid-auto-columns: var(--tracker-cell-size);
  gap: var(--tracker-cell-gap);
  width: max-content;
  max-width: 100%;
}

.line-shift-cell {
  width: var(--tracker-cell-size);
  height: var(--tracker-cell-size);
  box-sizing: border-box;
  border-radius: 2px;
  border: 1px solid #d4deea;
  background: transparent;
}

.line-shift-cell.is-none {
  background: transparent;
  border-color: #d4deea;
}

.line-shift-cell.is-one {
  background: #9cb5cc;
  border-color: #9cb5cc;
}

.line-shift-cell.is-both {
  background: #2f475f;
  border-color: #2f475f;
}

.line-shift-cell.is-pad {
  opacity: 0;
}

.line-card-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

#openBuilder {
  margin-top: 0.15rem;
}

#homeView section > .muted {
  margin-top: 0.55rem;
  margin-bottom: 0;
}

#supervisorMobileMode.active {
  background: var(--accent);
  color: var(--brand-dark);
}

#supervisorAppSection.mobile-mode .control-row,
#supervisorAppSection.mobile-mode .form-grid {
  grid-template-columns: 1fr;
}

#supervisorAppSection.mobile-mode .kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#supervisorAppSection.mobile-mode .table-wrap {
  display: none;
}

#supervisorAppSection.mobile-mode #supervisorEntryCards {
  display: grid !important;
}

#supervisorAppSection.mobile-mode #supervisorActionCards {
  display: grid !important;
}

.supervisor-main-tab-btn {
  min-width: 160px;
}

#supervisorAppSection .tabs {
  display: inline-flex;
  width: auto;
  margin: 0.35rem 0 0.7rem;
}

#supervisorAppSection {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#supervisorAppSection .action-row {
  margin-bottom: 0.25rem;
}

.supervisor-top-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 0.2rem 0 0.7rem;
}

.supervisor-line-select-inline {
  min-width: 260px;
  max-width: 340px;
}

.supervisor-line-select-inline select {
  height: 46px;
  border-radius: var(--control-radius);
}

#supervisorAppSection .data-subtabs {
  margin-bottom: 0.65rem;
}

#supervisorAppSection .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

#supervisorAppSection .form-grid button:not(.input-now-btn) {
  min-width: 170px;
}

#supervisorActionDescription {
  grid-column: 1 / -1;
  min-height: 150px;
  resize: vertical;
}

#supervisorAppSection .table-wrap {
  margin-top: 0.65rem;
}

.supervisor-main-panel .control-row {
  margin-bottom: 0.8rem;
  grid-template-columns: minmax(160px, 1.1fr) minmax(180px, 1fr) minmax(210px, 1fr) minmax(160px, 1.1fr);
}

.supervisor-main-panel {
  display: none;
}

.supervisor-main-panel.active {
  display: block;
}

.supervisor-assignment-sections {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.6rem;
}

.supervisor-assignment-wrap {
  display: grid;
  gap: 0.55rem;
}

.supervisor-assignment-group {
  display: grid;
  gap: 0.38rem;
}

.supervisor-assignment-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #4f5f70;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.supervisor-access-grid {
  border: 1px solid #d3dbe4;
  border-radius: 14px;
  padding: 0.55rem;
  display: grid;
  gap: 0.42rem;
  background: #f8fbfd;
}

.supervisor-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.48rem;
  border: 1px solid #dce4ec;
  border-radius: 12px;
  background: #ffffff;
}

.supervisor-access-line {
  font-size: 0.92rem;
  font-weight: 600;
  color: #2f4051;
}

.supervisor-access-shifts {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.supervisor-shift-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid #ccd8e4;
  border-radius: 999px;
  padding: 0.24rem 0.68rem;
  background: #eef3f7;
  color: #2f4051;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.supervisor-shift-pill input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.supervisor-shift-pill.is-selected,
.supervisor-shift-pill:has(input[type="checkbox"]:checked) {
  border-color: var(--accent-strong);
  background: #f7d89a;
  color: #182735;
}

.supervisor-shift-pill:has(input[type="checkbox"]:focus-visible) {
  outline: 2px solid rgba(207, 127, 0, 0.32);
  outline-offset: 1px;
}

.supervisor-manager-row h3 {
  margin: 0;
}

.supervisor-manager-actions {
  margin-top: 0.1rem;
}

#manageSupervisorsModal .modal-card {
  width: min(1160px, 96vw);
  padding: 1rem;
}

#manageSupervisorsModal .modal-head {
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid #d8e1eb;
}

#manageSupervisorsModal .modal-head h2 {
  font-size: clamp(1.85rem, 2.5vw, 2.35rem);
  line-height: 1.05;
}

#manageSupervisorsModal .modal-title-block .muted {
  margin-top: 0.35rem;
  font-size: 1rem;
  max-width: 58ch;
  line-height: 1.34;
}

#manageSupervisorsModal #supervisorManagerList {
  gap: 1.05rem;
}

.supervisor-manager-empty {
  border: 1px dashed #c7d3df;
  border-radius: 0.9rem;
  padding: 1rem;
  background: #f8fbfd;
}

.supervisor-manager-empty .muted {
  margin: 0;
}

#manageSupervisorsModal .supervisor-manager-row {
  border-radius: 0.9rem;
  border: 1px solid #cfdbe7;
  background: linear-gradient(180deg, #fdfefe 0%, #f8fbfd 100%);
  padding: 0.78rem 0.82rem;
  box-shadow: 0 1px 0 rgba(14, 24, 38, 0.03);
}

.supervisor-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}

.supervisor-manager-identity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#manageSupervisorsModal .supervisor-manager-row h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.supervisor-manager-handle {
  border: 1px solid #d1dce7;
  border-radius: 999px;
  padding: 0.14rem 0.5rem;
  background: #f0f5fa;
  color: #4a5f74;
  font-size: 0.86rem;
  font-weight: 600;
}

.supervisor-count-chip {
  border: 1px solid #e7c48a;
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  background: #fff4dd;
  color: #7a4a00;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

#manageSupervisorsModal .supervisor-assignment-wrap {
  gap: 0.45rem;
}

#manageSupervisorsModal .supervisor-assignment-group {
  gap: 0.4rem;
  padding: 0.52rem;
  border: 1px solid #d7e1ec;
  border-radius: 0.78rem;
  background: #ffffff;
}

#manageSupervisorsModal .supervisor-assignment-title {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: #607387;
}

#manageSupervisorsModal .supervisor-access-grid {
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 0.38rem;
  background: transparent;
}

#manageSupervisorsModal .supervisor-access-row {
  padding: 0.46rem 0.55rem;
  border-radius: 0.68rem;
  border: 1px solid #dbe5ef;
  background: #f9fcfe;
}

#manageSupervisorsModal .supervisor-access-line {
  font-size: 0.94rem;
}

#manageSupervisorsModal .supervisor-access-shifts {
  gap: 0.3rem;
}

#manageSupervisorsModal .supervisor-shift-pill {
  padding: 0.22rem 0.62rem;
  border-color: #cedae6;
  background: #edf3f8;
  font-size: 0.78rem;
}

#manageSupervisorsModal .supervisor-shift-pill.is-selected,
#manageSupervisorsModal .supervisor-shift-pill:has(input[type="checkbox"]:checked) {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: var(--brand-dark);
}

#manageSupervisorsModal .supervisor-shift-pill:has(input[type="checkbox"]:focus-visible) {
  outline: 2px solid rgba(207, 127, 0, 0.35);
  outline-offset: 1px;
}

#manageSupervisorsModal .supervisor-shift-pill.is-selected span,
#manageSupervisorsModal .supervisor-shift-pill:has(input[type="checkbox"]:checked) span {
  color: var(--brand-dark);
}

#manageSupervisorsModal .supervisor-manager-actions {
  margin-top: 0.52rem;
  padding-top: 0.58rem;
  gap: 0.45rem;
  border-top: 1px solid #dce6f0;
}

#manageSupervisorsModal .supervisor-manager-actions button {
  min-width: 0;
  padding: 0.5rem 0.88rem;
}

#manageSupervisorsModal .supervisor-action-save {
  background: var(--brand-dark);
}

#manageSupervisorsModal .supervisor-action-delete {
  background: #bf2d20;
}

.manage-line-groups-modal-card {
  width: min(1000px, 96vw);
  padding: 1rem;
}

.manage-product-list-modal-card {
  width: min(1380px, 97vw);
  padding: 1rem;
}

.product-line-assign-modal-card {
  width: min(560px, 94vw);
  padding: 1rem;
}

#manageProductCatalogModal .modal-head {
  align-items: center;
  margin-bottom: 0.7rem;
  padding-bottom: 0.62rem;
  border-bottom: 1px solid #d8e1eb;
}

#manageProductCatalogModal .modal-head-actions {
  justify-content: flex-end;
}

#productLineAssignModal .modal-head {
  align-items: center;
  margin-bottom: 0.7rem;
  padding-bottom: 0.62rem;
  border-bottom: 1px solid #d8e1eb;
}

.product-line-assign-product-wrap {
  margin: 0 0 0.55rem;
  color: #35495e;
  font-size: 0.91rem;
}

.product-line-assign-list {
  border: 1px solid #d6e1ec;
  border-radius: 12px;
  background: #f9fbfd;
  max-height: 320px;
  overflow: auto;
  padding: 0.55rem;
  display: grid;
  gap: 0.35rem;
}

.product-line-assign-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
}

.product-line-assign-row:hover {
  background: #eef4fb;
}

.product-line-assign-actions {
  justify-content: flex-end;
  margin-top: 0.65rem;
}

#manageLineGroupsModal .modal-head {
  align-items: center;
  margin-bottom: 0.7rem;
  padding-bottom: 0.62rem;
  border-bottom: 1px solid #d8e1eb;
}

#manageLineGroupsModal .modal-head h2 {
  font-size: clamp(1.7rem, 2.3vw, 2.15rem);
  line-height: 1.05;
}

#manageLineGroupsModal .modal-title-block .muted {
  margin-top: 0.28rem;
  margin-bottom: 0;
  max-width: 56ch;
}

.line-group-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.52rem;
  align-items: center;
  margin-bottom: 0.72rem;
}

.line-group-create-form input {
  height: 46px;
}

.line-group-manager-list {
  display: grid;
  gap: 0.68rem;
}

.line-group-panel {
  display: grid;
  gap: 0.5rem;
}

.line-group-panel h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #31465b;
}

.line-group-list,
.line-group-line-list {
  display: grid;
  gap: 0.45rem;
}

.line-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 0.42rem;
  align-items: center;
  border: 1px solid #d6e1ec;
  border-radius: 0.68rem;
  padding: 0.44rem 0.5rem;
  background: #f8fbfe;
}

.line-group-row input {
  height: 40px;
}

.line-group-row .line-group-count {
  font-size: 0.74rem;
  color: #53697f;
  font-weight: 700;
  white-space: nowrap;
}

.line-group-row .ghost-btn,
.line-group-row .danger {
  min-height: 34px;
  padding: 0 0.72rem;
}

.line-group-line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.6fr);
  align-items: center;
  gap: 0.56rem;
  border: 1px solid #dbe5ef;
  border-radius: 0.68rem;
  padding: 0.48rem 0.58rem;
  background: #f9fcfe;
}

.line-group-line-row span {
  color: #2f4051;
  font-weight: 600;
  font-size: 0.92rem;
}

.line-group-line-row select {
  height: 40px;
}

#addSupervisorModal .modal-card {
  width: min(1080px, 96vw);
  padding: 1rem;
}

#addSupervisorModal .modal-head {
  align-items: center;
  margin-bottom: 0.9rem;
  padding-bottom: 0.72rem;
  border-bottom: 1px solid #d8e1eb;
}

#addSupervisorModal .modal-head h2 {
  font-size: clamp(1.85rem, 2.5vw, 2.3rem);
  line-height: 1.04;
}

#addSupervisorModal .modal-title-block .muted {
  margin-top: 0.35rem;
  max-width: 58ch;
  font-size: 1rem;
  line-height: 1.33;
}

#addSupervisorModal .add-supervisor-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 0;
}

#addSupervisorModal .add-supervisor-section {
  border: 1px solid #d7e1ec;
  border-radius: 0.86rem;
  background: linear-gradient(180deg, #fdfefe 0%, #f8fbfd 100%);
  padding: 0.64rem;
  display: grid;
  gap: 0.45rem;
}

#addSupervisorModal .add-supervisor-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

#addSupervisorModal .add-supervisor-field {
  display: grid;
  gap: 0.22rem;
}

#addSupervisorModal .add-supervisor-field > span {
  margin: 0 0 0.05rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #607387;
}

#addSupervisorModal .add-supervisor-field input {
  height: 48px;
  border-radius: 0.72rem;
  padding: 0.55rem 0.68rem;
  border-color: #cfdbe7;
  background: #ffffff;
}

#addSupervisorModal .add-supervisor-access {
  gap: 0;
}

#addSupervisorModal .add-supervisor-access .supervisor-assignment-group {
  gap: 0.45rem;
  padding: 0.62rem;
  border: 1px solid #d7e1ec;
  border-radius: 0.82rem;
  background: #ffffff;
}

#addSupervisorModal .add-supervisor-section-head {
  display: grid;
  gap: 0.2rem;
}

#addSupervisorModal .add-supervisor-section-head .muted {
  margin: 0;
  font-size: 0.85rem;
}

#addSupervisorModal .supervisor-access-grid {
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 0.42rem;
  background: transparent;
}

#addSupervisorModal .supervisor-access-row {
  padding: 0.52rem 0.6rem;
  border-radius: 0.7rem;
  border: 1px solid #dbe5ef;
  background: #f9fcfe;
}

#addSupervisorModal .supervisor-access-shifts {
  gap: 0.32rem;
}

#addSupervisorModal .supervisor-shift-pill {
  padding: 0.24rem 0.68rem;
  border-color: #cedae6;
  background: #edf3f8;
  font-size: 0.8rem;
}

#addSupervisorModal .supervisor-shift-pill.is-selected,
#addSupervisorModal .supervisor-shift-pill:has(input[type="checkbox"]:checked) {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: var(--brand-dark);
}

#addSupervisorModal .supervisor-shift-pill.is-selected span,
#addSupervisorModal .supervisor-shift-pill:has(input[type="checkbox"]:checked) span {
  color: var(--brand-dark);
}

#addSupervisorModal .add-supervisor-actions {
  display: flex;
  align-items: center;
}

#addSupervisorModal .add-supervisor-actions button {
  min-width: 232px;
  padding: 0.64rem 1.05rem;
}

.builder-actions {
  margin: 0.45rem 0;
}

.builder-stages {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.builder-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.25fr) minmax(78px, 0.72fr) 78px 104px 54px;
  gap: 0.32rem;
  align-items: center;
}

.builder-stages .builder-row input,
.builder-stages .builder-row select,
.builder-stages .builder-row button,
.builder-stages .builder-row .builder-index {
  height: 48px;
  min-height: 48px;
}

.builder-row > * {
  min-width: 0;
}

.builder-row-head {
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
  padding: 0 0.15rem;
}

.builder-row-head span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #5a6979;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1.15;
}

.builder-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #4d5e70;
  border: 1px solid #c8d4e1;
  border-radius: 0.5rem;
  background: #edf3f8;
}

.builder-stages .builder-row button {
  padding: 0;
}

.builder-modal-card {
  width: min(1180px, 94vw);
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr);
  gap: 0.8rem;
}

.builder-grid .panel {
  min-width: 0;
  overflow: hidden;
}

.builder-stages button {
  padding: 0.48rem 0.4rem;
}

.builder-canvas {
  position: relative;
  min-height: 520px;
  border: 1px dashed #9eb0c3;
  border-radius: 0.65rem;
  background:
    linear-gradient(90deg, rgba(168, 184, 201, 0.15) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(rgba(168, 184, 201, 0.15) 1px, transparent 1px) 0 0 / 32px 32px,
    #f7fbff;
  overflow: hidden;
}

.builder-stage-chip {
  position: absolute;
  border: 2px solid #5f7488;
  border-radius: 0.45rem;
  background: #ece9de;
  color: #243342;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.25rem;
  cursor: move;
  user-select: none;
  overflow: hidden;
}

.builder-stage-chip.transfer {
  background: #e7f4fb;
  border-style: dashed;
}

.builder-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, transparent 0 40%, #4d6175 42% 48%, transparent 50% 60%, #4d6175 62% 68%, transparent 70% 100%);
  cursor: nwse-resize;
}

.panel {
  border: 1px solid var(--stroke);
  border-radius: 0.75rem;
  padding: 0.9rem;
  background: var(--panel);
}

.panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.form-grid button {
  align-self: end;
}

.run-crewing-summary {
  grid-column: 1 / -1;
  margin: 0.05rem 0 0;
  font-size: 0.8rem;
  color: #5f6f80;
}

@media (min-width: 1200px) {
  #managerAppSection #shiftForm.form-grid {
    grid-template-columns: 140px 120px minmax(125px, 1fr) 118px 118px 150px;
    gap: 0.45rem;
  }

  #managerAppSection #runForm.form-grid {
    grid-template-columns:
      140px
      minmax(150px, 1.05fr)
      126px
      126px
      108px
      150px
      minmax(160px, 1.2fr)
      150px;
    gap: 0.45rem;
  }

  #managerAppSection #downtimeForm.form-grid {
    grid-template-columns:
      140px
      118px
      118px
      150px
      minmax(150px, 1fr)
      minmax(170px, 1.2fr)
      150px;
    gap: 0.45rem;
  }

  #managerAppSection #runForm .run-crewing-summary {
    grid-column: auto;
    margin: 0;
    align-self: end;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #managerAppSection #shiftForm button,
  #managerAppSection #runForm button,
  #managerAppSection #downtimeForm button {
    width: 100%;
  }
}

.run-crewing-stage-list {
  max-height: min(56vh, 520px);
  overflow: auto;
  border: 1px solid #d3dce6;
  border-radius: 0.72rem;
  padding: 0.55rem;
  display: grid;
  gap: 0.42rem;
  background: #f8fbfd;
}

.run-crewing-stage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid #dde5ee;
  border-radius: 0.62rem;
  padding: 0.42rem 0.5rem;
  background: #ffffff;
}

.run-crewing-stage-name {
  display: block;
  color: #2f4051;
  font-size: 0.86rem;
  font-weight: 600;
}

.run-crewing-stage-row input[type="number"] {
  height: 40px;
}

.stage-data-source-hint {
  grid-column: 1 / -1;
  margin: -4px 0 2px;
  font-size: 0.79rem;
  line-height: 1.35;
}

.stage-data-source-hint.is-warning {
  color: #b54708;
}

.connect-data-source-modal-card {
  width: min(920px, 95vw);
}

.connect-data-source-form {
  gap: 0.62rem;
}

.connect-data-source-field-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.62rem;
}

.connect-data-source-help {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  font-size: 0.8rem;
  line-height: 1.34;
}

.connect-data-source-test-result.is-success {
  color: #127042;
}

.connect-data-source-test-result.is-error {
  color: #9f1c1c;
}

.run-crewing-actions {
  margin-top: 0.62rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.input-now-wrap {
  position: relative;
  display: block;
}

.input-now-wrap input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) {
  margin: 0;
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  padding: 0.55rem 4.15rem 0.55rem 0.86rem;
}

.input-now-wrap[data-time-prefix]::before {
  content: attr(data-time-prefix);
  position: absolute;
  left: 0.86rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #71859a;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease;
}

.input-now-wrap[data-time-prefix] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) {
  padding: 0.55rem 4.15rem 0.55rem 0.86rem;
}

.input-now-wrap[data-time-prefix].has-value::before {
  opacity: 1;
}

.input-now-wrap[data-time-prefix].has-value input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) {
  padding: 0.55rem 4.15rem 0.55rem 3.8rem;
}

.input-now-wrap[data-time-prefix].has-value:focus-within::before {
  color: #5c7287;
}

.input-now-wrap .input-now-btn {
  position: absolute;
  right: 0.38rem;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  min-height: 24px;
  min-width: 3rem;
  height: 24px;
  padding: 0 0.64rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #cfdbe7;
  background: linear-gradient(180deg, #f4f8fb 0%, #eaf1f7 100%);
  color: #4c6074;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.input-now-wrap .input-now-btn:hover {
  border-color: #c3d1df;
  background: linear-gradient(180deg, #eef4f9 0%, #e3ecf4 100%);
  color: #44586d;
}

.form-time-actions,
.form-submit-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.form-time-actions .ghost-btn {
  padding: 0.45rem 0.65rem;
}

.table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
}

th,
td {
  border-bottom: 1px solid #e5eaf0;
  padding: 0.42rem;
  font-size: 0.83rem;
  text-align: left;
}

th {
  color: var(--muted);
  background: #f6f9fb;
  position: sticky;
  top: 0;
}

.table-edit-pill {
  min-height: 0;
  height: 24px;
  padding: 0.08rem 0.56rem;
  font-size: 0.72rem;
  line-height: 1;
  border: 1px solid #25374e;
  border-radius: 999px;
  background: #edf3fa;
  color: #16293f;
  font-weight: 700;
}

.table-edit-pill.is-save {
  border-color: #1d3351;
  background: #e7eef8;
  color: #132845;
}

.table-edit-pill:hover {
  border-color: #1a2e49;
  background: #e3ecf8;
  color: #0f2239;
}

.table-action-stack {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.table-action-stack > * {
  flex: 0 0 auto;
}

#shiftTable th:last-child,
#shiftTable td:last-child,
#downtimeTable th:last-child,
#downtimeTable td:last-child {
  min-width: 15.5rem;
}

#runTable th:last-child,
#runTable td:last-child {
  min-width: 13.5rem;
}

#shiftTable td:nth-child(1),
#downtimeTable td:nth-child(1),
#shiftTable td:nth-child(2),
#downtimeTable td:nth-child(2),
#shiftTable td:nth-child(4),
#shiftTable td:nth-child(5),
#downtimeTable td:nth-child(3),
#downtimeTable td:nth-child(4),
#shiftTable td:nth-child(3),
#shiftTable td:nth-child(6),
#shiftTable td:nth-child(7),
#shiftTable td:nth-child(8),
#downtimeTable td:nth-child(5),
#shiftTable td:nth-child(9),
#downtimeTable td:nth-child(8) {
  white-space: nowrap;
}

#runTable td:nth-child(1),
#runTable td:nth-child(2),
#runTable td:nth-child(4),
#runTable td:nth-child(5),
#runTable td:nth-child(6),
#runTable td:nth-child(7),
#runTable td:nth-child(8),
#runTable td:nth-child(9),
#runTable td:nth-child(10),
#runTable td:nth-child(11),
#runTable td:nth-child(12) {
  white-space: nowrap;
}

#shiftTable :is(th, td):first-child,
#runTable :is(th, td):first-child,
#downtimeTable :is(th, td):first-child {
  min-width: 7.8rem;
}

.table-row-pending td {
  background: #fffaf0;
}

.table-row-pending td:first-child {
  box-shadow: inset 3px 0 0 #e6ac4a;
}

.table-inline-input {
  width: 100%;
  min-width: 88px;
  border: 1px solid #c7d3df;
  border-radius: 0.42rem;
  padding: 0.24rem 0.38rem;
  font-size: 0.76rem;
  line-height: 1.2;
  background: #ffffff;
  color: var(--ink);
}

.table-inline-input:disabled {
  background: #f3f6f9;
  color: #6c7b8a;
}

.table-inline-stack {
  display: grid;
  gap: 0.24rem;
  min-width: 180px;
}

.table-inline-stack .table-inline-input {
  min-width: 0;
}

.table-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.34rem;
  flex-wrap: wrap;
}

.table-inline-note {
  font-size: 0.68rem;
  color: #5d6d7c;
  line-height: 1.2;
}

.table-inline-mini {
  height: 26px;
  padding: 0.16rem 0.56rem;
  font-size: 0.68rem;
}

.table-inline-input::placeholder {
  color: #8190a0;
}

.pending-log-wrap {
  margin-top: 0.35rem;
}

.pending-log-list {
  display: grid;
  gap: 0.42rem;
}

.pending-log-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.62rem;
  border: 1px solid #d5dfe9;
  border-radius: 0.72rem;
  background: #f8fbfd;
}

.pending-log-meta {
  min-width: 0;
}

.pending-log-item.active {
  border-color: #9ecf9a;
  box-shadow: 0 0 0 1px #9ecf9a inset;
  background: #f2f8f0;
}

.pending-log-meta h5 {
  margin: 0;
  font-size: 0.88rem;
  color: #223548;
}

.pending-log-meta p {
  margin: 0.15rem 0 0;
  color: #5a6d80;
  font-size: 0.76rem;
}

.pending-break-active {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  border: 1px solid #efc27a;
  background: #fff1d7;
  color: #8d5f18;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.pending-break-editor {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 0.48rem;
  border-top: 1px solid #d6e2ec;
  padding-top: 0.45rem;
}

.pending-break-editor h6 {
  margin: 0 0 0.3rem;
  font-size: 0.76rem;
  color: #445a6f;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.pending-break-editor-list {
  display: grid;
  gap: 0.28rem;
}

.pending-break-editor-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.3rem;
  align-items: center;
}

.pending-break-editor-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4f6376;
}

.pending-break-editor-input {
  width: 100%;
  min-height: 0;
  height: 32px;
  border: 1px solid #cbd8e4;
  border-radius: 0.42rem;
  padding: 0.2rem 0.38rem;
  font-size: 0.74rem;
  background: #ffffff;
  color: #223548;
}

.pending-break-editor-row-new {
  padding-top: 0.12rem;
}

.pending-break-editor-empty {
  margin: 0;
  font-size: 0.74rem;
  color: #64798c;
}

.pending-log-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  justify-self: end;
}

.table-edit-pill.finalise-pill,
.pending-complete-pill {
  border-radius: 999px;
  font-weight: 700;
  color: #0f6b56;
  border-color: #1f7f6b;
  background: #eaf9f5;
}

.table-edit-pill.finalise-pill:hover,
.pending-complete-pill:hover {
  border-color: #176756;
  background: #dff3ec;
  color: #0d5c4a;
}

.table-edit-pill.table-delete-pill {
  border-radius: 999px;
  font-weight: 700;
  color: #a22f24;
  border-color: #8e2e24;
  background: #fff0ee;
}

.table-edit-pill.table-delete-pill:hover {
  border-color: #7a261f;
  background: #ffe4df;
  color: #922b21;
}

.pending-log-empty {
  margin: 0.2rem 0 0;
}

.supervisor-action-ticket-wrap {
  margin-top: 0.3rem;
}

.supervisor-action-ticket-list {
  gap: 0.55rem;
}

.supervisor-action-ticket {
  border-color: #cfdce8;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.supervisor-action-ticket .pending-log-meta h5 {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.supervisor-action-ticket-id {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  border: 1px solid #d0dbe6;
  background: #eef3f8;
  color: #5f7286;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.supervisor-action-ticket-line {
  margin-top: 0.18rem;
  color: #5d6f82;
}

.supervisor-action-ticket-relation {
  margin-top: 0.16rem;
  color: #4f647a;
}

.supervisor-action-ticket-description {
  margin-top: 0.24rem;
  color: #32485d;
  line-height: 1.4;
}

.supervisor-action-ticket-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.34rem;
}

.supervisor-action-ticket-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  border: 1px solid #c8d4e0;
  background: #eef4f9;
  color: #364c62;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.supervisor-action-ticket-badge.priority-low {
  border-color: #95bbc8;
  background: #e9f7fc;
  color: #16667b;
}

.supervisor-action-ticket-badge.priority-medium {
  border-color: #8ca4c9;
  background: #eaf0fb;
  color: #2d4d7d;
}

.supervisor-action-ticket-badge.priority-high {
  border-color: #d6b178;
  background: #fff4e3;
  color: #8b5c12;
}

.supervisor-action-ticket-badge.priority-critical {
  border-color: #d08b8b;
  background: #fff0f0;
  color: #9a2f2f;
}

.supervisor-action-ticket-badge.status-open {
  border-color: #87b6d0;
  background: #eaf5fd;
  color: #1f5f85;
}

.supervisor-action-ticket-badge.status-in-progress {
  border-color: #8ab6b0;
  background: #e8f6f2;
  color: #0f6656;
}

.supervisor-action-ticket-badge.status-blocked {
  border-color: #d2a5a5;
  background: #fff2f2;
  color: #8f2b2b;
}

.supervisor-action-ticket-badge.status-completed {
  border-color: #94be95;
  background: #eef8ee;
  color: #1f6a3b;
}

.crew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.55rem;
}

.crew-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 0.45rem;
  align-items: center;
  padding: 0.44rem 0.5rem;
  border: 1px solid #d3dbe4;
  border-radius: 0.6rem;
  background: #f8fbfd;
}

.crew-item span {
  font-weight: 600;
  color: #3d4e5f;
}

.muted {
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.import-label {
  border: 1px solid var(--stroke);
  border-radius: var(--control-radius);
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
}

.import-label input {
  display: none;
}

.danger {
  background: var(--danger);
}

#auditTrail {
  margin-top: 0.7rem;
}

@media (max-width: 1000px) {
  .control-row {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .line-map {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 0.7rem;
    padding: 0.7rem;
  }

  .line-trend-grid {
    grid-template-columns: 1fr;
  }

  .line-trend-range .ghost-btn {
    min-width: 0;
    flex: 1 1 0;
  }

  .stage-card.kind-transfer::before {
    display: none;
  }

  .stage-card {
    position: relative;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    min-height: 130px;
  }

  .modal-head {
    flex-direction: column;
    align-items: stretch;
  }

  #manageSupervisorsModal .modal-card {
    padding: 0.85rem;
  }

  #manageSupervisorsModal .modal-head {
    align-items: flex-start;
  }

  #manageSupervisorsModal .supervisor-manager-head {
    flex-direction: column;
    align-items: flex-start;
  }

  #manageSupervisorsModal .supervisor-manager-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  #manageSupervisorsModal .supervisor-manager-actions button {
    width: 100%;
  }

  #addSupervisorModal .modal-card {
    padding: 0.85rem;
  }

  #addSupervisorModal .modal-head {
    align-items: flex-start;
  }

  #addSupervisorModal .add-supervisor-fields {
    grid-template-columns: 1fr;
  }

  #addSupervisorModal .add-supervisor-actions button {
    width: 100%;
    min-width: 0;
  }

  #manageLineGroupsModal .modal-card {
    padding: 0.85rem;
  }

  #manageProductCatalogModal .modal-card {
    padding: 0.85rem;
  }

  #manageProductCatalogModal .modal-head-actions {
    width: 100%;
  }

  #productLineAssignModal .modal-card {
    padding: 0.85rem;
  }

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

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

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

  .trend-controls {
    justify-content: flex-start;
  }

  .modal-head h2 {
    font-size: 1.4rem;
  }

  .modal-title-block .muted {
    font-size: 0.98rem;
  }

  .tab-btn {
    font-size: 0.92rem;
    padding: 0.5rem 0.8rem;
  }

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

  .builder-row-head {
    display: none;
  }

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

  .builder-canvas {
    min-height: 420px;
  }

  .supervisor-access-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .supervisor-access-shifts {
    flex-wrap: wrap;
  }

  .pending-log-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .pending-log-actions {
    width: 100%;
    justify-content: flex-end;
    justify-self: stretch;
  }

  .supervisor-action-ticket-badges {
    justify-content: flex-start;
  }

  #homeView.dashboard-page #managerActionList .manager-action-ticket-controls {
    align-items: flex-start;
  }

  .run-crewing-stage-row {
    grid-template-columns: 1fr;
  }

  .run-crewing-stage-row input[type="number"] {
    width: 100%;
  }

  #dashboardTable {
    min-width: 700px;
  }
}

@media (max-width: 760px) {
  #dashboardTable {
    min-width: 620px;
  }
}

@media (max-width: 1260px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }
}

/* Home Dashboard Overhaul */
:root {
  --p-50: #fff7ea;
  --p-100: #fce9c8;
  --p-200: #f7d599;
  --p-300: #f1bf69;
  --p-400: #e8a63a;
  --p-500: #cf7f00;
  --p-600: #b66f00;
  --p-700: #9c5f00;
  --p-800: #774700;
  --p-900: #573300;
  --s-400: #d5a14b;
  --g-0: #ffffff;
  --g-50: #fafafa;
  --g-100: #f6f7f8;
  --g-150: #f1f3f5;
  --g-200: #e1e5ea;
  --g-300: #cfd5dc;
  --g-400: #a8b1ba;
  --g-500: #7b8792;
  --g-600: #5b6672;
  --g-700: #3b4651;
  --g-800: #1f2a35;
  --g-900: #101820;
  --a-warning-tint: #fef3c7;
  --a-danger-tint: #fee2e2;
  --page-bg-home: #ffffff;
  --app-bg-home: #ffffff;
  --card-bg-home: #ffffff;
  --border-home: #d7dde4;
  --text-strong-home: #101820;
  --text-home: #101820;
  --text-muted-home: #5f6772;
  --shadow-card-home: 0 4px 14px rgba(16, 24, 32, 0.08);
  --shadow-shell-home: 0 12px 30px rgba(16, 24, 32, 0.1);
  --focus-home: 0 0 0 3px rgba(207, 127, 0, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg-home: #ffffff;
    --app-bg-home: #ffffff;
    --card-bg-home: #ffffff;
    --border-home: #d7dde4;
    --text-strong-home: #101820;
    --text-home: #101820;
    --text-muted-home: #5f6772;
    --shadow-card-home: 0 4px 14px rgba(16, 24, 32, 0.08);
    --shadow-shell-home: 0 12px 30px rgba(16, 24, 32, 0.1);
    --focus-home: 0 0 0 3px rgba(207, 127, 0, 0.22);
  }
}

body:has(#homeView.dashboard-page:not(.hidden)) {
  background:
    radial-gradient(circle at 92% 2%, rgba(207, 127, 0, 0.08), transparent 28%),
    #f4f7fb;
}

#homeView.dashboard-page {
  max-width: 1248px;
  padding: 24px;
}

#homeView.dashboard-page .sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 48;
  background: rgba(17, 21, 24, 0.32);
}

#homeView.dashboard-page .dashboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
}

#homeView.dashboard-page .dashboard-sidebar {
  min-width: 200px;
  border-radius: 20px;
  background: var(--card-bg-home);
  border: 1px solid var(--border-home);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#homeView.dashboard-page .brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#homeView.dashboard-page .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--p-700);
  color: var(--g-0);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.74rem;
}

#homeView.dashboard-page .brand-row h2 {
  margin: 0;
  color: var(--text-strong-home);
  font-size: 1.02rem;
  line-height: 1.2;
}

#homeView.dashboard-page .brand-row p {
  margin: 2px 0 0;
  color: var(--text-muted-home);
  font-size: 0.75rem;
}

#homeView.dashboard-page .side-label {
  margin: 0 0 8px;
  color: var(--g-500);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#homeView.dashboard-page .side-nav-group {
  display: grid;
  gap: 4px;
}

#homeView.dashboard-page .side-item {
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--g-500);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  padding: 0 10px;
}

#homeView.dashboard-page .side-item:hover {
  background: var(--g-100);
  color: var(--g-700);
}

#homeView.dashboard-page .side-item.active {
  color: var(--g-900);
}

#homeView.dashboard-page .side-rail {
  width: 4px;
  height: 26px;
  border-radius: 999px;
  background: var(--p-700);
}

#homeView.dashboard-page .dashboard-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

#homeView.dashboard-page .dashboard-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  border-radius: 14px;
  border: 1px solid #d5dde7;
  background: linear-gradient(180deg, #fbfcfe 0%, #f5f8fb 100%);
  box-shadow: var(--shadow-card-home);
  margin-bottom: 10px;
}

#homeView.dashboard-page .search-wrap {
  display: none;
}

#homeView.dashboard-page .home-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

#homeView.dashboard-page .home-brand-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

#homeView.dashboard-page .cordina-logo {
  width: clamp(118px, 15vw, 186px);
  height: auto;
  max-width: 100%;
}

#homeView.dashboard-page .home-title-block h1 {
  margin: 0;
  color: var(--text-strong-home);
  font-size: clamp(1.5rem, 2.1vw, 1.92rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

#homeView.dashboard-page .home-title-block p {
  margin: 2px 0 0;
  font-size: 0.91rem;
  line-height: 1.25;
  color: var(--text-muted-home);
}

#homeView.dashboard-page .menu-btn {
  display: none;
}

#homeView.dashboard-page .search-pill {
  width: min(520px, 100%);
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--g-200);
  background: var(--g-0);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

#homeView.dashboard-page .search-pill input {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text-home);
}

#homeView.dashboard-page .search-pill input:focus {
  outline: none;
}

#homeView.dashboard-page .search-pill kbd {
  margin-left: auto;
  border-radius: 8px;
  background: var(--g-150);
  color: var(--g-600);
  border: 1px solid var(--g-200);
  padding: 2px 8px;
  font-size: 0.72rem;
}

#homeView.dashboard-page .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: nowrap;
  min-height: 0;
}

#homeView.dashboard-page .topbar-right .shift-toggle {
  height: 44px;
  border-radius: 999px;
  border-color: var(--stroke);
  background: #eef2f6;
}

#homeView.dashboard-page .topbar-right .shift-option {
  min-width: 126px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 700;
  color: var(--ink);
}

#homeView.dashboard-page .topbar-right .shift-option.active {
  color: var(--brand-dark);
}

#homeView.dashboard-page .topbar-right .ghost-btn {
  min-height: 44px;
  border-radius: var(--control-radius);
  padding: 0 14px;
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--stroke);
  background: #ffffff;
  color: var(--ink);
}

#homeView.dashboard-page .icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--g-200);
  background: var(--g-0);
  color: var(--g-600);
  display: grid;
  place-items: center;
  padding: 0;
}

#homeView.dashboard-page .user-chip {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: #ffffff;
  min-height: 44px;
  padding: 4px 12px 4px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#homeView.dashboard-page .avatar-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid #e9edf2;
  background: var(--accent);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
}

#homeView.dashboard-page .user-chip strong {
  display: block;
  font-size: 0.76rem;
  color: var(--text-home);
  line-height: 1.1;
}

#homeView.dashboard-page .user-chip span {
  font-size: 0.68rem;
  color: var(--text-muted-home);
}

#homeView.dashboard-page #supervisorLogout.home-btn {
  width: auto;
  min-width: 96px;
  padding: 0 16px;
  font-size: 0.92rem;
}

#homeView.dashboard-page #managerSettingsTabBtn.home-settings-tab {
  width: auto;
  min-width: 96px;
  min-height: 44px;
  border-radius: var(--control-radius);
  padding: 0 16px;
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 700;
  border: 1px solid var(--stroke);
  background: #ffffff;
  color: var(--ink);
}

#homeView.dashboard-page #managerSettingsTabBtn.home-settings-tab.active {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 24, 32, 0.24);
}

#lineWorkspace.app-shell {
  max-width: 1248px;
  padding: 24px;
}

#lineWorkspace .manager-workspace-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-home);
  background: #f7f9fb;
  box-shadow: var(--shadow-card-home);
  margin-bottom: 10px;
}

#lineWorkspace .home-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

#lineWorkspace .home-brand-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

#lineWorkspace .cordina-logo {
  width: clamp(118px, 15vw, 186px);
  height: auto;
  max-width: 100%;
}

#lineWorkspace .home-title-block h1 {
  margin: 0;
  color: var(--text-strong-home);
  font-size: clamp(1.5rem, 2.1vw, 1.92rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

#lineWorkspace .home-title-block p {
  margin: 2px 0 0;
  font-size: 0.91rem;
  line-height: 1.25;
  color: var(--text-muted-home);
}

#lineWorkspace .topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: nowrap;
  min-height: 0;
}

#lineWorkspace .manager-workspace-actions .user-chip {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: #ffffff;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#lineWorkspace .manager-workspace-actions .avatar-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid #e9edf2;
  background: var(--accent);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.8rem;
}

#lineWorkspace .manager-workspace-actions .user-chip strong {
  display: block;
  font-size: 0.76rem;
  color: var(--text-home);
  line-height: 1.1;
}

#lineWorkspace .manager-workspace-actions .user-chip span {
  font-size: 0.68rem;
  color: var(--text-muted-home);
}

#lineWorkspace .manager-workspace-actions .shift-toggle {
  height: 44px;
  border-radius: 999px;
  border-color: var(--stroke);
  background: #eef2f6;
}

#lineWorkspace .manager-workspace-actions .shift-option {
  min-width: 126px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 700;
  color: var(--ink);
}

#lineWorkspace .manager-workspace-actions .shift-option.active {
  color: var(--brand-dark);
}

#lineWorkspace .manager-workspace-actions .ghost-btn {
  min-height: 44px;
  border-radius: var(--control-radius);
  padding: 0 14px;
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--stroke);
  background: #ffffff;
  color: var(--ink);
}

#lineWorkspace .manager-workspace-top-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0.85rem;
  margin: 0.2rem 0 0.7rem;
}

#lineWorkspace .manager-workspace-top-controls .tabs {
  margin-left: 0;
  min-height: 44px;
  border-radius: 999px;
  border-color: var(--stroke);
  background: #eef2f6;
}

#lineWorkspace .manager-workspace-top-controls .tab-btn {
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 700;
  color: var(--ink);
}

#lineWorkspace .manager-workspace-top-controls .tab-btn.active {
  color: #ffffff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

#lineWorkspace :is(button, input, textarea, select, .tab-btn):focus-visible {
  outline: none;
  box-shadow: var(--focus-home);
}

#homeView.dashboard-page #managerAppSection.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 24px;
}

#homeView.dashboard-page .dash-card {
  border-radius: 16px;
  border: 1px solid var(--border-home);
  background: var(--card-bg-home);
  box-shadow: 0 3px 10px rgba(16, 24, 32, 0.06);
  padding: 16px;
  transition: box-shadow 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

#homeView.dashboard-page .dash-card h2 {
  margin: 0 0 11px;
  font-size: 15px;
  line-height: 20px;
  color: var(--text-home);
  letter-spacing: -0.01em;
}

#homeView.dashboard-page .stat-card {
  grid-column: span 3;
  min-height: 96px;
}

#homeView.dashboard-page .stat-kpi {
  margin: 0 0 4px;
  font-size: 36px;
  line-height: 40px;
  font-weight: 800;
  color: var(--text-strong-home);
}

#homeView.dashboard-page .stat-meta {
  margin: 0;
  font-size: 12px;
  color: var(--p-600);
}

#homeView.dashboard-page .stat-highlight {
  background: linear-gradient(160deg, var(--p-700), var(--p-800));
  border-color: transparent;
}

#homeView.dashboard-page .stat-highlight h3,
#homeView.dashboard-page .stat-highlight .stat-kpi {
  color: var(--g-0);
}

#homeView.dashboard-page .stat-highlight .stat-meta {
  color: var(--p-200);
}

#homeView.dashboard-page .analytics-card {
  grid-column: span 6;
  min-height: 140px;
}

/* Temporarily hide multi-line dashboard while keeping markup intact for later restore */
#homeView.dashboard-page #managerHome .analytics-card {
  display: none;
}

#homeView.dashboard-page .dashboard-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--g-200);
}

#homeView.dashboard-page .dashboard-filter-group {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

#homeView.dashboard-page .dashboard-filter-group > label {
  min-width: 170px;
}

#homeView.dashboard-page .dashboard-filter-group input {
  height: 44px;
  border-radius: var(--control-radius);
  font-weight: 600;
}

#homeView.dashboard-page #dashboardShiftToggle {
  height: 44px;
  border-radius: var(--control-radius);
  overflow: hidden;
}

#homeView.dashboard-page #dashboardShiftToggle .shift-option {
  min-width: 88px;
  font-weight: 700;
}

#homeView.dashboard-page .project-list-card {
  grid-column: span 12;
  min-height: 240px;
}

#homeView.dashboard-page .project-list-card .line-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#homeView.dashboard-page .project-list-card #lineCards.line-cards-grouped {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.82rem;
  max-height: none;
  overflow: visible;
}

#homeView.dashboard-page .line-group-section {
  border: 1px solid #d5dfeb;
  border-radius: 12px;
  padding: 0.7rem;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fc 100%);
  display: grid;
  gap: 0.65rem;
}

#homeView.dashboard-page .line-group-section-ungrouped {
  border-style: dashed;
}

#homeView.dashboard-page .line-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

#homeView.dashboard-page .line-group-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

#homeView.dashboard-page .line-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

#homeView.dashboard-page .line-group-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(207, 127, 0, 0.18);
  border-radius: 6px;
}

#homeView.dashboard-page .line-group-caret {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #5f7388;
  transform: rotate(90deg);
  transform-origin: 38% 50%;
  transition: transform 0.16s ease, border-left-color 0.16s ease;
}

#homeView.dashboard-page .line-group-toggle[aria-expanded="false"] .line-group-caret {
  transform: rotate(0deg);
}

#homeView.dashboard-page .line-group-toggle:hover .line-group-caret {
  border-left-color: #425a72;
}

#homeView.dashboard-page .line-group-head h3 {
  margin: 0;
  font-size: 0.98rem;
  color: #1d2c3d;
}

#homeView.dashboard-page .line-group-body[hidden] {
  display: none !important;
}

#homeView.dashboard-page .line-group-head .line-group-count {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c8d5e2;
  border-radius: 999px;
  padding: 0.14rem 0.56rem;
  background: #eef3f8;
  color: #445a70;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

#homeView.dashboard-page .line-group-drag-handle,
#homeView.dashboard-page .line-card-drag-handle {
  border: 0;
  background: transparent;
  padding: 0 2px;
  color: #4f6278;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  opacity: 0.74;
  transition: color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

#homeView.dashboard-page .line-group-drag-handle:hover,
#homeView.dashboard-page .line-card-drag-handle:hover {
  color: #33495f;
  opacity: 1;
  transform: translateY(-1px);
}

#homeView.dashboard-page .line-group-drag-handle:focus-visible,
#homeView.dashboard-page .line-card-drag-handle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(207, 127, 0, 0.18);
  border-radius: 6px;
  opacity: 1;
}

#homeView.dashboard-page .line-group-drag-handle:active,
#homeView.dashboard-page .line-card-drag-handle:active {
  cursor: grabbing;
  transform: none;
}

#homeView.dashboard-page .line-group-section .line-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#homeView.dashboard-page .add-line-card,
#homeView.dashboard-page .manage-super-card,
#homeView.dashboard-page .manage-products-card {
  grid-column: span 4;
  min-height: 170px;
}

#homeView.dashboard-page .data-sources-card {
  grid-column: span 12;
  min-height: 220px;
}

#homeView.dashboard-page #managerAppSection.dashboard-grid .manager-settings-card {
  display: none;
}

#homeView.dashboard-page #managerAppSection.dashboard-grid.is-settings-view .manager-primary-card {
  display: none;
}

#homeView.dashboard-page #managerAppSection.dashboard-grid.is-settings-view .manager-settings-card {
  display: block;
}

#homeView.dashboard-page .data-sources-actions {
  margin: 8px 0 12px;
  justify-content: flex-end;
}

#homeView.dashboard-page .data-sources-actions button {
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

#homeView.dashboard-page .manager-actions-card {
  grid-column: span 12;
  min-height: 220px;
}

#homeView.dashboard-page .manage-products-card .products-table-wrap {
  display: none;
}

#homeView.dashboard-page .manager-actions-card .muted {
  margin: 10px 0;
  line-height: 1.35;
}

#homeView.dashboard-page #dataSourcesList table {
  min-width: 1240px;
}

#homeView.dashboard-page .data-source-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.1rem 0.56rem;
  border-radius: 999px;
  border: 1px solid #c8d5e2;
  background: #eef3f8;
  color: #445a70;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

#homeView.dashboard-page .data-source-status-pill.is-used {
  border-color: #b8d6be;
  background: #e8f5eb;
  color: #245c34;
}

#homeView.dashboard-page .data-source-status-pill.is-conflict {
  border-color: #dcb2b2;
  background: #fdeeee;
  color: #8f1f1f;
}

#homeView.dashboard-page .data-source-empty {
  margin: 0.2rem 0 0;
  color: var(--text-muted-home);
  line-height: 1.35;
}

#homeView.dashboard-page .data-source-connection-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.1rem 0.56rem;
  border-radius: 999px;
  border: 1px solid #c8d5e2;
  background: #eef3f8;
  color: #445a70;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

#homeView.dashboard-page .data-source-connection-pill.is-configured {
  border-color: #b8d6be;
  background: #e8f5eb;
  color: #245c34;
}

#homeView.dashboard-page .data-source-test-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.1rem 0.56rem;
  border-radius: 999px;
  border: 1px solid #c8d5e2;
  background: #eef3f8;
  color: #445a70;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

#homeView.dashboard-page .data-source-test-pill.is-success {
  border-color: #b8d6be;
  background: #e8f5eb;
  color: #245c34;
}

#homeView.dashboard-page .data-source-test-pill.is-failed {
  border-color: #dcb2b2;
  background: #fdeeee;
  color: #8f1f1f;
}

#homeView.dashboard-page .data-source-actions-cell {
  white-space: nowrap;
}

#homeView.dashboard-page .data-source-test-btn {
  min-height: 30px;
  padding: 0 0.72rem;
  font-size: 0.78rem;
  font-weight: 700;
}

#homeView.dashboard-page #managerActionList .manager-action-groups {
  display: grid;
  gap: 0.72rem;
}

#homeView.dashboard-page #managerActionList .manager-action-group {
  border: 1px solid #d3deea;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
}

#homeView.dashboard-page #managerActionList .manager-action-group-overdue {
  border-color: #d3a3a3;
  background: linear-gradient(180deg, #fff9f9 0%, #fff3f3 100%);
}

#homeView.dashboard-page #managerActionList .manager-action-group-urgent {
  border-color: #d9b183;
  background: linear-gradient(180deg, #fffaf3 0%, #fff5e8 100%);
}

#homeView.dashboard-page #managerActionList .manager-action-group-completed {
  border-color: #a8cab0;
  background: linear-gradient(180deg, #f7fcf7 0%, #f0f8f0 100%);
}

#homeView.dashboard-page #managerActionList .manager-action-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#homeView.dashboard-page #managerActionList .manager-action-group-head h3 {
  margin: 0;
  font-size: 0.91rem;
  color: #20364a;
}

#homeView.dashboard-page #managerActionList .manager-action-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  border: 1px solid #c8d4e0;
  background: #edf3f8;
  color: #465e74;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
}

#homeView.dashboard-page #managerActionList.table-wrap {
  overflow: visible;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket-wrap {
  margin-top: 0.3rem;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket-list {
  gap: 0.62rem;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 0.75rem;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket .pending-log-meta {
  display: grid;
  gap: 0.04rem;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket-edit-grid {
  margin-top: 0.42rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.42rem;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket-field {
  display: grid;
  gap: 0.16rem;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket-field > span {
  font-size: 0.68rem;
  font-weight: 700;
  color: #4d6277;
  letter-spacing: 0.01em;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket-related {
  margin-top: 0.42rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.42rem;
}

#homeView.dashboard-page .manager-action-related-cell {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

#homeView.dashboard-page .manager-action-related-equipment-select,
#homeView.dashboard-page .manager-action-reason-category-select,
#homeView.dashboard-page .manager-action-reason-detail-select {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0.2rem 0.42rem;
}

#homeView.dashboard-page .manager-action-assign-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex-wrap: wrap;
}

#homeView.dashboard-page .manager-action-assign-select {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0.2rem 0.42rem;
}

#homeView.dashboard-page .manager-action-priority-select,
#homeView.dashboard-page .manager-action-status-select {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0.2rem 0.42rem;
}

#homeView.dashboard-page .manager-action-due-date-input {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0.2rem 0.42rem;
}

#homeView.dashboard-page #managerActionList .manager-action-ticket-controls {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.42rem;
}

#homeView.dashboard-page .manager-action-actions-cell {
  flex-basis: 100%;
  justify-content: flex-end;
}

#homeView.dashboard-page .manager-action-actions-cell .table-edit-pill {
  height: 30px;
  padding: 0 0.68rem;
}

#homeView.dashboard-page .dash-card-head {
  margin-bottom: 4px;
}

#homeView.dashboard-page .line-card {
  border-color: #ced8e3;
  border-radius: 14px;
  padding: 14px;
  min-height: 176px;
  background: linear-gradient(180deg, #f9fbfe 0%, #f5f8fc 100%);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

#homeView.dashboard-page .line-card[data-open-line] {
  cursor: pointer;
}

#homeView.dashboard-page .line-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.34rem;
}

#homeView.dashboard-page .line-card h3 {
  margin: 0;
  line-height: 1.18;
}

#homeView.dashboard-page .line-card p {
  margin-bottom: 0;
  line-height: 1.3;
  color: #5a6674;
}

#homeView.dashboard-page .line-card-callouts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin: 0;
  min-height: 0;
}

#homeView.dashboard-page .line-card-footer {
  margin-top: 0.62rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.6rem;
}

#homeView.dashboard-page .line-card-footer .line-card-callouts {
  flex: 1 1 auto;
}

#homeView.dashboard-page .line-card-footer .line-card-actions {
  margin-top: 0;
  padding-top: 0;
  flex: 0 0 auto;
}

#homeView.dashboard-page .line-callout-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid #b8c7d6;
  padding: 0.24rem 0.58rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #425568;
  background: #edf3f8;
}

#homeView.dashboard-page .line-callout-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.88;
}

#homeView.dashboard-page .line-callout-pill.is-green {
  color: #1f6644;
  border-color: #95cfb0;
  background: #e8f7ef;
}

#homeView.dashboard-page .line-callout-pill.is-yellow {
  color: #7a5419;
  border-color: #dfbf84;
  background: #fff3df;
}

#homeView.dashboard-page .line-callout-pill.is-red {
  color: #8a3434;
  border-color: #dfaaaa;
  background: #fdeaea;
}

#homeView.dashboard-page .line-callout-pill.is-neutral {
  color: #5b6875;
  border-color: #c6d0db;
  background: #eef3f7;
}

#homeView.dashboard-page .line-card.line-card-live-active {
  border-color: #63b487;
  background: linear-gradient(180deg, #f2fcf6 0%, #e8f8ef 100%);
}

#homeView.dashboard-page .line-card.line-card-live-active h3 {
  color: #163f2d;
}

#homeView.dashboard-page .line-card.line-card-live-active p {
  color: #3f6f58;
}

#homeView.dashboard-page .line-card.line-card-live-active .line-shift-tracker {
  border-color: #b8e0ca;
  background: rgba(255, 255, 255, 0.84);
}

#homeView.dashboard-page .line-card.line-card-live-active .line-callout-pill.is-green {
  color: #1a5f3f;
  border-color: #84c7a0;
  background: #dcf4e7;
}

#homeView.dashboard-page .line-card.line-card-live-active .line-shift-cell.is-none {
  border-color: #b7d9c6;
}

#homeView.dashboard-page .line-card.line-card-live-active .line-shift-cell.is-one {
  background: #83c6a3;
  border-color: #83c6a3;
}

#homeView.dashboard-page .line-card.line-card-live-active .line-shift-cell.is-both {
  background: #2e7c55;
  border-color: #2e7c55;
}

#homeView.dashboard-page .line-card.line-card-live-warning {
  border-color: #d79b42;
  background: linear-gradient(180deg, #fff9ef 0%, #fff1dc 100%);
}

#homeView.dashboard-page .line-card.line-card-live-warning h3 {
  color: #66440f;
}

#homeView.dashboard-page .line-card.line-card-live-warning p {
  color: #866337;
}

#homeView.dashboard-page .line-card.line-card-live-warning .line-shift-tracker {
  border-color: #ebd2aa;
  background: rgba(255, 255, 255, 0.84);
}

#homeView.dashboard-page .line-card.line-card-live-warning .line-callout-pill.is-yellow {
  color: #704a13;
  border-color: #d6b26f;
  background: #fcebc9;
}

#homeView.dashboard-page .line-card.line-card-live-warning .line-shift-cell.is-none {
  border-color: #e5d1ad;
}

#homeView.dashboard-page .line-card.line-card-live-warning .line-shift-cell.is-one {
  background: #e6be76;
  border-color: #e6be76;
}

#homeView.dashboard-page .line-card.line-card-live-warning .line-shift-cell.is-both {
  background: #b9791d;
  border-color: #b9791d;
}

#homeView.dashboard-page .line-card.line-card-live-critical {
  border-color: #d36c6c;
  background: linear-gradient(180deg, #fff5f5 0%, #ffebeb 100%);
}

#homeView.dashboard-page .line-card.line-card-live-critical h3 {
  color: #6f2323;
}

#homeView.dashboard-page .line-card.line-card-live-critical p {
  color: #925252;
}

#homeView.dashboard-page .line-card.line-card-live-critical .line-shift-tracker {
  border-color: #efc2c2;
  background: rgba(255, 255, 255, 0.84);
}

#homeView.dashboard-page .line-card.line-card-live-critical .line-callout-pill.is-red {
  color: #822a2a;
  border-color: #d89797;
  background: #f9dddd;
}

#homeView.dashboard-page .line-card.line-card-live-critical .line-shift-cell.is-none {
  border-color: #edcdcd;
}

#homeView.dashboard-page .line-card.line-card-live-critical .line-shift-cell.is-one {
  background: #e6a0a0;
  border-color: #e6a0a0;
}

#homeView.dashboard-page .line-card.line-card-live-critical .line-shift-cell.is-both {
  background: #bd4747;
  border-color: #bd4747;
}

#homeView.dashboard-page .line-card-actions {
  gap: 0.5rem;
  justify-content: flex-end;
}

#homeView.dashboard-page .line-card-actions button:not(.table-edit-pill) {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

#homeView.dashboard-page .line-card-actions .ghost-btn {
  background: #f2f5f8;
}

#homeView.dashboard-page .line-card-actions .table-edit-pill {
  border-color: #8fa3b8;
  background: #f0f5fb;
  color: #16293f;
}

#homeView.dashboard-page .line-card-actions .table-edit-pill:hover {
  border-color: #8096ad;
  background: #e9f0f8;
  color: #132845;
}

#homeView.dashboard-page .line-card-actions .danger {
  background: #c92a1a;
}

#homeView.dashboard-page .line-card.line-card-live-active .line-card-actions button:not(.ghost-btn):not(.danger):not(.table-edit-pill) {
  background: #1f7d52;
}

#homeView.dashboard-page .line-card.line-card-live-active .line-card-actions .ghost-btn {
  background: #eaf4ee;
  border-color: #bcd8c8;
  color: #244c39;
}

#homeView.dashboard-page .line-card.line-card-live-warning .line-card-actions button:not(.ghost-btn):not(.danger):not(.table-edit-pill) {
  background: #976019;
}

#homeView.dashboard-page .line-card.line-card-live-warning .line-card-actions .ghost-btn {
  background: #f8f1e5;
  border-color: #e2cea7;
  color: #6d4a1b;
}

#homeView.dashboard-page .line-card.line-card-live-critical .line-card-actions button:not(.ghost-btn):not(.danger):not(.table-edit-pill) {
  background: #842f2f;
}

#homeView.dashboard-page .line-card.line-card-live-critical .line-card-actions .ghost-btn {
  background: #faefef;
  border-color: #e6c0c0;
  color: #6f2f2f;
}

#homeView.dashboard-page .line-card:hover {
  border-color: #bcc9d7;
  box-shadow: 0 6px 16px rgba(16, 24, 32, 0.1);
  transform: translateY(-1px);
}

#homeView.dashboard-page .line-card.line-card-live-active:hover {
  border-color: #55a876;
}

#homeView.dashboard-page .line-card.line-card-live-warning:hover {
  border-color: #c88731;
}

#homeView.dashboard-page .line-card.line-card-live-critical:hover {
  border-color: #c25757;
}

#homeView.dashboard-page .line-card:focus-within {
  border-color: #c5862c;
  box-shadow: 0 0 0 3px rgba(207, 127, 0, 0.18);
}

#homeView.dashboard-page .line-card.line-card-live-active:focus-within {
  border-color: #4e9f6f;
  box-shadow: 0 0 0 3px rgba(56, 146, 101, 0.2);
}

#homeView.dashboard-page .line-card.line-card-live-warning:focus-within {
  border-color: #be7f2b;
  box-shadow: 0 0 0 3px rgba(198, 130, 30, 0.21);
}

#homeView.dashboard-page .line-card.line-card-live-critical:focus-within {
  border-color: #b44c4c;
  box-shadow: 0 0 0 3px rgba(190, 72, 72, 0.23);
}

#homeView.dashboard-page #lineCards.home-dnd-group-active .line-group-section,
#homeView.dashboard-page #lineCards.home-dnd-line-active .line-card {
  transition: transform 0.12s ease;
}

#homeView.dashboard-page .line-group-section.is-dragging,
#homeView.dashboard-page .line-card.is-dragging {
  opacity: 0.6;
  transform: scale(0.995);
}

#homeView.dashboard-page .line-card.line-card-unavailable {
  border-color: #e6b8b8;
  background: #fff4f4;
}

#homeView.dashboard-page .line-card.line-card-empty {
  background: #f7fbff;
}

#homeView.dashboard-page .manage-super-card .action-row,
#homeView.dashboard-page .add-line-card .action-row,
#homeView.dashboard-page .manage-products-card .action-row {
  margin-top: 2px;
}

#homeView.dashboard-page .manage-super-card .action-row button,
#homeView.dashboard-page .add-line-card .action-row button,
#homeView.dashboard-page .manage-products-card .action-row button {
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

#homeView.dashboard-page .manage-super-card .muted,
#homeView.dashboard-page .add-line-card .muted,
#homeView.dashboard-page .manage-products-card .muted {
  margin-top: 10px;
  line-height: 1.35;
}

#homeView.dashboard-page .dashboard-grid .control-row {
  margin-bottom: 12px;
}

#homeView.dashboard-page .dashboard-table-wrap {
  border: 1px solid var(--g-200);
  border-radius: 14px;
  overflow: auto;
  background: var(--g-0);
}

#homeView.dashboard-page #dashboardTable {
  min-width: 860px;
}

#homeView.dashboard-page #dashboardTable th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--g-100);
  color: var(--g-600);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#homeView.dashboard-page #dashboardTable td {
  font-size: 13px;
  color: var(--text-home);
  vertical-align: top;
}

#homeView.dashboard-page #dashboardTable td:nth-child(4),
#homeView.dashboard-page #dashboardTable td:nth-child(5),
#homeView.dashboard-page #dashboardTable td:nth-child(6),
#homeView.dashboard-page #dashboardTable td:nth-child(7) {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#homeView.dashboard-page #dashboardTable td:nth-child(8),
#homeView.dashboard-page #dashboardTable td:nth-child(9) {
  white-space: nowrap;
}

#homeView.dashboard-page #dashboardTable tbody tr:nth-child(even) {
  background: var(--g-50);
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) .products-table-wrap {
  border: 1px solid var(--g-200);
  border-radius: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--g-0);
  max-height: 460px;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--g-100);
  color: var(--g-600);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.25;
  padding: 0.34rem 0.32rem;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td {
  font-size: 11px;
  color: var(--text-home);
  vertical-align: top;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
  padding: 0.34rem 0.32rem;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(1) {
  width: 6%;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(2) {
  width: 11%;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(3) {
  width: 23%;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(4),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(5) {
  width: 8%;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(6),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(7),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(8),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(9),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(10),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(11),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(12) {
  width: 5%;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable :is(th, td):nth-child(13) {
  width: 12%;
  text-align: left;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(1) {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(2),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(3) {
  word-break: break-word;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(6),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(7),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(9),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(10),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(11),
:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:nth-child(12) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable tbody tr:nth-child(even) {
  background: var(--g-50);
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable tr.product-row-editing td {
  background: #fffaf0;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable tr.product-row-editing td:first-child {
  box-shadow: inset 3px 0 0 #e6ac4a;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable td:last-child .table-action-stack {
  justify-content: flex-start;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable .product-row-line-summary {
  margin-top: 0.28rem;
  font-size: 0.68rem;
  color: #4b5f75;
  line-height: 1.2;
}

:is(#homeView.dashboard-page, #manageProductCatalogModal) #productCatalogTable .table-inline-input {
  min-width: 0;
  font-size: 0.72rem;
  padding: 0.22rem 0.3rem;
}

#homeView.dashboard-page :is(button, input, textarea, select, .shift-option):focus-visible {
  outline: none;
  box-shadow: var(--focus-home);
}

#homeView.dashboard-page .dash-card:hover {
  box-shadow: 0 8px 20px rgba(17, 21, 24, 0.08);
}

@media (max-width: 1536px) {
  #homeView.dashboard-page {
    max-width: 1200px;
  }

  #lineWorkspace.app-shell {
    max-width: 1200px;
  }
}

@media (max-width: 1280px) {
  #homeView.dashboard-page .project-list-card .line-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 320px;
    overflow: auto;
  }

  #homeView.dashboard-page .project-list-card #lineCards.line-cards-grouped {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
  }

  #homeView.dashboard-page .project-list-card #lineCards.line-cards-grouped .line-group-section .line-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 1024px) {
  #homeView.dashboard-page .stat-card {
    grid-column: span 6;
  }

  #homeView.dashboard-page .analytics-card {
    grid-column: span 12;
  }

  #homeView.dashboard-page .project-list-card,
  #homeView.dashboard-page .add-line-card,
  #homeView.dashboard-page .manage-super-card,
  #homeView.dashboard-page .manage-products-card {
    grid-column: span 6;
    grid-row: auto;
  }
}

@media (max-width: 768px) {
  #homeView.dashboard-page .project-list-card .line-cards {
    grid-template-columns: 1fr;
  }

  #homeView.dashboard-page .dashboard-topbar {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    border-radius: 14px;
    margin-bottom: 6px;
    gap: 8px;
  }

  #homeView.dashboard-page .dashboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #homeView.dashboard-page .dashboard-filter-group {
    display: grid;
    grid-template-columns: 1fr;
  }

  #homeView.dashboard-page .topbar-right {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    margin-left: 0;
  }

  #homeView.dashboard-page .user-chip {
    width: 100%;
    order: 0;
    grid-column: 1 / -1;
  }

  #homeView.dashboard-page .topbar-right .shift-toggle {
    width: 100%;
    grid-column: 1 / -1;
  }

  #homeView.dashboard-page .topbar-right .shift-option {
    min-width: 0;
    width: 100%;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  #homeView.dashboard-page #managerSettingsTabBtn.home-settings-tab,
  #homeView.dashboard-page #supervisorLogout.home-btn,
  #homeView.dashboard-page #supervisorMobileMode.ghost-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  #homeView.dashboard-page .home-title-block p {
    font-size: 0.86rem;
  }

  #lineWorkspace .manager-workspace-topbar {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    border-radius: 14px;
    margin-bottom: 6px;
    gap: 8px;
  }

  #lineWorkspace .topbar-right {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    margin-left: 0;
  }

  #lineWorkspace .manager-workspace-actions .user-chip {
    width: 100%;
    order: 0;
    grid-column: 1 / -1;
  }

  #lineWorkspace .manager-workspace-actions .shift-toggle {
    width: 100%;
    grid-column: 1 / -1;
  }

  #lineWorkspace .manager-workspace-top-controls {
    margin-top: 0.3rem;
    margin-bottom: 0.65rem;
  }

  #lineWorkspace .manager-workspace-top-controls .tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  #lineWorkspace .manager-workspace-top-controls .tab-btn {
    min-width: 126px;
  }

  #lineWorkspace #goHome.home-btn {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
    justify-content: center;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  #lineWorkspace .home-title-block p {
    font-size: 0.86rem;
  }

  .supervisor-top-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .supervisor-line-select-inline {
    min-width: 0;
    max-width: none;
  }

  #homeView.dashboard-page #managerAppSection.dashboard-grid {
    grid-template-columns: 1fr;
  }

  #homeView.dashboard-page .stat-card,
  #homeView.dashboard-page .analytics-card,
  #homeView.dashboard-page .project-list-card,
  #homeView.dashboard-page .add-line-card,
  #homeView.dashboard-page .manage-super-card,
  #homeView.dashboard-page .manage-products-card,
  #homeView.dashboard-page .data-sources-card,
  #homeView.dashboard-page .manager-actions-card {
    grid-column: span 1;
    grid-row: auto;
  }

  .connect-data-source-field-group {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #homeView.dashboard-page {
    padding: 12px;
  }

  #lineWorkspace.app-shell {
    padding: 12px;
  }

  #homeView.dashboard-page .dashboard-topbar {
    padding: 9px 10px;
  }

  #lineWorkspace .manager-workspace-topbar {
    padding: 9px 10px;
  }

  #homeView.dashboard-page .cordina-logo {
    width: 132px;
  }

  #lineWorkspace .cordina-logo {
    width: 132px;
  }

  #homeView.dashboard-page .home-title-block h1 {
    font-size: 22px;
    line-height: 28px;
  }

  #lineWorkspace .home-title-block h1 {
    font-size: 22px;
    line-height: 28px;
  }

  #homeView.dashboard-page .home-title-block p {
    font-size: 0.82rem;
  }

  #lineWorkspace .home-title-block p {
    font-size: 0.82rem;
  }

  #homeView.dashboard-page .topbar-right .shift-toggle {
    min-height: 40px;
  }

  #homeView.dashboard-page .topbar-right .shift-option {
    min-height: 40px;
    font-size: 0.82rem;
    padding: 0 6px;
  }

  #lineWorkspace .manager-workspace-actions .shift-toggle {
    min-height: 40px;
  }

  #lineWorkspace .manager-workspace-actions .shift-option {
    min-height: 40px;
    font-size: 0.82rem;
    padding: 0 6px;
  }

  #homeView.dashboard-page #managerSettingsTabBtn.home-settings-tab,
  #homeView.dashboard-page #supervisorLogout.home-btn,
  #homeView.dashboard-page #supervisorMobileMode.ghost-btn {
    min-height: 40px;
  }

  #lineWorkspace .manager-workspace-top-controls .tabs {
    min-height: 40px;
  }

  #lineWorkspace .manager-workspace-top-controls .tab-btn {
    min-height: 40px;
    font-size: 0.82rem;
    padding: 0 6px;
  }

  #lineWorkspace #goHome.home-btn {
    min-height: 40px;
  }
}
