/*
 * Mijn Warmtewerf: the customer portal of the fictional installer, as a clickable demo (README.md,
 * "Website concepts"). Warmtewerf's palette and type: an off-white sheet, a charcoal side bar and
 * one signal lime, only ever a fill under charcoal text (12:1) or a mark on charcoal.
 *
 * No script. The inputs in `.state` hold every state (the view, the role, the approved quote, the
 * day, the reply, the filter), the labels in the page switch them, and the rules below show what
 * each state shows. Nothing is a form, nothing personal is asked and nothing is sent.
 */
:root {
  --sheet: #f2f2ee;
  --paper: #fbfbf8;
  --ink: #1d2321;
  --soft: #4c5552;
  --line: #c9ccc6;
  --char: #1f2624;
  --char-ink: #eef0ea;
  --char-soft: #a9b0ab;
  --lime: #d4f000;
  --display: Bahnschrift, 'DIN Alternate', 'Segoe UI', system-ui, sans-serif;
  --sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: Consolas, 'SF Mono', Menlo, ui-monospace, monospace;
}
body {
  background: var(--sheet);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
}
.mono {
  font-family: var(--mono);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}
.label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
}
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.03em;
}
h2 {
  margin-top: 0.5rem;
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  line-height: 1;
}
h3 {
  font-size: 1.25rem;
  line-height: 1.15;
}
.lead {
  margin-top: 0.75rem;
  max-width: 40rem;
  font-size: 1.0625rem;
  color: var(--soft);
}

/* The state: out of sight, still reachable by keyboard and screen reader. */
.state input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------------------------------- */
/* The frame: a charcoal side bar and the sheet. */

.app {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  width: min(100% - 2.5rem, 82rem);
  min-height: 46rem;
  margin: 1.25rem auto 0;
  border: 1px solid var(--line);
  background: var(--paper);
}
.side {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding: 1.5rem 1.25rem;
  background: var(--char);
  color: var(--char-ink);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font: 700 1.25rem/1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand svg {
  width: 1.375rem;
  fill: none;
  stroke: var(--lime);
  stroke-width: 4;
}
.side h1 {
  margin-top: -1.25rem;
  color: var(--char-soft);
}
.roles-label {
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--char-soft);
}
.v-berichten .roles-label {
  color: var(--soft);
}
.roles-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #4a524f;
}
.role {
  display: grid;
  place-items: center;
  min-height: 44px;
  cursor: pointer;
  font: 600 0.875rem var(--sans);
  color: var(--char-soft);
}
.nav {
  display: grid;
  gap: 0.125rem;
}
.tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 0.875rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--char-soft);
}
.tab:hover,
.role:hover {
  color: var(--char-ink);
}
.tab-on {
  border-left-color: var(--lime);
  background: #2b3431;
  color: var(--char-ink);
  cursor: default;
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.375rem;
  background: var(--lime);
  color: var(--ink);
  font: 700 0.75rem var(--mono);
}
.main {
  padding: clamp(1.5rem, 1rem + 2vw, 3rem);
}

/* ---------------------------------------------------------------------------------------- */
/* Which view, which role. */

