.progress-portfolio,
.progress-project {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 1rem;
}

/* Wide schedule content belongs to its own scroll panel, not the page grid. */
.workspace:has(.progress-project, .progress-portfolio),
.detail:has(.progress-project, .progress-portfolio) {
  min-width: 0;
}

.detail:has(.progress-project, .progress-portfolio) {
  grid-template-columns: minmax(0, 1fr);
}

.progress-project > *,
.progress-portfolio > *,
.gantt-panel > *,
.schedule-update-panel > *,
.progress-form > *,
.progress-form fieldset > *,
.progress-form-grid > * {
  min-width: 0;
  max-width: 100%;
}

.progress-actions,
.progress-tabs,
.progress-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.progress-tabs {
  margin: 0.8rem 0;
}

.progress-tab {
  color: var(--navy);
  background: #eef4f8;
  border-color: #bfd0db;
}

.progress-tab.active {
  color: white;
  background: var(--navy);
}

.progress-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.progress-card {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 0.85rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress-card strong {
  display: block;
  color: var(--navy);
}

.progress-card .progress-number {
  margin-top: 0.3rem;
  font-size: 1.6rem;
  font-weight: 750;
}

.progress-table-wrap {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.progress-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.progress-table th,
.progress-table td {
  padding: 0.65rem;
  border-bottom: 1px solid #e4dac8;
  text-align: left;
  vertical-align: top;
}

.progress-table th {
  color: var(--navy);
  background: #f2f6f8;
  font-size: 0.82rem;
}

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

.progress-chart {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0.65rem;
}

.progress-chart svg {
  width: 100%;
  min-height: 240px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gantt-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0.75rem;
}

.gantt-scroll {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.gantt-chart {
  display: block;
  min-width: 980px;
  background: white;
}

.gantt-axis {
  stroke: #9fb0bc;
  stroke-width: 1.5;
}

.gantt-baseline {
  fill: #315d79;
}

.gantt-baseline.overdue {
  fill: #9f3d2f;
}

.gantt-verified {
  fill: #36a26f;
}

.gantt-today {
  stroke: #ba8a2a;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.gantt-label {
  fill: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.gantt-sub-label,
.gantt-date-label,
.gantt-progress-label {
  fill: var(--muted);
  font-size: 11px;
}

.gantt-today-label,
.gantt-overdue-label {
  fill: #8b2f25;
  font-size: 11px;
  font-weight: 700;
}

.gantt-data-table {
  min-width: 2300px;
}

.schedule-update-panel { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 0.85rem; }
.schedule-update-panel h4 { margin: 0; }
.schedule-date { font-size: 1.15rem; font-weight: 750; margin: 0.4rem 0; color: var(--navy); }
.schedule-quality { padding: 0.85rem; background: #fff8e9; border: 1px solid #d9b872; border-radius: 8px; }
.schedule-quality ul { margin-bottom: 0; }
.schedule-quality li { margin: 0.5rem 0; }
.schedule-entry-table td:first-child { min-width: 250px; }
.schedule-entry-table input[type="number"] { max-width: 14rem; }
.schedule-register { max-height: 70vh; overflow: auto; }
.schedule-register thead { position: sticky; top: 0; z-index: 2; }
.schedule-register th:first-child, .schedule-register td:first-child { position: sticky; left: 0; min-width: 220px; max-width: 280px; background: #fff; z-index: 1; }
.schedule-register th:first-child { background: #f2f6f8; }
.gantt-grid { stroke: #d5dfe6; stroke-width: 1; }
.gantt-row-line { stroke: #e2e9ee; stroke-width: 1; }
.gantt-nonworking { fill: #e9edf2; }
.gantt-approved { fill: #aab5c1; stroke: #798a99; stroke-width: 0.5; }
.gantt-cpm { fill: #315d79; }
.gantt-forecast { fill: #348bb6; }
.gantt-cpm.critical, .gantt-forecast.critical { fill: #b63235; }
.gantt-cpm.nearcritical, .gantt-forecast.nearcritical { fill: #ba7c17; }
.gantt-actual { fill: #178354; stroke: white; stroke-width: 1; }
.gantt-link { fill: none; stroke: #687b8b; stroke-width: 1.1; opacity: 0.65; }
.gantt-link.driving { stroke: #a73639; stroke-width: 1.5; opacity: 0.9; }
.progress-legend .gantt-legend-approved { background: #aab5c1; }
.progress-legend .gantt-legend-cpm { background: #315d79; }
.progress-legend .gantt-legend-forecast { background: #348bb6; }
.progress-legend .gantt-legend-critical { background: #b63235; }
.progress-legend .gantt-legend-near { background: #ba7c17; }
.progress-legend .gantt-legend-actual { background: #178354; }
.progress-legend .gantt-legend-nonworking { background: #e9edf2; border: 1px solid #b7c5cf; }
.progress-form fieldset { min-width: 0; border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.85rem; }

.progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-legend span {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.3rem;
  border-radius: 999px;
  vertical-align: -0.08rem;
}

.progress-legend .planned {
  background: #315d79;
}

.progress-legend .reported {
  background: #ba8a2a;
}

.progress-legend .accepted {
  background: #237653;
}

.progress-legend .gantt-legend-baseline {
  background: #315d79;
}

.progress-legend .gantt-legend-verified {
  background: #36a26f;
}

.progress-legend .gantt-legend-today {
  background: #ba8a2a;
}

.progress-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  color: var(--navy);
  background: #eef4f8;
  border: 1px solid #bfd0db;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.progress-warning {
  padding: 0.75rem;
  background: #fff6dd;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
}

.progress-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0.9rem;
}

.progress-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.progress-form-grid .field.wide {
  grid-column: 1 / -1;
}

.progress-edit-table {
  min-width: 980px;
}

.progress-edit-table input,
.progress-edit-table textarea,
.progress-edit-table select {
  min-width: 8rem;
}

.progress-edit-table textarea {
  min-height: 3.2rem;
}

.progress-empty {
  padding: 1rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .progress-cards,
  .progress-form-grid {
    grid-template-columns: 1fr;
  }

  .progress-actions,
  .progress-row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .progress-actions button,
  .progress-row-actions button {
    width: 100%;
  }
}
