:root {
  --ink: #10231d;
  --blue: #0f4f3b;
  --bright: #1d7b5a;
  --soft: #effaf4;
  --line: #c8dfd3;
  --white: #ffffff;
  --muted: #5d7168;
  --good: #14805e;
  --warn: #8a4b0f;
  --bad: #8f1d1d;
  --shadow: 0 18px 48px rgba(16, 35, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #f4faf6;
  line-height: 1.5;
}

a {
  color: var(--blue);
  font-weight: 800;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--white);
  background: var(--blue);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

nav a {
  min-height: 42px;
  padding: 10px 12px;
  text-decoration: none;
}

.quote-alert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
}

.quote-alert strong {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  color: var(--white);
  background: var(--muted);
}

.quote-alert.has-quotes {
  color: var(--white);
  background: #b31322;
  border-color: #b31322;
  animation: quotePulse 1.1s infinite;
}

.quote-alert.has-quotes strong {
  color: #b31322;
  background: var(--white);
}

@keyframes quotePulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(179, 19, 34, 0.65);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(179, 19, 34, 0);
  }
}

.portal-link,
.button.primary {
  color: var(--white);
  background: var(--blue);
  border-color: var(--blue);
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px) 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: clamp(24px, 5vw, 54px);
  align-items: center;
  min-height: 560px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--bright);
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  color: var(--blue);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  color: var(--blue);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

.lead {
  color: #26453a;
  font-size: 20px;
}

.panel,
.portal-card {
  padding: clamp(20px, 4vw, 34px);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel.narrow {
  max-width: 780px;
  margin: 0 auto;
}

.portal-card {
  background: linear-gradient(180deg, var(--blue), #1d7b5a);
  color: var(--white);
}

.portal-card h2 {
  color: var(--white);
}

.portal-card li {
  margin: 10px 0;
}

.hero-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 2px solid var(--blue);
  color: var(--blue);
  background: var(--white);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  color: var(--blue);
  background: var(--white);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.form-grid.compact {
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-weight: 800;
}

label span {
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #b9d9ca;
  font: inherit;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.check input {
  width: 22px;
  min-height: 22px;
  margin-top: 2px;
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--soft);
  border-left: 5px solid var(--bright);
  font-weight: 800;
}

.flash.success {
  border-color: var(--good);
}

.flash.error {
  border-color: var(--bad);
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

.mini-card,
.ledger-row {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 14px;
  color: var(--ink);
  background: #f8fcfa;
  border: 1px solid var(--line);
  text-decoration: none;
}

.mini-card strong,
.ledger-row strong {
  color: var(--blue);
}

.mini-card span,
.ledger-row span,
.muted {
  color: var(--muted);
}

.status-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.message-thread {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.message-card {
  padding: 14px;
  background: #f8fcfa;
  border: 1px solid var(--line);
  border-left: 6px solid var(--bright);
}

.message-card.author-admin,
.message-card.admin_private {
  border-left-color: var(--blue);
}

.message-card.author-customer {
  border-left-color: var(--warn);
}

.message-card.unread {
  background: #fff8ec;
  border-color: #e2b269;
  box-shadow: 0 10px 28px rgba(138, 75, 15, 0.12);
}

.message-card strong,
.message-card span {
  display: block;
}

.message-card span {
  color: var(--muted);
  font-size: 13px;
}

.message-compose {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.empty-state {
  display: grid;
  gap: 14px;
  padding: 24px;
  background: #f8fcfa;
  border: 1px solid var(--line);
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.ledger-row:nth-child(even) {
  background: #effaf4;
}

.ledger-row details {
  margin-top: 8px;
}

.ledger-row summary {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--white);
  background: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.status-new_quote {
  border-left: 6px solid var(--bright);
}

.status-quoted {
  border-left: 6px solid var(--warn);
}

.status-accepted,
.status-scheduled,
.status-in_progress {
  border-left: 6px solid var(--blue);
}

.status-completed {
  border-left: 6px solid var(--good);
}

.status-declined,
.status-cancelled {
  border-left: 6px solid var(--bad);
}

.warning {
  color: var(--bad);
  font-weight: 900;
}

.today-panel {
  padding: clamp(14px, 3vw, 28px);
}

.today-job {
  min-height: calc(100vh - 190px);
  margin: 20px 0 34px;
  padding: clamp(18px, 4vw, 34px);
  background: var(--white);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

.today-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 18px;
  color: var(--muted);
  font-weight: 900;
}

.today-job-top,
.today-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.today-job h2 {
  margin: 12px 0 18px;
  font-size: clamp(34px, 5vw, 58px);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--white);
  background: var(--blue);
  font-weight: 900;
}

.map-address {
  display: block;
  flex: 1;
  padding: 16px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.2;
  text-decoration: none;
}

.today-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.today-info-grid section,
.today-manage,
.today-photos {
  padding: 16px;
  background: #f8fcfa;
  border: 1px solid var(--line);
}

.today-info-grid h3,
.today-photos h3 {
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 22px;
}

.today-info-grid p {
  margin-bottom: 9px;
  color: #21483a;
  font-size: 18px;
}

.today-manage summary {
  min-height: 48px;
  color: var(--blue);
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}

.complete-form {
  margin-top: 18px;
}

.complete-button {
  width: 100%;
  min-height: 72px;
  color: var(--white);
  background: var(--good);
  border-color: var(--good);
  font-size: clamp(24px, 5vw, 38px);
}

.photo-upload {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.photo-card {
  margin: 0;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--soft);
}

.photo-card figcaption {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.photo-card figcaption span {
  color: var(--muted);
}

.consent-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.calendar-panel {
  width: 100%;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.calendar-head,
.calendar-day {
  background: var(--white);
}

.calendar-head {
  min-height: 42px;
  padding: 10px;
  color: var(--blue);
  font-weight: 900;
  text-align: center;
}

.calendar-day {
  min-height: 170px;
  padding: 8px;
}

.calendar-day.empty {
  background: #edf6f1;
}

.day-number {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.calendar-job {
  display: grid;
  gap: 4px;
  margin: 7px 0;
  padding: 8px;
  background: var(--soft);
  border-left: 4px solid var(--blue);
  font-size: 13px;
}

.calendar-job a,
.calendar-job span {
  overflow-wrap: anywhere;
}

.calendar-job .job-name {
  color: var(--blue);
  font-size: 15px;
}

.consent-form .check {
  padding: 8px;
  font-size: 14px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 56px);
  color: var(--white);
  background: var(--blue);
}

@media (max-width: 860px) {
  .site-header,
  .today-job-top,
  .today-primary,
  .today-nav,
  .dashboard-head,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero,
  .grid.two,
  .photo-grid,
  .today-info-grid,
  .status-columns,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .actions,
  .hero-actions {
    width: 100%;
  }

  .button {
    width: 100%;
  }

  .map-address {
    width: 100%;
  }

  .today-info-grid p {
    font-size: 19px;
  }

  .calendar-grid {
    display: block;
    background: transparent;
    border: 0;
  }

  .calendar-head,
  .calendar-day.empty {
    display: none;
  }

  .calendar-day {
    min-height: 96px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
  }

  .calendar-day .day-number::before {
    content: "Day ";
  }

  .calendar-job {
    font-size: 16px;
  }
}
