/* Source-accurate dashboard additions. Kept screen-only so the dedicated
   two-page A4 report remains isolated from the public dashboard layout. */
@media screen {
  .hero-photo.phase-map {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 405px;
    border: 1px solid #d6e1da;
    background: #eef3ef;
  }

  .hero-photo.phase-map > img {
    position: relative;
    inset: auto;
    display: block;
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 10px;
    object-fit: contain;
    object-position: center;
    filter: none;
    background: #f6f7f2;
  }

  .hero-photo.phase-map::after {
    display: none;
  }

  .hero-photo.phase-map figcaption {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 13px 18px;
    color: #fff;
    background: linear-gradient(112deg, #123b2b, #176345);
  }

  .hero-photo.phase-map figcaption > span {
    grid-column: 1;
    margin: 0 0 4px;
    color: #cce8d8;
  }

  .hero-photo.phase-map figcaption > strong {
    grid-column: 1;
    max-width: 34ch;
    padding: 0;
    font-size: clamp(17px, 1.35vw, 21px);
    line-height: 1.18;
    letter-spacing: -0.25px;
  }

  .hero-photo.phase-map .photo-link {
    position: static;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .hero-photo.phase-map .photo-corner {
    top: 16px;
    right: 16px;
    color: #183529;
    border-color: rgba(24, 53, 41, 0.2);
    background: rgba(249, 251, 247, 0.9);
    backdrop-filter: blur(4px);
  }

  .kpi-card #kpiCost {
    font-size: clamp(25px, 2.35vw, 38px);
    white-space: nowrap;
  }

  .source-photo-panel .map-image-wrap {
    aspect-ratio: 3 / 2;
    background: #e8f0eb;
  }

  .source-photo-panel .map-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

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

  .source-summary-card {
    min-width: 0;
  }

  .key-list .key-wide {
    grid-column: 1 / -1;
  }

  .scope-summary,
  .payment-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 5px 24px 20px;
  }

  .scope-stat,
  .scope-summary > div,
  .payment-item,
  .payment-summary > div {
    min-width: 0;
    padding: 18px 0;
    border-bottom: 1px solid #e8efea;
  }

  .scope-stat:nth-child(odd),
  .scope-summary > div:nth-child(odd),
  .payment-item:nth-child(odd),
  .payment-summary > div:nth-child(odd) {
    padding-right: 20px;
    border-right: 1px solid #e8efea;
  }

  .scope-stat:nth-child(even),
  .scope-summary > div:nth-child(even),
  .payment-item:nth-child(even),
  .payment-summary > div:nth-child(even) {
    padding-left: 20px;
  }

  .scope-stat:nth-last-child(-n + 2),
  .scope-summary > div:nth-last-child(-n + 2),
  .payment-item:nth-last-child(-n + 2),
  .payment-summary > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .scope-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-bottom: 13px;
    border: 1px solid #d5e7dc;
    border-radius: 9px;
    color: #19784f;
    background: #eff8f3;
  }

  .scope-icon svg {
    width: 16px;
    height: 16px;
  }

  .scope-label,
  .payment-label,
  .scope-summary dt,
  .payment-summary dt {
    display: block;
    margin: 0 0 7px;
    color: #506477;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: 0.75px;
    text-transform: uppercase;
  }

  .scope-value,
  .payment-value,
  .scope-summary dd,
  .payment-summary dd {
    display: block;
    margin: 0;
    color: #172b3c;
    font-family: var(--serif);
    font-size: clamp(24px, 2vw, 32px);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.7px;
    overflow-wrap: anywhere;
  }

  .payment-summary .payment-value,
  .payment-summary dd {
    color: #19784f;
    font-size: clamp(21px, 1.75vw, 28px);
  }

  .payment-summary .payment-total-cost {
    grid-column: 1 / -1;
    padding-right: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .payment-summary .payment-total-cost .payment-value {
    font-size: clamp(28px, 2.5vw, 40px);
  }

  .scope-detail,
  .payment-detail {
    display: block;
    margin-top: 7px;
    color: #52677a;
    font-size: 11px;
    font-weight: 550;
    line-height: 1.6;
  }

  .payment-total {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 0 1px;
    border-top: 1px solid #dbe8df;
    color: #274252;
  }

  .payment-total strong {
    color: #19784f;
    font: 600 clamp(22px, 1.8vw, 29px) var(--serif);
    letter-spacing: -0.5px;
    white-space: nowrap;
  }

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

  .timeline-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 20px;
    min-width: 0;
    padding: 25px;
    overflow: hidden;
    border: 1px solid #dce7df;
    border-radius: var(--radius);
    background:
      radial-gradient(
        circle at 100% 0%,
        rgba(47, 143, 96, 0.12),
        transparent 42%
      ),
      #fff;
    box-shadow: var(--shadow);
  }

  .timeline-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #19784f, #65ad82);
  }

  .timeline-number,
  .timeline-duration {
    display: grid;
    place-items: center;
    align-self: start;
    width: 78px;
    min-height: 78px;
    padding: 10px;
    border: 1px solid #cfe3d7;
    border-radius: 14px;
    color: #19784f;
    background: #eef8f2;
    font: 600 25px/1 var(--serif);
    text-align: center;
  }

  .timeline-number small,
  .timeline-duration small {
    display: block;
    margin-top: 5px;
    color: #507262;
    font:
      700 8px/1.2 "Inter",
      Arial,
      sans-serif;
    letter-spacing: 0.9px;
    text-transform: uppercase;
  }

  .timeline-copy {
    min-width: 0;
  }

  .timeline-quantity {
    display: block;
    margin-bottom: 5px;
    color: #19784f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .75px;
    text-transform: uppercase;
  }

  .timeline-copy h3,
  .timeline-card > div > h3 {
    margin: 0;
    color: #142739;
    font: 600 25px/1.18 var(--serif);
    letter-spacing: -0.45px;
  }

  .timeline-copy > p,
  .timeline-card > div > p {
    margin: 9px 0 17px;
    color: #40566a;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.7;
  }

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

  .timeline-date {
    padding: 11px 12px;
    border: 1px solid #e0e9e3;
    border-radius: 9px;
    background: rgba(247, 250, 248, 0.92);
  }

  .timeline-date span,
  .timeline-date small {
    display: block;
    margin-bottom: 4px;
    color: #607366;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
  }

  .timeline-date strong {
    color: #1d3546;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }

  [data-panel="details"] .phase-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  [data-panel="details"] .phase-card {
    position: relative;
    min-width: 0;
    padding: 21px;
    overflow: hidden;
    border-top: 0;
    border-left: 4px solid #56a778;
  }

  [data-panel="details"] .phase-card::after {
    content: "";
    position: absolute;
    right: -32px;
    bottom: -40px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(44, 139, 89, 0.06);
    pointer-events: none;
  }

  [data-panel="details"] .phase-card.completed {
    border-left-color: #21805a;
  }

  [data-panel="details"] .phase-card.not-started {
    border-left-color: #aebbb3;
  }

  [data-panel="details"] .phase-card.finishing {
    border-left-color: #4c879e;
  }

  [data-panel="details"] .phase-card h3 {
    color: #152a3b;
    font-size: 25px;
    font-weight: 600;
  }

  [data-panel="details"] .phase-package {
    display: block;
    margin-bottom: 5px;
    color: #19784f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .7px;
    text-transform: uppercase;
  }

  [data-panel="details"] .phase-progress-track {
    display: block;
    height: 5px;
    margin: 17px 0 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eee9;
  }

  [data-panel="details"] .phase-progress-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #19784f, #61aa7e);
  }

  [data-panel="details"] .phase-card.not-started .phase-progress-track > span {
    background: #aebbb3;
  }

  [data-panel="details"] .phase-card .phase-length,
  [data-panel="details"] .phase-card p {
    color: #405a6e;
    font-weight: 550;
  }

  .phase-progress-table {
    table-layout: fixed;
  }

  .phase-progress-table th:first-child,
  .phase-progress-table td:first-child {
    width: 19%;
  }

  .phase-progress-table th:nth-child(2),
  .phase-progress-table td:nth-child(2) {
    width: 31%;
    text-align: left;
  }

  .phase-progress-table th:nth-child(3),
  .phase-progress-table td:nth-child(3) {
    width: 22%;
  }

  .phase-progress-table th:last-child,
  .phase-progress-table td:last-child {
    width: 28%;
  }

  .phase-progress-table tbody tr:hover {
    background: #f6faf7;
  }

  .table-package,
  .table-phase-name {
    color: #1d3547;
    font-weight: 700;
  }

  .table-length {
    color: #2f495c;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .table-status {
    display: inline-flex;
    justify-content: center;
    max-width: 100%;
    padding: 6px 9px;
    border: 1px solid #d3e6da;
    border-radius: 999px;
    color: #246d4c;
    background: #eef8f2;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
  }

  .table-status.not-started {
    border-color: #dde3df;
    color: #5d6a62;
    background: #f2f5f3;
  }

  [data-panel="details"] .chart-panel {
    background:
      linear-gradient(180deg, rgba(240, 248, 243, 0.55), transparent 45%), #fff;
  }
}

