:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f4f8;
  --ink: #18212f;
  --ink-soft: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #d8dee8;
  --line-strong: #c5cedb;
  --accent: #2458a6;
  --accent-strong: #173f78;
  --accent-soft: #e7eefb;
  --safe: #15705c;
  --safe-soft: #dcf2ea;
  --warn: #9a5b00;
  --warn-soft: #fff3d6;
  --block: #b42318;
  --block-soft: #fde3df;
  --info: #365f9f;
  --info-soft: #e6eefb;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --max-page: 1760px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Aptos, Candara, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(36, 88, 166, 0.35);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.app-header {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  gap: 0.9rem;
  align-content: start;
  padding: 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0f172a;
  color: #ffffff;
}

.brand-block {
  min-width: 0;
}

.brand-block h1,
.topbar h1,
.panel h2 {
  margin: 0.1rem 0 0;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-block h1 {
  color: #ffffff;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-block .eyebrow {
  color: #93a4bd;
}

.app-status-strip,
.meta-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.app-status-strip {
  justify-content: flex-start;
}

.app-status-pill,
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.app-status-pill {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.app-status-pill strong,
.meta-pill strong {
  color: var(--ink-soft);
  font-weight: 700;
}

.app-status-pill strong {
  color: #ffffff;
}

.app-status-link {
  text-decoration: none;
}

.app-status-link:hover {
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.permission-grid {
  display: grid;
  gap: 10px;
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.reset-password-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.app-nav {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: 0;
  z-index: 20;
  display: block;
  height: calc(100vh - 99px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.nav-group {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.9rem 0.8rem;
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.nav-group:last-child {
  border-right: 0;
}

.nav-group.is-current {
  background: #f8fafc;
}

.nav-group-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.nav-links a,
.topnav a {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0.42rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  white-space: normal;
}

.nav-links a:hover,
.topnav a:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent-strong);
}

.nav-links a.is-active {
  border-color: rgba(36, 88, 166, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.topbar,
.topnav {
  display: flex;
  gap: 1rem;
}

.page-shell {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: min(100%, var(--max-page));
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #f3c06a;
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: #6b3d00;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.two-up {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.three-up {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel,
.section-block {
  min-width: 0;
  margin-bottom: 1rem;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel,
.page-header {
  border-top: 3px solid var(--accent);
  background: var(--surface);
}

.subtle-panel {
  background: var(--surface-soft);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.section-head h2,
.section-head h3,
.panel h3 {
  margin: 0.1rem 0 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.section-head h2 {
  font-size: 1.18rem;
}

.section-head-actions,
.action-row,
.post-opening-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.lede {
  max-width: 980px;
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.mini-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.mini-label,
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stats-grid,
.metric-strip,
.sync-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  margin: 0.85rem 0 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sync-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card,
.sync-grid > div {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.stat-card:nth-last-child(-n + 1),
.sync-grid > div:nth-last-child(-n + 1) {
  border-right-color: transparent;
}

.stat-card strong,
.sync-grid strong {
  display: block;
  margin: 0.12rem 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.stat-card small,
.sync-grid small {
  color: var(--muted);
  line-height: 1.35;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 0;
}

.production-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  margin: 0.85rem 0 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.production-kpi-card {
  min-width: 0;
  padding: 0.85rem 0.9rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  background: var(--surface);
}

.production-kpi-card.status-good {
  border-left-color: var(--safe);
}

.production-kpi-card.status-warn {
  border-left-color: #c28725;
}

.production-kpi-card.status-bad {
  border-left-color: var(--block);
}

.production-kpi-card span,
.production-kpi-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.production-kpi-card strong {
  display: block;
  margin: 0.14rem 0;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1.2;
}

.production-kpi-card small,
.production-kpi-metrics small {
  color: var(--muted);
  line-height: 1.35;
}

.production-cockpit-section {
  display: grid;
  gap: 1rem;
}

.production-kpi-detail-grid {
  margin: 0;
}

.production-kpi-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.production-kpi-metrics > div {
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.production-kpi-metrics strong {
  display: block;
  margin: 0.12rem 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.22;
}

.production-flow-row {
  grid-template-columns: minmax(0, 1.15fr) minmax(150px, 1.4fr) minmax(100px, 0.7fr);
}

.stack-form,
.filters,
.component-selection-form {
  display: grid;
  gap: 0.75rem;
}

.stack-form label,
.filters label,
.quick-lookup-field,
.component-selection-form label {
  display: grid;
  gap: 0.28rem;
}

label > span,
fieldset legend {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

textarea {
  min-height: 4.5rem;
  resize: vertical;
}

button,
.primary-btn,
.secondary-btn,
.secondary-link,
.action-pill,
.service-opening-scope-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.48rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button {
  border-color: transparent;
}

button:disabled,
.primary-btn:disabled,
.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-btn:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
  text-decoration: none;
}

.secondary-btn,
.secondary-link,
.action-pill,
.service-opening-scope-action {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.secondary-btn:hover,
.secondary-link:hover,
.action-pill:hover,
.service-opening-scope-action:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  text-decoration: none;
}

.action-pill-button {
  appearance: none;
}

.quick-lookup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.quick-lookup-results[aria-busy="true"] {
  opacity: 0.65;
  transition: opacity 0.2s ease;
}

.lookup-results-panel {
  background: var(--surface-soft);
}

.filters {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.daily-filters,
.non-delivery-filters,
.delivery-risk-filters,
.delivery-dashboard-filters {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.delivery-risk-search {
  min-width: min(100%, 280px);
}

.weekend-planner-filters {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.weekend-date-field {
  min-width: min(100%, 320px);
}

.weekend-capacity-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weekend-capacity-table {
  min-width: 1180px;
}

.compact-number-input {
  min-width: 5.2rem;
  min-height: 34px;
  padding: 0.35rem 0.45rem;
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
  align-items: flex-start;
}

.check-row input[type="checkbox"],
.check-row input[type="radio"] {
  width: auto;
  min-height: auto;
  margin-top: 0.2rem;
}

.check-row span {
  display: grid;
  gap: 0.08rem;
}

.check-row small {
  color: var(--muted);
  line-height: 1.35;
}

.inline-check {
  align-items: center;
}

.empty-state {
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
}

.warning-box {
  margin: 0.85rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid #f0ca76;
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: #5f3700;
}

.warning-box .lede,
.warning-box p {
  color: #6b3d00;
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
}

.plain-list li + li {
  margin-top: 0.25rem;
}

.table-scroll,
.services-opening-table-shell,
.dashboard-monthly-chart-shell,
.dashboard-heatmap-shell,
.forecast-chart-shell {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.data-table.compact,
.compact.data-table {
  min-width: 940px;
}

.data-table th,
.data-table td {
  padding: 0.62rem 0.65rem;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-top: 0;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr:hover td {
  background: #fbfdff;
}

.data-table td small {
  color: var(--muted);
  line-height: 1.35;
}

.compact td,
.compact th {
  padding: 0.5rem 0.55rem;
}

.dashboard-matrix td,
.dashboard-matrix th {
  text-align: center;
  white-space: nowrap;
}

.dashboard-matrix td:first-child,
.dashboard-matrix th:first-child {
  text-align: left;
}

.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.2rem 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.badge.seguro_para_referencia,
.badge.ready-open,
.badge.no_prazo {
  border-color: rgba(21, 112, 92, 0.22);
  background: var(--safe-soft);
  color: var(--safe);
}

.badge.permite_com_alerta,
.badge.atencao {
  border-color: rgba(154, 91, 0, 0.22);
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.bloquear_automacao,
.badge.critico,
.badge.bloqueado {
  border-color: rgba(180, 35, 24, 0.22);
  background: var(--block-soft);
  color: var(--block);
}

.badge.info {
  border-color: rgba(54, 95, 159, 0.2);
  background: var(--info-soft);
  color: var(--info);
}

.row-overdue td {
  background: #fff9eb;
}

.action-links {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.daily-sector-panel {
  display: grid;
  gap: 1rem;
}

.daily-section {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  overflow-x: auto;
  padding-top: 0.25rem;
}

.services-report-table {
  min-width: 1320px;
}

.services-report-stage-list,
.services-report-action-form {
  display: grid;
  gap: 0.45rem;
}

.services-report-stage {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr);
  gap: 0.25rem 0.45rem;
  align-items: center;
}

.services-report-stage small {
  grid-column: 2;
}

.services-report-missing {
  margin-top: 0.55rem;
  color: var(--block);
}

.services-report-action-form input,
.services-report-action-form textarea {
  min-width: 190px;
}

.services-report-action-form textarea {
  min-height: 64px;
}

.compact-head {
  margin-bottom: 0.1rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--line);
}

.capacity-form {
  min-width: 260px;
}

.component-tree-toolbar,
.confirm-bar,
.gantt-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.component-tree {
  display: grid;
  gap: 0.75rem;
}

.component-group-card,
.gantt-control-group,
.delivery-risk-route-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.component-group-row,
.component-child-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  align-items: flex-start;
}

.component-group-row input[type="checkbox"],
.component-child-row input[type="checkbox"] {
  width: auto;
  min-height: auto;
  margin-top: 0.2rem;
}

.component-group-row span,
.component-child-row span {
  display: grid;
  gap: 0.12rem;
}

.component-group-row small,
.component-child-row small,
.confirm-hint,
.gantt-status-text {
  color: var(--muted);
  line-height: 1.35;
}

.component-children {
  display: grid;
  gap: 0.55rem;
  padding-left: 1.35rem;
  border-left: 2px solid var(--line);
}

.gantt-panel {
  overflow: hidden;
}

.gantt-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: flex-start;
}

.gantt-controls {
  display: grid;
  gap: 0.85rem;
}

.gantt-control-group h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

.check-stack {
  display: grid;
  gap: 0.6rem;
}

.categories-stack {
  max-height: 18rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.compact-choice {
  padding: 0.05rem 0;
}

.gantt-actions,
.gantt-visual-panel {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.gantt-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.gantt-overview-strip {
  display: flex;
  flex: 1 1 520px;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gantt-overview-card {
  min-width: 130px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.gantt-overview-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.gantt-overview-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1rem;
}

.gantt-overview-card small {
  color: var(--muted);
}

.gantt-overview-card.emphasis {
  border-color: rgba(36, 88, 166, 0.24);
  background: var(--accent-soft);
}

.gantt-zoom-controls {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.gantt-zoom-btn {
  min-width: 4.4rem;
}

.gantt-zoom-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.gantt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
}

.legend-swatch.oxicorte {
  background: #b74f35;
}

.legend-swatch.internal {
  background: #365f9f;
}

.legend-swatch.external-execution {
  background: #15705c;
}

.legend-swatch.external-transport {
  background: #876214;
}

.gantt-chart-shell {
  display: grid;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.gantt-axis {
  position: relative;
  min-width: 720px;
  height: 2rem;
  margin-left: 9rem;
  border-bottom: 1px dashed var(--line-strong);
}

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

.gantt-axis-tick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 1.15rem;
  width: 1px;
  height: 0.8rem;
  background: var(--line-strong);
}

.gantt-axis-tick span {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.gantt-axis-caption {
  position: absolute;
  right: 0;
  bottom: 0.2rem;
  padding: 0.12rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.74rem;
}

.gantt-lanes {
  display: grid;
  gap: 0.8rem;
  min-width: 720px;
}

.gantt-lane {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
}

.gantt-lane-label-block {
  display: grid;
  gap: 0.1rem;
  align-self: stretch;
  align-content: center;
}

.gantt-lane-label {
  color: var(--ink);
  font-weight: 700;
}

.gantt-lane-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.gantt-track {
  position: relative;
  height: 3.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.42)),
    repeating-linear-gradient(90deg, #ffffff 0, #ffffff 10%, #eef2f6 10%, #eef2f6 20%);
}

.gantt-bar {
  position: absolute;
  top: 0.38rem;
  bottom: 0.38rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.08rem;
  overflow: hidden;
  padding: 0.42rem 0.55rem;
  border: 0;
  border-radius: var(--radius-sm);
  color: #ffffff;
  text-align: left;
  cursor: default;
}

.gantt-bar-label,
.gantt-bar-meta {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-bar-label {
  font-size: 0.8rem;
  font-weight: 700;
}

.gantt-bar-meta {
  font-size: 0.72rem;
  opacity: 0.9;
}

.gantt-bar-compact {
  justify-content: center;
  padding-right: 0.35rem;
}

.gantt-bar-compact .gantt-bar-meta {
  display: none;
}

.gantt-bar-compact .gantt-bar-label {
  font-size: 0.72rem;
}

.gantt-bar-oxicorte {
  background: #b74f35;
}

.gantt-bar-internal {
  background: #365f9f;
}

.gantt-bar-external-execution {
  background: #15705c;
}

.gantt-bar-external-transport {
  background: #876214;
}

.gantt-finish-line {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: 0;
  border-left: 2px dashed rgba(24, 33, 47, 0.55);
  pointer-events: none;
}

.gantt-finish-line span {
  position: absolute;
  top: 0.2rem;
  right: 0.25rem;
  padding: 0.12rem 0.35rem;
  border-radius: var(--radius-sm);
  background: rgba(24, 33, 47, 0.88);
  color: #ffffff;
  font-size: 0.72rem;
  transform: translateX(100%);
  white-space: nowrap;
}

.gantt-drilldown {
  display: grid;
  gap: 0.65rem;
}

.gantt-drilldown-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.gantt-drilldown-group summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  list-style: none;
  cursor: pointer;
  font-weight: 700;
}

.gantt-drilldown-group summary::-webkit-details-marker {
  display: none;
}

.gantt-drilldown-group summary small {
  color: var(--muted);
  font-weight: 600;
}

.gantt-drilldown-group table {
  margin-top: 0;
}

.services-opening-table {
  min-width: 1580px;
  table-layout: fixed;
}

.services-opening-table th,
.services-opening-table td {
  line-height: 1.4;
}

.services-opening-table th:nth-child(1),
.services-opening-table td:nth-child(1) {
  width: 108px;
}

.services-opening-table th:nth-child(2),
.services-opening-table td:nth-child(2) {
  width: 102px;
}

.services-opening-table th:nth-child(3),
.services-opening-table td:nth-child(3) {
  width: 86px;
}

.services-opening-table th:nth-child(4),
.services-opening-table td:nth-child(4) {
  width: 92px;
}

.services-opening-table th:nth-child(6),
.services-opening-table td:nth-child(6) {
  width: 148px;
}

.services-opening-table th:nth-child(7),
.services-opening-table td:nth-child(7) {
  width: 88px;
}

.services-opening-table th:nth-child(8),
.services-opening-table td:nth-child(8),
.services-opening-table th:nth-child(9),
.services-opening-table td:nth-child(9) {
  width: 124px;
}

.services-opening-table th:nth-child(10),
.services-opening-table td:nth-child(10) {
  width: 320px;
}

.services-opening-table th:nth-child(11),
.services-opening-table td:nth-child(11) {
  width: 260px;
}

.service-opening-row.is-selected td {
  background: var(--accent-soft);
}

.service-opening-select {
  min-width: 96px;
  align-items: center;
}

.service-opening-select span {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.service-opening-channel,
.service-opening-code,
.service-opening-due {
  white-space: nowrap;
}

.service-opening-order,
.service-opening-scope,
.service-opening-scope-body {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.service-opening-order strong {
  font-size: 0.94rem;
}

.service-opening-order small {
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.45;
}

.service-opening-route {
  min-width: 140px;
}

.service-opening-plaqueta {
  align-items: center;
}

.service-opening-size,
.service-opening-plates {
  min-width: 94px;
}

.service-opening-scope-cell {
  vertical-align: top;
}

.service-opening-scope-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.service-opening-scope-option {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.service-opening-scope-option.is-selected,
.service-opening-scope-option[aria-pressed="true"] {
  border-color: rgba(36, 88, 166, 0.4);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.service-opening-scope-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.service-opening-scope-list {
  display: grid;
  gap: 0.3rem;
  max-height: 13.5rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.service-opening-scope-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.4rem;
  align-items: flex-start;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

.service-opening-scope-empty,
.service-opening-status-copy {
  color: var(--muted);
  line-height: 1.4;
}

.service-opening-status {
  min-width: 240px;
}

.service-opening-status-copy {
  display: block;
  margin-top: 0.35rem;
}

.service-opening-row.is-ready .service-opening-select span {
  color: var(--safe);
}

.service-opening-row.is-review .service-opening-select span {
  color: var(--warn);
}

.non-delivery-case-list {
  display: grid;
  gap: 0.8rem;
}

.non-delivery-case-card {
  margin: 0;
}

.non-delivery-case {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.non-delivery-case.is-closed {
  border-left-color: var(--safe);
  background: #fbfefc;
}

.non-delivery-case-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.non-delivery-case-title {
  display: grid;
  gap: 0.15rem;
}

.non-delivery-case-title h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.non-delivery-case-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.non-delivery-case-status {
  display: grid;
  gap: 0.3rem;
  justify-items: end;
  text-align: right;
}

.non-delivery-case-status small {
  color: var(--muted);
  line-height: 1.35;
}

.non-delivery-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.65rem;
  margin: 0;
}

.non-delivery-meta-item {
  margin: 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.non-delivery-meta-item dt {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.non-delivery-meta-item dd {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
  line-height: 1.35;
}

.non-delivery-interruption-box {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #f0ca76;
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
}

.non-delivery-interruption-box h4,
.non-delivery-interruption-box p,
.non-delivery-interruption-box ul {
  margin: 0;
}

.non-delivery-interruption-box h4 {
  color: #6b3d00;
}

.non-delivery-interruption-box ul {
  padding-left: 1.1rem;
}

.non-delivery-interruption-box textarea {
  min-height: 3.2rem;
  background: var(--surface);
}

.non-delivery-checklist {
  margin: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.non-delivery-checklist legend {
  padding: 0 0.35rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.non-delivery-reason-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.6rem;
}

.non-delivery-reason-option {
  display: grid;
  margin: 0;
  padding: 0;
}

.non-delivery-reason-option-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: flex-start;
  width: 100%;
  min-height: 100%;
  padding: 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.non-delivery-reason-option-body:hover {
  border-color: rgba(36, 88, 166, 0.45);
}

.non-delivery-reason-option-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.non-delivery-reason-marker {
  position: relative;
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  border: 2px solid var(--muted-2);
  border-radius: 4px;
  background: var(--surface);
}

.non-delivery-reason-copy {
  display: grid;
  gap: 0.15rem;
  line-height: 1.35;
}

.non-delivery-reason-copy strong {
  font-size: 0.92rem;
}

.non-delivery-reason-copy small {
  color: var(--muted);
}

.non-delivery-reason-option-input:checked + .non-delivery-reason-marker::after,
.non-delivery-reason-option-input:checked + .non-delivery-reason-option-body .non-delivery-reason-marker::after {
  content: "X";
  position: absolute;
  inset: -2px 0 0;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.05rem;
  text-align: center;
}

.non-delivery-reason-option.is-selected .non-delivery-reason-option-body,
.non-delivery-reason-option-input:checked + .non-delivery-reason-option-body {
  border-color: rgba(36, 88, 166, 0.55);
  background: var(--accent-soft);
}

.non-delivery-reason-option.is-other {
  grid-column: 1 / -1;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: stretch;
}

.non-delivery-other-input {
  min-height: 100%;
}

.non-delivery-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.delivery-risk-group summary span {
  display: grid;
  gap: 0.16rem;
}

.delivery-risk-group summary .badge {
  align-self: flex-start;
}

.delivery-risk-detail-body {
  padding: 0 0.9rem 0.9rem;
}

.delivery-risk-route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}

.delivery-risk-route-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.dashboard-chart-panel {
  background: var(--surface);
}

.dashboard-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.dashboard-swatch-safe {
  background: var(--safe);
}

.dashboard-swatch-late {
  background: var(--block);
}

.dashboard-monthly-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 0.75rem;
  min-width: 420px;
  align-items: end;
}

.dashboard-monthly-column {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.dashboard-monthly-column strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.dashboard-monthly-column small {
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-monthly-track {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  gap: 0.16rem;
  height: 13rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(248, 250, 252, 0.86)),
    repeating-linear-gradient(180deg, rgba(197, 206, 219, 0.32) 0, rgba(197, 206, 219, 0.32) 1px, transparent 1px, transparent 25%);
}

.dashboard-monthly-segment {
  width: 100%;
  height: max(0.4rem, var(--segment-height));
  border-radius: var(--radius-sm);
}

.dashboard-monthly-segment.is-safe {
  background: var(--safe);
}

.dashboard-monthly-segment.is-late {
  background: var(--block);
}

.dashboard-bar-list {
  display: grid;
  gap: 0.7rem;
}

.dashboard-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(220px, 2fr) minmax(120px, 0.75fr);
  gap: 0.75rem;
  align-items: center;
}

.dashboard-bar-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.dashboard-bar-copy strong,
.dashboard-bar-copy small {
  overflow-wrap: anywhere;
}

.dashboard-bar-copy small,
.dashboard-bar-metric small {
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-bar-link {
  color: inherit;
  text-decoration: none;
}

.dashboard-bar-link:hover {
  color: var(--accent);
}

.dashboard-bar-track {
  position: relative;
  min-height: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.dashboard-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar-width);
}

.dashboard-bar-fill.is-cause {
  background: #a15f4a;
}

.dashboard-bar-fill.is-cause-open {
  background: var(--safe);
  mix-blend-mode: multiply;
}

.dashboard-bar-fill.is-taxonomy {
  background: #876214;
}

.dashboard-bar-fill.is-bottleneck {
  background: var(--info);
}

.dashboard-bar-metric {
  display: grid;
  gap: 0.1rem;
  justify-items: end;
  text-align: right;
}

.dashboard-bar-metric strong {
  font-size: 0.95rem;
}

.dashboard-heatmap-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1.15fr) repeat(var(--heatmap-columns), minmax(88px, 1fr));
  gap: 0.35rem;
  min-width: 560px;
  align-items: stretch;
}

.dashboard-heatmap-corner,
.dashboard-heatmap-column-label,
.dashboard-heatmap-row-label,
.dashboard-heatmap-cell {
  min-height: 3rem;
  border-radius: var(--radius-sm);
}

.dashboard-heatmap-corner {
  border: 1px dashed var(--line-strong);
  background: var(--surface-soft);
}

.dashboard-heatmap-column-label,
.dashboard-heatmap-row-label {
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: center;
}

.dashboard-heatmap-row-label {
  justify-items: start;
  color: var(--ink-soft);
  font-weight: 700;
  text-align: left;
}

.dashboard-heatmap-cell {
  display: grid;
  place-items: center;
  padding: 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.dashboard-heatmap-cell.is-active {
  border-color: rgba(36, 88, 166, 0.3);
  background: rgba(36, 88, 166, var(--heat-alpha));
  color: var(--ink);
}

.forecast-chart-shell {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.forecast-chart-svg {
  display: block;
  max-width: none;
  height: auto;
}

.forecast-chart-svg rect[fill="#fffef8"] {
  fill: #ffffff;
  stroke: #d8dee8;
}

.forecast-chart-svg rect[fill="#f5efe3"] {
  fill: #eef2f6;
}

.forecast-chart-svg line[stroke="#ddd5c7"],
.forecast-chart-svg line[stroke="#cfc6b6"] {
  stroke: #c5cedb;
}

.forecast-chart-svg line[stroke="#a0462d"] {
  stroke: #2458a6;
}

.forecast-chart-svg text[fill="#a0462d"] {
  fill: #2458a6;
}

.forecast-chart-svg rect[fill="#375b8a"] {
  fill: #365f9f;
}

.services-activity-filters {
  grid-template-columns: minmax(160px, 0.8fr) minmax(160px, 0.8fr) minmax(220px, 1.4fr) auto;
  align-items: end;
}

.services-activity-list {
  display: grid;
  gap: 0.8rem;
}

.service-activity-card {
  overflow: visible;
}

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

.service-activity-card-head h2 {
  margin: 0.1rem 0 0;
  font-size: 1.12rem;
}

.service-activity-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.service-activity-meta > div {
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.service-activity-meta span,
.service-document-field-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.service-activity-meta strong {
  display: block;
  margin-top: 0.12rem;
  overflow-wrap: anywhere;
}

.service-activity-missing,
.services-document-missing {
  margin-top: 0.75rem;
  color: var(--warn);
}

.service-activity-actions,
.service-document-actions,
.services-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.85rem;
}

.service-activity-actions form,
.service-document-actions form,
.services-document-actions form {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.service-document-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.service-document-field-grid label.is-missing input {
  border-color: #d8962f;
  background: #fffaf0;
}

.service-document-checklist,
.service-document-attachments,
.service-document-notes {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.service-document-check-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(120px, auto));
  gap: 0.55rem;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.service-document-check-row legend {
  float: left;
  width: 100%;
  padding: 0;
}

.service-document-check-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
}

.service-document-check-row input {
  width: auto;
  min-height: auto;
}

.service-document-reject-form,
.services-document-reject-inline {
  min-width: min(100%, 360px);
}

.services-document-reject-inline input {
  min-width: 160px;
}

.service-document-audit {
  display: grid;
  gap: 0.4rem;
}

.compact-warning {
  margin: 0;
}

.compact-warning p {
  margin: 0.35rem 0 0;
}

.machine-queue-filters {
  grid-template-columns: minmax(140px, 0.75fr) minmax(150px, 0.75fr) minmax(170px, 0.8fr) minmax(220px, 1.3fr) auto;
  align-items: end;
}

.machine-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.75rem;
}

.machine-queue-card {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}

.machine-queue-card.is-overdue {
  border-left-color: var(--block);
  background: #fffafa;
}

.machine-queue-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.machine-queue-card-head h3 {
  margin: 0.1rem 0 0;
  font-size: 1rem;
}

.machine-queue-card-head small,
.machine-queue-body small {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.machine-queue-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.machine-queue-meta div {
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.machine-queue-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.machine-queue-meta dd {
  margin: 0.08rem 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.machine-queue-body {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.machine-queue-body strong {
  overflow-wrap: anywhere;
}

.machine-queue-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

@media (max-width: 1180px) {
  .app-shell {
    display: block;
  }

  .app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-right: 0;
  }

  .app-status-strip {
    justify-content: flex-start;
  }

  .app-nav {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    height: auto;
    max-height: 46vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-group {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-group:last-child {
    border-bottom: 0;
  }

  .nav-links {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-links a {
    width: auto;
    white-space: nowrap;
  }

  .page-shell {
    width: min(100%, var(--max-page));
  }
}

@media (max-width: 720px) {
  body {
    font-size: 13px;
  }

  .app-header,
  .page-shell {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .app-header {
    flex-direction: column;
  }

  .app-nav {
    grid-template-columns: 1fr;
    max-height: 52vh;
  }

  .nav-links a {
    white-space: normal;
  }

  .brand-block h1,
  .topbar h1,
  .section-head h2 {
    font-size: 1.08rem;
  }

  .section-head,
  .non-delivery-case-head,
  .gantt-toolbar,
  .delivery-risk-route-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-head-actions,
  .post-opening-actions,
  .non-delivery-form-actions {
    width: 100%;
    justify-content: stretch;
  }

  .section-head-actions > *,
  .post-opening-actions > *,
  .post-opening-actions form,
  .post-opening-actions button,
  .post-opening-actions a,
  .non-delivery-form-actions button,
  .action-pill,
  .secondary-link {
    width: 100%;
  }

  .quick-lookup-form,
  .gantt-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .metric-strip,
  .sync-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters,
  .daily-filters,
  .non-delivery-filters,
  .delivery-risk-filters,
  .delivery-dashboard-filters,
  .services-activity-filters,
  .machine-queue-filters {
    grid-template-columns: 1fr;
  }

  .service-activity-card-head,
  .service-document-check-row,
  .machine-queue-card-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .service-activity-meta {
    grid-template-columns: 1fr 1fr;
  }

  .service-activity-actions > *,
  .service-activity-actions form,
  .service-activity-actions button,
  .service-activity-actions a,
  .service-document-actions > *,
  .service-document-actions form,
  .service-document-actions button,
  .services-document-actions > *,
  .services-document-actions form,
  .services-document-actions button,
  .services-document-actions a,
  .machine-queue-filters button {
    width: 100%;
  }

  .gantt-axis {
    min-width: 560px;
    margin-left: 0;
  }

  .gantt-lane {
    grid-template-columns: 1fr;
  }

  .gantt-track {
    min-width: 560px;
  }

  .gantt-finish-line span {
    top: 0.25rem;
    right: auto;
    left: 0.25rem;
    transform: translateX(0);
  }

  .dashboard-monthly-chart {
    min-width: 520px;
  }

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

  .dashboard-bar-metric,
  .non-delivery-case-status {
    justify-items: flex-start;
    text-align: left;
  }

  .dashboard-heatmap-grid {
    min-width: 640px;
  }

  .non-delivery-reason-option.is-other {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid,
  .metric-strip,
  .sync-grid,
  .service-activity-meta {
    grid-template-columns: 1fr;
  }

  .nav-links a {
    flex: 1 1 auto;
    justify-content: center;
  }

  .machine-queue-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  .services-opening-table {
    min-width: 1460px;
  }

  .services-opening-table th:nth-child(10),
  .services-opening-table td:nth-child(10) {
    width: 280px;
  }

  .services-opening-table th:nth-child(11),
  .services-opening-table td:nth-child(11) {
    width: 220px;
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .app-header,
  .app-nav,
  .topbar,
  .topnav,
  .meta-strip,
  .filters,
  .flash,
  .non-delivery-screen-actions {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .panel,
  .non-delivery-case {
    break-inside: avoid;
    border: 1px solid #000000;
    background: #ffffff;
    box-shadow: none;
  }

  .hero-panel {
    border-top: 1px solid #000000;
    background: #ffffff;
  }

  .non-delivery-meta-item,
  .non-delivery-checklist,
  .non-delivery-reason-option-body {
    border-color: #000000;
    background: #ffffff;
    box-shadow: none;
  }

  .non-delivery-reason-marker {
    border-color: #000000;
    background: #ffffff;
  }

  .non-delivery-other-input {
    border: 0;
    border-bottom: 1px solid #000000;
    border-radius: 0;
    background: transparent;
    padding: 0.35rem 0.1rem;
  }

  .badge,
  .status-badge {
    border: 1px solid #000000;
    background: #ffffff !important;
    color: #000000 !important;
  }
}
