/* 1. Design tokens */
:root {
  --olive: #394438;
  --sand: #d8cbb5;
  --terra: #a65f45;
  --char: #252724;
  --bone: #f3efe6;
  --white: #fffdf8;
  --line: rgba(37, 39, 36, .5);
  --muted: #686b64;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease-premium: cubic-bezier(.22, 1, .36, 1);
}

/* 2. Reset & base */
* { box-sizing: border-box; }
html { scrollbar-width: none; }
html::-webkit-scrollbar { width: 0; height: 0; }

body {
  margin: 0;
  background: var(--white);        /* V5 correction */
  color: var(--char);
  font: 15px/1.6 var(--sans);
}

a { color: inherit; text-decoration: none; }
button, select { font: inherit; }

/* 3. Site header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 78px;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bone);          /* V5 correction */
  color: var(--char);               /* V5 correction */
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: contain;
  flex: 0 0 38px;
}

.brand-name {
  font: 23px var(--serif);
  letter-spacing: .03em;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,.18);
}

.portal-title {
  color: var(--terra);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.signout {
  border: 1px solid rgba(57, 68, 56, .35); /* V5 correction */
  border-radius: 4px;
  background: transparent;
  color: var(--olive);               /* V5 correction */
  padding: 9px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}
.signout:hover {
  background: var(--olive);
  color: var(--white);
}

/* 4. Dashboard shell */
.dashboard-shell {
  width: min(1180px, calc(100% - 56px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.section-kicker {
  color: var(--terra);
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.welcome-section {
  margin-bottom: 2rem;
  padding-bottom: 1.35rem;
  border-bottom: 0.0625rem solid var(--line);
}

.welcome-section h1 {
  margin: 0;
  color: var(--char);
  font: 400 clamp(1.75rem, 4vw, 2.75rem)/1.15 var(--serif);
  letter-spacing: -0.025em;
}

/* 5. Property selector */
.property-section {
  margin-bottom: 2rem;
}
.property-selector-wrap {
  width: min(26rem, 100%);
  margin-top: .75rem;
}

.property-address,
.project-switcher-row select {
  margin: 0;
  font: 400 1rem/1.25 var(--serif);
  letter-spacing: -.01em;
}

.property-address {
  padding: .55rem .7rem;
  background: var(--white);
  border: .0625rem solid var(--terra);
  border-radius: .1875rem;
}

.project-switcher-row {
  position: relative;
  width: 100%;
}
.project-switcher-row select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  border: .0625rem solid var(--terra);
  border-radius: .1875rem;
  background: var(--white);
  color: var(--char);
  padding: .55rem 2.25rem .55rem .7rem;
}
.project-switcher-row select:focus {
  box-shadow: 0 0 0 .1875rem rgba(166,95,69,.09);
}

.project-switcher-arrow {
  position: absolute;
  top: 33%;
  right: .75rem;
  transform: translateY(-50%);
  color: var(--terra);
  pointer-events: none;
  font-size: 1rem;
}

/* 6. Portal layout (grid) */
.portal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr);
  grid-template-areas:
    "left right"
    "photos photos";
  gap: 32px 18px;
  align-items: stretch;
}

.left-column {
  grid-area: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;          
  background: var(--white);
}

.right-column {
  grid-area: right;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  background: var(--white);
}

.column-section {
  padding: 30px;
}
.update-panel,
.progress-block,
.details-panel,
.contact-panel {
  border-inline: 1px solid var(--line);
}
.update-panel,
.details-panel {
  border-top: 1px solid var(--line);
}
.progress-block,
.contact-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* 7. Update panel (latest update) – V5 corrections applied */
.update-panel {
  flex: 0 0 auto;
  background: var(--olive);        /* V5 correction */
  color: var(--white);             /* V5 correction */
  min-width: 0;
}

.update-panel .section-kicker {
  color: var(--sand);              /* V5 correction */
}

.update-title,
.contact-panel h2 {
  margin: 10px 0 0;
  font: 400 29px/1.1 var(--serif);
  letter-spacing: -.02em;
}

.update-body {
  max-width: 720px;
  margin: 20px 0 0;
  color: rgba(255, 253, 248, .76); /* V5 correction */
  font: 400 18px/1.65 var(--serif);
  white-space: pre-line;
}

.update-date-row {
  display: flex;
  gap: 7px;
  margin-top: 22px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: rgba(255, 253, 248, .76); /* V5 correction */
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* 8. Progress block */
.progress-block {
  flex: 1 1 auto;
  background: var(--bone);
  overflow: hidden;
}

.progress-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.progress-copy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.progress-value {
  flex: 0 0 auto;
  color: var(--olive);
  font: 400 40px/.95 var(--serif);
  letter-spacing: -.035em;
}

.progress-track {
  height: 5px;
  margin-top: 18px;
  overflow: hidden;
  background: rgba(57,68,56,.11);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--terra);
  transition: width 1.25s var(--ease-premium);
}

.progress-list {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.progress-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.progress-item__title {
  font: 400 16px/1.3 var(--serif);
}

.progress-item__desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.progress-item__percent {
  align-self: start;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
}

.progress-item.in-progress .progress-item__title,
.progress-item.in-progress .progress-item__percent {
  color: var(--terra);
}

/* 9. Details panel */
.details-panel {
  flex: 1 1 auto;
}

.details-list {
  margin: 18px 0 0;
}

.detail-row {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.detail-row:last-child {
  border-bottom: 0;
}

.detail-row dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.detail-row dd {
  margin: 0;
  font: 400 16px/1.4 var(--serif);
}

/* 10. Contact panel */
.contact-panel {
  flex: 0 0 auto;
  background: var(--olive);
  color: var(--white);
}
.contact-panel .section-kicker {
  color: var(--sand);
}

@media (min-width: 821px) {
  .progress-block,
  .details-panel {
    margin-inline: 1px;
  }
}

.phone-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--sand);
  font: 400 24px/1.2 var(--serif);
}
.phone-link:hover {
  color: var(--white);
}

/* 11. Photos panel */
.photos-panel {
  grid-area: photos;
  padding: 30px;
  background: var(--white);
  border: 1px solid var(--line);
}

.photo-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 12px;
}

.photo-button {
  display: block;
  border: 1px solid rgba(37,39,36,.10);
  padding: 0;
  background: #e7e2d8;
  cursor: zoom-in;
  overflow: hidden;
  aspect-ratio: 4/3;
}

.photo-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.empty-state {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* 12. Error message & footer */
.error-message {
  margin-bottom: 18px;
  background: #f8eee9;
  border: 1px solid rgba(166,95,69,.25);
  padding: 18px;
  color: var(--terra);
}

.site-footer {
  background: var(--char);
  color: var(--white);
}

.footer-inner {
  width: min(1180px, calc(100% - 56px));
  min-height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: rgba(255,255,255,.48);
  font-size: 11px;
}

.footer-inner a {
  color: inherit;
  text-underline-offset: .18em;
}

/* 13. Photo lightbox */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 36px;
  background: rgba(25,28,25,.84);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.photo-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}
.photo-lightbox img {
  max-width: min(1100px,92vw);
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 25px 70px rgba(0,0,0,.28);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  border: 0;
  background: transparent;
  color: var(--white);
  font: 300 36px/1 sans-serif;
  cursor: pointer;
}

/* 14. Responsive: tablets */
@media (max-width: 820px) {
  .dashboard-shell {
    width: min(100% - 40px,1180px);
    padding: 34px 0 48px;
  }
  .portal-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .left-column { order: 1; }
  .right-column { display: contents; }
  .details-panel { order: 2; background: var(--white); border: 1px solid var(--line); }
  .photos-panel { order: 3; }
  .contact-panel { order: 4; border: 1px solid var(--olive); }
  .photo-grid { grid-template-columns: repeat(2,1fr); }
  .footer-inner { width: min(100% - 40px,1180px); }
}

/* 15. Responsive: mobile */
@media (max-width: 560px) {
  .site-header {
    min-height: 70px;
    padding: 0 20px;
  }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 20px; }
  .brand-divider { height: 18px; }
  .portal-title { display: none; }
  .signout { font-size: 11px; padding: 8px 11px; }

  .dashboard-shell {
    width: min(100% - 28px,1180px);
    padding: 24px 0 40px;
  }
  .welcome-section {
    margin-bottom: 1.375rem;
    padding-bottom: 1rem;
  }
  .property-section { margin-bottom: 1.375rem; }
  .property-selector-wrap { width: 100%; margin-top: .625rem; }
  .property-address,
  .project-switcher-row select { font-size: 1rem; }
  .property-address { padding: .55rem .7rem; }
  .project-switcher-row select { padding: .55rem 2.25rem .55rem .7rem; }
  .project-switcher-arrow { right: .75rem; font-size: 1rem; }

  .portal-layout { gap: 12px; }
  .column-section,
  .photos-panel { padding: 22px; }
  .update-title,
  .contact-panel h2 { font-size: 26px; }
  .update-body { font-size: 17px; }
  .progress-heading { align-items: flex-start; }
  .progress-value { font-size: 36px; }
  .photo-grid { grid-template-columns: 1fr; }
  .footer-inner { width: min(100% - 28px,1180px); min-height: 70px; }
}

/* 16. Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