@media screen and (max-width: 1100px) {
  .source-summary-grid,
  .timeline-grid {
    gap: 15px;
  }

  .timeline-card {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .timeline-number,
  .timeline-duration {
    width: auto;
    min-height: auto;
    justify-content: start;
    grid-auto-flow: column;
    gap: 7px;
    padding: 11px 13px;
    justify-self: start;
    font-size: 22px;
  }

  .timeline-number small,
  .timeline-duration small {
    margin: 0;
  }
}

@media screen and (max-width: 760px) {
  .hero-photo.phase-map {
    min-height: 300px;
  }

  .hero-photo.phase-map > img {
    padding: 7px;
  }

  .hero-photo.phase-map figcaption {
    min-height: 66px;
    padding: 12px 15px;
  }

  .hero-photo.phase-map .photo-corner {
    top: 12px;
    right: 12px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .source-summary-grid,
  .timeline-grid {
    grid-template-columns: 1fr;
  }

  .scope-summary,
  .payment-summary {
    padding: 3px 19px 17px;
  }

  .timeline-card {
    padding: 21px;
  }

  [data-panel="details"] .phase-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .phase-progress-table {
    min-width: 620px;
  }
}

@media screen and (max-width: 430px) {
  .hero-photo.phase-map {
    min-height: 272px;
  }

  .hero-photo.phase-map figcaption > strong {
    font-size: 16px;
  }

  .kpi-card #kpiCost {
    font-size: 22px;
  }

  .scope-summary,
  .payment-summary {
    grid-template-columns: 1fr;
  }

  .scope-stat,
  .scope-summary > div,
  .payment-item,
  .payment-summary > div {
    padding: 15px 0;
    border-right: 0 !important;
    border-bottom: 1px solid #e8efea !important;
  }

  .scope-stat:nth-child(even),
  .scope-summary > div:nth-child(even),
  .payment-item:nth-child(even),
  .payment-summary > div:nth-child(even),
  .scope-stat:nth-child(odd),
  .scope-summary > div:nth-child(odd),
  .payment-item:nth-child(odd),
  .payment-summary > div:nth-child(odd) {
    padding-right: 0;
    padding-left: 0;
  }

  .scope-stat:last-child,
  .scope-summary > div:last-child,
  .payment-item:last-child,
  .payment-summary > div:last-child {
    border-bottom: 0 !important;
  }

  .payment-total {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .timeline-dates {
    grid-template-columns: 1fr;
  }

  [data-panel="details"] .phase-grid {
    grid-template-columns: 1fr;
  }
}

@media screen {
  .phase-card .phase-contractor {
    display: block;
    margin-top: 13px;
    color: #245f43;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.45;
  }

  .phase-card .phase-contractor + p {
    margin-top: 7px;
  }

  .phase-progress-table {
    min-width: 790px;
  }

  .phase-progress-table th:nth-child(1),
  .phase-progress-table td:nth-child(1) {
    width: 13%;
  }

  .phase-progress-table th:nth-child(2),
  .phase-progress-table td:nth-child(2) {
    width: 17%;
  }

  .phase-progress-table th:nth-child(3),
  .phase-progress-table td:nth-child(3) {
    width: 15%;
  }

  .phase-progress-table th:nth-child(4),
  .phase-progress-table td:nth-child(4) {
    width: 19%;
  }

  .phase-progress-table th:nth-child(5),
  .phase-progress-table td:nth-child(5) {
    width: 36%;
    text-align: left;
  }

  .table-contractor {
    color: #334e40;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
  }

  .activity-progress-panel {
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(232, 246, 237, 0.72), rgba(255, 255, 255, 0) 180px),
      #fff;
  }

  .wall-progress-summary {
    display: grid;
    grid-template-columns: 1.15fr repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid #dfe9e2;
  }

  .wall-progress-summary article {
    display: flex;
    min-width: 0;
    min-height: 132px;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 23px 25px;
    border-right: 1px solid #dfe9e2;
  }

  .wall-progress-summary article:last-child {
    border-right: 0;
  }

  .wall-progress-summary span {
    color: #476052;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
  }

  .wall-progress-summary strong {
    color: #173b2a;
    font: 600 30px/1.05 var(--serif);
    font-variant-numeric: tabular-nums;
  }

  .wall-progress-summary small {
    min-height: 30px;
    color: #50685a;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.45;
  }

  .wall-progress-summary .wall-summary-total {
    background: linear-gradient(135deg, #11613e, #1f8057);
  }

  .wall-progress-summary .wall-summary-total span,
  .wall-progress-summary .wall-summary-total small {
    color: #d6f2e2;
  }

  .wall-progress-summary .wall-summary-total strong {
    color: #fff;
    font-size: 36px;
  }

  .activity-table-wrap {
    max-width: 100%;
    padding: 8px 18px 18px;
  }

  .activity-progress-table {
    min-width: 1100px;
    table-layout: fixed;
  }

  .activity-progress-table th,
  .activity-progress-table td {
    padding: 12px 11px;
    border-right: 1px solid #edf2ee;
    font-variant-numeric: tabular-nums;
  }

  .activity-progress-table th:last-child,
  .activity-progress-table td:last-child {
    border-right: 0;
  }

  .activity-progress-table thead tr:first-child th {
    padding-top: 15px;
    padding-bottom: 15px;
    background: #e8f4ec;
    color: #1d5f40;
    font-size: 10px;
    letter-spacing: 0.7px;
    text-align: center;
  }

  .activity-progress-table thead tr:first-child th:first-child {
    width: 270px;
    text-align: left;
  }

  .activity-progress-table thead tr:first-child th:nth-child(2) {
    width: 90px;
  }

  .activity-progress-table thead th span,
  .activity-progress-table thead th small {
    display: block;
  }

  .activity-progress-table thead th small {
    max-width: 210px;
    margin: 5px auto 0;
    color: #587064;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.35;
    text-transform: none;
  }

  .activity-progress-table thead tr:nth-child(2) th {
    background: #f5f9f6;
    color: #65796e;
    font-size: 8px;
    text-align: right;
  }

  .activity-progress-table tbody th {
    color: #243e31;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
  }

  .activity-progress-table tbody tr:nth-child(even) {
    background: #fafcfb;
  }

  .activity-progress-table tbody tr:hover {
    background: #f0f8f3;
  }

  .activity-target,
  .activity-number,
  .activity-percent {
    color: #3d5548;
    text-align: right;
  }

  .activity-target {
    font-weight: 700;
  }

  .activity-percent span {
    display: inline-flex;
    min-width: 49px;
    justify-content: center;
    padding: 5px 7px;
    border-radius: 999px;
    background: #eaf5ee;
    color: #176542;
    font-size: 9px;
    font-weight: 800;
  }

  .phase-editor {
    grid-template-columns: 0.85fr 0.8fr 0.75fr 0.75fr 0.8fr 1.5fr 1.5fr auto;
  }
}

@media screen and (max-width: 980px) {
  .wall-progress-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wall-progress-summary article:nth-child(2) {
    border-right: 0;
  }

  .wall-progress-summary article:nth-child(-n + 2) {
    border-bottom: 1px solid #dfe9e2;
  }
}

@media screen and (max-width: 720px) {
  .activity-scroll-hint {
    display: flex;
  }

  .activity-table-wrap {
    padding-right: 0;
    padding-left: 0;
  }
}

@media screen and (max-width: 430px) {
  .wall-progress-summary {
    grid-template-columns: 1fr;
  }

  .wall-progress-summary article,
  .wall-progress-summary article:nth-child(2) {
    min-height: 0;
    padding: 19px;
    border-right: 0;
    border-bottom: 1px solid #dfe9e2;
  }

  .wall-progress-summary article:last-child {
    border-bottom: 0;
  }

  .wall-progress-summary small {
    min-height: 0;
  }
}