.view,
.nav-team {
  display: none;
}
body:has(#rol-team:checked) .nav-klant {
  display: none;
}
body:has(#rol-team:checked) .nav-team,
body:has(#rol-klant:checked):has(#s-overzicht:checked) .v-overzicht,
body:has(#rol-klant:checked):has(#s-offerte:checked) .v-offerte,
body:has(#rol-klant:checked):has(#s-planning:checked) .v-planning,
body:has(#rol-klant:checked):has(#s-documenten:checked) .v-documenten,
body:has(#rol-klant:checked):has(#s-berichten:checked) .v-berichten,
body:has(#rol-team:checked) .v-team {
  display: block;
}
body:has(#s-overzicht:checked) .tab-overzicht,
body:has(#s-offerte:checked) .tab-offerte,
body:has(#s-planning:checked) .tab-planning,
body:has(#s-documenten:checked) .tab-documenten,
body:has(#s-berichten:checked) .tab-berichten {
  border-left-color: var(--lime);
  background: #2b3431;
  color: var(--char-ink);
}
body:has(#rol-klant:checked) .role-klant,
body:has(#rol-team:checked) .role-team {
  background: var(--lime);
  color: var(--ink);
}

/* Keyboard focus lands on the hidden input; its label shows it. */
body:has(#rol-klant:focus-visible) .role-klant,
body:has(#rol-team:focus-visible) .role-team,
body:has(#s-overzicht:focus-visible) .tab-overzicht,
body:has(#s-offerte:focus-visible) .tab-offerte,
body:has(#s-planning:focus-visible) .tab-planning,
body:has(#s-documenten:focus-visible) .tab-documenten,
body:has(#s-berichten:focus-visible) .tab-berichten {
  outline: 2px solid var(--lime);
  outline-offset: -2px;
}
body:has(#akkoord:focus-visible) label[for='akkoord'],
body:has(#dag-ma:focus-visible) .day-ma,
body:has(#dag-wo:focus-visible) .day-wo,
body:has(#dag-vr:focus-visible) .day-vr,
body:has(#antw-helder:focus-visible) .chip-helder,
body:has(#antw-bellen:focus-visible) .chip-bellen,
body:has(#verstuurd:focus-visible) .send,
body:has(#f-alle:focus-visible) .chip-alle,
body:has(#f-wacht:focus-visible) .chip-wacht,
body:has(#f-gepland:focus-visible) .chip-gepland,
body:has(#f-klaar:focus-visible) .chip-klaar {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------------------------------- */
/* The quote: open until approved, and everything that follows from it. */

body .if-ok {
  display: none;
}
body:has(#akkoord:checked) .if-open {
  display: none;
}
body:has(#akkoord:checked) .if-ok {
  display: revert;
}
body:has(#akkoord:checked) .status.if-ok {
  display: inline-block;
}
body:has(#akkoord:checked) .badge-offerte {
  display: none;
}

/* The day chosen, wherever it is named. */
.d-ma,
.d-wo,
.d-vr,
.a-helder,
.a-bellen {
  display: none;
}
body:has(#dag-ma:checked) .d-ma,
body:has(#dag-wo:checked) .d-wo,
body:has(#dag-vr:checked) .d-vr,
body:has(#antw-helder:checked) .a-helder,
body:has(#antw-bellen:checked) .a-bellen {
  display: inline;
}

/* ---------------------------------------------------------------------------------------- */
/* Pieces. */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0 1.25rem;
  background: var(--lime);
  color: var(--ink);
  cursor: pointer;
  font: 700 0.9375rem var(--mono);
  transition:
    background-color 0.15s,
    color 0.15s;
}
.btn:hover {
  background: var(--ink);
  color: var(--lime);
}
.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.note {
  margin-top: 1.25rem;
  color: var(--soft);
}

.track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 2.25rem;
  border-top: 1px solid var(--line);
}
.track li {
  position: relative;
  display: grid;
  gap: 0.125rem;
  padding: 1.25rem 0.75rem 0 0;
  font-weight: 600;
}
.track small {
  font: 400 0.8125rem var(--mono);
  color: var(--soft);
}
.dot {
  position: absolute;
  top: -0.4375rem;
  left: 0;
  width: 0.875rem;
  height: 0.875rem;
  border: 1px solid var(--ink);
  background: var(--paper);
}
.track .done .dot,
body:has(#akkoord:checked) .step-offerte .dot {
  background: var(--ink);
}
body:has(#akkoord:checked) .step-installatie .dot {
  background: var(--lime);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}
.card {
  display: grid;
  align-content: start;
  gap: 0.625rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--sheet);
}
.card p:not(.label) {
  color: var(--soft);
}
.card-todo {
  border-color: var(--ink);
  background: var(--paper);
}
.card .btn {
  justify-self: start;
  margin-top: 0.5rem;
}
.card .link {
  justify-self: start;
}

table {
  width: 100%;
  margin-top: 2rem;
  border-collapse: collapse;
}
th,
td {
  padding: 0.875rem 0.75rem 0.875rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
thead th {
  font: 400 0.75rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
}
.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tfoot th,
tfoot td {
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
}
.approve {
  margin-top: 2rem;
}
.approve .mono {
  margin-top: 0.75rem;
  color: var(--soft);
}
.notice {
  padding: 1.25rem;
  border: 1px solid var(--ink);
  border-left: 6px solid var(--lime);
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1rem;
}

.days,
.chips,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.day,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--ink);
  cursor: pointer;
  font-weight: 600;
}
.day {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 7rem;
  min-height: 4.5rem;
  gap: 0;
}
body:has(#dag-ma:checked) .day-ma,
body:has(#dag-wo:checked) .day-wo,
body:has(#dag-vr:checked) .day-vr,
body:has(#antw-helder:checked) .chip-helder,
body:has(#antw-bellen:checked) .chip-bellen,
body:has(#f-alle:checked) .chip-alle,
body:has(#f-wacht:checked) .chip-wacht,
body:has(#f-gepland:checked) .chip-gepland,
body:has(#f-klaar:checked) .chip-klaar {
  background: var(--ink);
  color: var(--paper);
}
/* The choice never rests on colour alone. */
body:has(#antw-helder:checked) .chip-helder::before,
body:has(#antw-bellen:checked) .chip-bellen::before,
body:has(#f-alle:checked) .chip-alle::before,
body:has(#f-wacht:checked) .chip-wacht::before,
body:has(#f-gepland:checked) .chip-gepland::before,
body:has(#f-klaar:checked) .chip-klaar::before,
body:has(#dag-ma:checked) .day-ma .mono::after,
body:has(#dag-wo:checked) .day-wo .mono::after,
body:has(#dag-vr:checked) .day-vr .mono::after {
  content: '✓';
}
.day .mono::after {
  margin-left: 0.375rem;
}
.saved {
  margin-top: 1.25rem;
}

.docs {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}
.docs li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.docs small {
  font: 400 0.8125rem var(--mono);
  color: var(--soft);
}
.kind {
  padding: 0.25rem 0.5rem;
  background: var(--char);
  color: var(--char-ink);
  font-size: 0.75rem;
}
.docs .later {
  color: var(--soft);
}
.docs .later .kind {
  border: 1px dashed var(--soft);
  background: transparent;
  color: var(--soft);
}

.thread {
  display: grid;
  gap: 1rem;
  max-width: 40rem;
  margin-top: 2rem;
}
.thread li {
  display: grid;
  gap: 0.375rem;
  max-width: 85%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--line);
  background: var(--sheet);
}
.thread .me {
  justify-self: end;
  border-color: var(--char);
  background: var(--char);
  color: var(--char-ink);
}
.thread small {
  font-size: 0.75rem;
  color: var(--soft);
}
.thread .me small {
  color: var(--char-soft);
}
.thread .sent,
.sent-note {
  display: none;
}
body:has(#verstuurd:checked) .thread .sent {
  display: grid;
}
body:has(#verstuurd:checked) .sent-note {
  display: block;
}
body:has(#verstuurd:checked) .reply .chips,
body:has(#verstuurd:checked) .send {
  display: none;
}
.reply {
  max-width: 40rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.reply .chips {
  margin-top: 0;
}
.send {
  margin-top: 1rem;
}

.status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font: 600 0.8125rem var(--mono);
  white-space: nowrap;
}
.st-wacht {
  border: 1px dashed var(--ink);
}
.st-gepland {
  background: var(--lime);
  color: var(--ink);
}
.st-klaar {
  background: var(--char);
  color: var(--char-ink);
}
/* The filter. WW-0148 follows the quote: waiting until approved, planned after. */
body:has(#f-wacht:checked) .job:not(.is-wacht, .job-148),
body:has(#f-wacht:checked):has(#akkoord:checked) .job-148,
body:has(#f-gepland:checked) .job:not(.is-gepland, .job-148),
body:has(#f-gepland:checked):not(:has(#akkoord:checked)) .job-148,
body:has(#f-klaar:checked) .job:not(.is-klaar) {
  display: none;
}

.foot {
  display: grid;
  gap: 0.25rem;
  width: min(100% - 2.5rem, 82rem);
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
  color: var(--soft);
  font-size: 0.8125rem;
}

/* ---------------------------------------------------------------------------------------- */
/* A phone: the side bar becomes a header, the tables become rows of their own. */

@media (max-width: 47.99rem) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    margin-top: 0;
    border-inline: 0;
  }
  .side {
    gap: 1rem;
    padding: 1rem;
  }
  .side h1 {
    margin-top: -0.75rem;
  }
  body:has(#rol-klant:checked) .nav-klant,
  body:has(#rol-team:checked) .nav-team {
    display: flex;
    flex-wrap: wrap;
  }
  .tab {
    gap: 0.5rem;
    padding: 0 0.75rem;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }
  body:has(#s-overzicht:checked) .tab-overzicht,
  body:has(#s-offerte:checked) .tab-offerte,
  body:has(#s-planning:checked) .tab-planning,
  body:has(#s-documenten:checked) .tab-documenten,
  body:has(#s-berichten:checked) .tab-berichten,
  .tab-on {
    border-bottom-color: var(--lime);
  }
  .main {
    padding: 1.5rem 1rem 2rem;
  }
  .track {
    grid-template-columns: minmax(0, 1fr);
    border-top: 0;
    border-left: 1px solid var(--line);
    margin-left: 0.4375rem;
  }
  .track li {
    padding: 0 0 1.25rem 1.25rem;
  }
  .dot {
    top: 0.25rem;
    left: -0.4375rem;
  }
  .jobs thead {
    display: none;
  }
  .jobs tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.25rem 0.75rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--line);
  }
  .jobs td {
    padding: 0;
    border: 0;
  }
  .jobs td:nth-child(2),
  .jobs td:nth-child(3) {
    grid-column: 1 / -1;
  }
  .jobs td:nth-child(4) {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
  }
  .docs li {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .docs small {
    grid-column: 2;
  }
  .foot {
    width: auto;
    padding-inline: 1rem;
  }
}
