:root {
  /* Each section keeps a colour of its own, from the Benchberry family
     (18 October 2026): oat cream at home, berry blush for enquiries, slate
     mist for jobs, sage for contacts, heather for adding, eucalyptus for the
     schedule, stone for settings, honey for money, clay for suppliers. */
  --bg-home: #f1ece1;
  --bg-leads: #ecdae2;
  --bg-projects: #dbe3e8;
  --bg-contacts: #dce6d6;
  --bg-new: #e5dbe7;
  --bg-schedule: #d7e5e0;
  --bg-settings: #e3e1db;
  --bg-cashflow: #f1e5c9;
  --bg-suppliers: #efdfd1;
  --surface: #ffffff;
  --surface-soft: #f6f3f2;
  --surface-high: #eae7e7;
  --text: #2d2d2d;
  --muted: #7a7a72;
  /* Benchberry (18 October 2026): forest, leaf and berry from the logo. */
  --primary: #1f3a33;
  --secondary: #3e5f73;
  --orange: #b5653c;
  --green: #5d7c57;
  --purple: #8c335d;
  --gold: #c4922f;
  --border: #e6e6e6;
  --outline: #c1c9c0;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg-home);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-home);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.screen {
  width: 100%;
  min-height: 100vh;
  padding: 0 12px 112px;
}

.screen.home { background: var(--bg-home); }
.screen.leads { background: var(--bg-leads); }
.screen.live-projects { background: var(--bg-projects); }
.screen.schedule { background: var(--bg-schedule); }
.screen.contacts { background: var(--bg-contacts); }
.screen.new-project { background: var(--bg-new); }
.screen.settings { background: var(--bg-settings); }
.screen.suppliers { background: var(--bg-suppliers); }
.screen.project-hq { background: #f2e5eb; }
.screen.project-hq.live { background: #e2e8ec; }

.screen-inner {
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 0 0 28px;
  min-width: 0;
}

/* Nothing should be able to widen a page sideways. Without this, one oversized
   child makes every centred panel look shunted to the right. */
body {
  overflow-x: hidden;
}

.top-shell {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 -12px 12px;
  padding: 8px 12px;
  background: var(--page-bg, var(--bg-home));
  box-shadow: 0 8px 14px rgba(45, 45, 45, 0.04);
}

.compact-top-shell {
  margin-bottom: 10px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.compact-header {
  gap: 0;
}

.screen.home { --page-bg: var(--bg-home); }
.screen.leads { --page-bg: var(--bg-leads); }
.screen.live-projects { --page-bg: var(--bg-projects); }
.screen.schedule { --page-bg: var(--bg-schedule); }
.screen.contacts { --page-bg: var(--bg-contacts); }
.screen.new-project { --page-bg: var(--bg-new); }
.screen.settings { --page-bg: var(--bg-settings); }
.screen.suppliers { --page-bg: var(--bg-suppliers); }
.screen.cashflow { background: var(--bg-cashflow); --page-bg: var(--bg-cashflow); }
.screen.project-hq { --page-bg: #f2e5eb; }
.screen.project-hq.live { --page-bg: #e2e8ec; }

.auth-screen {
  display: grid;
  min-height: 100vh;
  padding-bottom: 24px;
  place-items: center;
  background: var(--bg-home);
}

.auth-inner {
  width: min(100%, 430px);
}

.auth-card {
  display: grid;
  gap: 16px;
  padding: 24px 22px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.auth-brand {
  justify-content: center;
  padding-bottom: 4px;
}

.auth-card h1 {
  margin: 0;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.auth-card .auth-welcome-message {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.sync-conflict-modal {
  display: grid;
  gap: 12px;
}

.sync-conflict-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

.sync-conflict-list span {
  display: block;
  font-size: 12px;
}

/* Shown whenever Berry is speaking, anywhere in the app. Lives on <body> rather
   than inside the screen so a re-render cannot interrupt playback. */
.flow-voice-bubble {
  position: fixed;
  right: 14px;
  bottom: 160px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  border-radius: 999px;
  background: #6d3f86;
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}

.flow-voice-label {
  display: grid;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.flow-voice-usage {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.75;
  letter-spacing: 0;
}

/* Berry's orb - the same one as the launch film, drawn small. Painted on a
   canvas from the audio she is actually speaking, so there is nothing to keep
   in step here. */
.flow-orb {
  width: 34px;
  height: 34px;
  flex: none;
  display: block;
}

/* Listening: red so it reads as a live microphone, not playback. */
.flow-voice-bubble.listening {
  background: #8f2f2f;
  animation: flow-listen-pulse 1.4s ease-in-out infinite;
}

.flow-voice-symbol {
  font-size: 14px;
  line-height: 1;
}

@keyframes flow-listen-pulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(211, 58, 58, 0.5); }
  50% { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(211, 58, 58, 0); }
}

/* Thinking: bars slow right down so it reads as working, not talking. */
.flow-voice-bubble.thinking {
  background: #40484f;
}

/* Thinking and paused dim the orb rather than the old bars; the canvas keeps
   drawing, so the state has to read from opacity. */
.flow-voice-bubble.thinking .flow-orb { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  .flow-voice-bubble.listening { animation: none; }
}

/* Paused: the orb dims and stops reacting, since the audio it reads has
   stopped feeding it. */
.flow-voice-bubble.paused .flow-orb { opacity: 0.55; }

.flow-voice-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}



/* Bottom-nav nudge to go and add the rest of their real work. The only pulse
   left outside the walkthrough, and it stops once they have a few customers. */
.nav-item.add-more-pulse {
  position: relative;
  border-radius: 10px;
  animation: add-more-pulse 2.4s ease-in-out infinite;
}

@keyframes add-more-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(54, 101, 72, 0.08); }
  50% { box-shadow: 0 0 0 7px rgba(54, 101, 72, 0.18); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-item.add-more-pulse {
    animation: none;
  }
}

.sync-strip {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 60;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 460px;
  padding: 9px 14px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.sync-strip.offline {
  background: #4a4a4a;
  color: #fff;
}

.sync-strip.pending {
  background: #fde8b5;
  color: #7a5200;
}

.voice-choice-row {
  /* Grid rather than flex so the two choices share the width evenly and can
     actually shrink; a Listen button inside each made the old flex row wider
     than the card on a phone. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.voice-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.voice-choice input[type="radio"] {
  flex: 0 0 auto;
  margin: 0;
}

@media (max-width: 430px) {
  .voice-choice-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.voice-choice.selected {
  border-color: var(--accent);
  background: rgba(45, 107, 115, 0.08);
}

.voice-choice span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-preview-btn {
  flex: 0 0 auto;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.trial-countdown {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.trial-countdown p {
  margin: 0;
  font-weight: 500;
}

.trial-countdown.urgent {
  border-color: rgba(200, 80, 80, 0.4);
  background: rgba(247, 222, 222, 0.75);
  color: #9c2b2b;
}

.subscribe-card {
  display: grid;
  gap: 12px;
}

.subscribe-points {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.45;
}

.subscribe-price {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.subscribe-notice {
  margin: 0;
}

.subscribe-button,
.subscribe-contact,
.subscribe-logout {
  width: 100%;
  text-align: center;
}

.subscribe-contact {
  display: block;
  padding: 12px;
  text-decoration: none;
}

.field-password {
  position: relative;
}
.field-password input {
  padding-right: 60px;
}
.password-reveal {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  line-height: 1;
}

.auth-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.notice-card {
  padding: 10px 12px;
  border: 1px solid rgba(57, 95, 148, 0.2);
  border-radius: 8px;
  background: rgba(213, 227, 255, 0.55);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
}

.field-help {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
}

.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 8px;
}

.appbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
}

.appbar-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--primary);
  font-size: 15px;
  font-weight: 800;
}

.icon-svg {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appbar img {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.header,
.home-header {
  display: grid;
  gap: 4px;
}

.mini-brand {
  display: flex;
}

.company {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
}

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

h1 {
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 32px;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 28px;
}

h3 {
  font-size: 16px;
  line-height: 24px;
}

.muted {
  color: var(--muted);
}

.stats-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.home-control-strip {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 66px;
}

.home-settings-button {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 4px;
  border-left: 1px solid var(--outline);
  border-radius: 0 12px 12px 0;
  color: var(--text);
}

.home-settings-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
}

.home-settings-icon svg {
  width: 24px;
  height: 24px;
}

.home-settings-button small {
  font-size: 9px;
  font-weight: 800;
}

.stat {
  min-width: 0;
  padding: 16px;
}

.home-private-stat {
  display: block;
  width: 100%;
  color: var(--text);
  text-align: left;
}

.home-private-stat:active {
  background: rgba(45, 107, 115, 0.06);
}

.home-private-stat strong {
  white-space: nowrap;
}

.stat + .stat {
  border-left: 1px solid var(--outline);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #414942;
  font-size: 10px;
  line-height: 14px;
}

.coin-icon {
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
}

.stat strong {
  display: block;
  margin-top: 5px;
  color: #1b1c1c;
  font-size: 16px;
  font-weight: 800;
  line-height: 24px;
}

.scope-change-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

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

.home-primary-grid .tile {
  min-height: 76px;
  aspect-ratio: auto;
  padding: 10px 8px;
}

.home-action-window {
  margin-bottom: 10px;
}

.home-action-window .activity-head {
  padding: 10px 12px;
}

.home-action-window .activity-head > div {
  display: grid;
  gap: 1px;
}

.home-action-window .activity-head .company {
  margin: 0;
  font-size: 9px;
}

.activity-view-all {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--secondary);
  background: rgba(57, 95, 148, 0.1);
  font-size: 11px;
  font-weight: 900;
}

.home-action-list {
  max-height: 170px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 12px;
}

.home-action-list .activity-icon {
  width: 32px;
  height: 32px;
}

.home-navigation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.home-navigation-tile {
  display: grid;
  min-width: 0;
  min-height: 78px;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 9px 5px;
  border-radius: 10px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
  text-align: center;
}

.home-navigation-tile .tile-icon {
  width: 34px;
  height: 34px;
}

.home-navigation-tile strong {
  font-size: 11px;
  line-height: 1.15;
}

.tile,
.project-card:not(.demo-project-card),
.contact-card,
.form-panel,
.card,
.settings-card,
.activity-card,
.spotlight-card {
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tile {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 8px;
  color: var(--text);
  text-align: center;
  transition: background-color 0.18s ease, transform 0.15s ease;
}

.wide-tool-button {
  display: flex;
  width: 100%;
  min-height: 76px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 24px;
  padding: 14px;
  border-radius: 10px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
  font-weight: 900;
}

.home-business-button {
  margin-bottom: 8px;
}

.page-intro {
  margin: -3px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.business-hq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.business-group-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.business-group-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.business-group-card h2,
.business-group-card p {
  margin: 0;
}

.business-group-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.business-group-grid .business-hq-tile {
  aspect-ratio: auto;
  min-height: 82px;
}

.business-hq-tile {
  display: flex;
  min-width: 0;
  aspect-ratio: 1 / 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 6px;
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
  text-align: center;
}

.business-hq-tile:active {
  transform: scale(0.96);
}

.business-hq-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--tile-colour);
}

.business-hq-icon svg {
  width: 23px;
  height: 23px;
}

.business-hq-tile strong {
  max-width: 100%;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.business-result-hero {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  padding: 18px;
}

.business-result-hero > span,
.business-health-grid span,
.business-breakdown span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.business-result-hero > strong {
  color: var(--primary);
  font-size: 30px;
  line-height: 1.1;
}

.business-result-hero.watch > strong {
  color: #7b5200;
}

.business-result-hero.attention > strong {
  color: #8f1e16;
}

.business-result-hero p,
.business-health-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.business-planning-form {
  margin-bottom: 12px;
}

.settings-three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.business-breakdown,
.business-health-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.business-breakdown {
  grid-template-columns: 1fr 1fr;
  padding: 14px;
}

.business-breakdown > div,
.business-health-grid > article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.business-breakdown strong,
.business-health-grid strong {
  font-size: 18px;
}

.business-health-grid {
  grid-template-columns: 1fr 1fr;
}

.business-document-upload {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.business-document-card {
  display: grid;
  gap: 10px;
}

.business-document-card.expiring {
  border-left: 4px solid #c4922f;
}

.business-document-card p {
  color: var(--muted);
  font-size: 12px;
}

.cutlist-upload-button {
  position: relative;
  cursor: pointer;
  text-align: center;
}

.cutlist-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.cutlist-upload-button.disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 620px) {
  .settings-three-col,
  .business-breakdown,
  .business-health-grid {
    grid-template-columns: 1fr;
  }

  .home-control-strip {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 58px;
  }

  .home-control-strip .stat {
    padding: 12px 10px;
  }

  .home-control-strip .stat-label {
    gap: 4px;
    font-size: 9px;
  }

  .home-control-strip .stat strong {
    font-size: 14px;
  }
}

.wide-tool-button .tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.flow-wide-button {
  margin: 0 0 14px;
}

.tile:hover {
  background: var(--surface-high);
}

.tile:active,
.project-card:active,
.project-card-inner:active,
.contact-card:active,
.nav-item:active,
.action-tile:active,
.wide-tool-button:active,
.activity-item:active {
  transform: scale(0.95);
}

.tile-icon,
.action-icon,
.nav-icon {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--tile-colour, var(--primary));
  font-weight: 800;
}

.tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 20px;
}

.tile span:last-child {
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
}

.tile.disabled {
  opacity: 0.68;
}

.dashboard-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-tools:empty {
  display: none;
}

.dashboard-tools.editing {
  grid-template-columns: 1fr 1fr;
}

.dashboard-tools .primary-button,
.dashboard-tools .back-hq-button,
.dashboard-tools .upload-button {
  width: 100%;
}

.column-editor {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
}

.activity-card {
  overflow: hidden;
  margin-bottom: 16px;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--outline);
  background: #ffffff;
}

.activity-head h2 {
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

.activity-head span {
  color: var(--secondary);
  font-size: 10px;
  text-decoration: underline;
}

.activity-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.activity-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.activity-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.activity-icon.leads {
  background: var(--bg-leads);
}

.activity-icon.projects {
  background: var(--bg-projects);
}

.activity-icon.todo {
  background: var(--green);
}

.activity-icon.event {
  background: #607d8b;
}

.activity-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.activity-item strong {
  display: block;
  font-size: 14px;
  line-height: 20px;
}

.activity-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 14px;
}

.spotlight-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.spotlight-image {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.56)),
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.6), transparent 18%),
    linear-gradient(135deg, #d8c2a5, #f7f3ed 42%, #9fbf9e);
}

.spotlight-image span {
  position: absolute;
  left: 14px;
  bottom: 12px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.spotlight-card strong {
  display: block;
  font-size: 14px;
}

.spotlight-card p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* Dashboard: prevent page scroll from competing with column scroll */
.dashboard-screen {
  height: 100vh;
  height: 100dvh;
  min-height: unset;
  overflow: hidden;
  padding-bottom: 0;
}

.dashboard-screen .screen-inner {
  padding-bottom: 0;
}

/* Horizontal scroll container.
   overflow-x:auto with NO height forces columns to own all horizontal gestures.
   align-items:flex-start lets each column be its natural height (capped by max-height). */
/* .columns is just a viewport window — no scroll, overflow:hidden clips the track */
.columns {
  overflow: hidden;
}

/* .columns-track holds all pipeline columns and moves via transform.
   All columns are painted upfront so scroll is pure compositor — no paint
   ever happens mid-gesture, giving identical smoothness in both directions. */
.columns-track {
  display: flex;
  gap: 12px;
  padding: 2px 12px 14px;
  align-items: flex-start;
  will-change: transform;
  transform: translateX(0);
  transition: transform 320ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* IMPORTANT: overflow must be the shorthand — never set overflow-x/overflow-y
   separately here, as browsers convert overflow-y:visible → auto which creates
   a competing vertical scroll container that swallows horizontal swipe events. */
.pipeline-column {
  flex: 0 0 min(85vw, 360px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 210px);
  max-height: calc(100dvh - 210px);
  overflow: hidden;
  padding: 0 2px;
  scroll-snap-align: center;
  will-change: transform;
  transform: translateZ(0);
}

.pipeline-column.managing {
  padding: 10px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.35);
}

.column-heading {
  flex: 0 0 auto;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 12px rgba(45, 45, 45, 0.08);
}

.column-body {
  display: grid;
  min-height: 0;
  gap: 10px;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: none; /* JS handles all scroll — prevents browser claiming touch before we decide direction */
  padding: 0 2px 64px;
}

.column-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.column-title {
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.column-title-input {
  width: 100%;
  min-height: 38px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: #ffffff;
  font-weight: 800;
}

.column-lock {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.delete-column-button {
  min-height: 38px;
  border-radius: 8px;
  color: #ffffff;
  background: #b1241a;
  font-size: 13px;
  font-weight: 900;
}

/* The boards share the standard title row; this only nudges its alignment. */
.dashboard-header {
  align-items: end;
}

.manage-column-button {
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(45, 45, 45, 0.1);
  font-size: 11px;
  font-weight: 800;
}

.manage-column-button.active {
  color: #ffffff;
  background: #284f83;
}

.project-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  color: var(--text);
  text-align: left;
}

.project-card-inner {
  display: grid;
  gap: 8px;
  padding: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
}

.demo-project-card {
  border-color: rgba(180, 160, 220, 0.5);
  background: var(--surface);
  padding: 14px;
}

.demo-badge {
  background: #7a4a78 !important;
  color: #fff !important;
  font-size: 11px;
  opacity: 0.85;
}

.demo-delete-btn {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(155, 89, 182, 0.4);
  background: transparent;
  color: #7a4a78;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.demo-delete-btn.pending {
  background: #7a4a78;
  color: #fff;
  border-color: #7a4a78;
}

/* Contact cards are slim — just name + action buttons on one row */
.contact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  text-align: left;
}

.contact-main {
  flex: 1;
  min-width: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.project-card strong,
.project-card-inner strong,
.contact-card strong,
.contact-main strong {
  font-size: 16px;
}

.managing-card {
  cursor: default;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.move-project-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.move-project-control select {
  width: 100%;
  min-height: 40px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: #f5f5f5;
}

.empty {
  padding: 16px;
  border: 1px dashed rgba(45, 45, 45, 0.18);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.contact-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.contact-actions .action-button,
.contact-actions .upload-button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.contacts-search-wrap {
  margin-bottom: 12px;
}

.contacts-search-input {
  width: 100%;
  min-height: 44px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  background: rgba(255,255,255,0.85);
  outline: 0;
}

.contacts-search-input:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.search-prompt {
  padding: 24px 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.contact-project-section {
  display: grid;
  gap: 10px;
  margin: 16px 0 14px;
}

.contact-project-section h2 {
  color: var(--primary);
  font-size: 18px;
}

.contact-hq-picker {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
}

.contact-hq-picker h3 {
  color: var(--primary);
  font-size: 16px;
}

.action-button,
.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 800;
  text-align: center;
}

.action-button,
.primary-button {
  color: #ffffff;
  background: var(--green);
}

/* Muted text on a near-white card read as a caption rather than a control, so
   the secondary actions across Settings looked like labels nobody could press.
   A definite edge and a darker label make it a button; green stays reserved for
   the main action on a card, so the hierarchy still holds. */
.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(54, 101, 72, 0.34);
}

.ghost-button:active {
  background: rgba(54, 101, 72, 0.10);
}

.form-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  /* The shared card border is translucent white, which disappears against a
     light panel on a coloured page - a form needs a definite edge so it reads
     as a separate thing sitting over the list behind it. */
  border: 1px solid rgba(28, 42, 36, 0.22);
  box-shadow: 0 8px 24px rgba(20, 30, 26, 0.16);
}

.buildflow-address-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.buildflow-address-row input {
  flex: 1;
  min-width: 0;
  border: none !important;
  border-radius: 0;
  background: transparent;
}

.buildflow-address-domain {
  flex: 0 0 auto;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.buildflow-address-status {
  font-size: 12px;
  font-weight: 700;
}
.buildflow-address-status.ok { color: #2f6b45; }
.buildflow-address-status.err { color: #b23b3b; }
.buildflow-address-status.checking { color: var(--muted); }

.buildflow-confirm-btn {
  justify-self: start;
  padding: 8px 14px;
  font-size: 13px;
}

.buildflow-confirm-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.buildflow-address-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.buildflow-address-suggestions button {
  padding: 5px 10px;
  font-size: 12px;
}

.locked-customer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(28, 42, 36, 0.14);
  border-radius: 10px;
  background: rgba(45, 107, 115, 0.07);
}

.locked-customer-row span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.locked-customer-row small {
  color: var(--muted);
  font-size: 11px;
}

.locked-customer-row strong {
  font-size: 15px;
}

.contact-select-list {
  border: 1px solid rgba(28, 42, 36, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  padding: 6px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #f5f5f5;
  outline: 0;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.project-hero,
.site-notes,
.todo-summary {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
}

.project-hero {
  gap: 10px;
  padding: 12px 14px;
}

.project-hero.project-tone-lead,
.todo-summary.project-tone-lead {
  background: var(--bg-leads);
  border-color: rgba(255, 255, 255, 0.72);
}

.project-hero.project-tone-live,
.todo-summary.project-tone-live {
  background: var(--bg-projects);
  border-color: rgba(255, 255, 255, 0.72);
}

.project-hero.project-tone-lead .muted,
.project-hero.project-tone-live .muted,
.todo-summary.project-tone-lead .muted,
.todo-summary.project-tone-live .muted {
  color: rgba(45, 45, 45, 0.76);
}

.project-value-standard {
  margin-top: 5px;
  font-size: 15px;
  font-weight: 900;
}

.project-value-summary {
  display: grid;
  gap: 2px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(45, 45, 45, 0.12);
}

.project-value-summary > span {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 9px;
}

.project-value-summary small {
  color: rgba(45, 45, 45, 0.72);
  font-size: 11px;
  font-weight: 800;
}

.project-value-summary strong {
  font-size: 18px;
}

.project-value-summary p {
  color: rgba(45, 45, 45, 0.74);
  font-size: 11px;
}

.project-value-summary .project-value-pending {
  color: #7b5200;
  font-weight: 900;
}

.todo-summary {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.todo-summary .company {
  color: rgba(45, 45, 45, 0.7);
  font-size: 13px;
  font-weight: 800;
}

.todo-summary strong {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(45, 45, 45, 0.72);
  font-size: 16px;
}

.todo-list {
  display: grid;
  gap: 0;
  margin-bottom: 14px;
  overflow: hidden;
}

.new-enquiry-badge {
  background: #a85a32 !important;
  color: #fff !important;
  margin-left: 6px;
}

.website-embed-card {
  display: grid;
  gap: 12px;
}

.embed-snippet-block {
  display: grid;
  gap: 8px;
}

.embed-snippet-block small,
.embed-advanced p {
  color: var(--muted);
  font-size: 12px;
}

.embed-snippet {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  word-break: break-all;
  white-space: pre-wrap;
}

.embed-advanced {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.embed-field-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
}

.embed-field-list code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
}

.embed-field-list span {
  color: var(--muted);
}

.embed-advanced summary {
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.original-enquiry-card {
  display: grid;
  gap: 8px;
}

.original-enquiry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.original-enquiry-head h2 {
  margin: 0;
}

.original-enquiry-source {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.original-enquiry-quote {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: rgba(45, 107, 115, 0.07);
  font-style: italic;
  line-height: 1.5;
  white-space: pre-wrap;
}

.original-enquiry-meta {
  margin: 0;
  font-size: 13px;
}






.flow-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.flow-current-result {
  display: grid;
  gap: 10px;
}

.flow-voice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.flow-toggle {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(57, 95, 148, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.flow-listen-button {
  min-height: 42px;
}

.flow-voice-picker {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1.4fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr) auto;
  align-items: end;
}

.flow-voice-picker .field {
  margin: 0;
}

.flow-voice-picker input[type="range"] {
  width: 100%;
  accent-color: #3e5f73;
}

.flow-test-voice {
  min-height: 42px;
}

.flow-voice-guide {
  border: 1px solid rgba(57, 95, 148, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.flow-voice-guide summary {
  padding: 11px 12px;
  color: #3e5f73;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.flow-voice-guide-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.flow-voice-guide-body section {
  display: grid;
  gap: 3px;
}

.flow-voice-guide-body strong {
  font-size: 13px;
}

.flow-voice-guide-body p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.flow-message {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(57, 95, 148, 0.14);
}

.flow-message p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.flow-message.user {
  justify-self: end;
  background: #3e5f73;
}

.flow-message.user p {
  color: #ffffff;
}

.flow-task-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.flow-task-list.empty,
.flow-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(57, 95, 148, 0.24);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.flow-task-chip {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(57, 95, 148, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  text-align: left;
}

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

.flow-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.flow-input-row textarea {
  flex: 1;
  min-width: 0;
}

.flow-input-row textarea {
  min-height: 76px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  background: #f5f5f5;
}

.flow-action-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.flow-action {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 137, 123, 0.1);
}

.flow-action.pending {
  background: rgba(244, 166, 32, 0.16);
  border: 1px solid rgba(184, 95, 56, 0.24);
}

.flow-action strong,
.flow-action small {
  color: var(--text);
  overflow-wrap: anywhere;
}

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

.flow-email-action pre {
  margin: 4px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.flow-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.flow-action-buttons .primary-button,
.flow-action-buttons .ghost-button {
  min-height: 38px;
  padding: 9px 12px;
  text-decoration: none;
}

.todo-toolbar {
  position: sticky;
  top: 70px;
  z-index: 9;
  margin-bottom: 10px;
  padding: 8px 0;
  background: #f2e5eb;
}

.screen.project-hq.live .todo-toolbar {
  background: #e2e8ec;
}

@media (max-width: 720px) {
  .flow-voice-picker {
    grid-template-columns: 1fr;
  }
}

.todo-item {
  display: block;
  padding: 0;
  transition: background-color 0.16s ease;
}

.todo-item + .todo-item {
  border-top: 1px solid var(--border);
}

.todo-item.complete {
  background: #eef8ee;
}

.todo-row {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.todo-check {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid var(--outline);
  border-radius: 8px;
  background: #ffffff;
}

.todo-check-placeholder {
  display: block;
  width: 24px;
  height: 24px;
}

.todo-check.edit-spacer:not(.checked) {
  visibility: hidden;
}

.todo-check.checked {
  border-color: var(--green);
  background: var(--green);
}

.todo-check.checked::after {
  content: "";
  width: 8px;
  height: 12px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(40deg) translateY(-1px);
}

.todo-copy strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.todo-copy small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.todo-item.complete .todo-copy strong,
.todo-item.complete .todo-copy small {
  text-decoration: line-through;
}

.todo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px 50px;
}

.todo-actions .primary-button,
.todo-actions .ghost-button {
  min-height: 38px;
  padding: 8px;
  font-size: 12px;
}

.todo-actions .danger {
  color: var(--tertiary, #b1241a);
}

.todo-item.editing {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
}

.todo-edit-form {
  display: grid;
  gap: 8px;
}

.todo-edit-form input,
.todo-edit-form textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #f5f5f5;
}

.todo-edit-form textarea {
  min-height: 78px;
  resize: vertical;
}

.todo-edit-form .todo-actions {
  grid-template-columns: 1fr 1fr;
  padding: 0;
}

.full-width-button {
  width: 100%;
}

.back-hq-button {
  display: block;
  min-height: 46px;
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffffff;
  background: #284f83;
  box-shadow: var(--shadow);
  font-weight: 900;
  text-align: center;
}

.upload-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 11px 14px;
  color: #ffffff;
  background: #3e5f73;
  box-shadow: var(--shadow);
  font-weight: 900;
  text-align: center;
}

.communication-strip,
.action-grid {
  margin-bottom: 14px;
}

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

.action-tile {
  display: grid;
  gap: 8px;
  justify-items: center;
  align-content: center;
  min-height: 82px;
  padding: 10px 8px;
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

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

.scope-protection-strip {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  color: var(--text);
  text-align: left;
}

.scope-protection-strip span {
  display: grid;
  gap: 3px;
}

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

.scope-protection-strip b {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #7a4a78;
}

.scope-change-form {
  margin-bottom: 12px;
}

.scope-add-button {
  margin-bottom: 12px;
}

.scope-change-list {
  margin-bottom: 12px;
}

.scope-change-card {
  border-left: 4px solid #c4922f;
}

.scope-change-card.approved {
  border-left-color: #5d7c57;
}

.scope-change-card.declined {
  border-left-color: #b1241a;
  opacity: 0.72;
}

.scope-change-head small,
.scope-impact-row {
  color: var(--muted);
  font-size: 11px;
}

.scope-impact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.scope-approval-note {
  padding: 9px;
  border-radius: 8px;
  background: rgba(90, 138, 106, 0.1);
}

.project-info-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.project-info-tabs button {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(45, 45, 45, 0.08);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.project-info-tabs button.active {
  color: #ffffff;
  background: #2d6b73;
}

.next-action-label {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--secondary);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.action-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 18px;
}

.order-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.order-count {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(45, 45, 45, 0.72);
  font-size: 18px;
  font-weight: 900;
}

.order-list,
.materials-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.order-card,
.material-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.order-card strong,
.material-card strong {
  font-size: 15px;
}

.order-card span,
.material-card span,
.material-card small {
  color: var(--muted);
  font-size: 13px;
}

.order-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.order-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.order-card dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

/* ── Schedule: month calendar view ──────────────────────────────────── */
.cal-nav {
  position: sticky;
  top: 118px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 -2px 10px;
  padding: 8px 2px;
  background: var(--page-bg, var(--bg-schedule));
}

.screen.schedule .cal-nav {
  position: static;
  z-index: auto;
  margin: 6px 0 0;
  padding: 8px 0 0;
}

.screen.schedule {
  height: 100vh;
  height: 100dvh;
  min-height: unset;
  overflow: hidden;
}

.screen.schedule .screen-inner {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.screen.schedule .schedule-top-shell {
  position: relative;
  top: auto;
  flex: 0 0 auto;
  z-index: 20;
  margin-bottom: 6px;
}

.screen.schedule .page-intro {
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  color: var(--primary);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  flex: 0 0 auto;
}

.cal-month-label {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.cal-today-btn {
  min-height: unset;
  padding: 7px 12px;
  font-size: 12px;
  flex: 0 0 auto;
}

.cal-grid-card {
  overflow: hidden;
  margin-bottom: 10px;
  padding: 0;
}

/* The card is a fixed frame; the run of weeks inside it is the only thing that
   scrolls. Previously the card scrolled, which would nest two scrollers once
   the weeks became continuous and make the drag unpredictable. The key and the
   weekday letters stay put at the top where they are useful. */
.screen.schedule .cal-grid-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Months sit side by side and the calendar is dragged sideways through them.
   Free scrolling rather than snapping, so it keeps moving with the finger and
   can rest showing the end of one month and the start of the next. */
.cal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* The scrollbar would sit across the bottom of the grid on desktop. */
  scrollbar-width: none;
}

.cal-scroll::-webkit-scrollbar {
  display: none;
}

.cal-month-panel {
  /* One month fills the width; shrinking is off so panels keep their size
     rather than being squeezed to fit the row. */
  flex: 0 0 100%;
  min-width: 0;
  border-right: 1px solid var(--border);
}

@media (prefers-reduced-motion: reduce) {
  .cal-scroll {
    scroll-behavior: auto;
  }
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.cal-weekdays span {
  padding: 5px 2px;
  border-right: 1px solid var(--border);
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.cal-weekdays span:last-child {
  border-right: 0;
}

.screen.schedule .cal-week {
  flex: 1 1 0;
  min-height: 66px;
  border-bottom: 1px solid var(--border);
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(14.285714% - 1px),
    var(--border) calc(14.285714% - 1px),
    var(--border) 14.285714%
  );
}

.screen.schedule .cal-week:last-child { border-bottom: none; }

.cal-day-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 0 2px;
  background: transparent;
  border-right: 1px solid var(--border);
}

.cal-day:last-child { border-right: none; }

.cal-day-num {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.cal-day.today .cal-day-num {
  background: var(--secondary);
  color: #ffffff;
  font-weight: 800;
}

.cal-day.faded .cal-day-num {
  color: var(--muted);
  opacity: 0.45;
}

.cal-pay-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 1px;
}

/* Bars overlay: CSS grid with 7 cols, rows determined by --lanes */
.cal-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(var(--lanes, 1), 18px);
  gap: 1px;
  padding: 1px 2px 3px;
}

.cal-bar {
  min-width: 0;
  height: 18px;
  border-radius: 3px;
  padding: 0 3px;
  color: #ffffff;
  background: var(--project-colour, var(--secondary));
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  font-size: 8px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.95;
}

.cal-bar .stage-pill,
.cal-bar .bar-pay {
  min-width: 12px;
  height: 12px;
  border-radius: 3px;
  font-size: 8px;
}

.cal-bar.production { background-image: linear-gradient(135deg, rgba(255,255,255,0.18) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0.18) 75%, transparent 75%, transparent); background-size: 8px 8px; }
.cal-bar.install { box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.36); }
.cal-bar.event { background: #607d8b; border-left-color: rgba(255, 255, 255, 0.76); }

/* Keep old schedule-editor and modal styles intact */
.schedule-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

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

.schedule-empty-editor {
  margin-bottom: 14px;
}

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

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.photo-button {
  display: grid;
  place-items: center;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.photo-slot {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-weight: 800;
}

.photo-preview {
  position: relative;
  overflow: hidden;
  margin: 0;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #f5f5f5;
}

/* The whole tile opens the photo. It has to fill the square itself, or the
   image's own 100% height measures against nothing and the tile collapses. */
.photo-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A site photo at full size, with the two things worth doing to it underneath.
   Above the nav and the sticky footer, so nothing of the app shows through and
   there is no doubt about what Delete applies to. */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  /* minmax(0, 1fr) rather than 1fr, so the row may actually shrink below the
     picture's own size instead of forcing the bar off the bottom. */
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  background: rgba(20, 18, 16, 0.94);
}

/* The frame takes whatever room is left and the picture is laid into it
   absolutely. Sizing the picture with max-height: 100% instead looks right on a
   wide screen and collapses to nothing on a phone: its height resolves against
   a frame whose own height depends on the picture, and the browser is entitled
   to settle that circle at zero. */
.photo-viewer-frame {
  position: relative;
  margin: 0;
  min-height: 0;
}

.photo-viewer-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.photo-viewer-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.customer-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.simplified-project-form {
  gap: 12px;
}

.advanced-options {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
}

.advanced-options summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 900;
}

.advanced-options-content {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.type-btn {
  min-height: 48px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.type-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.contact-select-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px 0;
}

.contact-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.contact-select-item strong {
  font-size: 14px;
}

.contact-select-item span {
  color: var(--muted);
  font-size: 12px;
}

.contact-select-item.selected {
  border-color: var(--primary);
  background: #ffffff;
}

.no-results {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.settings-list {
  display: grid;
  gap: 10px;
}

.settings-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

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

.workflow-readiness-card {
  border: 1px solid rgba(57, 95, 148, 0.22);
  background: rgba(255, 255, 255, 0.82);
}

.workflow-readiness-card.needs-work {
  border-color: rgba(177, 36, 26, 0.28);
}

.workflow-status-pill {
  justify-self: start;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(90, 138, 106, 0.16);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.workflow-status-pill.warning {
  background: rgba(177, 36, 26, 0.12);
  color: #8f1e16;
}

.workflow-issue-list {
  display: grid;
  gap: 6px;
}

.workflow-issue-list p {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.workflow-issue-list span {
  color: var(--muted);
  font-size: 12px;
}

.trigger-method-options {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(45, 45, 45, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
}

.trigger-method-options > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trigger-method-options .settings-toggle {
  min-height: 34px;
  padding: 6px 8px;
}

.trigger-contact-method {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(57, 95, 148, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.trigger-contact-method + .trigger-contact-method {
  margin-top: 8px;
}

.trigger-contact-method > strong {
  font-size: 14px;
}

.archived-lead-list {
  margin-bottom: 14px;
}

.archived-lead-card {
  gap: 10px;
}

.archived-lead-card small {
  color: var(--muted);
}

.close-lead-button {
  color: #8f1e16;
  border-color: rgba(177, 36, 26, 0.22);
  background: rgba(255, 255, 255, 0.72);
}

.contact-archive-actions {
  margin: 12px 0;
}

.workshop-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.workshop-tool-list {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.workshop-list-tile {
  display: grid;
  width: 100%;
  min-height: 92px;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
}

.workshop-list-tile:active {
  transform: scale(0.98);
}

.workshop-list-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--secondary);
  color: #ffffff;
  font-weight: 900;
}

.workshop-list-tile strong,
.workshop-list-tile small {
  display: block;
}

.workshop-list-tile strong {
  font-size: 17px;
  line-height: 23px;
}

.workshop-list-tile small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
}

.workshop-tool-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.workshop-tool-visual {
  display: grid;
  min-height: 74px;
  place-items: center;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(62, 95, 115, 0.2), rgba(93, 124, 87, 0.16)),
    #ffffff;
}

.workshop-tool-visual span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: #ffffff;
  color: var(--secondary);
  font-size: 20px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.workshop-tool-copy h3 {
  margin: 0;
}

.workshop-tool-copy p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.workshop-tool-copy small {
  display: block;
  margin-top: 6px;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
}

.workshop-tool-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.workshop-tool-inputs label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.workshop-tool-inputs input {
  width: 100%;
  min-height: 38px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
}

.workshop-tool-result {
  display: block;
  padding: 10px;
  border-radius: 8px;
  background: rgba(90, 138, 106, 0.14);
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.cutlist-screen .screen-inner {
  width: min(100%, 230mm);
}

.cutlist-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.cutlist-project-label {
  font-size: 13px;
  padding: 8px 0;
}

.cutlist-project-select {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.cutlist-project-select select {
  width: 100%;
  min-height: 42px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
}

.cutlist-save-status {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cutlist-optimizer-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.cutlist-material-prompt {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.cutlist-material-prompt form {
  display: grid;
  gap: 10px;
}

.cutlist-start-card {
  display: grid;
  gap: 14px;
}

.cutlist-start-card .settings-list {
  gap: 8px;
}

.cutlist-optimizer-summary p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(90, 138, 106, 0.12);
  font-size: 12px;
}

.cutlist-optimizer-summary span,
.cutlist-optimizer-summary small {
  color: var(--muted);
  font-size: 12px;
}

.cutlist-optimizer-settings {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.cutlist-optimizing-modal {
  align-items: center;
  text-align: center;
}

.hourglass-loader {
  width: 34px;
  height: 46px;
  border: 3px solid var(--secondary);
  border-top-color: var(--orange);
  border-bottom-color: var(--orange);
  border-radius: 18px;
  animation: hourglass-spin 1.1s ease-in-out infinite;
}

@keyframes hourglass-spin {
  0%, 35% { transform: rotate(0deg); }
  70%, 100% { transform: rotate(180deg); }
}

.cutlist-plan {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.cutlist-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
}

.cutlist-plan-board {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 120px;
  border: 2px solid #303030;
  background:
    linear-gradient(90deg, rgba(48, 48, 48, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(48, 48, 48, 0.05) 1px, transparent 1px),
    #f8f5ef;
  background-size: 24px 24px;
}

.cutlist-plan-usable {
  position: absolute;
  border: 1px dashed rgba(177, 36, 26, 0.5);
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.cutlist-plan-part {
  position: absolute;
  display: grid;
  min-width: 18px;
  min-height: 18px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #3e5f73;
  background: rgba(74, 111, 165, 0.24);
  color: #203a5e;
  text-align: center;
}

.cutlist-plan-part strong {
  font-size: 11px;
  line-height: 13px;
}

.cutlist-plan-part small {
  max-width: 100%;
  padding: 0 2px;
  color: #203a5e;
  font-size: 8px;
  line-height: 10px;
}

.cutlist-plan-part em {
  color: #203a5e;
  font-size: 8px;
  font-style: normal;
  line-height: 10px;
}

.cutlist-a4 {
  width: 100%;
  margin: 0 auto 18px;
  padding: 12px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #ffffff;
  color: #202020;
  box-shadow: var(--shadow);
}

.cutlist-title-block {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.cutlist-title-main {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #202020;
}

.cutlist-title-main h2 {
  font-size: 22px;
  line-height: 28px;
}

.cutlist-title-main strong {
  color: #202020;
  font-size: 12px;
}

.cutlist-title-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.cutlist-title-grid label {
  display: grid;
  gap: 3px;
  color: #555555;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.cutlist-title-grid input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #b8b8b8;
  border-radius: 0;
  padding: 6px 8px;
  background: #ffffff;
}

.cutlist-ref-field {
  background: #f4f4f4 !important;
  color: #555;
  cursor: default;
  font-weight: 600;
}

.cutlist-table-wrap {
  overflow-x: auto;
}

.cutlist-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.cutlist-table th,
.cutlist-table td {
  border: 1px solid #8f8f8f;
  padding: 0;
  vertical-align: middle;
}

.cutlist-table th {
  height: 30px;
  padding: 6px;
  background: #efefef;
  font-size: 11px;
  text-align: left;
}

.cutlist-table th:nth-child(1),
.cutlist-table td:nth-child(1) {
  width: 44px;
  text-align: center;
}

.cutlist-table th:nth-child(2) {
  width: 190px;
}

.cutlist-table th:nth-child(3),
.cutlist-table th:nth-child(4) {
  width: 92px;
}

.cutlist-table th:nth-child(5) {
  width: 150px;
}

.cutlist-number {
  color: #202020;
  font-weight: 900;
}

.cutlist-table input,
.cutlist-table select {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  padding: 6px 7px;
  background: #ffffff;
  color: #202020;
  font-size: 12px;
}

.cutlist-table select {
  cursor: pointer;
}

.project-file-card {
  display: grid;
  gap: 10px;
}

.communication-expand {
  justify-self: start;
  padding: 2px 0;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
  background: none;
  text-decoration: underline;
}

.communication-empty-note {
  font-size: 12px;
}

.communication-preview {
  max-height: 120px;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow: auto;
}

.communication-preview.expanded {
  max-height: none;
}

.communication-thread-shell {
  display: grid;
  gap: 14px;
}

.communication-thread-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(45, 45, 45, 0.08);
  border-radius: 8px;
  background: #ffffff;
}

.communication-thread-header h2,
.communication-thread-header p {
  margin: 0;
}

.communication-thread-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.communication-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.communication-code {
  display: inline-block;
  margin-bottom: 6px;
  color: #2d6b73;
  font-size: 12px;
  font-weight: 900;
}

.communication-thread {
  display: grid;
  gap: 12px;
}

.communication-message {
  display: grid;
  width: min(88%, 680px);
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(45, 45, 45, 0.08);
  border-radius: 8px;
  background: #ffffff;
}

.communication-message.incoming {
  justify-self: start;
  border-left: 4px solid #2d6b73;
}

.communication-message.outgoing {
  justify-self: end;
  border-right: 4px solid #6f4a7e;
  background: #f8f5fa;
}

.communication-message h3 {
  margin: 0;
  font-size: 14px;
}

.project-email-modal-backdrop {
  z-index: 90;
}

.project-email-error {
  color: #b3401f;
}

.communication-message-head,
.email-capture-address {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.communication-message-head > div {
  display: grid;
  gap: 2px;
}

.communication-message-head small,
.communication-direction {
  color: var(--muted);
  font-size: 11px;
}

.communication-direction {
  font-weight: 800;
}

.communication-note {
  margin-top: 8px;
}

.communication-notes-section {
  margin-top: 14px;
}

.email-capture-address {
  padding: 12px;
  border-radius: 8px;
  background: rgba(45, 107, 115, 0.08);
}

.email-capture-setup {
  display: grid;
  gap: 14px;
}

.email-capture-setup h2,
.email-capture-setup h3,
.email-capture-setup p {
  margin: 0;
}

.email-capture-benefit,
.email-code-explainer,
.email-capture-result {
  display: grid;
  gap: 5px;
  padding: 13px;
  border-radius: 8px;
}

.email-capture-benefit {
  border-left: 4px solid #2d6b73;
  background: rgba(45, 107, 115, 0.08);
}

.email-code-explainer {
  background: rgba(111, 74, 126, 0.08);
}

.email-capture-result {
  border-left: 4px solid #5d7c57;
  background: rgba(90, 138, 106, 0.1);
}

.email-capture-benefit p,
.email-code-explainer p,
.email-capture-result p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.email-capture-address > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.email-capture-address strong {
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: clamp(11px, 3vw, 15px);
  line-height: 1.4;
}

.email-capture-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.email-capture-status-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border-radius: 8px;
  background: rgba(45, 107, 115, 0.08);
}

.email-capture-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.email-capture-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.email-capture-status-badge.connected {
  background: rgba(90, 138, 106, 0.18);
  color: #3d6a49;
}

.email-capture-status-badge.disconnected {
  background: rgba(196, 130, 60, 0.18);
  color: #a1601f;
}

@media (max-width: 640px) {
  .communication-thread-header {
    display: grid;
  }

  .communication-thread-header .primary-button {
    width: 100%;
  }

  .communication-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .communication-message {
    width: 94%;
  }
}

.production-spec-card,
.production-section-card {
  gap: 14px;
}

.production-spec-grid {
  display: grid;
  gap: 12px;
}

.production-spec-grid textarea {
  min-height: 86px;
}

.supplier-order-list {
  display: grid;
  gap: 10px;
}

.supplier-order-group {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.supplier-order-head {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.supplier-order-head span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.supplier-order-head strong {
  font-size: 16px;
  line-height: 22px;
}

.supplier-order-head small {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.supplier-order-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 12px;
}

.disabled-link {
  display: grid;
  min-height: 44px;
  place-items: center;
  opacity: 0.6;
}

.supplier-call-list {
  display: grid;
  gap: 0;
  margin: 0 14px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.supplier-call-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.supplier-call-row:last-child {
  border-bottom: 0;
}

.supplier-call-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 17px;
}

.compact-order-list {
  margin: 0 14px 14px;
}

.finance-editor-card,
.finance-file-card {
  gap: 14px;
}

.finance-line-list {
  display: grid;
  gap: 8px;
}

.finance-line-row {
  display: grid;
  grid-template-columns: 1fr 76px 96px;
  gap: 8px;
}

.finance-line-row input {
  min-width: 0;
}

.finance-sync-fields {
  padding: 12px;
  border-radius: 8px;
  background: rgba(96, 125, 139, 0.12);
}

.finance-document-preview {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.finance-doc-head,
.finance-doc-meta,
.finance-doc-totals {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.finance-doc-head img {
  max-width: 150px;
  max-height: 70px;
  object-fit: contain;
}

.finance-doc-head strong {
  display: block;
  font-size: 22px;
  text-align: right;
}

.finance-doc-head span,
.finance-doc-head small {
  display: block;
  text-align: right;
}

.finance-doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.finance-doc-table th,
.finance-doc-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.finance-doc-totals {
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .finance-line-row {
    grid-template-columns: 1fr;
  }

  .finance-doc-head,
  .finance-doc-meta {
    display: grid;
  }
}

.cutlist-table input:focus,
.cutlist-table select:focus,
.cutlist-title-grid input:focus {
  outline: 2px solid var(--secondary);
  outline-offset: -2px;
}

@media (min-width: 390px) {
  .workshop-tools-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workshop-tool-inputs {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) {
  .screen.cutlist-screen {
    padding-right: 24px;
    padding-left: 24px;
  }

  .cutlist-a4 {
    width: 210mm;
    min-height: 297mm;
    padding: 14mm;
  }

  .cutlist-toolbar {
    grid-template-columns: minmax(220px, 1fr) repeat(6, auto);
    align-items: end;
  }

  .cutlist-title-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .cutlist-title-grid label:nth-child(7) {
    grid-column: span 2;
  }

  .cutlist-table {
    min-width: 0;
  }
}

@media print {
  .top-shell,
  .cutlist-toolbar,
  .nav,
  .cutlist-optimizer-settings,
  .cutlist-material-prompt,
  .cutlist-screen .back-hq-button {
    display: none !important;
  }

  .screen,
  .screen-inner {
    width: 210mm !important;
    min-height: auto;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .cutlist-a4 {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 10mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .cutlist-a4:last-of-type {
    break-after: auto;
    page-break-after: auto;
  }

  body.print-cutlist-only .cutlist-optimizer-summary {
    display: none !important;
  }

  body.print-optimizer-only .cutlist-a4,
  body.print-optimizer-only .cutlist-save-status,
  body.print-optimizer-only datalist {
    display: none !important;
  }

  body.print-optimizer-only .cutlist-optimizer-summary {
    display: grid !important;
    gap: 8mm;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  body.print-optimizer-only .cutlist-plan {
    break-after: page;
    page-break-after: always;
    border-color: #222222;
    box-shadow: none;
  }

  body.print-optimizer-only .cutlist-plan:last-of-type {
    break-after: auto;
    page-break-after: auto;
  }
}

.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 -8px 20px rgba(45, 45, 45, 0.12);
  backdrop-filter: blur(12px);
}

/* Equal columns for however many buttons there are, rather than a fixed five.
   It was still set to five after Leads and Projects became one Work button,
   which left the four sitting in the first four fifths with a gap on the
   right instead of spread evenly across the bar. */
.nav-inner {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  justify-content: center;
  gap: 6px;
  width: min(100%, 430px);
  margin: 0 auto;
}

.nav-item {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 16px;
  /* No opacity reduction — icons stay full brightness on every page */
}

/* The page you are on. Marked rather than greyed out: a greyed button reads
   as broken or unavailable, and this one is neither — it is simply where you
   already are. The others step back instead, so the one you are on is the one
   that stands out and there is nothing to press. */
.nav-item.active {
  color: var(--primary);
  font-weight: 900;
}

.nav-item.active .nav-icon {
  box-shadow: 0 0 0 3px rgba(45, 45, 45, 0.45);
}

.nav-item:not(.active) .nav-icon {
  opacity: 0.62;
}

.nav-item:not(.active) {
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(45, 45, 45, 0.42);
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.modal {
  width: min(100%, 430px);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-bottom));
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

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

.quick-add-option {
  display: grid;
  min-width: 0;
  min-height: 118px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 12px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  text-align: center;
}

.quick-add-option > span:last-child {
  display: grid;
  gap: 3px;
}

.quick-add-option small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.quick-add-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  background: var(--secondary);
}

.quick-add-icon svg {
  width: 21px;
  height: 21px;
}

.full-action-list {
  max-height: 65vh;
  overflow-y: auto;
}

.schedule-modal {
  max-height: min(88vh, 720px);
}

.modal-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.modal-close {
  min-height: 38px;
  padding: 8px 10px;
}

.onboarding-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(45, 45, 45, 0.36);
}

.onboarding-card {
  width: min(100%, 520px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(45, 45, 45, 0.18);
}


.onboarding-kicker {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.onboarding-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
}

.onboarding-card p {
  margin: 0;
  color: var(--muted);
  line-height: 22px;
}

.onboarding-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.onboarding-actions {
  justify-content: stretch;
}

.onboarding-actions button {
  flex: 1;
}


.onboarding-highlight {
  position: relative;
  z-index: 45;
  outline: 3px solid rgba(54, 101, 72, 0.85);
  outline-offset: 6px;
  box-shadow: 0 0 0 10px rgba(54, 101, 72, 0.16);
  animation: onboarding-focus-pulse 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {

  .onboarding-highlight {
    animation: none;
  }
}

@keyframes onboarding-focus-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 8px rgba(54, 101, 72, 0.12);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(54, 101, 72, 0.2);
  }
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

@media (min-width: 760px) {
  .screen {
    padding-top: 0;
  }

  .screen-inner {
    width: min(100%, 760px);
  }

  .tile-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .pipeline-column {
    flex-basis: 340px;
  }

  .onboarding-backdrop {
    place-items: center;
  }
}

/* ── Order cards ─────────────────────────────── */
.order-card {
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 8px;
}

.order-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.order-tick {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: #ffffff;
}

.order-tick.checked {
  border-color: var(--green);
  background: var(--green);
}

.order-tick svg {
  width: 14px;
  height: 14px;
}

.order-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.order-copy strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-copy small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  color: #ffffff;
}

.ordered-badge {
  background: var(--green);
}

.order-card .todo-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}

.order-card.editing {
  border: 2px solid var(--primary);
}

.order-edit-form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.order-add-form {
  margin-bottom: 14px;
}

.order-add-form h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

/* ── Materials page ──────────────────────────── */
.materials-section {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  margin-bottom: 12px;
}

.materials-section-title {
  padding: 12px 14px 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
}

.material-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.material-row:last-child {
  border-bottom: none;
}

.material-tick {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: #ffffff;
}

.material-tick.checked {
  border-color: var(--green);
  background: var(--green);
}

.material-tick svg {
  width: 12px;
  height: 12px;
}

.material-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.material-info strong {
  font-size: 13px;
}

.material-info small {
  color: var(--muted);
  font-size: 11px;
}

.material-cost {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.suppliers-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.suppliers-link-card h3 {
  font-size: 14px;
}

/* ── Suppliers page ──────────────────────────── */
.supplier-card {
  width: 100%;
  gap: 6px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.supplier-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.supplier-chevron {
  color: var(--muted);
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
}

.supplier-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.supplier-link {
  display: block;
  color: var(--secondary);
  font-size: 13px;
  text-decoration: underline;
}

/* ── Supplier detail ─────────────────────────── */
.supplier-detail-card {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  margin-bottom: 12px;
}

.supplier-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.supplier-contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.supplier-detail-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.supplier-detail-row:last-child {
  border-bottom: none;
}

.supplier-detail-label {
  flex: 0 0 90px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 1px;
}

.supplier-detail-section {
  border-top: 1px solid var(--border);
}

.supplier-detail-section h3 {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.danger {
  color: #c0392b;
}

.materials-section-title.standalone {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  padding: 4px 0 8px;
  margin-bottom: 0;
}

.order-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

/* With a back chevron there are three things across the row: the chevron, the
   title, and the brand. Home builds its header its own way, so it takes the
   same rule and the chevron behaves the same there as everywhere else. */
.title-row.has-back,
.home-header.has-back {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
}

/* A button that says what it does (Dean, 5 November 2026: the chevron alone
   was too small to see or to press on a desktop): the chevron and "Back" in
   an outlined pill, sized for a thumb, never squeezed by a long title. */
.header-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-height: 40px;
  padding: 0 14px 0 8px;
  border: 1.5px solid var(--border, #d8d4cc);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.header-back svg { width: 20px; height: 20px; flex: none; }
.header-back:hover { border-color: var(--text); }
.header-back:active { background: rgba(45, 45, 45, 0.08); }
.header-back:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* A title too long for the room left beside the back button and the logo
   gets smaller, then wraps to two lines, never under either. */
.title-row.has-back .page-title-block h1,
.home-header.has-back .page-title-block h1 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.page-title-block h1.is-longer { font-size: 15px; line-height: 1.2; }
@media (max-width: 480px) {
  /* With Back showing on a phone, the word Benchberry gives its room to the
     title; the leaf and berry (your assistant) stay. */
  .title-row.has-back .internal-brand,
  .home-header.has-back .internal-brand { display: none; }
}
@media (max-width: 420px) {
  .header-back { padding: 0 10px 0 6px; font-size: 14px; }
  .title-row.has-back .page-title-block h1 { font-size: 16px; line-height: 1.2; }
  .title-row.has-back .page-title-block h1.is-longer { font-size: 14px; }
}

.header-brand-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

/* Berry lives beside the logo on every page - same spot, always reachable. */
.flow-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* The assistant is the leaf and berry from the logo (Dean, 19 October 2026):
   no name, only the picture, breathing gently all the time so a maker always
   knows it is there to tap. */
.flow-berry {
  display: block;
  width: auto;
  height: 40px;
  filter: drop-shadow(0 2px 4px rgba(108, 36, 73, 0.3));
  animation: berry-breathe 2.8s ease-in-out infinite;
  transform-origin: 50% 70%;
}

@keyframes berry-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 2px 4px rgba(108, 36, 73, 0.3)); }
  /* Twice the swell it had, so it reads on a phone (Dean, 20 October 2026). */
  50% { transform: scale(1.16); filter: drop-shadow(0 4px 14px rgba(140, 51, 93, 0.6)); }
}

.flow-button:active {
  transform: scale(0.95);
}

/* Pulses on the first opening of a day that has work waiting. Settles once she
   has been opened, and starts again tomorrow if there is more to do. */
/* With work waiting, the berry breathes a little quicker and deeper. */
.flow-button.pulsing .flow-berry {
  animation-duration: 1.6s;
}

@keyframes flow-button-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(140, 51, 93, 0.45); }
  50% { box-shadow: 0 0 0 9px rgba(140, 51, 93, 0); }
}

/* Berry opens over the current page, so the user never loses their place. */
/* No dimming. Berry speaks over the page rather than taking it over, and
   darkening everything made a short spoken line feel like a modal interruption.
   The layer still catches a tap outside her panel to close it. */
.flow-overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
}

/* Compact, in the berry's colours. She speaks and navigates, so there is
   no transcript to make room for - only a change awaiting confirmation. */
.flow-overlay {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 420px);
  max-height: 60vh;
  margin: 0 10px 10px;
  padding: 14px;
  border-radius: 16px;
  background: #6d3f86;
  color: #fff;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
  animation: flow-overlay-in 220ms ease-out;
}

.flow-overlay .flow-pending-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

/* The confirmation card stays light so it reads as a document to check. */
.flow-overlay .flow-action {
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}

@keyframes flow-overlay-in {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.flow-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.flow-overlay-head strong {
  font-size: 16px;
}

.flow-overlay-head small {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.flow-overlay-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.flow-overlay-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  align-content: start;
}

.flow-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  background: #d33a3a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .flow-button.pulsing { animation: none; }
  .flow-berry { animation: none; }
}

.page-help-button {
  display: grid;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(54, 101, 72, 0.42);
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(45, 45, 45, 0.08);
}

.page-help-button:hover,
.page-help-button:focus-visible {
  background: rgba(90, 138, 106, 0.12);
  border-color: var(--primary);
}

.required-setup-screen {
  min-height: 100vh;
  padding: 24px 14px;
  background: #f4f5f2;
}

.required-setup-inner {
  width: min(100%, 650px);
  margin: 0 auto;
}

.required-setup-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.required-setup-brand .buildflow-header-logo {
  width: min(300px, 76vw);
  height: 96px;
}

.required-setup-card {
  width: 100%;
  gap: 18px;
  padding: clamp(20px, 5vw, 34px);
}

.required-setup-card h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
}

.required-setup-card > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.required-setup-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.required-setup-benefits {
  display: grid;
  gap: 10px;
}

.required-setup-benefits > div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-left: 4px solid var(--secondary);
  background: rgba(90, 138, 106, 0.09);
}

.required-setup-benefits span,
.required-setup-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 19px;
}

.required-setup-address {
  margin: 0;
}

.forwarding-test-subject {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px dashed rgba(54, 101, 72, 0.5);
  border-radius: 6px;
  background: rgba(90, 138, 106, 0.08);
  overflow-wrap: anywhere;
}

.forwarding-test-subject small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.button-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.success-notice {
  border-color: rgba(54, 101, 72, 0.45);
  background: rgba(90, 138, 106, 0.12);
}

.title-row h1 {
  min-width: 0;
}

.page-title-block {
  display: grid;
  min-width: 0;
  gap: 1px;
}

/* Words break only where one alone cannot fit, and a long title is set
   smaller, so "Materials & Fittings" never reads "Material / s" (Dean,
   21 October 2026). */
.page-title-block h1 {
  overflow-wrap: break-word;
  hyphens: auto;
}
.page-title-block h1.is-long {
  font-size: 17px;
}

/* Its own line under the title, the full width of the header, so a second
   button can never run under the Berry button on a narrow phone. It wraps
   rather than overflowing if a page ever carries more than two. */
.page-action-row {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}

.page-action-row .manage-column-button {
  flex: 0 0 auto;
}

.page-company {
  overflow: hidden;
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-read-panel {
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.contact-read-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.contact-read-row:last-child {
  border-bottom: 0;
}

.contact-read-row > span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.copyable-value {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
  user-select: text;
}

.danger-button {
  background: #b1241a;
}

.ghost-button.danger {
  color: #b1241a;
}

.project-hero-main {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.project-hero-heading,
.project-hero-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-hero-heading h2,
.project-hero-meta p {
  min-width: 0;
  margin: 0;
}

.project-hero-heading h2 {
  font-size: 18px;
  line-height: 1.2;
}


.project-hero-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.hero-action {
  flex: 1;
  padding: 9px 6px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.hero-action:active {
  transform: scale(0.97);
}

.hero-action--edit {
  background: rgba(255, 255, 255, 0.85);
}

.project-edit-group {
  margin: 6px 0 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.project-edit-modal {
  max-height: 85vh;
  overflow-y: auto;
}

.project-hero-value {
  flex: 0 0 auto;
  font-size: 17px;
  line-height: 1.2;
}

/* The project name sits directly under the customer name, so it needs to hold
   its own rather than read as small print. */
.project-hero-meta p {
  color: rgba(45, 45, 45, 0.88);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.project-hero-meta .badge {
  flex: 0 0 auto;
}

/* ── Cashflow page ───────────────────────────────────────────────────── */
.period-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.period-btn {
  padding: 9px 4px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.period-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.cf-card {
  display: grid;
  padding: 0;
  overflow: hidden;
  margin-bottom: 12px;
}

.cf-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cf-card-head h2 {
  font-size: 16px;
}

.cf-card-head p {
  font-size: 12px;
  margin-top: 2px;
}

.cf-total {
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.cf-incoming {
  color: var(--primary);
}

.cf-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}

.cf-line:last-of-type {
  border-bottom: none;
}

.cf-line-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cf-line-info strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-line-info small {
  color: var(--muted);
  font-size: 11px;
}

.cf-line-amount {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.cf-line-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.overhead-line.paused {
  opacity: 0.58;
  background: rgba(96, 125, 139, 0.06);
}

.overhead-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.overhead-actions .ghost-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
}

.cf-delete-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(177,36,26,0.1);
  color: #b1241a;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.cf-empty {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
}

.cf-add-form {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.overhead-form {
  background: rgba(255, 255, 255, 0.68);
}

.overhead-recovery-card {
  padding-bottom: 14px;
}

.overhead-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.overhead-metrics div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.overhead-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.overhead-metrics strong {
  color: var(--text);
  font-size: 20px;
}

.overhead-hours-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 0 16px;
}

.overhead-recovery-card > .field-help {
  padding: 10px 16px 0;
}

@media (max-width: 620px) {
  .overhead-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .overhead-line .cf-line-right {
    width: 100%;
    justify-content: space-between;
  }

  .overhead-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .overhead-metrics,
  .overhead-hours-form {
    grid-template-columns: 1fr;
  }
}

.cf-summary {
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 12px;
}

.cf-summary.cf-positive {
  border-color: rgba(90,138,106,0.4);
  background: rgba(90,138,106,0.08);
}

.cf-summary.cf-negative {
  border-color: rgba(177,36,26,0.3);
  background: rgba(177,36,26,0.06);
}

.cf-summary-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.cf-net {
  display: block;
  font-size: 36px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 8px;
}

.cf-summary.cf-positive .cf-net { color: var(--primary); }
.cf-summary.cf-negative .cf-net { color: #b1241a; }

.overhead-metrics small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.trigger-editor-mini {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.trigger-editor-mini label,
.compact-field span {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.trigger-editor-mini input,
.trigger-editor-mini select,
.trigger-editor-mini textarea,
.compact-field select,
.compact-field input {
  width: 100%;
  min-height: 38px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

.trigger-editor-mini textarea {
  resize: vertical;
}

.trigger-action-card {
  border-color: rgba(57, 95, 148, 0.25);
  background: rgba(255, 255, 255, 0.86);
}

/* Side by side, so the card takes less of the screen and more of the tiles
   below it show (Dean, 21 October 2026). */
.trigger-action-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.trigger-action-card { gap: 6px; padding: 12px 14px; }
.trigger-action-card h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.trigger-action-card p { margin: 0; }
.trigger-action-stack .primary-button,
.trigger-action-stack .ghost-button { min-height: 44px; }

.reminder-grid {
  display: grid;
  gap: 8px;
}

.cal-event-dot {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--purple);
  box-shadow: 0 0 0 2px #fff;
}

.cf-mini-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.cf-mini-totals span {
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.cf-line.paid {
  margin-inline: -6px;
  padding-inline: 6px;
  border-radius: 8px;
  background: rgba(90, 138, 106, 0.14);
}

.email-template-group {
  gap: 10px;
}

.email-template-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.email-template-row-text {
  display: grid;
  gap: 2px;
  /* The subject can be long, and it must wrap rather than push the buttons off
     the edge of a phone. */
  min-width: 0;
}

.email-template-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.email-template-row-actions .ghost-button {
  padding: 4px 10px;
  font-size: 12px;
}

.email-template-row small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.cal-day {
  position: relative;
}

.trigger-editor-note {
  color: var(--secondary);
  font-size: 11px;
  font-weight: 900;
}

.reminder-today-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.reminder-today-row .field {
  flex: 1;
  margin: 0;
}

.reminder-date-row {
  display: grid;
  gap: 8px;
}

.trigger-outcome-actions {
  display: grid;
  gap: 8px;
}

.user-settings-form {
  gap: 14px;
}

.settings-section-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.settings-section-nav button {
  min-height: 40px;
  padding: 8px;
  border: 1px solid rgba(45, 45, 45, 0.08);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 900;
}

.settings-section-nav button.active {
  color: #ffffff;
  background: var(--secondary);
}

.user-settings-form > section {
  display: none;
}

/* Each section declares which tab it belongs to, so adding or reordering
   sections can never scramble the tabs. This previously matched by position
   (nth-of-type) and broke the moment a section was inserted. */
.user-settings-form[data-active-section="profile"] > section[data-section="profile"],
.user-settings-form[data-active-section="connections"] > section[data-section="connections"],
.user-settings-form[data-active-section="account"] > section[data-section="account"],
.user-settings-form[data-active-section="preferences"] > section[data-section="preferences"],
.user-settings-form[data-active-section="materials"] > section[data-section="materials"],
.user-settings-form[data-active-section="design"] > section[data-section="design"],
.user-settings-form[data-active-section="finance"] > section[data-section="finance"],
.user-settings-form[data-active-section="notifications"] > section[data-section="notifications"],
.user-settings-form[data-active-section="workflow"] > section[data-section="workflow"] {
  display: grid;
}

.settings-save-message {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 0;
}
.settings-save-message.ok { background: #dcebe1; color: #1f3a33; }
.settings-save-message.err { background: #f7dede; color: #c03030; }

.settings-save-button {
  width: 100%;
}

.settings-signout-row {
  display: flex;
  justify-content: center;
  padding: 24px 0 8px;
}

.settings-signout-btn {
  color: var(--muted);
  font-size: 14px;
}

.settings-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

/* Grid and flex children default to min-width:auto, so a select with a long
   option (a timezone, say) can force its track wider than the card and push the
   whole panel off centre. Letting them shrink keeps everything inside. */
.settings-two-col > *,
.field,
.voice-choice-row > * {
  min-width: 0;
}

.field select,
.field input,
.field textarea {
  max-width: 100%;
}

/* Long option text is truncated rather than allowed to stretch the layout. */
.field select {
  text-overflow: ellipsis;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.settings-toggle.locked-toggle {
  align-items: flex-start;
  border-color: rgba(113, 121, 114, 0.35);
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
}

.settings-toggle.locked-toggle input {
  accent-color: var(--muted);
  opacity: 0.65;
}

.settings-toggle.locked-toggle span {
  display: grid;
  gap: 3px;
}

.settings-toggle.locked-toggle small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

#buildflowEmail[readonly] {
  color: var(--secondary);
  background: #ffffff;
  font-weight: 800;
}

.business-logo-img,
.business-logo-placeholder {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.business-logo-img {
  object-fit: contain;
  padding: 5px;
}

.business-logo-placeholder {
  color: var(--primary);
  font-size: 15px;
  font-weight: 900;
}

.logo-upload-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.logo-preview .business-logo-img,
.logo-preview .business-logo-placeholder {
  width: 64px;
  height: 64px;
}

.logo-upload-button {
  display: grid;
  min-height: 44px;
  place-items: center;
}

.trigger-choice-modal {
  gap: 12px;
}

.trigger-choice-footer {
  display: grid;
  width: 100%;
  margin-top: 4px;
}

.trigger-popup-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.action-section {
  border-color: rgba(90, 138, 106, 0.28);
  background: rgba(90, 138, 106, 0.12);
}

.delay-section {
  border-color: rgba(177, 36, 26, 0.18);
  background: rgba(177, 36, 26, 0.08);
}

.trigger-popup-heading {
  display: grid;
  gap: 2px;
}

.trigger-popup-heading strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.trigger-popup-heading span,
.trigger-template-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.trigger-template-note {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  font-weight: 800;
}

.delay-section .delay-button.primary-button {
  background: #8f4a45;
}

.delay-section .delay-button.upload-button,
.delay-section .delay-button.ghost-button {
  color: #7b332f;
  background: rgba(255, 255, 255, 0.7);
}

.notification-settings-card {
  gap: 14px;
}

.notif-delivery-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notif-delivery-current p {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
}

/* Every grid ancestor has to be allowed to shrink. One item with the default
   min-width:auto pushes its whole chain of parents wider than the screen, which
   is what made the entire card overhang. */
.user-settings-form > section,
.working-hours-block,
.working-hours-list,
.working-hours-row {
  min-width: 0;
}

.working-hours-block {
  display: grid;
  gap: 8px;
}

.working-hours-block h3 {
  margin: 0;
}

.working-hours-list {
  display: grid;
  gap: 6px;
}

.working-hours-row {
  display: grid;
  /* Time inputs have a wide intrinsic minimum, so the tracks must be allowed to
     shrink or the row runs off the side of the card. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 84px) minmax(0, 84px);
  align-items: center;
  gap: 6px;
}

.working-hours-row input[type="time"] {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 4px 2px;
  font-size: 13px;
  text-align: center;
}

.working-hours-row .settings-toggle {
  min-width: 0;
  gap: 6px;
}

.working-hours-row .settings-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Times stay visible but recede on a day they are not working. */
.working-hours-row.off input[type="time"] {
  opacity: 0.45;
}

/* Below this the three-across layout stops being honest about how much room a
   time picker needs, so the day gets its own line with the times beneath. */
@media (max-width: 430px) {
  .working-hours-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "day day"
      "start end";
    gap: 4px 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }
  .working-hours-row .settings-toggle { grid-area: day; }
  .working-hours-row input[type="time"]:nth-of-type(1) { grid-area: start; }
  .working-hours-row input[type="time"]:nth-of-type(2) { grid-area: end; }
  .working-hours-row input[type="time"] {
    font-size: 14px;
  }
}

.notification-day-list {
  display: grid;
  gap: 8px;
}

.notification-day-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
  align-items: center;
}

.notification-day-row input[type="time"] {
  width: 100%;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 390px) {
  .notification-day-row {
    grid-template-columns: 1fr;
  }
}



.notification-break-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(96, 125, 139, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
}


.screen.home .appbar {
  min-height: 72px;
  align-items: center;
}

.home-logo-bar {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  padding-bottom: 4px;
}

.home-logo-bar .internal-brand {
  grid-column: 2;
}

.home-logo-bar > .business-logo-img,
.home-logo-bar > .business-logo-placeholder {
  grid-column: 3;
  justify-self: end;
}

.screen.home .appbar > .business-logo-img,
.screen.home .appbar > .business-logo-placeholder {
  width: 64px;
  height: 64px;
  aspect-ratio: 1;
  align-self: center;
  object-fit: contain;
  border-radius: 14px;
}

.todo-date-field {
  margin-top: 8px;
}

.todo-due {
  color: var(--secondary);
  font-weight: 800;
}

.todo-due.overdue,
.todo-item.overdue .todo-copy strong {
  color: #9f332b;
}

.todo-item.overdue {
  border-color: rgba(177, 36, 26, 0.22);
  background: rgba(255, 218, 214, 0.42);
}

.payment-settings-card {
  gap: 12px;
}

.payment-stage-list {
  display: grid;
  gap: 8px;
}

.payment-stage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 8px;
}

.payment-stage-row input {
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-weight: 800;
}


.schedule-key {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 0 2px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.schedule-key span {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.schedule-key b,
.stage-pill,
.bar-pay {
  display: inline-grid;
  min-width: 14px;
  height: 14px;
  place-items: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-size: 9px;
  font-weight: 900;
}

.bar-pay {
  margin-left: auto;
}

.schedule-bar,
.schedule-block {
  background: var(--project-colour, var(--secondary));
}


.schedule-day-modal,
.schedule-day-list,
.schedule-event-form {
  display: grid;
  gap: 10px;
}

.schedule-day-row {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  text-align: left;
}

.schedule-day-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cal-day {
  border: 0;
  border-right: 1px solid var(--border);
  text-align: left;
}

.cal-day:last-child {
  border-right: 0;
}


.updates-card {
  padding: 0 4px 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.updates-logo-burst {
  position: relative;
  display: grid;
  min-height: 188px;
  place-items: center;
  overflow: visible;
  isolation: isolate;
}

.updates-logo-burst img {
  position: relative;
  z-index: 2;
  width: min(260px, 76vw);
  height: auto;
  opacity: 0;
  transform: scale(0.18) rotate(-8deg);
  filter: drop-shadow(0 12px 18px rgba(45, 45, 45, 0.2));
  will-change: transform, opacity;
}

.updates-logo-burst.is-visible img {
  animation: logo-pop 2.1s cubic-bezier(0.2, 0.85, 0.22, 1) both;
}

.updates-logo-burst span {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #698862;
  opacity: 0;
  transform:
    translate(-50%, -50%)
    rotate(calc(var(--i) * 30deg))
    translateX(0)
    scale(0.2);
  animation-delay: calc(var(--i) * 70ms);
  will-change: transform, opacity;
}

.updates-logo-burst.is-visible span {
  animation: logo-spark 2.1s ease-out both;
  animation-delay: calc(var(--i) * 70ms);
}

.updates-logo-burst span:nth-child(odd) {
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: #6c2f7f;
}

.updates-logo-burst span:nth-child(3n) {
  width: 12px;
  height: 12px;
  background: #172a26;
}

.updates-copy {
  display: grid;
  gap: 6px;
  padding: 0 10px;
}

.updates-link {
  width: fit-content;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 900;
  text-decoration: underline;
}

@keyframes logo-pop {
  0% {
    opacity: 0;
    transform: scale(0.18) rotate(-8deg);
  }
  18% {
    opacity: 1;
    transform: scale(1.18) rotate(2deg);
  }
  34% {
    transform: scale(0.92) rotate(-1deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.03) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes logo-spark {
  0%, 8% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--i) * 30deg))
      translateX(0)
      scale(0.2);
  }
  24% {
    opacity: 0.95;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--i) * 30deg))
      translateX(calc(72px + (var(--i) * 3px)))
      scale(1);
  }
  62% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(calc(var(--i) * 30deg))
      translateX(calc(106px + (var(--i) * 3px)))
      scale(0.35);
  }
  100% {
    opacity: 0;
  }
}


.supplier-category-card,
.materials-library-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.category-chip-grid {
  display: grid;
  gap: 8px;
}

.category-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.category-chip input,
.category-add-row input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.78);
}

.category-chip button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #ffffff;
  background: #b1241a;
  font-weight: 900;
}

.category-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.material-library-card {
  display: grid;
  gap: 8px;
}

.material-library-card strong,
.material-library-card small {
  display: block;
}

.material-library-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.stock-pill {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  color: #ffffff;
  background: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.compact-form {
  padding: 0;
}

.category-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
}

.category-filter {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.66);
  font-size: 12px;
  font-weight: 900;
}

.category-filter.active {
  color: #ffffff;
  background: var(--secondary);
}

.compact-list,
.materials-compact-list {
  display: grid;
  gap: 8px;
}

.material-library-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.material-detail-pop {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.material-detail-pop p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.materials-action-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.materials-action-card h3 {
  font-size: 15px;
  margin-bottom: 3px;
}

.supplier-name-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 2px;
}

.supplier-name-card {
  padding: 12px 14px;
}

.supplier-name-card .supplier-card-head h3 {
  font-size: 14px;
}

.material-add-project-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.62);
}

.library-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  padding: 0 16px 12px;
}

.schedule-action-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
}

.supplier-action-row {
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
}

.schedule-project-picker .settings-list {
  max-height: 54vh;
  overflow-y: auto;
}

.compact-top-shell h1 {
  font-size: 22px;
  line-height: 28px;
}

/* The boards use the same title row as every other page now, so they need
   nothing of their own here. */

.start-position-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(57, 95, 148, 0.18);
  background: rgba(255, 255, 255, 0.55);
}

.start-position-panel h3 {
  font-size: 14px;
}

.stage-select-panel.hidden {
  display: none;
}

.internal-brand {
  display: flex;
  width: auto;
  flex: 0 0 auto;
  justify-content: flex-end;
  padding-bottom: 0;
  line-height: 1;
}

.screen.home .internal-brand,
.home-brand {
  padding-bottom: 4px;
}

.buildflow-header-logo {
  display: block;
  width: 162px;
  height: 54px;
  object-fit: contain;
}

.compact-top-shell .buildflow-header-logo,
.schedule-top-shell .buildflow-header-logo {
  width: 177px;
  height: 60px;
}

.home-brand .buildflow-header-logo {
  width: 177px;
  height: 60px;
}

.auth-brand {
  justify-content: center;
}

.auth-brand .buildflow-header-logo {
  width: min(320px, 82vw);
  height: 116px;
}

.header-right {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.home-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.home-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
}

.home-title-row > .business-logo-img,
.home-title-row > .business-logo-placeholder {
  width: 64px;
  height: 64px;
  aspect-ratio: 1;
  justify-self: end;
  object-fit: contain;
  border-radius: 14px;
}

@media (max-width: 520px) {
  .header-brand-group {
    gap: 6px;
  }

  .header-brand-group .buildflow-header-logo,
  .compact-top-shell .header-brand-group .buildflow-header-logo,
  .schedule-top-shell .header-brand-group .buildflow-header-logo,
  .header-brand-group .home-brand .buildflow-header-logo {
    width: 132px;
    height: 48px;
  }

  .required-setup-card h1 {
    font-size: 26px;
  }
}

@media (max-width: 380px) {
  .header-brand-group .buildflow-header-logo,
  .compact-top-shell .header-brand-group .buildflow-header-logo,
  .schedule-top-shell .header-brand-group .buildflow-header-logo,
  .header-brand-group .home-brand .buildflow-header-logo {
    width: 118px;
  }
}

/* ===== Launch splash ===== */

#launch-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #fdfbf7;
  transition: opacity 420ms ease;
}

#launch-splash.splash-leaving {
  opacity: 0;
  pointer-events: none;
}

.launch-splash-burst {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.launch-splash-burst img {
  position: relative;
  z-index: 2;
  width: min(340px, 80vw);
  height: auto;
  filter: drop-shadow(0 12px 18px rgba(45, 45, 45, 0.2));
  /* The short delay leaves the screen empty for a beat first, so the logo pops
     into existence rather than being there from the outset. `both` holds the
     invisible first frame during that wait. */
  animation: logo-pop 1.6s cubic-bezier(0.2, 0.85, 0.22, 1) 300ms both;
  will-change: transform, opacity;
}

.launch-splash-burst span {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #698862;
  opacity: 0;
  animation: logo-spark 1.6s ease-out both;
  /* Same 300ms blank beat as the logo, then staggered per spark. */
  animation-delay: calc(300ms + (var(--i) * 55ms));
  will-change: transform, opacity;
}

.launch-splash-burst span:nth-child(odd) {
  width: 8px;
  height: 18px;
  background: #8c335d;
}

.launch-splash-burst span:nth-child(3n) {
  width: 12px;
  height: 12px;
  background: #172a26;
}

/* ===== Screen transitions (route changes only) ===== */

.screen.screen-enter {
  animation: screen-enter 220ms ease-out both;
}

@keyframes screen-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Button press ripple ===== */

.has-ripple {
  position: relative;
  overflow: hidden;
}

.press-ripple {
  position: absolute;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.22;
  transform: scale(0);
  animation: press-ripple 480ms ease-out both;
  pointer-events: none;
}

@keyframes press-ripple {
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .launch-splash-burst img,
  .launch-splash-burst span,
  .screen.screen-enter,
  .press-ripple {
    animation: none !important;
  }
  .launch-splash-burst img {
    opacity: 1;
    transform: none;
  }
  #launch-splash {
    transition: none;
  }
}

.email-signature-preview {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ===== Task confirmation toast =====
   Feedback for completing or delaying a task. Deliberately not a modal: during
   a run through the day's list a dismissable box would mean closing one after
   every job. It sits above the nav, blocks nothing and clears itself. */

.task-toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 65;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 32px);
  max-width: 380px;
  /* Content can shrink inside the fixed shell rather than pushing it wider. */
  min-width: 0;
  padding: 11px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(45, 45, 45, 0.22);
  color: #fff;
  cursor: pointer;
  animation: task-toast-in 240ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.task-toast.is-done {
  background: var(--primary);
}

.task-toast.is-delayed {
  background: var(--secondary);
}

.task-toast-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 14px;
  line-height: 1;
}

.task-toast-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.task-toast-text strong {
  font-size: 14px;
  font-weight: 700;
}

.task-toast-text small {
  font-size: 12px;
  opacity: 0.85;
  /* Long customer names truncate instead of forcing the toast off screen. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes task-toast-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== Completion confetti =====
   Bursts from the middle of the banner and carries out across the page. It
   lives in its own fixed layer above everything so it is not clipped by the
   banner, and passes clicks straight through. */

.task-confetti {
  position: fixed;
  left: 50%;
  bottom: 104px;
  z-index: 64;
  width: 0;
  height: 0;
  pointer-events: none;
}

.task-confetti .bit {
  position: absolute;
  top: 0;
  left: 0;
  width: 9px;
  height: 14px;
  margin: -7px 0 0 -4px;
  opacity: 0;
  border-radius: 2px;
  animation: task-confetti-fly 1500ms cubic-bezier(0.15, 0.6, 0.35, 1) forwards;
}

/* Spread of directions, distances and colours. Every third piece is round and
   every fourth is small, so it does not read as a uniform pinwheel. */
.task-confetti .bit.b0 { --x: 150px; --y: -275px; --r: -380deg; background: var(--gold); animation-delay: 0ms; animation-duration: 1150ms; border-radius: 50%; }
.task-confetti .bit.b1 { --x: -253px; --y: -590px; --r: 568deg; background: var(--orange); animation-delay: 183ms; animation-duration: 2440ms; width: 6px; height: 9px; }
.task-confetti .bit.b2 { --x: 14px; --y: -232px; --r: -447deg; background: var(--purple); animation-delay: 39ms; animation-duration: 1230ms; }
.task-confetti .bit.b3 { --x: 162px; --y: -567px; --r: 576deg; background: var(--secondary); animation-delay: 155ms; animation-duration: 1931ms; border-radius: 50%; width: 11px; height: 16px; }
.task-confetti .bit.b4 { --x: -224px; --y: -353px; --r: -655deg; background: var(--green); animation-delay: 87ms; animation-duration: 1673ms; }
.task-confetti .bit.b5 { --x: 206px; --y: -317px; --r: 472deg; background: var(--gold); animation-delay: 93ms; animation-duration: 1784ms; width: 6px; height: 9px; }
.task-confetti .bit.b6 { --x: -73px; --y: -367px; --r: -512deg; background: var(--orange); animation-delay: 18ms; animation-duration: 2026ms; border-radius: 50%; }
.task-confetti .bit.b7 { --x: -85px; --y: -300px; --r: 791deg; background: var(--purple); animation-delay: 130ms; animation-duration: 1381ms; }
.task-confetti .bit.b8 { --x: 273px; --y: -457px; --r: -561deg; background: var(--secondary); animation-delay: 123ms; animation-duration: 2089ms; }
.task-confetti .bit.b9 { --x: -228px; --y: -327px; --r: 493deg; background: var(--green); animation-delay: 20ms; animation-duration: 1794ms; border-radius: 50%; }
.task-confetti .bit.b10 { --x: 66px; --y: -333px; --r: -487deg; background: var(--gold); animation-delay: 187ms; animation-duration: 1189ms; width: 11px; height: 16px; }
.task-confetti .bit.b11 { --x: 56px; --y: -436px; --r: 687deg; background: var(--orange); animation-delay: 61ms; animation-duration: 1400ms; }
.task-confetti .bit.b12 { --x: -278px; --y: -355px; --r: -524deg; background: var(--purple); animation-delay: 133ms; animation-duration: 2299ms; border-radius: 50%; }
.task-confetti .bit.b13 { --x: 147px; --y: -454px; --r: 711deg; background: var(--secondary); animation-delay: 193ms; animation-duration: 1156ms; width: 6px; height: 9px; }
.task-confetti .bit.b14 { --x: -108px; --y: -613px; --r: -636deg; background: var(--green); animation-delay: 247ms; animation-duration: 1407ms; }
.task-confetti .bit.b15 { --x: -31px; --y: -342px; --r: 761deg; background: var(--gold); animation-delay: 225ms; animation-duration: 1768ms; border-radius: 50%; }
.task-confetti .bit.b16 { --x: 263px; --y: -576px; --r: -798deg; background: var(--orange); animation-delay: 177ms; animation-duration: 2447ms; }
.task-confetti .bit.b17 { --x: -240px; --y: -466px; --r: 707deg; background: var(--purple); animation-delay: 165ms; animation-duration: 1757ms; width: 6px; height: 9px; width: 11px; height: 16px; }
.task-confetti .bit.b18 { --x: 202px; --y: -343px; --r: -628deg; background: var(--secondary); animation-delay: 155ms; animation-duration: 2051ms; border-radius: 50%; }
.task-confetti .bit.b19 { --x: -10px; --y: -566px; --r: 789deg; background: var(--green); animation-delay: 197ms; animation-duration: 1601ms; }
.task-confetti .bit.b20 { --x: -198px; --y: -327px; --r: -420deg; background: var(--gold); animation-delay: 145ms; animation-duration: 2214ms; }
.task-confetti .bit.b21 { --x: 264px; --y: -400px; --r: 572deg; background: var(--orange); animation-delay: 98ms; animation-duration: 1928ms; border-radius: 50%; }
.task-confetti .bit.b22 { --x: -237px; --y: -553px; --r: -735deg; background: var(--purple); animation-delay: 169ms; animation-duration: 2075ms; }
.task-confetti .bit.b23 { --x: 59px; --y: -216px; --r: 531deg; background: var(--secondary); animation-delay: 7ms; animation-duration: 1962ms; }
.task-confetti .bit.b24 { --x: 164px; --y: -593px; --r: -666deg; background: var(--green); animation-delay: 190ms; animation-duration: 2359ms; border-radius: 50%; width: 11px; height: 16px; }
.task-confetti .bit.b25 { --x: -276px; --y: -315px; --r: 687deg; background: var(--gold); animation-delay: 63ms; animation-duration: 2087ms; width: 6px; height: 9px; }
.task-confetti .bit.b26 { --x: 232px; --y: -256px; --r: -716deg; background: var(--orange); animation-delay: 10ms; animation-duration: 1856ms; }
.task-confetti .bit.b27 { --x: -138px; --y: -541px; --r: 386deg; background: var(--purple); animation-delay: 128ms; animation-duration: 2549ms; border-radius: 50%; }
.task-confetti .bit.b28 { --x: -110px; --y: -350px; --r: -669deg; background: var(--secondary); animation-delay: 223ms; animation-duration: 2323ms; }
.task-confetti .bit.b29 { --x: 240px; --y: -404px; --r: 392deg; background: var(--green); animation-delay: 72ms; animation-duration: 1961ms; width: 6px; height: 9px; }
.task-confetti .bit.b30 { --x: -345px; --y: -506px; --r: -520deg; background: var(--gold); animation-delay: 171ms; animation-duration: 2529ms; border-radius: 50%; }
.task-confetti .bit.b31 { --x: 163px; --y: -379px; --r: 778deg; background: var(--orange); animation-delay: 239ms; animation-duration: 2162ms; width: 11px; height: 16px; }
.task-confetti .bit.b32 { --x: 35px; --y: -603px; --r: -781deg; background: var(--purple); animation-delay: 221ms; animation-duration: 1549ms; }
.task-confetti .bit.b33 { --x: -188px; --y: -404px; --r: 727deg; background: var(--secondary); animation-delay: 215ms; animation-duration: 1735ms; border-radius: 50%; }

/* Thrown out and up, slowing to a stop, and only then fading. Movement is
   finished by 55% and the transform is identical from there to the end, so the
   piece is genuinely still while it fades - previously the last of the travel
   happened during the fade, which read as drifting off rather than settling. */
@keyframes task-confetti-fly {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(0.5); }
  6%   { opacity: 1; }
  55%  { opacity: 1; transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); }
}

/* Movement is decoration only - the words carry the meaning without it. */
@media (prefers-reduced-motion: reduce) {
  .task-toast { animation: none; }
  .task-confetti { display: none; }
}

/* ===== Touch feedback =====
   Buttons and cards press in slightly when touched. This is the one piece of
   polish that touches every interaction rather than a single moment, and on a
   phone being used in a workshop it is what makes a tap feel registered. */

/* Nav items, action tiles and activity rows already press in at 0.95 further up
   this file. These add the same feel to the buttons and cards that were missing
   it, at the same depth so the app is consistent, plus the transition those
   earlier rules never had. */
.primary-button,
.ghost-button,
.upload-button,
.action-button,
.back-hq-button,
.period-btn,
.project-card-inner,
.todo-row,
.order-row,
.flow-button,
.nav-item,
.action-tile,
.wide-tool-button,
.activity-item {
  transition: transform 90ms ease;
  /* The grey flash Android paints on tap fights the press effect. */
  -webkit-tap-highlight-color: transparent;
}

.primary-button:active,
.ghost-button:active,
.upload-button:active,
.action-button:active,
.back-hq-button:active,
.period-btn:active,
.project-card-inner:active,
.todo-row:active,
.order-row:active,
.flow-button:active {
  transform: scale(0.95);
}

/* ===== Berry badge counting down ===== */

.flow-badge.counting-down {
  animation: flow-badge-drop 520ms cubic-bezier(0.2, 0.85, 0.22, 1);
}

@keyframes flow-badge-drop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ===== A project that has just moved on =====
   Winning the work, or moving it forward, is the good news in this app. The
   card lifts into its new column and glows briefly rather than simply being
   somewhere different than it was. */

.project-card.just-advanced {
  animation: project-advanced 2600ms ease-out;
}

@keyframes project-advanced {
  0%   { transform: scale(0.94); box-shadow: 0 0 0 0 rgba(54, 101, 72, 0); }
  12%  { transform: scale(1.03); box-shadow: 0 10px 30px rgba(54, 101, 72, 0.4); }
  30%  { transform: scale(1);    box-shadow: 0 8px 26px rgba(54, 101, 72, 0.34); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(54, 101, 72, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .primary-button:active,
  .ghost-button:active,
  .upload-button:active,
  .action-button:active,
  .back-hq-button:active,
  .period-btn:active,
  .project-card-inner:active,
  .activity-item:active,
  .todo-row:active,
  .order-row:active,
  .flow-button:active,
  .nav-item:active,
  .action-tile:active,
  .wide-tool-button:active {
    transform: none;
  }

  .flow-badge.counting-down,
  .project-card.just-advanced {
    animation: none;
  }
}

/* The calendar address is only needed by someone copying it by hand, so it is
   tucked away behind a summary rather than shown as the first thing. */
.calendar-address-details {
  margin: 10px 0 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.calendar-address-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.calendar-address-details input {
  /* A long random key would otherwise stretch the settings card. */
  min-width: 0;
  font-size: 12px;
}

/* Numbered setup steps in the calendar sync card. */
.calendar-steps {
  margin: 4px 0 12px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  /* Long URLs in a step must wrap rather than widen the card. */
  min-width: 0;
  overflow-wrap: anywhere;
}

.calendar-steps b {
  color: var(--text);
}

/* Berry personality picker. Each option carries a line of explanation, so the
   row needs to stack rather than sit on one line like a plain toggle. */
.flow-personality-choice {
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}

.flow-personality-choice.selected {
  border-color: var(--primary);
  background: rgba(54, 101, 72, 0.06);
}

.flow-personality-choice span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Lets the description wrap instead of widening the settings card. */
  min-width: 0;
}

.flow-personality-choice small {
  font-size: 12px;
  line-height: 1.35;
}

/* Sets the scene at the top of the Connections tab. */
.connections-intro p {
  font-size: 14px;
  line-height: 1.45;
}

/* A change Berry has proposed, waiting on the user. Deliberately plain and
   readable rather than styled to persuade - the user is agreeing to it. */
.flow-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface);
}

.flow-confirm strong { font-size: 15px; }

.flow-confirm p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  /* Long task titles wrap rather than widening her panel. */
  min-width: 0;
  overflow-wrap: anywhere;
}

.flow-confirm .button-row { margin-top: 4px; }

/* What Berry has learned. Plain and unthreatening: this list exists so nothing
   is decided out of sight, and it only works if people feel able to open it. */
.flow-memory-list {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-memory-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 14px;
}

.flow-memory-list li span {
  /* Long sentences wrap rather than pushing the button off the card. */
  min-width: 0;
  overflow-wrap: anywhere;
}

.flow-memory-list li button {
  flex: 0 0 auto;
  padding: 5px 10px;
  font-size: 13px;
}

/* What she has noticed and not been told. Each one is a question, so it gets
   room to be read rather than a row with a button on the end - the whole value
   of asking is lost if the question is easier to dismiss than to read. */
.flow-candidate-list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flow-candidate-list li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.flow-candidate-fact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.flow-candidate-fact textarea {
  /* The sentence is editable in place, because narrowing a suggestion and
     agreeing to it are one action. */
  width: 100%;
  min-width: 0;
  font-size: 15px;
  resize: vertical;
}

.flow-candidate-noticed,
.flow-candidate-clash {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.flow-candidate-noticed { color: var(--muted); }

.flow-candidate-clash {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.flow-candidate-clash strong {
  display: block;
  margin: 4px 0;
}

.flow-candidate-list .button-row {
  flex-wrap: wrap;
  gap: 8px;
}

/* A box Berry filled in. Marked so the user can see at a glance what came from
   her and what they typed, without it looking like an error. */
input.flow-filled,
textarea.flow-filled {
  border-color: var(--purple);
  background: rgba(155, 89, 182, 0.06);
}

.flow-form-notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--purple);
  border-radius: 8px;
  background: rgba(155, 89, 182, 0.07);
}

.flow-form-notice strong { font-size: 14px; }

.flow-form-notice p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Shown when a follow-up has been put off, so the card does not look identical
   to one that is still outstanding. */
.trigger-reminder-note {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}


/* Optional link on a notice - currently how someone asks for more Berry messages. */
.notice-action-link {
  display: block;
  margin: 2px 0 10px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
}

/* Variations on the job's front page. An unapproved one is worth noticing, so it
   is marked rather than left to look like every other row. */
.project-changes-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
}

.project-changes-copy {
  display: grid;
  gap: 2px;
}

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

.project-changes-row.has-pending {
  border-left: 4px solid var(--gold);
}

.project-changes-row.has-pending .project-changes-copy small {
  color: var(--text);
  font-weight: 600;
}

.project-changes-chevron {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

/* Marks the template Berry has just written, so it does not read as one the
   user already had. It is a draft until they press Save. */
.flow-draft-note {
  border-left: 3px solid var(--green);
}

.flow-draft-note h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.flow-draft-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Confirmation under the mobile number, showing how it would actually be
   dialled from outside the account holder's own country. */
.field .small-note {
  margin: 4px 0 0;
  font-size: 0.82rem;
}

/* The walkthrough cue: one line above the nav, never over the page. It replaces
   a card that sat in the middle of the screen and covered the very control the
   step was asking the user to press. The pulsing highlight says where; this says
   what; the orb says Berry is speaking. */
.onboarding-cue {
  position: fixed;
  left: 12px;
  right: 12px;
  /* Clears the fixed bottom nav, which is icon plus label plus its own padding
     and the phone home indicator. */
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 68;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(28, 22, 34, 0.96);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.onboarding-cue-text {
  display: grid;
  gap: 1px;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.35;
}

.onboarding-cue-text strong {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
}

.onboarding-cue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.onboarding-cue-actions button {
  border: none;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.onboarding-cue-replay {
  width: 30px;
  padding: 7px 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 14px;
}

.onboarding-cue-next {
  background: linear-gradient(100deg, #6b2449, #9b3b65);
  color: #fff;
}

.onboarding-cue-skip {
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
}

/* Budget range or agreed price: one or the other, so they read as a choice
   rather than two boxes that both want filling in. */
.pricing-mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.pricing-mode-option {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pricing-mode-option.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.pricing-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Hidden rather than removed, so switching does not rebuild the form and lose
   what has already been typed into the boxes around it. */
.pricing-panel.hidden {
  display: none;
}

/* ── Site survey ──────────────────────────────────────────────────────────
   The plan is drawn in millimetres through the SVG viewBox, so the only job
   here is to give it a sensible box to sit in and keep the finger from
   scrolling the page while someone is drawing. */
.survey-stage {
  padding: 12px;
}

.survey-canvas {
  display: block;
  width: 100%;
  /* Roughly square, so a room is readable whichever way it is shaped. */
  aspect-ratio: 1 / 1;
  max-height: 60vh;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  /* Without this the browser treats a drawing stroke as a scroll. */
  touch-action: none;
}

.survey-wall {
  stroke: var(--primary);
  stroke-linecap: square;
}

.survey-wall.is-selected {
  stroke: var(--orange);
}

/* Dashed, because this line is the one the measurements did not draw. */
.survey-wall-closing {
  stroke: var(--outline);
  stroke-dasharray: 120 90;
}

/* A fat invisible line over each wall, so tapping one on a phone works
   without having to hit a two-pixel stroke. */
.survey-wall-hit line {
  stroke: transparent;
  cursor: pointer;
}

.survey-wall-label {
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 700;
  pointer-events: none;
}

.survey-hint,
.survey-outofsquare {
  margin: 10px 0 0;
  font-size: 13px;
}

.survey-hint {
  color: var(--muted);
  text-align: center;
}

/* A finding, not an error - so it is stated plainly rather than in red. */
.survey-outofsquare {
  color: var(--text);
  background: var(--surface-soft);
  border-left: 3px solid var(--gold);
  padding: 8px 10px;
  border-radius: 6px;
}

.survey-sketch-line {
  stroke: var(--primary);
  stroke-linecap: square;
  stroke-linejoin: miter;
}

/* Appears on the first corner when coming back to it would shut the room. */
.survey-sketch-close {
  fill: none;
  stroke: var(--orange);
  stroke-width: 40;
}

/* Where the maker is standing. Every elevation is worked out from it, so it is
   shown on the plan rather than being an invisible assumption. */
.survey-eye circle {
  fill: var(--orange);
  fill-opacity: 0.85;
}

.survey-eye-label {
  fill: var(--muted);
  text-anchor: middle;
  font-weight: 600;
}



/* One wall at a time, with the plan still above it. */
.survey-measure-inner {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.survey-measure-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.survey-measure-head h3 {
  margin: 0;
  font-size: 15px;
}

.survey-measure-head p {
  margin: 2px 0 0;
  font-size: 12px;
}

.survey-measure-wall {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--orange);
  color: #ffffff;
  font-size: 19px;
  font-weight: 700;
}

.survey-measure-entry {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.survey-measure-entry input {
  flex: 1;
  min-width: 0;
  font-size: 17px;
}

/* Red until a wall has been dealt with, green once it has. The whole survey
   starts red and goes green as it is measured, so what is left is visible on
   the drawing rather than counted underneath it. */
.survey-wall.is-todo {
  stroke: #c0392b;
}

.survey-wall.is-measured {
  stroke: var(--green);
}

/* Dealt with, but deliberately never measured - so it is green and dashed
   rather than pretending to carry a figure. */
.survey-wall.is-skipped {
  stroke: var(--green);
  /* The dash length is set in the markup: it is in plan millimetres, so a
     fixed figure reads as a solid line on a large room. */
}

/* The wall whose figure is being typed. Blue between red and green, and the
   same weight as the rest - only the colour changes. */
.survey-wall.is-active {
  stroke: var(--secondary);
}

.survey-wall.is-current {
  stroke: var(--orange);
}

.survey-measure {
  flex-shrink: 0;
}

/* Floor to ceiling, on its own line above the wall question. */
.survey-height {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.survey-height label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.survey-height input {
  flex: 1;
  min-width: 0;
}

/* The four views, numbered off the standing point. */
.survey-eye-view {
  fill: var(--orange);
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 700;
}

/* Labels take the colour of the wall they belong to. */
.survey-wall-label.is-measured { fill: var(--green); }
.survey-wall-label.is-active { fill: var(--secondary); }
.survey-wall-label.is-todo { fill: #c0392b; }
.survey-wall-label.is-skipped { fill: var(--muted); }

/* The button wears the standing point's colour, so it is obvious which mark on
   the plan it moves. */
.survey-eye-button {
  border-color: var(--orange);
  color: var(--orange);
}

.survey-eye-button.is-on {
  background: var(--orange);
  color: #ffffff;
}

/* The survey holds still. Anything that scrolls here moves the drawing out from
   under the finger working on it.

   min-height has to be overridden, not just left alone: .screen sets it to
   100vh, and on a phone 100vh is the viewport with the browser's own bars
   hidden, which is taller than the 100dvh actually on screen. The taller figure
   would win, and the bottom of the survey - the figure box, and the navigation
   bar - would sit below the fold. */
.survey-screen.is-measuring,
.survey-screen.is-sketching,
.survey-screen.is-elevation {
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* The section lines, drawn through the standing point. Faint on purpose: they
   are there to be lined up against, not to be read. Which side of them the
   standing point sits is what decides whether a chimney breast's return is in
   an elevation or not, so the maker can see the answer before asking for the
   drawing. */
.survey-section line {
  stroke: var(--muted);
  opacity: 0.35;
}

/* The four elevations, offered under the plan once it carries its figures. */
.survey-elevation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.survey-elevation-row-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.survey-elevation-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex: 1;
  min-width: 0;
}

/* Numbered to match the figures around the standing point on the plan, so
   "elevation two" means the same thing on site as it does on the drawing. */
.survey-elevation-button {
  padding: 8px 0;
  border-color: var(--orange);
  color: var(--orange);
  font-weight: 700;
}

.survey-elevation-button.is-made {
  background: var(--orange);
  color: #ffffff;
}

.survey-elevation-wall {
  fill: none;
  stroke: var(--green);
  stroke-linejoin: miter;
}

.survey-elevation-line {
  stroke: var(--green);
  stroke-linecap: butt;
}

.survey-elevation-figure {
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 600;
}

/* How far a piece of wall stands in front of the wall behind it - the figure a
   chimney breast or an alcove is actually built to. */
.survey-elevation-proud {
  fill: var(--muted);
  text-anchor: middle;
  dominant-baseline: middle;
}

.survey-elevation-caption,
.survey-empty {
  flex-shrink: 0;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Previous, plan, next - three even columns rather than a wrapping row, so
   stepping round the elevations does not move the buttons about under the
   thumb doing the stepping. */
.survey-elevation-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex-shrink: 0;
}

.survey-elevation-nav .ghost-button {
  padding: 12px 4px;
}

/* ── Site survey layout ──────────────────────────────────────────────────────
   Every survey screen - the sketch, the plan and each elevation - is the same
   two pieces: the drawing, and a side panel of everything done to it. Upright,
   the panel sits under the drawing. Held sideways, the header and navigation
   bar go, the drawing takes the full height on the left and the panel becomes a
   narrow column down the right.

   The drawing area is the same size on every screen held the same way, and the
   drawing is scaled to fit it rather than the box being sized to the drawing.
   Turning from the plan to an elevation does not jump, and one layout fits any
   size of phone. */
.survey-screen.is-sketching .screen-inner,
.survey-screen.is-measuring .screen-inner,
.survey-screen.is-elevation .screen-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 10px;
}

.survey-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.survey-layout .survey-stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

/* The same neat white surround on every screen. */
.survey-stage-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.survey-layout .survey-canvas,
.survey-layout .survey-elevation-canvas {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  aspect-ratio: auto;
  max-height: none;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  /* Without this the browser treats a finger on the drawing as a scroll. */
  touch-action: none;
}

.survey-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.survey-side .survey-hint {
  margin: 0;
}

/* Upright, the measured plan and every elevation keep a panel of the same
   height, which is what makes their drawings exactly the same size. The part
   of an elevation's panel not used yet is where its skirting, socket and other
   buttons will go. */
.survey-screen.is-measuring.is-scaled .survey-side,
.survey-screen.is-elevation .survey-side {
  flex-basis: 190px;
  height: 190px;
  overflow-y: auto;
}

.survey-landscape-only {
  display: none;
}

@media (orientation: landscape) and (max-height: 560px) {
  .survey-screen.is-sketching,
  .survey-screen.is-measuring,
  .survey-screen.is-elevation {
    padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  }

  .survey-screen.is-sketching .top-shell,
  .survey-screen.is-measuring .top-shell,
  .survey-screen.is-elevation .top-shell,
  .survey-screen.is-sketching ~ .nav,
  .survey-screen.is-measuring ~ .nav,
  .survey-screen.is-elevation ~ .nav {
    display: none;
  }

  /* Out from under the upright page width, which left most of a sideways
     phone empty. */
  .survey-screen.is-sketching .screen-inner,
  .survey-screen.is-measuring .screen-inner,
  .survey-screen.is-elevation .screen-inner {
    width: 100%;
    padding-bottom: 0;
  }

  /* The column is one width on every screen, so the drawing beside it is one
     size too. */
  .survey-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(170px, 30vw, 240px);
    height: 100%;
  }

  .survey-layout .survey-stage {
    height: 100%;
  }

  .survey-stage-inner {
    padding: 8px;
  }

  .survey-side,
  .survey-screen.is-measuring.is-scaled .survey-side,
  .survey-screen.is-elevation .survey-side {
    height: 100%;
    overflow-y: auto;
    gap: 6px;
  }

  /* Down the column: what to type, what to press, where to go next. */
  .survey-side .survey-height { order: 1; }
  .survey-side .survey-measure { order: 2; }
  .survey-side .survey-plan-actions { order: 3; }
  .survey-side .survey-elevation-row { order: 4; }
  .survey-side .survey-landscape-exit { order: 5; }

  /* One button to a row, elevations included, so every one of them fits the
     narrow column. */
  .survey-side .button-row,
  .survey-side .survey-elevation-nav,
  .survey-side .survey-elevation-buttons {
    grid-template-columns: 1fr;
  }

  .survey-side .ghost-button,
  .survey-side .primary-button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .survey-side .survey-elevation-row,
  .survey-side .survey-height {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
  }

  .survey-side .survey-height input {
    width: 100%;
  }

  .survey-side .survey-measure-inner {
    padding: 8px;
  }

  .survey-side .survey-measure-head p,
  .survey-side .survey-hint {
    display: none;
  }

  .survey-side .survey-measure-entry {
    flex-direction: column;
  }

  .survey-landscape-only {
    display: block;
  }
}

/* ── Fitting out an elevation ────────────────────────────────────────────────
   The buttons for what can be added, the small forms that take its figures,
   and how it all looks on the drawing. */
.survey-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.survey-tools .ghost-button {
  min-height: 40px;
  padding: 6px 4px;
  font-size: 12px;
  line-height: 1.15;
}

.survey-tools .ghost-button.is-made {
  border-color: var(--green);
  color: var(--green);
}

.survey-form {
  display: grid;
  gap: 8px;
}

.survey-form-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.survey-form-hint,
.survey-form-error {
  margin: 0;
  font-size: 12px;
}

.survey-form-hint {
  color: var(--muted);
}

.survey-form-error {
  color: #c0392b;
  font-weight: 600;
}

.survey-form-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.survey-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
}

/* 16px stops a phone zooming the whole page in when the box is tapped. */
.survey-field input {
  width: 100%;
  min-width: 0;
  font-size: 16px;
}

.survey-form-actions,
.survey-scope {
  display: flex;
  gap: 8px;
}

.survey-form-actions > *,
.survey-scope > * {
  flex: 1 1 0;
  min-width: 0;
}

.survey-scope .ghost-button.is-on {
  background: var(--orange);
  border-color: var(--orange);
  color: #ffffff;
}

/* Upright, a panel with figures to type grows to fit them for as long as it is
   open, then goes back to the fixed height that keeps the drawings the same
   size. */
.survey-screen.is-elevation .survey-side.has-form {
  height: auto;
  flex-basis: auto;
  max-height: 48dvh;
  overflow-y: auto;
}

.survey-trim {
  fill: #efe6d8;
  stroke: var(--muted);
}

.survey-item {
  cursor: pointer;
}

.survey-item-plate {
  fill: #ffffff;
}

.survey-item-detail {
  fill: none;
}

.survey-item.is-todo .survey-item-plate,
.survey-item.is-todo .survey-item-detail {
  stroke: #c0392b;
}

.survey-item.is-measured .survey-item-plate,
.survey-item.is-measured .survey-item-detail {
  stroke: var(--green);
}

.survey-item.is-selected .survey-item-plate,
.survey-item.is-selected .survey-item-detail {
  stroke: var(--orange);
}

.survey-item-pipe {
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Invisible, and wider than the item, so something 86mm across can be tapped
   on a phone without zooming in first. */
.survey-item-hit,
.survey-dim-hit,
.survey-pick-hit {
  fill: transparent;
  stroke: transparent;
}

.survey-dim path {
  fill: none;
  stroke: var(--text);
}

/* A white edge round each figure, so it can be read where it crosses a line. */
.survey-dim-text {
  fill: var(--text);
  stroke: #ffffff;
  paint-order: stroke;
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 600;
}

.survey-dim-group {
  cursor: grab;
}

.survey-dim-group.is-todo .survey-dim path {
  stroke: #c0392b;
}

.survey-dim-group.is-todo .survey-dim-text {
  fill: #c0392b;
}

.survey-dim-group.is-selected .survey-dim path {
  stroke: var(--orange);
}

.survey-dim-group.is-selected .survey-dim-text {
  fill: var(--orange);
}

.survey-pick {
  cursor: pointer;
}

.survey-pick-line {
  stroke: var(--orange);
  stroke-opacity: 0.25;
}

.survey-pick.is-picked .survey-pick-line {
  stroke-opacity: 0.9;
}

.survey-elevation-canvas.is-placing {
  cursor: crosshair;
}

@media (orientation: landscape) and (max-height: 560px) {
  .survey-side .survey-tools {
    grid-template-columns: 1fr 1fr;
  }

  .survey-screen.is-elevation .survey-side.has-form {
    height: 100%;
    max-height: none;
  }
}

/* Fit sits on the corner of the drawing, on the plan and every elevation, so
   zooming in never takes room from the panel beside it. */
.survey-stage-inner {
  position: relative;
}

.survey-fit {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
  min-height: 36px;
  padding: 6px 14px;
  background: var(--surface);
}

/* The name written on a radiator, sized to its width. */
.survey-item-label {
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 600;
  pointer-events: none;
}

/* A radiator on the plan: white, so the wall line does not run through it. */
.survey-plan-radiator rect {
  fill: #ffffff;
  stroke: var(--text);
}

/* Boxing and beams: shaded on the elevation, dashed on the plan, the usual way
   to show something above or in front of the floor rather than a wall. */
.survey-item.is-boxing .survey-item-plate {
  fill: #e4e0da;
}

.survey-plan-boxing {
  fill: none;
  stroke: var(--text);
  stroke-dasharray: 6 4;
}

/* Upright, the header already names the elevation and the panel needs the room
   for its buttons. Sideways the header is hidden, so the caption says which
   elevation this is. */
.survey-screen.is-elevation .survey-elevation-caption {
  display: none;
}

@media (orientation: landscape) and (max-height: 560px) {
  .survey-screen.is-elevation .survey-elevation-caption {
    display: block;
  }
}

/* Boxing or a beam seen from another elevation: shaded like the one it was
   added on, but it is changed from that elevation, so it does not take taps. */
.survey-boxing-seen {
  fill: #e4e0da;
  stroke: var(--muted);
  pointer-events: none;
}

/* ── Datum lines and notes ───────────────────────────────────────────────────
   Datums are red and dashed, the usual way to show a level or plumb line that
   is not part of the building. Notes sit on a faint white ground so they can
   be read over anything behind them. */
.survey-datum {
  cursor: grab;
}

.survey-datum-line {
  stroke: #c0392b;
  stroke-dasharray: 10 6;
}

.survey-datum.is-selected .survey-datum-line {
  stroke: var(--orange);
}

.survey-datum-hit,
.survey-note-handle-hit {
  fill: transparent;
  stroke: transparent;
}

.survey-note {
  cursor: grab;
}

.survey-note-box {
  fill: rgba(255, 255, 255, 0.85);
  stroke: transparent;
}

.survey-note.is-selected .survey-note-box {
  stroke: var(--orange);
  stroke-dasharray: 4 3;
}

.survey-note-text {
  fill: var(--text);
  text-anchor: start;
  dominant-baseline: middle;
  font-weight: 500;
}

.survey-note.is-empty .survey-note-text {
  fill: var(--muted);
}

.survey-note-handle {
  fill: var(--orange);
  stroke: #ffffff;
}

.survey-note-handle,
.survey-note-handle-hit {
  cursor: ew-resize;
}

.survey-note-input {
  width: 100%;
  min-height: 72px;
  font-size: 16px;
  resize: vertical;
}

/* The measured plan gained a row of tools, so the panel under the plan and
   every elevation is a little taller - still the same height as each other, so
   the drawings stay the same size. */
.survey-screen.is-measuring.is-scaled .survey-side,
.survey-screen.is-elevation .survey-side {
  flex-basis: 206px;
  height: 206px;
}

.survey-screen.is-measuring.is-scaled .survey-side.has-form {
  height: auto;
  flex-basis: auto;
  max-height: 48dvh;
  overflow-y: auto;
}

@media (orientation: landscape) and (max-height: 560px) {
  .survey-screen.is-measuring.is-scaled .survey-side,
  .survey-screen.is-elevation .survey-side,
  .survey-screen.is-measuring.is-scaled .survey-side.has-form {
    height: 100%;
    max-height: none;
  }
}

/* The measured plan's tools, three to a row: at four, "Move standing point"
   wrapped onto three lines and pushed the room height out of the panel. The
   rows under them are a little tighter for the same reason. Sideways the column
   keeps two to a row. */
.survey-tools.survey-plan-actions {
  grid-template-columns: repeat(3, 1fr);
}

.survey-screen.is-measuring.is-scaled .survey-side .survey-elevation-row,
.survey-screen.is-measuring.is-scaled .survey-side .survey-height {
  padding-top: 6px;
  padding-bottom: 6px;
}

@media (orientation: landscape) and (max-height: 560px) {
  .survey-side .survey-tools.survey-plan-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Doors and windows ───────────────────────────────────────────────────────
   A door's hinges and handle are solid, so which way it opens reads at a
   glance; a window's sill is a white board across the bottom of the opening. */
.survey-item-hardware {
  fill: var(--text);
  stroke: none;
}

/* Door and Window made thirteen buttons, a row too many at four across, so an
   upright elevation takes five to a row and its panel stays the height that
   keeps its drawing the same size as the plan's. Sideways the column keeps
   two to a row. */
.survey-screen.is-elevation .survey-side .survey-tools {
  grid-template-columns: repeat(5, 1fr);
}

@media (orientation: landscape) and (max-height: 560px) {
  .survey-screen.is-elevation .survey-side .survey-tools {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Surveys listed on Site Info ─────────────────────────────────────────────
   Each survey is a card that opens it when tapped, with Rename and Delete kept
   as their own buttons; creating a new survey sits underneath, apart from
   them. */
.survey-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.survey-list h3 {
  margin: 0;
  font-size: 15px;
}

.survey-list-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.survey-list-item.is-renaming {
  cursor: default;
}

.survey-list-item p {
  margin: 0;
}

.survey-list-name {
  font-weight: 700;
}

.survey-list .survey-form-error {
  margin: 0;
}

/* Open, Rename and Delete side by side on a phone, rather than Delete dropping
   onto a line of its own. */
.survey-list-item .button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* ── The survey's name, and printing a survey ────────────────────────────────
   The name sits on the drawing's top corner, opposite Fit, so it takes no
   height. The print sheet is only ever seen on paper, or made off screen when
   the drawings are turned into pictures to share. */
.survey-name-tag {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 1;
  max-width: calc(100% - 100px);
  margin: 0;
  padding: 5px 12px;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}

.survey-print-sheet {
  display: none;
}

.survey-print-sheet.is-offscreen {
  display: block;
  position: fixed;
  top: 0;
  left: -20000px;
  width: 1400px;
}

.survey-print-sheet.is-offscreen .survey-print-drawing svg {
  display: block;
  width: 1400px;
  height: 900px;
}

.survey-print-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8mm;
  padding-bottom: 2mm;
  border-bottom: 0.4mm solid #222222;
  color: #222222;
}

.survey-print-head h1 {
  margin: 0;
  font-size: 18pt;
}

.survey-print-head p {
  margin: 0;
  font-size: 10pt;
}

.survey-print-meta {
  text-align: right;
}

.survey-print-view {
  font-weight: 700;
}

@media print {
  body.print-survey #app,
  body.print-survey .nav,
  body.print-survey .modal-backdrop {
    display: none !important;
  }

  body.print-survey {
    background: #ffffff !important;
  }

  body.print-survey .survey-print-sheet {
    display: block;
  }

  .survey-print-page {
    display: flex;
    flex-direction: column;
    gap: 4mm;
    height: 186mm;
    break-after: page;
    page-break-after: always;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .survey-print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .survey-print-drawing {
    flex: 1 1 auto;
    min-height: 0;
  }

  .survey-print-drawing svg {
    display: block;
    width: 100%;
    height: 100%;
  }
}

/* Quote builder (ADR 0008). The internal panel is deliberately quiet: it is
   read while pricing a job, not warned about. The exception report is not,
   because a warning that looks like the panel is a warning nobody reads. */
.quote-internal-panel {
  border-left: 3px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
}

.quote-internal-panel h3 {
  margin-bottom: 0.25rem;
}

.quote-issue-report {
  border-left: 4px solid #a85a32;
}

.quote-issue-report.blocking {
  border-left-color: #A32020;
}

.quote-issue-report ul {
  margin: 0.5rem 0 1rem;
  padding-left: 1.1rem;
}

.quote-issue-report li {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

.quote-line-drift {
  color: #a85a32;
}

.quote-margin-prompt {
  border-left: 4px solid #2F6F4E;
}

.quote-margin-prompt p {
  line-height: 1.5;
}

/* ── Work: enquiries and jobs as a list ──────────────────────────────────────
   Built for a phone, where the boards only ever showed one column at a time.
   Anything waiting on the maker carries a coloured edge and sits at the top. */
.work-screen .work-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 12px;
}

.work-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.work-tab span {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
}

.work-tab.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.work-tab.is-on span { background: rgba(255, 255, 255, 0.22); color: #ffffff; }

.work-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.work-list { display: grid; gap: 10px; }

.work-row {
  display: grid;
  gap: 8px;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--outline);
  border-radius: 12px;
}

.work-row.needs-you { border-left-color: var(--orange); }
.work-row.is-example { opacity: 0.85; }

.work-open {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.work-name { font-size: 16px; font-weight: 700; color: var(--text); }
.work-type { font-size: 14px; color: var(--muted); }
.work-line { font-size: 14px; color: var(--text); }
.work-row.needs-you .work-line { color: #b3521f; font-weight: 600; }

.work-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.work-tags span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.work-tags .work-new { background: #fdeadf; color: #b3521f; }

.work-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
}

.work-act {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.work-act.primary { background: var(--green); border-color: var(--green); color: #ffffff; }

.work-empty {
  padding: 22px 16px;
  background: var(--surface);
  border: 1px dashed var(--outline);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.work-reasons { display: grid; gap: 8px; margin: 14px 0; }
.work-reasons .ghost-button { justify-content: flex-start; text-align: left; }

/* ── Design & Quote ──────────────────────────────────────────────────────────
   The drawing takes the room, the panel takes the settings. Sideways or on a
   laptop they sit together; upright the panel drops underneath. */
/* A grid item will not shrink below the width of its contents unless it is
   told it may, and a number input asks for a good deal of width. Without
   these the panel sets the width of the whole screen: upright it pushed the
   drawing off the right hand side, and sideways it did it only once a cabinet
   was selected and the fields appeared, which is what made it come and go. */
.dq-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.dq-stage, .dq-side, .dq-panel, .dq-fields, .dq-palette, .dq-field { min-width: 0; }
.dq-field input { min-width: 0; width: 100%; }

@media (min-width: 900px) {
  .dq-layout { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
}

.dq-stage {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Talking to Berry. Above the drawing with the undo, because both are about the
   conversation happening to the drawing rather than about the drawing itself. */
.dq-voice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.dq-voice button { flex: 0 0 auto; }

.dq-voice-state {
  min-width: 0;
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* While she is listening, so it is obvious at a glance across a workshop that
   the microphone is open. */
.dq-voice.is-live .dq-voice-state {
  color: var(--primary);
  font-weight: 600;
}

/* The way back. Above the drawing, because it has to be seen without looking for
   it - a maker who has just watched the wrong figure go in should not have to
   hunt for the way out of it. */
.dq-undo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 14px;
}

.dq-undo-bar > span:first-child { min-width: 0; overflow-wrap: anywhere; }

.dq-undo-buttons {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
}

.dq-undo-bar button[disabled] {
  opacity: 0.4;
  /* Still there, so the pair does not shuffle sideways as they are used. */
  pointer-events: none;
}

.dq-canvas { display: block; width: 100%; height: auto; max-height: 52vh; background: var(--surface-soft); border-radius: 8px; }

@media (min-width: 900px) {
  .dq-canvas { max-height: 70vh; }
}

/* ── What the drawing is made of ───────────────────────────────────────────
   Two finishes, and everything on the elevation is one or the other. Inside is
   the board the carcass and its back are made from; outside is what you see with
   the doors shut - the fronts, the plinth, the scribes.

   They are custom properties rather than colours written into each rule, because
   finishes are going to be chosen per cabinet. When that arrives, a cabinet's
   own finish is set on its group:

       <g class="dq-unit" style="--dq-inside: #...; --dq-outside: #...">

   and everything inside it follows, with these staying as the default for
   anything not yet chosen. Nothing below needs touching for that to work, which
   is the reason for doing it this way round now rather than later.

   The figures are a light oak veneer and a pale green paint, which is where
   Dean wants a job to start. They also do a plainer job straight away: a white
   carcass on a near-white page was hard to read, and a cabinet now obviously
   has a back in it. */
:root {
  --dq-inside: #e7d2ae;
  --dq-outside: #d3e0cc;

  /* THE BACK PANEL RULE, which holds for every material ever added.
     A back panel is drawn two tones LIGHTER than the carcass it sits in. On a
     flat elevation a lighter surface reads as further away, so this is what
     gives an open carcass its depth - it is a drawing convention rather than a
     lighting one, and a maker reads it immediately.

     This is how much white goes into it. One figure, so the step can be tuned
     once and every material follows. */
  --dq-back-lift: 34%;
}

.dq-wall { fill: #ffffff; stroke: var(--outline); }

/* The 3D view: the boards as faces, tops lifted and sides darkened a little so
   it reads as solid. Colours follow the elevation's. */
.dq-view-switch { margin-bottom: 8px; max-width: 280px; }
/* The 3D view takes exactly the drawing's space (Dean): the same box, the
   same background, as large as it will go. */
.dq-3d { width: 100%; height: auto; max-height: 52vh; display: block; touch-action: none; cursor: grab; user-select: none;
  background: var(--surface-soft); border-radius: 8px; }
@media (min-width: 900px) { .dq-3d { max-height: 70vh; } }
.dq-3d-controls { margin-bottom: 4px; }
.dq3d.is-outline { fill: none; stroke: var(--text); stroke-opacity: 0.55; filter: none; }
.dq3d { stroke: rgba(0, 0, 0, 0.35); stroke-linejoin: round; cursor: pointer; }
.dq3d-carcass, .dq3d-drawer { fill: var(--dq-inside); }
.dq3d-back { fill: color-mix(in srgb, #ffffff var(--dq-back-lift), var(--dq-inside)); }
.dq3d-front, .dq3d-panel, .dq3d-trim { fill: var(--dq-outside); }
.dq3d-worktop { fill: var(--dq-inside); }
.dq3d-rail { fill: #9aa0a6; }
.dq3d-top { filter: brightness(1.08); }
.dq3d-side { filter: brightness(0.86); }
.dq3d.is-selected { stroke: var(--orange); }
.dq-canvas rect.is-clash { fill: #e5533d; fill-opacity: 0.6; stroke: #b3261e; }
.dq3d.is-clash { fill: #e5533d; fill-opacity: 0.75; stroke: #b3261e; }
.dq-floor { stroke: var(--text); }
.dq-plinth { fill: var(--dq-outside); stroke: var(--muted); }
/* The filler at each end, which reads as trim rather than carcass - but it is
   painted with the doors, so it takes the outside finish. */
.dq-side-scribe { fill: var(--dq-outside); stroke: var(--muted); }
.dq-scribe { fill: var(--dq-outside); stroke: var(--muted); }
.dq-carcass { fill: var(--dq-inside); stroke: var(--muted); }
.dq-front { fill: var(--dq-outside); stroke: var(--primary); }
/* The centre panel of a shaker door, which is part of the door. */
.dq-panel { fill: var(--dq-outside); stroke: var(--primary); }
.dq-moulding { fill: none; stroke: var(--muted); }
.dq-worktop { fill: #e4ded7; stroke: var(--muted); }
.dq-hit { fill: transparent; cursor: pointer; }
.dq-unit.is-selected .dq-carcass { stroke: var(--orange); stroke-width: 6; }
/* The elevation is the front view of the 3D boards: a board of the carcass is
   drawn as the carcass was, and an outline over the whole cabinet carries the
   selection. */
.dq-board { fill: var(--dq-inside); stroke: var(--muted); }
.dq-rail-bar { fill: #c9cdd1; stroke: var(--muted); }
.dq-outline { fill: none; stroke: var(--muted); pointer-events: none; }
.dq-unit.is-selected .dq-outline { stroke: var(--orange); stroke-width: 6; }
.dq-unit.is-selected .dq-front { stroke: var(--orange); }
.dq-dim { fill: none; stroke: var(--text); }
.dq-dim-text { fill: var(--text); font-family: inherit; font-weight: 600; text-anchor: middle; dominant-baseline: middle; }
/* The survey check above the drawing: how far the run stands out from the wall. */
.dq-projection { fill: var(--text); font-family: inherit; font-weight: 600; pointer-events: none; }
/* Extension lines are lighter than the dimension itself, so the drawing still
   reads as the drawing and the figures read as notes on it. */
.dq-dim-ext { fill: none; stroke: var(--outline); opacity: 0.7; }
.dq-dim-leader { fill: none; stroke: var(--text); }
.dq-dim-lead { text-anchor: start; }
.dq-dim-lead-end { text-anchor: end; }

.dq-side {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.dq-group {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* A part of the panel that folds away. Reads as a heading rather than a button,
   because what it is is a section of the panel that happens to open. */
.dq-fold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  margin: 6px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}
.dq-fold:hover { background: rgba(45, 45, 45, 0.04); }
.dq-fold.is-open { color: var(--text); border-color: var(--primary); }
.dq-fold-mark { font-size: 16px; line-height: 1; letter-spacing: 0; }
.dq-fold-body { display: grid; gap: 10px; }
/* The two it is hardest to undo sit at the foot, away from everything else. */
.dq-panel-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

.dq-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dq-palette .ghost-button { min-height: 44px; padding: 8px 10px; font-size: 13px; line-height: 1.2; }

/* Each unit is drawn on its own button, to the same scale as its neighbours,
   so the run can be built by picking out shapes rather than reading labels. */
.dq-add { display: flex; align-items: center; gap: 9px; text-align: left; }
.dq-thumb { flex: 0 0 40px; width: 40px; height: 46px; pointer-events: none; }
.dq-add-label { flex: 1 1 auto; }
.dq-shelf { stroke: var(--outline); fill: none; }

.dq-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.dq-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }

.dq-field input {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
}

.dq-note { margin: 0; font-size: 13px; color: var(--muted); }

/* "Every cabinet in this design": the one control that turns a change to the
   cabinet in hand into a change to all of them. */
/* The shelf tapped on the drawing, and its own few figures in the panel. */
.dq-fit-grab.is-picked { fill: var(--orange); fill-opacity: 0.25; }
.dq-picked { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--orange); border-radius: 10px; }
.dq-picked .ghost-button { justify-self: start; }
.dq-all { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.dq-all input { width: 18px; height: 18px; margin: 0; accent-color: var(--orange); }

/* The question mark beside anything that could be misread, and the short
   explanation it opens. Small enough to sit inside a field's label. */
.dq-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--outline);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
}
.dq-help.is-on { background: var(--orange); border-color: var(--orange); color: #fff; }
.dq-help-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 13px;
  color: var(--text);
}
.dq-help-box p { margin: 0; }
.dq-help-box .dq-help-title { font-weight: 700; }
.dq-help-box .ghost-button { justify-self: start; }

.dq-scope { display: flex; gap: 8px; }
.dq-scope .ghost-button { flex: 1 1 0; min-height: 40px; font-size: 13px; }
.dq-scope-four { flex-wrap: wrap; }
.dq-scope-four .ghost-button { flex: 1 1 calc(50% - 4px); }
.dq-scope .ghost-button.is-on, .dq-panel .ghost-button.is-on {
  background: var(--orange);
  border-color: var(--orange);
  color: #ffffff;
}

.dq-panel { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.dq-panel-head { display: grid; gap: 8px; }
.dq-panel-head h3 { margin: 0; font-size: 17px; }

.dq-problems {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 12px 10px 28px;
  background: #fdeadf;
  border-radius: 8px;
  color: #8f3b12;
  font-size: 13px;
}

.dq-parts { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }

.dq-parts li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 13px;
}

.dq-parts span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* What is cut on the panel as well as its size - a rebate, say. Its own line. */
.dq-parts small { flex-basis: 100%; color: var(--muted); font-size: 12px; }

/* ── Design & Quote, sideways ────────────────────────────────────────────────
   Designing a run needs width, so this screen is built for a tablet or a
   laptop held the way a drawing board sits. Turned sideways the header and the
   navigation bar go and the drawing takes the height, exactly as a survey
   does. Upright it still works, with a word of advice at the top. */
.dq-portrait-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  background: #fdeadf;
  border: 1px solid #f0c3a6;
  border-radius: 10px;
  color: #8f3b12;
  font-size: 14px;
  font-weight: 600;
}

/* The way out, since the navigation bar is hidden while designing sideways. */
.dq-landscape-exit { display: none; }
/* The way out of the drawing board, in the colour every "Back to Project HQ"
   button has, so it does not read as one of the drawing tools. */
.dq-side .dq-landscape-exit {
  color: #ffffff;
  background: #284f83;
  border-color: #284f83;
  font-weight: 900;
}

@media (orientation: landscape) {
  .dq-portrait-note { display: none; }

  /* Pinned to the viewport rather than sized in dvh. A phone reports a stale
     dvh for a moment after it is turned, which left the drawing at the size it
     had been in portrait until something else forced a reflow. A fixed box is
     the viewport by definition, so it is right the instant the screen turns. */
  .dq-screen {
    position: fixed;
    inset: 0;
    height: auto;
    min-height: 0;
    overflow: hidden;
    padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  }

  .dq-screen .top-shell,
  .dq-screen ~ .nav { display: none; }

  .dq-screen .screen-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding-bottom: 0;
  }

  .dq-layout {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) clamp(280px, 32vw, 400px);
    align-items: stretch;
  }

  .dq-stage { display: flex; height: 100%; min-height: 0; padding: 8px; }
  .dq-canvas { max-height: none; height: 100%; }
  .dq-side { height: 100%; overflow-y: auto; }
  .dq-screen .back-hq-button { display: none; }
  .dq-landscape-exit { display: inline-flex; }
}

/* A phone held sideways is not what this is for, but it should still be
   usable: the drawing keeps the room and the panel goes to one column. */
@media (orientation: landscape) and (max-width: 759px) {
  .dq-layout { grid-template-columns: minmax(0, 1fr) clamp(160px, 34vw, 240px); }
  .dq-palette, .dq-fields { grid-template-columns: 1fr; }
  .dq-side { padding: 10px; font-size: 13px; }
  .dq-palette .ghost-button { min-height: 38px; font-size: 12px; }
  .dq-thumb { flex-basis: 30px; width: 30px; height: 34px; }
  .dq-field input { min-height: 38px; }
}

/* The survey itself, drawn over the furniture by the survey's own code and
   restyled here as broken lines. Everything is outline only and nothing takes
   a pointer, so a socket behind a wardrobe can be seen without getting in the
   way of dragging the wardrobe. */
.dq-survey { pointer-events: none; }

/* The survey draws an invisible fat line behind everything you can tap, so it
   can be caught with a finger. There is nothing to tap here, and painting them
   turned every socket into a solid block. */
.dq-survey [class$="-hit"],
.dq-survey .survey-note-handle-hit { display: none; }

.dq-survey rect,
.dq-survey path,
.dq-survey line,
.dq-survey circle,
.dq-survey polyline,
.dq-survey polygon {
  fill: none !important;
  stroke: #1f6f8b !important;
  /* Short dash, short gap. A long dash at this scale read as a row of bars
     rather than as a broken line. */
  stroke-dasharray: 14 9;
  opacity: 0.9;
}
.dq-survey text { fill: #1f6f8b !important; font-family: inherit; font-weight: 600; }

/* Broken means hidden: it is there, and the furniture will stand in front of
   it. What the furniture will not be standing in front of is drawn solid.
   Nobody blocks a door or a window, and the section through a trim at the end
   of the wall is something you are looking at the end of rather than through.

   A bulkhead is solid only where this elevation cuts through it — where it
   comes away from the wall being drawn, so the furniture has to go under it.
   One seen side on belongs to another wall and is somewhere behind, and the
   person who surveyed it knows where. Drawn solid it reads as part of the
   furniture, so it stays broken. */
.dq-survey .is-door *,
.dq-survey .is-window *,
.dq-survey .is-boxing *,
.dq-survey .dq-trim-section { stroke-dasharray: none; opacity: 1; }
.dq-warning { margin: 8px 0 0; padding: 10px 12px; background: #fdeadf; border: 1px solid #f0c3a6; border-radius: 8px; color: #8f3b12; font-size: 13px; font-weight: 600; }

/* Choosing the wall a design starts from. */
.dq-start { display: grid; gap: 16px; }
.dq-start-survey { padding: 14px; background: var(--surface, #ffffff); border: 1px solid var(--outline); border-radius: 12px; }
.dq-start-survey h3 { margin: 0 0 10px; font-size: 15px; }
.dq-start-plan { margin-bottom: 12px; border: 1px solid var(--outline); border-radius: 8px; overflow: hidden; }
.dq-start-plan svg { display: block; width: 100%; height: auto; max-height: 260px; }
.dq-start-walls { display: grid; gap: 8px; }
.dq-start-wall { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; }
.dq-start-wall-name { font-weight: 700; }
.dq-start-wall-size { font-size: 12px; font-weight: 500; color: var(--muted); }

/* A drawer box, drawn floating in the carcass before any front goes on: its
   outline, then the pieces it is made of inside that. */
.dq-drawer-box { fill: none; stroke: var(--muted); }
.dq-drawer-part { fill: #efece7; stroke: var(--muted); }
/* The opening inside the carcass, so the boards read as boards. */
/* The inside of the carcass, which is the back seen through the opening. Filled
   rather than left clear, so a cabinet reads as having a back in it.

   Worked out from the carcass colour rather than written down beside it, which
   is the whole point: set --dq-inside to any material - an oak, a walnut, a
   painted board - and its back lightens to match without anybody choosing a
   second colour or remembering this rule exists.

   The plain fill first, as what an older browser falls back to. It loses the
   depth and keeps the cabinet. */
/* The cabinet number, on the back of the carcass. Big enough to read across a
   workshop and set back in the drawing rather than competing with it: this is a
   label on the thing, not a dimension. Nothing to click, so it never gets in the
   way of grabbing a shelf behind it. */
.dq-unit-number {
  fill: var(--muted);
  opacity: 0.55;
  font-family: inherit;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.dq-unit.is-selected .dq-unit-number { fill: var(--orange); opacity: 0.75; }

/* An infill beside internal drawers: carcass board, drawn as the carcass is. */
.dq-infill { fill: var(--dq-inside); stroke: var(--muted); }

.dq-opening {
  fill: var(--dq-inside);
  fill: color-mix(in srgb, #ffffff var(--dq-back-lift), var(--dq-inside));
  stroke: var(--muted);
}

/* Which way a door opens: the usual elevation mark, from the hinge side. */
.dq-swing { fill: none; stroke: var(--muted); opacity: 0.8; pointer-events: none; }

/* Where one carcass panel meets another: says which pair runs through. */
.dq-joint { stroke: var(--muted); }

/* Dragging a cabinet into place. The drawing takes the gesture outright; a
   palette button lets a vertical swipe scroll the panel and treats a pull
   towards the drawing as a drag. */
/* The drawing takes the gesture outright, and dragging across it must not
   select the figures on it: a stretch was leaving every dimension on the sheet
   highlighted in blue, which is the browser selecting the text under the
   finger. */
.dq-canvas {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.dq-palette .ghost-button { touch-action: pan-y; }
.dq-ghost { fill: rgba(155, 89, 182, 0.14); stroke: #7a4a78; stroke-dasharray: 40 26; pointer-events: none; }
.dq-ghost.is-trimmed { fill: rgba(217, 119, 6, 0.16); stroke: #b45309; }

/* The figure read off while an edge is being pulled. In the drawing's own
   colour so it is plainly a dimension, and above everything else. */
.dq-ghost-dim { pointer-events: none; }
.dq-ghost-dim .dq-dim, .dq-ghost-dim .dq-dim-leader { stroke: #7a4a78; }
.dq-ghost-dim .dq-dim-text { fill: #7a4a78; }

/* What is inside a carcass. A fixed shelf is a board like any other; an
   adjustable one is drawn lighter, because it is only sitting on its pins. */
.dq-shelf-fixed { fill: var(--dq-inside); stroke: var(--muted); }
/* An adjustable shelf is solid like everything else that is really there: on an
   elevation a dashed line means hidden behind something, which a shelf in an
   open carcass is not. What marks it out is that it is drawn short of the sides
   by its clearance, which is the truth of it. */
.dq-shelf-loose { fill: var(--dq-inside); stroke: var(--muted); }
.dq-rail { stroke: var(--muted); }
.dq-peg { fill: var(--text, #1d2329); stroke: none; pointer-events: none; }
.dq-rail-socket { fill: var(--dq-inside); stroke: var(--muted); }
/* A vertical division is a carcass panel, so it is drawn as solid as the sides. */
.dq-division { fill: var(--dq-inside); stroke: var(--muted); }

.dq-fitting-add { flex-wrap: wrap; gap: 8px; }
.dq-fitting { margin-top: 10px; padding: 10px; background: var(--surface-soft); border-radius: 8px; }
.dq-fitting-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dq-fitting-head b { font-size: 13px; }
.dq-fitting .dq-field span { font-size: 11px; line-height: 1.3; }
.dq-inside-dims .dq-dim, .dq-inside-dims .dq-dim-leader { stroke: var(--primary); }
.dq-inside-dims .dq-dim-text { fill: var(--primary); }
/* Something for a finger to land on when a figure inside a cabinet is tapped. */
.dq-dim-hit { fill: transparent; cursor: pointer; }
/* While something is being dragged, the figures it is replacing get out of the
   way. The live figure under the finger is the one being set, and reading it over
   the top of the settled one it is about to become is next to impossible. */
.dq-canvas.is-sizing .dq-dims,
.dq-canvas.is-sizing .dq-inside-dims { display: none; }
/* The figure just set by hand. Dragging gets you to a round fifty; this says
   you can tap it and type the exact one. */
.dq-dim-hit.is-live { fill: rgba(155, 89, 182, 0.14); stroke: #7a4a78; stroke-width: 1.5; stroke-dasharray: 4 3; }
/* What a finger picks a shelf, a rail or a division up by. Wider than the thing
   itself, and invisible: the fitting under it is the cue. */
.dq-fit-grab { fill: transparent; cursor: ns-resize; }
.dq-fit-grab[data-design-div-drag] { cursor: ew-resize; }
.dq-inside-dims .dq-dim-text { cursor: pointer; }

/* Set figures are locked, and locked figures are blue (Dean, 20 October
   2026). Unlocked to drag, a figure is back in the drawing's own ink. */
.dq-fig.is-locked .dq-dim, .dq-fig.is-locked .dq-dim-leader { stroke: #1d5fd1; }
.dq-fig.is-locked .dq-dim-text { fill: #1d5fd1; }
.dq-lock-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 47; padding: 8px 14px; border-radius: 999px; background: #1d5fd1; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow-wrap: anywhere; animation: dq-lock-hint 2.4s ease forwards; }
@media (max-width: 640px) { .dq-lock-hint { white-space: normal; text-align: center; } }
@keyframes dq-lock-hint { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.dq-lockrow { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--outline); border-radius: 10px; }
.dq-lockrow .dq-note { margin: 0 0 8px; color: #1d5fd1; }
.dq-lockrow.is-free .dq-note { color: var(--text); }
.dq-lockrow .button-row { margin: 0; flex-wrap: wrap; }
.dq-unlocked { position: absolute; top: 8px; left: 8px; z-index: 46; display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--outline); border-radius: 999px; background: var(--surface); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); font-size: 14px; font-weight: 600; }
.dq-unlocked .ghost-button { min-height: 34px; padding: 0 12px; }
.dq-zoom-fit { position: absolute; left: 8px; bottom: 8px; z-index: 46; display: inline-flex; gap: 6px; }
.dq-zoom-fit .ghost-button { min-height: 38px; min-width: 38px; }
.dq-plan { touch-action: none; }

/* Working on one cabinet: the insert tools give way to its own settings, so
   the drawing keeps the room. */
.dq-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dq-panel-done { flex: 0 0 auto; }
.dq-fronts-button { margin-bottom: 12px; }
.dq-fronts-sheet .dq-scope { margin-bottom: 12px; }
.dq-fronts-sheet .dq-fields { margin-bottom: 10px; }

/* The handle on a cabinet's free edge. It is what you pull to stretch the
   cabinet into the gap beside it. */
.dq-grip { fill: rgba(155, 89, 182, 0.18); cursor: ew-resize; }
.dq-grip-line { stroke: #7a4a78; pointer-events: none; }

/* Picking a board or a finish from the library. */
.dq-field select {
  min-height: 42px; padding: 8px 10px; min-width: 0; width: 100%;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 500;
}

/* Three figures to a finish, one for each way a door is made. */
.finish-hours-row { padding: 12px 0; border-top: 1px solid var(--border); }
.finish-hours-row:first-of-type { border-top: 0; }
.finish-hours-name { margin: 0 0 8px; font-weight: 700; font-size: 14px; }
.finish-hours-fields { gap: 10px; }
/* The grip on the top of a cabinet, pulled to make it taller. */
.dq-grip[data-design-resize-edge="top"],
.dq-grip[data-design-resize-edge="bottom"] { cursor: ns-resize; }

/* ── The band over the drawing ─────────────────────────────────────────────
   One row, the same in the elevation and in 3D: the view on the left, how far
   the run stands off the wall in the middle, undo and redo on the right. */
.dq-stage { display: flex; flex-direction: column; gap: 8px; }
.dq-band { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; flex: 0 0 auto; }
.dq-seg { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--outline); border-radius: 8px; overflow: hidden; }
.dq-seg button, .dq-band-tools button {
  min-height: 34px; padding: 0 14px; border: 0; background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.dq-seg button + button { border-left: 1px solid var(--outline); }
.dq-seg button.is-on { background: var(--orange); color: #fff; }
.dq-band-note { flex: 1 1 160px; min-width: 0; font-size: 13px; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.dq-band-tools { display: inline-flex; gap: 6px; flex: 0 0 auto; margin-left: auto; }
.dq-band-tools button { border: 1px solid var(--outline); border-radius: 8px; }
.dq-band-tools button[disabled] { opacity: 0.4; pointer-events: none; }

/* The drawing area: the elevation or the 3D view, with the warnings in its
   top right corner. */
.dq-drawing { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.dq-drawing > svg { flex: 1 1 auto; min-height: 0; }

.dq-warn { position: absolute; top: 8px; right: 76px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dq-warn-button {
  min-width: 44px; min-height: 36px; padding: 0 12px; border-radius: 18px; cursor: pointer;
  border: 1px solid var(--outline); background: var(--surface); color: var(--muted); font: inherit; font-weight: 700;
}
.dq-warn-button.is-open { background: #fdeadf; border-color: #e5a27f; color: #8f3b12; }
.dq-warn-panel {
  width: min(380px, 80vw); max-height: 60vh; overflow-y: auto; padding: 12px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); font-size: 13px;
}
.dq-warn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dq-warn-head .ghost-button, .dq-warn-actions .ghost-button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.dq-warn-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dq-warn-item { padding: 8px 10px; border-radius: 8px; background: #fdeadf; color: #8f3b12; }
.dq-warn-item.is-dismissed { background: var(--surface-soft); color: var(--muted); }
.dq-warn-item p { margin: 0 0 6px; }
.dq-warn-go { display: block; width: 100%; margin: 0 0 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dq-warn-go:hover, .dq-warn-go:focus-visible { text-decoration: underline; }
.dq-clash-box { margin: 8px 0; padding: 10px 12px; border: 1px solid #e3a49c; border-radius: 8px; background: #fbe9e7; color: #a32116; }
.dq-clash-box p { margin: 0 0 8px; font-weight: 600; font-size: 13px; }
.dq-clash-box .dq-warn-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dq-warn-actions { display: flex; gap: 6px; flex-wrap: wrap; }

@media (orientation: landscape) {
  .dq-stage { flex-direction: column; }
  .dq-3d { max-height: none; height: 100%; }
}

/* A short panel (the 3D view's) stays at the top rather than stretching its
   first button to fill the height. */
.dq-side { align-content: start; }
.dq-3d-panel .dq-3d-title { margin: 0; font-size: 17px; }

/* The doors switch in the band: a small label inside the group. */
.dq-seg-label { display: inline-flex; align-items: center; padding: 0 10px; font-size: 12px; color: var(--muted); background: var(--surface-soft); border-right: 1px solid var(--outline); }

/* The WebGL 3D view: a box the size the drawing would be, the canvas filling it. */
.dq-3d-host { height: 52vh; max-height: none; position: relative; overflow: hidden; }
@media (min-width: 900px) { .dq-3d-host { height: 70vh; } }
@media (orientation: landscape) { .dq-3d-host { height: 100%; min-height: 0; flex: 1 1 auto; } }
.dq-3d-canvas { display: block; width: 100%; height: 100%; touch-action: pan-x pan-y; cursor: default; }
.dq-3d-canvas.is-held { touch-action: none; }
/* The host must let a swipe through too: touch-action is the narrowest of an
   element and everything around it, so a host set to none stopped the page
   scrolling under a finger anywhere on the model (Dean, 31 October 2026). */
.dq-3d.dq-3d-host { touch-action: pan-x pan-y; }
.dq-3d-canvas.is-panning { cursor: grabbing; }

/* "Add inside": four tiles at the top of a cabinet's panel. */
.dq-inside-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.dq-inside-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 64px; padding: 6px 4px;
  font-size: 11px; line-height: 1.2; text-align: center; touch-action: none; }
.dq-inside-tile svg { color: var(--text); }
/* Locks under the size fields. */
.dq-locks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.dq-lock { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 52px; padding: 6px 10px; text-align: left; }
.dq-lock small { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted, #667); }
.dq-lock span { font-size: 13px; font-weight: 600; }
.dq-lock.is-on span { color: #1d5fd1; }
/* A locked figure is outlined in blue, not filled orange: the panel's general
   is-on fill put blue words on orange and made the lock unreadable. */
.dq-panel .ghost-button.dq-lock.is-on { background: #eef3fc; border-color: #1d5fd1; color: var(--text); }
.dq-keeps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.dq-keep { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 96px; padding: 10px; text-align: center; }
.dq-keep-pic { width: 72px; height: 34px; }
.dq-keep small { color: var(--muted, #666); }
.dq-keep-box { fill: none; stroke: currentColor; stroke-width: 1.5; }
.dq-keep-box.is-me { stroke: #d0661f; stroke-width: 2.5; }
.dq-keep-box.is-giving { fill: #c9dcf2; }
.dq-keep-box.is-gap { stroke-dasharray: 2 2; stroke-width: 1; }
.dq-keep-held { stroke: #1d5fd1; stroke-width: 3; }
.dq-field input[disabled] { background: var(--surface-soft); color: var(--muted); }

/* Hanging up on Berry is never covered: the pill on other screens, and the
   design screen's own button, both sit above any box that opens. */
/* Centred across the whole width, not from the middle, so on a phone it has
   the screen to use and its button is never squeezed (Dean, 31 October
   2026). */
.new-build-banner {
  position: fixed; z-index: 95; left: 16px; right: 16px; top: max(12px, env(safe-area-inset-top)); margin: 0 auto; width: fit-content; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); font-size: 14px; font-weight: 600;
}
.flow-hangup-pill {
  position: fixed; z-index: 90; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); font-size: 14px; font-weight: 600;
}
.dq-voice.is-live { position: relative; z-index: 45; }

/* Delete beside Done at the top of the cabinet panel, and beside a picked
   shelf's name (Dean, 8 October 2026). */
.dq-panel-actions { display: flex; gap: 8px; flex-shrink: 0; }
.dq-picked-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dq-picked-head .dq-group { margin: 0; }

/* The cabinet panel in clearly outlined boxes, in the order a maker works:
   what can be added, what is inside, fronts, then size and materials. No
   colours, just the outline (Dean, 9 October 2026). */
.dq-box {
  border: 1px solid var(--line, #d9dee6);
  border-radius: 10px;
  padding: 4px 12px 12px;
  margin: 10px 0;
}
.dq-inside-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line, #e6e9ee);
}
.dq-inside-line:last-of-type { border-bottom: 0; }
.dq-inside-line .ghost-button { min-height: 36px; padding: 6px 12px; }
.dq-stepper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 6px 0 10px;
}
.dq-stepper .ghost-button { min-width: 52px; min-height: 48px; font-size: 1.4rem; font-weight: 800; }
.dq-stepper-figure { min-width: 2ch; text-align: center; font-size: 1.6rem; font-weight: 800; }
/* Which cabinet a picked shelf or rail is in, above its name. */
.dq-panel-context { margin: 4px 0 0; font-size: 0.85rem; font-weight: 700; color: var(--muted, #6b7280); }
.dq-context-link { border: 0; background: none; padding: 0; font: inherit; color: var(--ink, #1f2937); text-decoration: underline; cursor: pointer; }

/* Choices as cards with a picture, each with its own i (Dean, 9 October
   2026). The i sits in the corner, apart from the card's own press. */
.dq-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.dq-cards-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dq-pic-spoil { fill: #d8d2c8; stroke: none; }
.dq-card { position: relative; }
.dq-card-pick {
  width: 100%; min-height: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 30px 8px 8px; border: 1px solid var(--line, #d0d0d0); border-radius: 10px;
  background: var(--panel, #fff); color: inherit; font: inherit; font-size: 13px; font-weight: 600; text-align: center; cursor: pointer;
}
.dq-card.is-on .dq-card-pick { border: 2px solid var(--text, #2d2d2d); padding: 7px 29px 7px 7px; }
.dq-card .dq-i { position: absolute; top: 6px; right: 6px; }
.dq-i {
  width: 22px; height: 22px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  margin-left: 6px; padding: 0; border: 1px solid #9a9a9a; border-radius: 50%;
  background: var(--panel, #fff); color: #555; font: 600 12px Georgia, serif; cursor: pointer; vertical-align: middle;
}
.dq-i.is-open { background: var(--text, #2d2d2d); border-color: var(--text, #2d2d2d); color: #fff; }
.dq-info-text { margin: 4px 0 8px; padding-left: 8px; border-left: 2px solid #bbb; font-size: 12px; line-height: 1.4; color: var(--muted, #666); }
.dq-pic { width: 60px; height: auto; }
.dq-pic-box { fill: none; stroke: #777; stroke-width: 1; }
.dq-pic-shelf { stroke: #555; stroke-width: 3; }
.dq-pic-shelf.is-key { stroke: #c0592b; }
.dq-pic circle { fill: #222; }
.dq-pic-board { stroke: #555; stroke-width: 5; }
.dq-pic .dq-pic-hole { fill: none; stroke: #222; stroke-width: 1.5; }
.dq-pic-flat { stroke: #c0592b; stroke-dasharray: 2 2; }
.dq-piece-sketch { display: block; width: 100%; max-width: 320px; height: auto; margin: 4px auto 10px; }
.dq-sketch-line { fill: none; stroke: #222; stroke-width: 1.5; }
.dq-sketch-dim { fill: none; stroke: #444; stroke-width: 0.75; }
.dq-sketch-fig { font-size: 10px; fill: #222; }
.dq-pic-run { fill: none; stroke: #2f6fd6; stroke-width: 3; stroke-linecap: round; }
/* A line saying what something is set to, with Change beside it: each its
   own outlined block, its name small above what it is set to, so lines never
   run together (Dean, 9 October 2026). */
.dq-row {
  display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 10px 12px;
  border: 1px solid #c9c9c9; border-radius: 10px; background: var(--panel, #fff);
}
.dq-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dq-row-k { display: flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #777); }
.dq-row-v { flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; }
.dq-row .ghost-button { flex: none; min-height: 36px; font-size: 12px; }
.dq-row-focus .dq-cards { margin-top: 0; }
.dq-panel-head h3 { display: flex; align-items: center; }
.dq-row-edit { margin: 0 0 8px; padding: 10px; border: 1px solid #ddd; border-radius: 10px; background: #fafafa; }
.dq-card-pick:has(> span:only-child) { min-height: 44px; justify-content: center; }
.dq-row-pic { flex: none; width: 52px; display: flex; justify-content: center; }
.dq-row-pic .dq-pic { width: 48px; }

/* The run's worktops (Dean, 9 October 2026): the top, its hit band, and the
   handles floating over its ends when it is picked. */
.dq-run-worktop.is-picked { stroke: #6b3fa0; }
.dq-wt-hit { fill: transparent; stroke: none; cursor: pointer; touch-action: none; }
.dq-wt-handle { fill: #fff; stroke: #6b3fa0; pointer-events: none; }
.dq-wt-stem { stroke: #6b3fa0; pointer-events: none; }
.dq-wt-arrow { fill: #6b3fa0; text-anchor: middle; font-weight: 700; pointer-events: none; }
.dq-pic-top { fill: #c79a6b; stroke: #7a5a3a; stroke-width: 1; }
.dq-pic-wall { stroke: #888; stroke-width: 3; }
.dq-pic-topplan { fill: #ead7bf; stroke: none; }
.dq-pic-edged { stroke: #2d2d2d; stroke-width: 4; }
.dq-pic-plain { stroke: #b9a58c; stroke-width: 1; }
.dq-pic-word { font-size: 7px; fill: #777; text-anchor: middle; }
.dq-pic-plan { width: 90px; }
.dq-wt-edges { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 8px; }
.dq-wt-edges .dq-scope { width: 100%; }

/* Callbacks settings (ADR 0037). */
.cb-day { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.cb-day span { display: flex; align-items: center; gap: 4px; }
.cb-day input { min-width: 0; width: 100%; }
@media (max-width: 560px) { .cb-day { grid-template-columns: 1fr; } }
.cb-away { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.cb-line { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; margin: 8px 0; border: 1px solid #c9c9c9; border-radius: 10px; background: var(--panel, #fff); }
.cb-line.is-cancelled { opacity: .6; }
.cb-line-text { display: flex; flex-direction: column; gap: 2px; }
.cb-line-text small { color: var(--muted, #777); }
.cb-line .button-row { margin: 0; flex-wrap: wrap; }
.cb-move-days { flex-wrap: wrap; }
.cb-move-days .ghost-button { flex: 0 0 auto; min-height: 34px; }
.cb-move-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin-top: 6px; }
.cb-project { padding: 4px 12px; }

/* A part picked in 3D: what to show, each choice saying what it does. */
.dq-show-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dq-show-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px; min-height: 0; }
.dq-show-choice b { font-size: 0.92rem; }
.dq-show-choices .dq-line-picture rect, .dq-show-choices .dq-line-picture path { fill: none; stroke: currentColor; stroke-width: 1.4; }
.dq-downstand { opacity: 0.9; }
.dq-show-choices.dq-two-up { grid-template-columns: repeat(2, 1fr); }
.dq-ticks { display: grid; gap: 6px; margin-bottom: 10px; }
.dq-ticks .dq-tick { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 2px 10px; border: 1px solid var(--outline); border-radius: 8px; background: var(--surface); cursor: pointer; }
.dq-ticks .dq-tick input { width: 18px; height: 18px; }
.dq-show-choice span { font-size: 0.78rem; font-weight: 400; color: var(--muted, #6b7280); }
.dq-show-choice.is-on { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.dq-show-choice.is-on span { color: inherit; opacity: 0.9; }
.dq-pic-section { fill: #e9dcc4; stroke: #555; stroke-width: 2; }

/* Sketching on a face (ADR 0038). */
.sk-wrap { display: flex; flex-direction: column; gap: 6px; height: 100%; }
/* Room on the right for the ⚠ over the drawing, so it never covers a tool. */
.sk-tools { display: flex; flex-wrap: wrap; gap: 6px; padding-right: 136px; }
.sk-tool { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; min-width: 64px; min-height: 0; font-size: 0.78rem; }
.sk-tool.is-on { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.sk-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sk-prompt { margin: 0; font-size: 0.85rem; color: var(--muted, #6b7280); min-height: 1.2em; }
.sk-sheet { width: 100%; flex: 1; min-height: 360px; max-height: 70vh; background: #fbf8f3; border-radius: 10px; touch-action: none; user-select: none; cursor: crosshair; }
.sk-face { fill: #efe2c8; stroke: #333; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.sk-neighbour { fill: rgba(70, 110, 170, 0.1); stroke: none; pointer-events: none; }
.sk-neighbour-round { stroke: #3e5f73; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.sk-ref { stroke: #3e5f73; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.sk-ref-centre { stroke-dasharray: 12 3 2 3; opacity: 0.8; }
.sk-ref.is-first { stroke: #b5653c; stroke-width: 2.5px; }
.sk-ref-name { fill: #3e5f73; }
.sk-line { fill: none; stroke: #1d4ed8; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.sk-line.is-picked { stroke: #b5653c; stroke-width: 3.5px; }
.sk-line.is-construction { stroke: #6b7c93; stroke-width: 1.5px; stroke-dasharray: 6 4; }
/* A copy in an array: drawn as the shape is, a little lighter, picked as its array. */
.sk-line.sk-copy { stroke: #5b7fe0; }
.sk-line.sk-copy.is-picked { stroke: #b5653c; }
.sk-point { fill: #1d4ed8; }
.sk-first { fill: none; stroke: #b5653c; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.sk-ghost { fill: none; stroke: #1d4ed8; stroke-width: 1.5px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.sk-dim { fill: #111; text-anchor: middle; cursor: pointer; paint-order: stroke; stroke: #fbf8f3; stroke-width: 4px; vector-effect: non-scaling-stroke; font-weight: 600; }
.sk-live { fill: #1d4ed8; paint-order: stroke; stroke: #fbf8f3; stroke-width: 3px; vector-effect: non-scaling-stroke; }
.dq-pic-added { fill: #c9dcf2; stroke: #1d4ed8; stroke-width: 2; }
.dq-pic-made { fill: #f8c9a0; stroke: #d0661f; stroke-width: 2; }
.dq-pic-cutline { fill: none; stroke: #c0392b; stroke-width: 2; stroke-dasharray: 3 2; }
.sk-wrap { position: relative; }
.sk-hover { fill: none; stroke: #b5653c; stroke-width: 4px; vector-effect: non-scaling-stroke; opacity: 0.85; }
.sk-hover-point { fill: #b5653c; opacity: 0.85; }
.sk-snap { fill: none; stroke: #2f7d4f; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.sk-snap-name { fill: #2f7d4f; }
.sk-trim { fill: none; stroke: #b42318; stroke-width: 4px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.sk-dimline { stroke: #666; stroke-width: 1px; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.sk-dim.is-picked { fill: #c2410c; }
.sk-dim.is-clash { fill: #d33a2c; }
.sk-dim.is-driven { fill: #6b7280; font-weight: 500; }
.sk-inline { position: absolute; width: 90px; height: 34px; padding: 4px 8px; font-size: 1rem; font-weight: 600; text-align: center; border: 2px solid #b5653c; border-radius: 6px; background: #fff; z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.sk-fill { stroke: none; fill: transparent; }
.sk-fill-through { fill: rgba(229, 83, 61, 0.16); }
.sk-fill-depth { fill: rgba(217, 160, 40, 0.22); }
.sk-fill-add { fill: rgba(29, 78, 216, 0.14); }
.sk-fill-extrude { fill: rgba(240, 138, 60, 0.30); }
.sk-fill.is-picked { stroke: #b5653c; stroke-width: 3px; vector-effect: non-scaling-stroke; }
.sk-dim-target { cursor: pointer; }
.sk-dim-hit { fill: transparent; pointer-events: all; }
.sk-dim-target:hover .sk-dim-hit { fill: rgba(232, 132, 90, 0.15); }
.sk-dim { pointer-events: none; }
/* Drawing: a figure never takes the click meant for a point under it. */
.sk-sheet.is-drawing .sk-dim-target, .sk-sheet.is-drawing .sk-dim-hit, .sk-sheet.is-drawing .sk-corner-hit { pointer-events: none; cursor: inherit; }
.sk-sheet [data-sk-preview], .sk-fill, .sk-dimline { pointer-events: none; }

/* The sketch list over the 3D model, as CAD programs keep their tree. */
.dq-tree { position: absolute; top: 8px; left: 8px; z-index: 4; width: min(280px, 70%); max-height: 60%; overflow: auto; background: rgba(60, 64, 72, 0.08); border-radius: 8px; font-size: 0.85rem; text-shadow: 0 0 3px rgba(255, 255, 255, 0.9); }
.dq-tree:not(.is-open) { width: auto; }
.dq-tree-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 6px 8px; border: 0; background: none; font: inherit; font-weight: 700; cursor: pointer; color: inherit; }
.dq-tree-list { list-style: none; margin: 0; padding: 0 6px 6px; }
.dq-tree-row { display: flex; align-items: center; gap: 8px; padding: 3px 2px; }
.dq-tree-tick { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #6b7280; background: rgba(255, 255, 255, 0.5); color: #fff; font-size: 0.75rem; line-height: 1; padding: 0; cursor: pointer; text-shadow: none; }
.dq-tree-tick.is-on { background: #2f6fd6; border-color: #2f6fd6; }
.dq-tree-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; padding: 2px 0; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.dq-tree-name span { color: #4b5563; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dq-tree-name:hover b { text-decoration: underline; }

/* Extrude: each way it goes in its own outlined block, coloured as its
   arrow on the model. */
.dq-way { border: 2px solid var(--line, #d9dee6); border-radius: 10px; padding: 8px; margin: 6px 0; }
.dq-way.is-off { border: 1px dashed var(--line, #d9dee6); padding: 8px; border-radius: 10px; margin: 6px 0; opacity: 0.85; }
.dq-way-swatch { flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dq-way-to { flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.dq-way-to .ghost-button { flex: 1 1 40%; }
.dq-tree-feature { padding-left: 30px; border-top: 0; }
.dq-tree-section { margin: 4px 8px 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #4b5563; }
.dq-tree-cabinet { padding: 3px 6px; border-radius: 6px; }
.dq-tree-cabinet.is-on { background: rgba(47, 111, 214, 0.16); box-shadow: inset 0 0 0 1.5px #2f6fd6; }
.dq-tree-feature .dq-tree-name span { white-space: normal; }

/* The 3D view's tools across the top, and the stage the model sits on. */
.dq-3d-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.dq-3d-tools { margin-bottom: 4px; }
.dq-3d-menu { position: absolute; z-index: 6; min-width: 220px; background: #fff; border: 1px solid var(--line, #d9dee6); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); padding: 4px; display: flex; flex-direction: column; }
.dq-3d-menu button { border: 0; background: none; text-align: left; padding: 12px 14px; font: inherit; cursor: pointer; border-radius: 6px; color: inherit; }
.dq-3d-menu button:hover { background: rgba(47, 111, 214, 0.1); }

/* Extrude, live: the figure by the pointer, the typed figure, and the
   question after: cut, or a new part. */
.dq-3d-figure { position: absolute; z-index: 6; pointer-events: none; padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.92); border: 1px solid #2f6fd6; font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.dq-3d-figure-input { position: absolute; z-index: 6; }
.dq-3d-ask { position: absolute; z-index: 7; width: 250px; background: #fff; border: 1px solid var(--line, #d9dee6); border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.dq-3d-ask p { margin: 0; font-size: 0.9rem; }
.dq-3d-ask-row { display: flex; gap: 8px; }
.dq-3d-ask-row button { flex: 1 1 0; }
.dq-tree-name { cursor: default; }
.dq-tree-cabinet { cursor: pointer; }
.dq-tree-edit { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(47, 111, 214, 0.5); background: rgba(255, 255, 255, 0.6); color: #1f4fa0; border-radius: 6px; padding: 2px 8px; font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; text-shadow: none; }
.dq-tree-edit .sk-icon { width: 14px; height: 14px; }
.dq-tree-edit:hover { background: #fff; }
.dq-pic-dim { fill: none; stroke: #2f6fd6; stroke-width: 1.2; }
.dq-pic-text { font-size: 7px; fill: #2f6fd6; font-weight: 700; }
.dq-edging-choices { border-left: 3px solid #b5653c; padding-left: 8px; margin: 4px 0 8px; }
.dq-inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.dq-inline-field input { width: 64px; padding: 4px 6px; }

/* ===== Technical drawings (ADR 0039) ===== */
.dq-drawings { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; background: #e9ecef; overflow: auto; }
.dq-drawings-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dq-drawings-bar > strong { font-size: 17px; margin-right: 6px; }
.dq-drawings-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.dq-drawings-tools .ghost-button.is-on { border-color: #111; background: #fff; }
.dq-drawings-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border: 1px solid #c9ced3; border-radius: 8px; }
.dq-drawings-ask > span { font-weight: 600; margin-right: 4px; }
.dq-drawings-ask .ghost-button.is-on { border-color: #111; }
.dq-drawings-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dq-drawings-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; background: #fff; border: 1px solid #c9ced3; border-radius: 8px; font-size: 13px; }
.dq-drawings-sheet { position: relative; width: 100%; max-width: 1500px; margin: 0 auto; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12); }
.dq-drawings-sheet > svg:first-child { display: block; width: 100%; height: auto; }
.dq-drawings-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dq-drawings-sheet.is-placing { cursor: crosshair; touch-action: none; }
.dq-draw-draft path, .dq-draw-draft rect { fill: rgba(47, 111, 214, 0.08); stroke: #2f6fd6; stroke-width: 0.5; }
.dq-draw-draft path { fill: none; }
/* ===== Grain (ADR 0042) ===== */
.dq-grain { fill: none; stroke: #8a6a3c; opacity: 0.45; pointer-events: none; }
.dq-grain-pic { width: 40px; height: 40px; display: block; }
.dq-grain-pic rect { fill: #f4e6cf; stroke: #6b5a3e; stroke-width: 1.5; }
.dq-grain-pic path { fill: none; stroke: #8a6a3c; stroke-width: 1.2; }
.dq-show-choice .dq-grain-pic { margin: 0 auto 4px; }

/* ===== Toolpaths (ADR 0044) ===== */
.dq-nest-path { fill: none; stroke-width: 2.5; opacity: 0.85; }
.dq-nest-path.is-t0 { stroke: #c0392b; }
.dq-nest-path.is-t1 { stroke: #b5653c; }
.dq-nest-path.is-t2 { stroke: #2f6fd6; }
.dq-nest-path.is-t3 { stroke: #7a4a78; }
.dq-nest-path.is-skin { stroke-dasharray: 10 8; opacity: 0.5; }
/* Rough and finish: the roughing faint, the finishing pass solid and dark,
   the tabs that hold small parts marked. */
.dq-nest-path.is-rough { stroke-dasharray: 6 5; opacity: 0.45; }
.dq-nest-path.is-finish { stroke: #1f6f4a; stroke-width: 3; opacity: 0.95; }
.dq-nest-tab { fill: #f2b705; stroke: #222; stroke-width: 1.5; }
.dq-nest-path.is-under { stroke-dasharray: 4 6; opacity: 0.7; }
.cnc-tool { margin-bottom: 10px; }

/* ===== Grain-matched sets (ADR 0043) ===== */
.dq-gm-pic { display: block; width: 100%; height: auto; max-height: 260px; margin: 6px 0 10px; }
.dq-gm-front rect { fill: #fff; stroke: #6b5a3e; stroke-width: 6; cursor: pointer; }
.dq-gm-front path { fill: none; stroke: #8a6a3c; stroke-width: 4; opacity: 0.45; pointer-events: none; }
.dq-gm-front.is-on rect { fill: #f4e6cf; stroke: #b5653c; stroke-width: 12; }
.dq-gm-front.is-off rect { fill: #eee; stroke: #bbb; cursor: default; }
.dq-nest-set { fill: none; stroke: #7a4a78; stroke-width: 5; stroke-dasharray: 22 10; }

/* ===== Nesting for the CNC (ADR 0041) ===== */
.dq-nest-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.dq-nest-files { display: flex; gap: 6px; }
.dq-nest-line { display: inline-flex; flex-direction: column; gap: 2px; padding: 6px 10px; background: #fff; border: 1px solid #c9ced3; border-radius: 8px; font-size: 14px; }
.dq-nest-line > small { font-size: 11px; color: #5f6057; text-transform: uppercase; letter-spacing: 0.04em; }
.dq-nest-line .ghost-button { padding: 2px 10px; }
.dq-nest-sheet { padding: 10px; position: relative; }
/* A sheet's name (SM-03), the same as its files' (Dean, 9 November 2026):
   on the sheet's picture, its heading and its thumbnail. */
.dq-nest-sheet-size { margin-left: 10px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, 0.45); font-weight: 600; letter-spacing: 0; }
.dq-nest-edge-size { fill: #1f2a24; font-weight: 700; text-anchor: middle; }
.dq-nest-sheet-tag { position: absolute; top: 14px; left: 14px; z-index: 1; display: inline-flex; align-items: baseline; padding: 4px 10px; border-radius: 8px; background: var(--ink, #1f2a24); color: #fff; pointer-events: none; }
.dq-nest-sheet-label { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.04em; }
.dq-nest-label { display: inline-block; padding: 1px 8px; margin-right: 4px; border-radius: 6px; background: var(--ink, #1f2a24); color: #fff; font-weight: 700; letter-spacing: 0.04em; }
.dq-nest-svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 230px); }
.dq-nest-board { fill: #f4efe6; stroke: #8a7f6c; stroke-width: 3; }
.dq-nest-grain { fill: none; stroke: rgba(138, 127, 108, 0.25); stroke-width: 3; stroke-dasharray: 40 30; }
.dq-nest-outline { fill: #fff; fill-rule: evenodd; stroke: #1d3a27; stroke-width: 3; }
.dq-nest-cutout { fill: #f4efe6; stroke: #1d3a27; stroke-width: 2.5; }
.dq-nest-pocket { fill: rgba(47, 111, 214, 0.18); fill-rule: evenodd; stroke: #2f6fd6; stroke-width: 1.5; }
/* A pocket round a piece left standing, or round a hole, is filled only between its edges (Dean, 6 November 2026: part 56's face looked pocketed all over). */
.dq-nest-outline, .dq-nest-cutout { fill-rule: evenodd; }
.dq-nest-pocket.is-under, .dq-nest-drill.is-under { stroke-dasharray: 6 4; }
.dq-nest-drill { fill: #2f6fd6; stroke: #2f6fd6; stroke-width: 1; }
.dq-nest-drill.is-under { fill: none; }
.dq-nest-turn { fill: none; stroke: #b5653c; stroke-width: 6; stroke-dasharray: 18 10; }
/* Where the check found a fault: ringed in red on the sheet. */
.dq-nest-mark { fill: rgba(211, 58, 44, 0.18); stroke: #d33a2c; stroke-width: 5; }
.dq-nest-names text { fill: #2d2d2d; text-anchor: middle; dominant-baseline: middle; font-weight: 600; }
.dq-nest-left { background: #fff; border: 1px solid #c9ced3; border-radius: 8px; padding: 6px 12px; }
.dq-nest-left ul { margin: 4px 0; padding-left: 18px; font-size: 14px; }
#dq-print-root { display: none; }
@media print {
  @page { size: A3 landscape; margin: 0; }
  body.is-printing-drawings > *:not(#dq-print-root) { display: none !important; }
  body.is-printing-drawings { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body.is-printing-drawings #dq-print-root { display: block !important; }
  .dq-print-page { width: 420mm; height: 297mm; page-break-after: always; break-after: page; overflow: hidden; }
  .dq-print-page:last-child { page-break-after: auto; break-after: auto; }
  .dq-print-page svg { width: 420mm; height: 297mm; display: block; }
}
.dq-title-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.dq-title-table th { text-align: left; font-weight: 600; padding: 6px 10px 6px 0; white-space: nowrap; vertical-align: middle; width: 1%; }
.dq-title-table td { padding: 4px 0; }
.dq-title-table input { width: 100%; }
.dq-title-table tr + tr { border-top: 1px solid #e3e6e9; }
.dq-title-backdrop { z-index: 80; }

/* An on-or-off choice with a dot that fills when it is on (ADR 0048). */
.dq-dot-toggle { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; margin: 6px 0; border: 1px solid rgba(0, 0, 0, 0.18); border-radius: 12px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.dq-dot-toggle.is-on { border-color: currentColor; }
.dq-dot { flex: none; width: 20px; height: 20px; margin-top: 1px; border: 2px solid currentColor; border-radius: 50%; position: relative; }
.dq-dot-toggle.is-on .dq-dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: currentColor; }
.dq-dot-text { display: flex; flex-direction: column; gap: 2px; }
.dq-dot-text small { opacity: 0.7; font-weight: 400; }
.dq-3d-menu-head { margin: 0; padding: 8px 14px 4px; font-size: 0.78rem; opacity: 0.7; }

/* Settings grouped by what they are about (Dean, 17 October 2026): each family
   outlined, on its own pale colour, the same wherever settings are shown. */
.dq-family { margin: 14px 0; padding: 12px 14px 14px; border: 1px solid var(--family-line); border-radius: 14px; background: var(--family-bg); }
.dq-family-title { margin: 0 0 4px; font-weight: 700; font-size: 0.95rem; color: var(--family-ink); }
.dq-family .dq-group:first-of-type { margin-top: 4px; }
.dq-family input, .dq-family select { background: #fff; }
.dq-family-carcass { --family-bg: #f7f1e6; --family-line: #e3d4b8; --family-ink: #7a5a26; }
.dq-family-setout { --family-bg: #eaf2fb; --family-line: #c6d9ef; --family-ink: #2f5a87; }
.dq-family-shelves { --family-bg: #e9f5ec; --family-line: #c3e1cb; --family-ink: #2e6b40; }
.dq-family-doors { --family-bg: #fbedf0; --family-line: #efcbd3; --family-ink: #8a3a4d; }
.dq-family-drawers { --family-bg: #f1edfb; --family-line: #d6cdef; --family-ink: #5a4690; }
.dq-family-cnc { --family-bg: #eef1f4; --family-line: #d2d9e1; --family-ink: #44515f; }

/* The specification view of a fitting (ADR 0049). */
.modal.fx-spec { width: min(100%, 760px); }
.fx-views { display: grid; gap: 12px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 640px) { .fx-views { grid-template-columns: 1fr; } }
.fx-sketch-host svg { width: 100%; height: auto; display: block; background: #fff; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 10px; }
.fx-3d-host { min-height: 240px; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 10px; background: #fbfaf7; overflow: hidden; }
.fx-3d-canvas { display: block; width: 100%; }

/* A sloped ceiling on a survey elevation: the room above it shaded off. */
.survey-elevation-slope { fill: rgba(60, 64, 72, 0.14); stroke: none; }
.survey-slope-picture { width: 60px; height: 44px; }
.survey-slope-picture polygon { fill: none; stroke: currentColor; stroke-width: 2; }

/* Where a carcass with no fronts stands, as a plan (Dean, 17 October 2026). */
.dq-line-picture { width: 60px; height: 44px; }
.dq-plate-picture { display: block; width: 60px; height: 44px; margin: 2px 0 6px; }
.dq-plate-picture rect { fill: none; stroke: currentColor; stroke-width: 1.5; }
.dq-plate-picture circle { fill: currentColor; }
.dq-plate-picture .dq-plate-edge { stroke: currentColor; stroke-width: 1; stroke-dasharray: 3 2; opacity: 0.6; }
.dq-line-picture rect { fill: none; stroke: currentColor; stroke-width: 1.5; }
.dq-line-picture .dq-line-faces { stroke: currentColor; stroke-width: 1; stroke-dasharray: 3 2; opacity: 0.6; }
.dq-line-picture .dq-line-door { stroke: currentColor; stroke-width: 3; }
.dq-line-ask { display: flex; justify-content: center; margin: 4px 0 12px; }
.dq-line-ask .dq-line-picture { width: 120px; height: 88px; }

/* Joined elevations (ADR 0055): the plan of the walls and the cabinets cut
   through the middle of their height. */
.dq-plan { width: 100%; height: auto; max-height: 70vh; display: block; background: var(--surface, #fff); }
.dq-plan-wall { fill: currentColor; opacity: 0.55; }
.dq-plan-label { fill: currentColor; }
.dq-plan-part { fill: currentColor; opacity: 0.18; stroke: currentColor; stroke-width: 2; vector-effect: non-scaling-stroke; }
.dq-plan-part.is-front { opacity: 0.4; }
.dq-plan-part.is-over { fill: none; opacity: 0.6; stroke-dasharray: 6 4; }
.dq-plan-unit { cursor: pointer; }
.dq-plan-unit polygon { fill: transparent; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.dq-plan-unit.is-over polygon { stroke-dasharray: 6 4; }
.dq-plan-unit.is-picked polygon { stroke-width: 3; stroke: var(--accent, #2a6); }
.dq-plan-unit text { fill: currentColor; pointer-events: none; }

/* The leaf and berry beside the assistant's own words and buttons. */
.flow-berry-inline {
  display: inline-block;
  height: 1.4em;
  width: auto;
  vertical-align: middle;
  margin-right: 6px;
}

/* The command in hand, at the top right of the model: what to pick next,
   step by step (Dean, 20 October 2026). */
.dq-cmd { position: absolute; top: 92px; right: 8px; z-index: 6; width: min(300px, 70%); background: #fff; border: 1px solid #2f6fd6; border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.dq-cmd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dq-cmd-head b { font-size: 0.95rem; }
.dq-cmd-cancel { min-height: 30px; padding: 0 8px; font-size: 0.8rem; }
.dq-cmd kbd { font: inherit; font-size: 0.72rem; border: 1px solid var(--outline, #d9dee6); border-radius: 4px; padding: 0 4px; margin-left: 4px; color: var(--muted, #667); }
.dq-cmd-steps { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.dq-cmd-steps li { color: var(--muted, #667); }
.dq-cmd-steps li.is-on { color: #1d3f8f; font-weight: 700; }
.dq-cmd-steps li.is-done { color: #2f6b45; }
.dq-cmd-step { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.dq-cmd-after { margin: 0; color: var(--muted, #667); font-size: 0.8rem; }
.dq-cmd-next { min-height: 34px; }

/* Copy from part: the edges that can be copied, dashed; points copied in. */
.sk-cand { fill: none; stroke: #9a6b2f; stroke-width: 1.5px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
circle.sk-cand { fill: rgba(154, 107, 47, 0.25); }
.sk-ref-point { fill: #2f6fd6; stroke: none; }
/* A sheet turned over: its words still read the right way round. */
.sk-mirror text { transform-box: fill-box; transform-origin: center; transform: scale(-1, 1); }

/* The assistant on the drawing (Dean, 20 October 2026): the leaf and berry,
   breathing, top right of the drawing in every view; talking, what it is
   doing and Hang up beside it. */
/* The leaf as far from the top of the drawing as the berry is from its right
   (Dean, 20 October 2026): the button is cut to the berry's own width. */
.dq-berry { position: absolute; top: 11px; right: 8px; z-index: 46; display: flex; align-items: center; gap: 10px; }
.dq-berry-btn { display: grid; place-items: center; width: 44px; height: 60px; padding: 0; border: none; border-radius: 22px; background: transparent; cursor: pointer; }
.dq-berry-btn .flow-berry { height: 48px; }
.dq-berry-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dq-berry-btn:active { transform: scale(0.94); }
.dq-berry.is-live { padding: 4px 4px 4px 14px; border: 1px solid var(--outline); border-radius: 999px; background: var(--surface); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); }
.dq-berry.is-live { top: 4px; }
.dq-berry.is-live .dq-berry-btn { width: 52px; height: 52px; border-radius: 50%; background: rgba(140, 51, 93, 0.1); }
.dq-berry-say { max-width: 260px; font-size: 14px; font-weight: 600; color: var(--primary); }
.dq-berry-hang { min-height: 38px; }
@media (max-width: 700px) { .dq-berry-say { max-width: 140px; font-size: 13px; } }
@media (max-height: 560px) { .dq-cmd { top: auto; bottom: 8px; right: 8px; } }

/* Files, and Materials & Fittings: each kind in a box of its own pale colour,
   from the settings families, so the boxes are told apart at a glance (Dean,
   21 October 2026). */
.files-group { margin-bottom: 14px; padding: 14px; border: 1px solid var(--family-line); border-radius: 12px; background: var(--family-bg); }
.files-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.files-group-head h2 { margin: 0 0 2px; font-size: 1.15rem; color: var(--family-ink); }
.files-group-head p { margin: 0; }
.files-group-head .ghost-button { flex: 0 0 auto; background: #fff; }
.files-group .empty { background: rgba(255, 255, 255, 0.6); }
.files-group > .button-row { margin-bottom: 8px; }
.files-group > .button-row .ghost-button { background: #fff; }
.files-open-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; cursor: pointer; }
.files-open-row small { color: var(--muted); }
.files-family-sky { --family-bg: #eaf2fb; --family-line: #c6d9ef; --family-ink: #2f5a87; }
.files-family-sand { --family-bg: #f7f1e6; --family-line: #e3d4b8; --family-ink: #7a5a26; }
.files-family-lavender { --family-bg: #f1edfb; --family-line: #d6cdef; --family-ink: #5a4690; }
.files-family-mint { --family-bg: #e9f5ec; --family-line: #c3e1cb; --family-ink: #2e6b40; }

/* Parts of a model brought in from other software (ADR 0060). */
.dq-import-part { fill: #efe6d6; stroke: #6b5a45; cursor: pointer; }
.dq-import-part.is-picked { fill: #f6d9bd; stroke: #c0592b; }
.dq-import-pick { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; }
.dq-import-list { margin: 0; padding-left: 18px; max-height: 50vh; overflow: auto; }
.dq-import-list li { margin: 2px 0; }
.dq-import-part.is-odd { fill: #f3d1cc; stroke: #b3261e; }
.cutlist-flagged td, .cutlist-flagged input, .cutlist-flagged select { color: #b3261e; background: #fbeaea; }
g.dq-import-part { cursor: pointer; }
g.dq-import-part path { fill: #efe6d6; stroke: #6b5a45; }
g.dq-import-part .dq-import-edges { fill: none; }
g.dq-import-part.is-picked path { fill: #f6d9bd; stroke: #c0592b; }
g.dq-import-part.is-odd path { fill: #f3d1cc; stroke: #b3261e; }
g.dq-import-part .dq-import-edges, g.dq-import-part.is-picked .dq-import-edges, g.dq-import-part.is-odd .dq-import-edges { fill: none; }
.dq-section-kinds { max-width: 420px; }
.dq-drawings-at { display: inline-flex; align-items: center; gap: 6px; }
.dq-drawings-at input { width: 90px; }

/* Parts hidden on the 3D model (build 360). */
.dq-tree-parts { padding-left: 26px; }
.dq-tree-part .dq-tree-name { cursor: pointer; }
.dq-tree-part .dq-tree-name.is-on b { text-decoration: underline; color: #1f4fa0; }
.dq-tree-section .dq-tree-edit { margin-left: 6px; text-transform: none; letter-spacing: 0; }
.dq-3d-hidden-note { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.92); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); font-size: 0.85rem; white-space: nowrap; }
.dq-3d-hidden-note .ghost-button { padding: 4px 10px; min-height: 0; }

/* One part made here, looked at straight on in 2D (Dean, 29 October 2026):
   its face, and an edge when a side is tapped, turning to it. */
.dq-piece-face-outline { fill: #f3ead8; stroke: #3b3b3b; }
.dq-piece-face-shape { fill: #fff; stroke: #3b3b3b; }
.dq-piece-face-shape.is-behind { fill: none; stroke-dasharray: 4 3; }
.dq-piece-face-hidden { fill: none; stroke: #3b3b3b; stroke-dasharray: 4 3; }
.dq-piece-face-tangent { stroke: #9a9a9a; }
.dq-piece-face-fig, .dq-piece-face-title, .dq-piece-face-hint { fill: #3b3b3b; }
.dq-piece-face-hint { fill: #777; }
.dq-piece-face-back { fill: #2f6fd6; cursor: pointer; text-decoration: underline; }
.dq-piece-edge-hit { stroke: transparent; cursor: pointer; }
.dq-piece-edge-hit:hover { stroke: rgba(47, 111, 214, 0.25); }
.dq-piece-face [data-design-piece-edge=""] { cursor: pointer; }
.dq-flip-x { animation: dq-flip-x 0.45s ease-out; transform-origin: 50% 50%; }
.dq-flip-y { animation: dq-flip-y 0.45s ease-out; transform-origin: 50% 50%; }
@keyframes dq-flip-x { from { transform: perspective(900px) rotateX(85deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes dq-flip-y { from { transform: perspective(900px) rotateY(85deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dq-flip-x, .dq-flip-y { animation: none; } }

/* What the assistant has heard so far, beside the berry. */
.dq-berry-heard { display: block; max-width: 260px; font-size: 12px; line-height: 1.35; color: #555; font-style: italic; }

/* The part's sketch over its face in 2D (Dean, 29 October 2026). */
.dq-piece-sketch { cursor: pointer; }
.dq-piece-sketch-dim { stroke: #2f6fd6; }
.dq-piece-sketch-fig { fill: #2f6fd6; font-weight: 600; }

/* How this job is cut, on the nest page (Dean, 29 October 2026). */
.dq-nest-cut { display: grid; gap: 8px; margin: 10px 0; }
.dq-nest-cut-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; }
.dq-nest-cut-line small { display: block; color: #6b6b6b; font-size: 0.75rem; }
.dq-nest-cut-options { display: grid; gap: 10px; padding: 4px 2px 8px; }
.dq-nest-job { font-size: 0.72rem; color: #6b6b6b; border: 1px solid #c9c9c9; border-radius: 6px; padding: 0 5px; margin-left: 6px; }
.dq-nest-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.dq-nest-tool { text-align: left; padding: 8px 12px; cursor: pointer; background: #fff; }
.dq-nest-tool small { display: block; color: #6b6b6b; }
.dq-nest-tool.is-on { border-color: #3b3b3b; box-shadow: inset 0 0 0 1px #3b3b3b; }
.dq-nest-hole { stroke-width: 2.5; fill: none; }
/* A hole is small on a whole sheet: a halo in its drill's colour round it,
   so it is seen lit with the outlines. */
.dq-nest-hole-halo { stroke: none; opacity: 0.35; }
.dq-nest-hole-halo.is-t0 { fill: #c0392b; }
.dq-nest-hole-halo.is-t1 { fill: #b5653c; }
.dq-nest-hole-halo.is-t2 { fill: #2f6fd6; }
.dq-nest-hole-halo.is-t3 { fill: #7a4a78; }
/* A tab at its size: the run of the cut it spans, across the cutter's width. */
.dq-nest-tab-span { stroke: #f2b705; stroke-linecap: butt; opacity: 0.95; }
.dq-nest-step { margin: 14px 0 4px; }
.dq-nest-view-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 6px; }
/* A view on a page takes a drag only while Move or Turn is chosen: until
   then a swipe scrolls the page and a pinch is left to the view. */
.dq-nest-svg, .dq-view-area { touch-action: pan-x pan-y; cursor: default; }
.dq-nest-svg.is-held, .dq-view-area.is-held { touch-action: none; cursor: grab; }
.dq-view-bar { margin: 6px 0; }
.dq-view-steps { display: inline-flex; gap: inherit; margin-left: auto; }

/* Watching it cut (ADR 0070). */
.dq-sim-backdrop { z-index: 70; }
.dq-sim { width: min(1100px, 96vw); max-width: none; }
.dq-sim-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.dq-sim-host { width: 100%; height: min(62vh, 620px); border-radius: 10px; overflow: hidden; background: #f3efe6; }
.dq-sim-host canvas { width: 100%; height: 100%; display: block; }
.dq-sim-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.dq-sim-controls progress { flex: 1 1 160px; height: 10px; }
.dq-sim-tool { font-size: 0.85rem; color: #555; }
.dq-nest-group { display: grid; gap: 8px; padding: 10px 12px; }
.dq-nest-group > span > small { display: block; color: #6b6b6b; font-size: 0.75rem; }
.dq-nest-ask { padding: 12px 14px; display: grid; gap: 8px; }
.dq-nest-ask p { margin: 0; }
.dq-nest-standard { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.dq-nest-fix { display: grid; gap: 6px; }
/* A part's rounded corner on its sketch, to tap and change (Constitution §33). */
.sk-corner-hit { fill: none; stroke: transparent; cursor: pointer; pointer-events: stroke; }
.sk-corner-hit:hover { stroke: rgba(47, 111, 214, 0.25); }
/* The Hole tool (ADR 0073). */
.dq-hole { display: grid; gap: 10px; }
.dq-hole .dq-check { display: flex; align-items: center; gap: 8px; }
.dq-part-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* A cutter as fitted under the collet nut, to scale (Dean, 30 October 2026). */
.cnc-pic { width: 100%; max-width: 620px; height: auto; display: block; }
.cnc-dim { cursor: pointer; }
.cnc-dim-line { fill: none; stroke: #555; stroke-width: 1; }
.cnc-dim-box { fill: #fff; stroke: #888; stroke-width: 1; }
.cnc-dim:hover .cnc-dim-box, .cnc-dim:focus .cnc-dim-box { stroke: #2f6fd6; stroke-width: 2; }
.cnc-dim-text { font-size: 14px; fill: #222; }
.cnc-dim.is-unknown .cnc-dim-text { fill: #8a5a00; }
.cnc-dim.is-unknown .cnc-dim-box { stroke-dasharray: 4 3; }
.cnc-dim.is-clash .cnc-dim-box { stroke: #c0392b; stroke-width: 2; }
.cnc-dim.is-clash .cnc-dim-text { fill: #c0392b; font-weight: 600; }
.cnc-pic-lead { fill: none; stroke: #aaa; stroke-width: 0.7; }
.dq-nest-setup-tool figcaption span { display: block; margin-top: 4px; }
.cnc-pic-spindle { fill: #d9d6cf; stroke: #777; stroke-width: 1; }
.cnc-pic-nut { fill: #c9c9c9; stroke: #555; stroke-width: 1.2; }
.cnc-pic-shank { fill: #e6e6e6; stroke: #666; stroke-width: 1.2; }
.cnc-pic-cutter { fill: none; stroke: #b5653c; stroke-width: 1.6; }
.cnc-pic-thin { fill: none; stroke: #888; stroke-width: 0.8; }
.cnc-pic-sheet { fill: #efe3c8; stroke: #a88f5f; stroke-width: 1; }
.cnc-pic-spoil { fill: #cfcfcf; stroke: #999; stroke-width: 0.8; }
.cnc-pic-face { stroke: #a88f5f; stroke-width: 1; stroke-dasharray: 3 2; }
.cnc-pic-over { fill: rgba(192, 57, 43, 0.35); stroke: #c0392b; stroke-width: 1; }
.cnc-pic-nut.is-clash, .cnc-pic-cutter.is-clash { stroke: #c0392b; stroke-width: 2; }
.cnc-pic-label { font-size: 13px; fill: #333; }
.cnc-pic-label.cnc-pic-mid { text-anchor: middle; fill: #666; }
.cnc-pic-label.is-clash { fill: #c0392b; font-weight: 600; }
.cnc-pic-label.is-note { fill: #8a5a00; }
.cnc-tool-setup { margin: 8px 0; }
.dq-nest-setup { display: block; }
.dq-nest-setup-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.dq-nest-setup-tool { margin: 0; flex: 1 1 340px; max-width: 620px; }
.dq-nest-setup-tool figcaption { font-size: 13px; }
.dq-nest-setup-tool.is-clash { outline: 2px solid #c0392b; outline-offset: 2px; border-radius: 6px; }
.dq-cutter-confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 8px; }
.dq-cutter-confirm small { display: block; font-size: 12px; color: #666; }
.dq-cutter-confirm.is-done { align-items: center; justify-content: space-between; }
.dq-cutter-edit { margin-top: 8px; }
.dq-cutter-status { margin: 6px 0; }
.dq-cutter-status .dq-note { display: block; margin-bottom: 6px; }
.cnc-start { margin: 8px 0; }
.dq-cutter-speeds { display: block; margin-top: 8px; }
.dq-cutter-speeds small { display: block; font-size: 12px; color: #666; }
.dq-cutter-speeds p { margin: 6px 0; }
.dq-nest-check { margin: 14px 0; }
.dq-nest-check-list { list-style: none; padding: 0; margin: 6px 0 10px; }
.dq-nest-check-list li { padding: 6px 0; border-bottom: 1px solid #ddd; }
.dq-nest-check-list .dq-row-k { display: inline-block; min-width: 180px; }
.dq-nest-check .dq-check { display: block; margin: 8px 0; font-weight: 600; }
.dq-nest-check.is-done .dq-box { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.dq-nest-busy { position: sticky; top: 0; z-index: 2; margin: 0 0 8px; padding: 6px 10px; background: #fff7d6; border: 1px solid #e3c766; border-radius: 6px; font-size: 13px; }
.dq-cutter-check { display: block; margin-top: 8px; }
.dq-cutter-check p { margin: 4px 0; }

/* The sheet on the machine's bed, from above (ADR 0081). */
.dq-bed-pic { width: 100%; max-width: 320px; height: auto; display: block; margin: 6px auto; }
.dq-nest-stock .dq-bed-pic { max-height: 200px; }
.dq-bed { fill: #e9e6df; stroke: #999; stroke-width: 1; }
.dq-bed-sheet { fill: #efe3c8; stroke: #a88f5f; stroke-width: 1; }
.dq-bed-part { fill: #fff; stroke: #777; stroke-width: 0.8; }
.dq-bed-zero { fill: #c0392b; }
.dq-nest-zero { fill: #c0392b; }
.dq-nest-axis { fill: none; stroke: #c0392b; }
.dq-nest-axis-label { fill: #c0392b; font-weight: 600; }
.dq-bed-corner { fill: #2f6fd6; }
.dq-bed-axis { fill: none; stroke: #c0392b; stroke-width: 1.5; }
.dq-bed-label { font-size: 12px; fill: #333; }
.dq-bed-past { fill: #b42318; font-weight: 600; }
.dq-bed-grain { stroke: #b89a6a; stroke-width: 0.8; fill: none; }
.dq-bed-length { font-size: 11px; font-weight: 600; fill: #6b5530; }
.dq-cards .dq-bed-pic { height: 210px; width: 100%; max-width: none; }
.dq-cards-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .dq-cards-four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The nest page (Dean, 30 and 31 October 2026): the steps down the left,
   each a card with its own pale header and its state (amber "Needs you",
   green "Done"); the sheet picked beside them on a wide screen, kept in
   view. On a phone the cards stack, the sheet after the boards. */
.dq-nest-body { display: grid; gap: 14px; width: 100%; max-width: 1480px; margin: 0 auto; align-items: start; }
.dq-nest-steps { display: contents; }
.dq-nest-steps > .dq-nest-card { order: 0; }
.dq-nest-steps > #nest-everything { order: 10; }
.dq-nest-preview { order: 5; display: grid; gap: 8px; min-width: 0; }
.dq-nest-preview-top, .dq-nest-preview-more { display: grid; gap: 8px; min-width: 0; align-content: start; }
.dq-nest-card[hidden], .dq-nest-card-body[hidden] { display: none !important; }
.dq-nest-card.is-band > .dq-nest-card-head { cursor: pointer; border-bottom: 0; }
.dq-nest-card.is-band > .dq-nest-card-head:hover, .dq-nest-card.is-band > .dq-nest-card-head:focus-visible { filter: brightness(0.96); outline: 2px solid var(--tone-ink); outline-offset: -2px; }
.dq-nest-card-go { flex: none; font-size: 1.4rem; line-height: 1; opacity: 0.6; }
.dq-nest-step-back { justify-self: start; }
.dq-nest-steps { grid-auto-rows: max-content; }
.dq-nest-stepper { display: inline-flex; align-items: center; gap: 6px; }
.dq-nest-step { min-width: 40px; font-size: 1.3rem; line-height: 1; padding: 4px 10px; }
.dq-nest-step-at { font-weight: 600; white-space: nowrap; }
.dq-nest-picked { fill: rgba(47, 111, 214, 0.28); stroke: #2f6fd6; stroke-width: 8; pointer-events: none; }
.dq-nest-pick { display: grid; gap: 6px; border: 2px solid #2f6fd6; padding: 8px 10px; }
.dq-nest-pick p { margin: 0; }
.dq-nest-pick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dq-nest-pick-row input { width: 92px; }
.dq-nest-pick-row .is-on { border-color: #2f6fd6; box-shadow: inset 0 0 0 1px #2f6fd6; font-weight: 700; }
.dq-nest-sides-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dq-nest-sides-row:empty { display: none; }
.dq-nest-preview-title .dq-nest-stepper { margin-right: 8px; vertical-align: middle; }
/* A wide screen (Dean, 10 November 2026): the steps scroll on the left; on
   the right the sheet picked is fixed at the top, and what goes with it
   (how to cut it, its time, the part picked) scrolls under it on its own. */
@media (min-width: 1100px) {
  .dq-drawings.dq-nest { overflow: hidden; }
  .dq-nest-body { grid-template-columns: minmax(460px, 640px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); flex: 1 1 auto; min-height: 0; align-items: stretch; }
  .dq-nest-steps { display: grid; gap: 14px; align-content: start; min-width: 0; overflow-y: auto; padding-right: 6px; }
  .dq-nest-preview { position: static; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; }
  .dq-nest-preview-top { flex: 0 0 auto; }
  .dq-nest-preview-more { flex: 1 1 0; min-height: 0; overflow-y: auto; padding-right: 6px; border-top: 1px solid rgba(0, 0, 0, 0.12); padding-top: 8px; }
  .dq-nest .dq-nest-preview .dq-nest-svg { max-height: clamp(160px, calc(100vh - 520px), 46vh); }
  .dq-nest .dq-nest-left { flex: 0 0 auto; max-height: 22vh; overflow-y: auto; }
}
.dq-nest-card { background: #fff; border: 1px solid var(--tone-line); border-radius: 12px; overflow: hidden; min-width: 0; scroll-margin: 12px; }
.dq-nest-card.is-needed { border: 2px solid #e0a43a; }
.dq-nest-card.is-done { border-color: #8bc08b; }
.dq-nest-card-head { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; background: var(--tone-bg); border-bottom: 1px solid var(--tone-line); color: var(--tone-ink); font-size: 1rem; font-weight: 700; }
.dq-nest-card-title { flex: 1; display: inline-flex; align-items: center; gap: 6px; }
.dq-nest-card-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--tone-ink); color: #fff; font-size: 0.85rem; flex: none; }
.dq-nest-card-body { display: grid; gap: 10px; padding: 12px 14px 14px; }
.dq-nest-card-body > .dq-nest-cut, .dq-nest-card-body > .dq-nest-check { margin: 0; }
.dq-nest-card .dq-nest-line { background: #fafaf8; }
.dq-nest-card .dq-nest-view-bar { margin: 0; }
/* What needs the maker, what is done, what is wrong: amber, green, red,
   the same everywhere on the page. */
.dq-state { font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.dq-state.is-needed { background: #fff1d6; color: #8a5a00; border: 1px solid #e0a43a; }
.dq-state.is-done { background: #e6f4e6; color: #2e6b2e; border: 1px solid #8bc08b; }
.dq-state.is-done::before { content: "✓ "; }
.dq-nest-need.is-needed, .dq-cutter-check.is-needed, .dq-nest-check.is-needed { border: 2px solid #e0a43a; border-radius: 10px; background: #fffaf0; padding: 8px; }
.dq-nest-cut-line.is-done { border-color: #8bc08b; background: #f3faf3; }
.dq-nest-check.is-done .dq-nest-signed { border: 2px solid #8bc08b; background: #f3faf3; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dq-nest-check.is-waiting { opacity: 0.85; }
.dq-nest-check-k { margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
/* Each step's own pale colour, none of them Settings' family colours. */
.dq-nest-tone-sheet { --tone-bg: #fdf1e7; --tone-line: #f0d5bf; --tone-ink: #8a4b1f; }
.dq-nest-tone-cut { --tone-bg: #e5f4f3; --tone-line: #bfe0dd; --tone-ink: #25615c; }
.dq-nest-tone-machine { --tone-bg: #eef0f8; --tone-line: #cdd2e8; --tone-ink: #3f4a7a; }
.dq-nest-tone-paths, .dq-nest-tone-board0 { --tone-bg: #faf5dc; --tone-line: #e9dea2; --tone-ink: #6b5c10; }
.dq-nest-tone-board1 { --tone-bg: #fbeee8; --tone-line: #efcfc2; --tone-ink: #874231; }
.dq-nest-tone-board2 { --tone-bg: #eaf4fa; --tone-line: #c4dfee; --tone-ink: #2a5d78; }
.dq-nest-tone-board3 { --tone-bg: #f3efe6; --tone-line: #ddd3bd; --tone-ink: #5e5236; }
.dq-nest-tone-check { --tone-bg: #eef3e2; --tone-line: #cfdcb2; --tone-ink: #4b5e22; }
/* To be cut, and what is still to do. */
.dq-nest-tobecut { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dq-nest-tobecut li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid #eee; }
.dq-nest-total { margin: 0; font-weight: 700; }
.dq-nest-todo { border: 2px solid #e0a43a; background: #fffaf0; border-radius: 10px; padding: 8px 12px; }
.dq-nest-todo p { margin: 0 0 4px; color: #8a5a00; }
.dq-nest-todo ol { margin: 0; padding-left: 20px; display: grid; gap: 2px; }
.dq-link { background: none; border: 0; padding: 2px 0; color: #1f5f99; text-decoration: underline; font: inherit; text-align: left; cursor: pointer; }
.dq-nest-alldone { margin: 0; padding: 8px 12px; border: 2px solid #8bc08b; background: #f3faf3; border-radius: 10px; color: #2e6b2e; font-weight: 600; }
/* A board's sheets, small, to pick. */
.dq-nest-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.dq-nest-thumb { display: grid; gap: 2px; justify-items: center; padding: 4px; border: 1px solid #d5d5d0; border-radius: 8px; background: #fff; cursor: pointer; font-size: 0.8rem; }
.dq-nest-thumb.is-on { border: 2px solid #1f5f99; }
.dq-nest-thumb svg { width: 100%; height: auto; display: block; }
.dq-nest-thumb-sheet { fill: #f2ece0; stroke: #b9ad94; stroke-width: 8; }
.dq-nest-thumb-part { fill: #fff; stroke: #2e4a3a; stroke-width: 10; }
.dq-nest-tool-name { margin: 4px 0 2px; font-weight: 700; }
.dq-nest-preview-title { margin: 0; }
.dq-nest-preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dq-nest-preview-bar .dq-view-bar { margin: 0; flex: 0 0 auto; width: auto; padding-right: 0; }
.dq-nest-preview .dq-nest-sheet { border-radius: 12px; }
.dq-nest-preview .dq-nest-svg { max-height: 70vh; }
/* Working: the leaf and berry turning slowly, as a coin turns, its shadow
   breathing with it (Dean, 31 October 2026); not the assistant's pulse. */
.dq-loading { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(246, 244, 239, 0.86); backdrop-filter: blur(2px); }
.dq-loading-card { display: grid; justify-items: center; gap: 10px; padding: 28px 32px; max-width: 320px; text-align: center; }
.dq-loading-turn { width: 88px; height: 88px; perspective: 400px; }
.dq-loading-turn img { width: 100%; height: 100%; animation: dq-turn 2.8s linear infinite; transform-style: preserve-3d; filter: drop-shadow(0 6px 10px rgba(80, 30, 40, 0.18)); }
.dq-loading-shadow { width: 56px; height: 8px; border-radius: 50%; background: rgba(60, 40, 30, 0.18); animation: dq-turn-shadow 2.8s linear infinite; }
.dq-loading-card p { margin: 6px 0 0; color: #4a4036; font-weight: 600; }
@keyframes dq-turn { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes dq-turn-shadow { 0%, 50%, 100% { transform: scaleX(1); } 25%, 75% { transform: scaleX(0.35); } }
@media (prefers-reduced-motion: reduce) { .dq-loading-turn img, .dq-loading-shadow { animation: none; } }
.dq-nest-z { display: grid; gap: 6px; padding: 8px 12px; }
.dq-nest-z small { color: #6b6b6b; font-size: 0.75rem; }
.dq-nest-z-ticks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.dq-nest-z-ticks .dq-check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dq-nest-z-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 6px; border-top: 1px solid #e3e3e3; }
.dq-nest-z-offer span { flex: 1 1 220px; }
.dq-nest-card .dq-nest-check-list li { display: grid; grid-template-columns: minmax(110px, 150px) minmax(0, 1fr); gap: 4px 12px; align-items: baseline; }
.dq-nest-card .dq-nest-check-list .dq-row-k { min-width: 0; }
.dq-nest-preview-bar .dq-view-bar { flex: 0 0 auto; width: auto; padding-right: 0; }
.dq-view-bar { padding-right: 0; }
@media (max-width: 520px) { .dq-nest-card .dq-nest-check-list li { grid-template-columns: 1fr; } }
/* Each cutter's speeds and feeds, to be confirmed for the job before any
   program is made (Dean, 30 October 2026): amber until confirmed, green
   after, so it stands out from the boxes round it. */
.dq-cutter-speeds { display: grid; gap: 8px; padding: 10px 12px; border-width: 2px; }
.dq-cutter-speeds.is-check { background: #fff7e6; border-color: #e0a43a; }
.dq-cutter-speeds.is-confirmed { background: #eef7ee; border-color: #8bc08b; }
.dq-speeds-flag { margin: 0; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.dq-cutter-speeds.is-check .dq-speeds-flag { color: #8a5a00; }
.dq-cutter-speeds.is-confirmed .dq-speeds-flag { color: #2e6b2e; }
.dq-speeds-list { display: grid; gap: 2px; margin: 0; }
.dq-speeds-list > div { display: grid; grid-template-columns: minmax(96px, 130px) minmax(0, 1fr); gap: 10px; }
.dq-speeds-list dt { color: #6b6b6b; font-size: 0.85rem; }
.dq-speeds-list dd { margin: 0; font-weight: 600; }
/* The berry turning, small, in its place on a page. */
.dq-loading-inline { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: #4a4036; font-weight: 600; }
.dq-loading-inline .dq-loading-turn { width: 30px; height: 30px; flex: none; }

/* Measure (Dean, 31 October 2026): the figures in a box over the model. */
.dq-measure { position: absolute; right: 8px; bottom: 8px; z-index: 47; max-width: min(420px, calc(100% - 16px)); background: #fff; border: 2px solid #2f6fd6; border-radius: 10px; padding: 8px 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); display: grid; gap: 6px; }
.dq-measure-k { margin: 0; display: grid; gap: 2px; }
.dq-measure-k .dq-note { font-size: 0.8rem; }
.dq-measure-list { margin: 0; display: grid; gap: 2px; }
.dq-measure-list > div { display: flex; justify-content: space-between; gap: 14px; }
.dq-measure-list dt { color: #555; }
.dq-measure-list dd { margin: 0; font-weight: 600; text-align: right; }
.dq-measure-list > div.is-main dd, .dq-measure-list > div.is-main dt { color: #1d4f9c; font-weight: 800; }

/* A phone (Dean, 31 October 2026): the drawing first, the page scrolling
   under a finger until View the model is pressed, the tools behind Tools,
   no zoom buttons where two fingers zoom. */
.dq-phone-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
/* Clear of the warning and the berry, which sit at the drawing's top right. */
.dq-phone-bar { padding-right: 118px; min-height: 60px; align-content: flex-start; }
.dq-phone-bar .ghost-button, .dq-phone-bar .primary-button { min-height: 38px; padding: 0 12px; font-size: 14px; }
.dq-screen.is-phone:not(.is-viewing) .dq-canvas,
.dq-screen.is-phone:not(.is-viewing) .dq-plan { touch-action: pan-y; }
.dq-screen.is-phone .dq-3d-host { height: 62vh; }
.dq-screen.is-phone.is-viewing .dq-3d-host,
.dq-screen.is-phone.is-viewing .dq-canvas { outline: 3px solid #2f6fd6; outline-offset: -3px; border-radius: 8px; }
@media (hover: none) and (pointer: coarse) {
  [data-view-zoom], .dq-zoom-fit [data-view-zoom] { display: none; }
}
/* A phone held sideways: the page scrolls as it does upright, the drawing
   the height of the screen, the panel below it. */
@media (orientation: landscape) and (max-height: 500px) {
  .dq-screen { position: static; overflow: visible; height: auto; }
  .dq-screen .screen-inner { display: block; height: auto; }
  .dq-layout { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .dq-stage { display: block; height: auto; }
  .dq-side { height: auto; overflow: visible; }
  .dq-screen.is-phone .dq-3d-host { height: 86vh; }
  .dq-screen.is-phone .dq-canvas { height: 86vh; max-height: 86vh; }
}
.dq-screen.is-phone .dq-portrait-note { display: none; }
.new-build-banner .primary-button { flex: none; white-space: nowrap; }
.new-build-banner[data-loading] { padding: 8px 16px; }
.new-build-turn { width: 26px; height: 26px; perspective: 300px; flex: none; }
.new-build-turn img { width: 100%; height: 100%; animation: dq-turn 2.8s linear infinite; }
.dq-speeds-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 560px) { .dq-speeds-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dq-speeds-proposal { margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; font-size: 0.9rem; color: #4a4036; }
.dq-cutter-speeds .primary-button { justify-self: start; }
.dq-nest-check-all { margin: 4px 0 8px; }
.dq-nest-check-all > summary { cursor: pointer; color: #1f5f99; font-weight: 600; padding: 4px 0; }

/* Standard / This job (Dean, 31 October 2026): one mark, one colour (slate
   blue, used for nothing else), wherever a job reads a workshop standard it
   may change for itself. Outlined while it follows the standard; filled
   once set for this job, with Back to standard beside it. */
.dq-std { display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 8px; border: 1px solid #5b6b8c; border-radius: 999px; background: #fff; color: #44546f; font-size: 0.72rem; font-weight: 700; line-height: 1.5; cursor: pointer; vertical-align: middle; }
.dq-std.is-job { background: #5b6b8c; color: #fff; }
.dq-std-back { margin-left: 6px; padding: 0; border: 0; background: none; color: #44546f; font-size: 0.75rem; text-decoration: underline; cursor: pointer; vertical-align: middle; }

/* What comes after the modelling, at the top of the drawing's panel (Dean,
   31 October 2026): three steps in the order the work goes. */
.dq-next .dq-next-steps { display: grid; grid-template-columns: 1fr; gap: 6px; }
.dq-next .dq-next-steps .primary-button, .dq-next .dq-next-steps .ghost-button { width: 100%; }
.dq-design-todo { border-color: #e0a43a; background: #fffaf0; }
.dq-design-todo .dq-warning { margin: 6px 0 0; }

/* The parts a cut passes through, a tick each (Dean, 1 November 2026). */
.dq-meets { display: grid; gap: 4px; margin: 6px 0; }
.dq-meets .dq-tick { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 2px 8px; border: 1px solid var(--outline); border-radius: 8px; background: var(--surface); cursor: pointer; }
.dq-meets .dq-tick input { width: 18px; height: 18px; }

/* Ends cut on the saw, asked once (Dean, 1 November 2026). */
.dq-saw-ask { display: grid; gap: 8px; padding: 8px 0; }
.dq-saw-ask .dq-tick { display: flex; align-items: center; gap: 8px; }
/* A part from the drawing on the cutting list: its figures are the model's. */
.cutlist-from-model input[readonly] { background: var(--surface-soft); color: var(--muted); }
.cutlist-saw { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 2px; }
.cutlist-saw .dq-std, .cutlist-saw .dq-std-back { font-size: 11px; white-space: nowrap; }

/* The step of a command that is the maker's now (Dean, 1 November 2026). */
.dq-box.is-current { border-color: #e0a43a; box-shadow: 0 0 0 2px rgba(224, 164, 58, 0.25); }
.dq-group .dq-state { margin-left: 6px; vertical-align: middle; }

/* The model taken by a click (Dean, 1 November 2026): ringed while it has
   the mouse, its hint saying how to use it and how to let go. */
.dq-3d-stage.is-live .dq-3d-host { outline: 2px solid #2f6fd6; outline-offset: -2px; }
.dq-3d-live-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.9); border: 1px solid var(--outline); font-size: 12px; color: var(--muted); pointer-events: none; z-index: 6; white-space: nowrap; }
.dq-3d-stage.is-live .dq-3d-live-hint { color: #1b4fa8; border-color: #2f6fd6; }
.dq-board-all { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 8px; border: 1px solid var(--outline); border-radius: 8px; background: var(--surface); cursor: pointer; }
.dq-board-all input { width: 18px; height: 18px; flex: none; }
.dq-nest-tone-skim { --tone-bg: #f5eef6; --tone-line: #e0cfe3; --tone-ink: #66406c; }
.dq-nest-figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.dq-nest-download { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.dq-nest-download.is-done { border-color: #8cc49a; background: #f0f8f1; }
.dq-nest-download.is-changed { border-color: #e0a43a; background: #fffaf0; }
.dq-nest-got { font-style: normal; color: #2e7d46; font-weight: 600; margin-left: 6px; }
.dq-nest-download-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.dq-nest-offcut { fill: #e8f2ec; stroke: #2e7d46; stroke-width: 3; stroke-dasharray: 18 10; }
.dq-nest-names .dq-nest-offcut-name { fill: #2e7d46; font-weight: 800; letter-spacing: 0.08em; }
.dq-nest-names .dq-nest-offcut-size { fill: #2e7d46; font-weight: 600; }
.dq-nest-offcut-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.dq-nest-offcut-line.is-on { border-color: #8cc49a; background: #f0f8f1; }
.dq-3d-views { position: absolute; top: 8px; right: 56px; display: grid; grid-template-columns: repeat(3, auto); gap: 4px; z-index: 3; }
.dq-3d-view { font: 600 12px/1 inherit; padding: 6px 8px; border: 1px solid var(--outline); border-radius: 6px; background: var(--surface); color: inherit; cursor: pointer; }
.dq-3d-view.is-on { background: #2f6fd6; border-color: #2f6fd6; color: #fff; }
.dq-nest-hit { fill: transparent; stroke: none; cursor: pointer; }
.dq-nest-hit:hover { fill: rgba(47, 111, 214, 0.12); }
.dq-nest-names .dq-nest-size { font-weight: 500; fill: #555; }
.dq-nest-part-info { margin-top: 8px; border-color: #b9cdf0; background: #f3f7fe; }
.dq-nest-names, .dq-nest-zero-words { pointer-events: none; }
.dq-nest-part-info small { display: block; }
.dq-nest-tone-recut { --tone-bg: #eef2f6; --tone-line: #cfd8e3; --tone-ink: #3b4e66; }
.dq-nest-sides { display: flex; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.dq-nest-outline.is-faint { opacity: 0.35; }
.dq-nest-problem { fill: rgba(229, 83, 61, 0.28); stroke: #e5533d; stroke-width: 3; }

/* Time to cut (Dean, 4 November 2026): beside the sheet's picture and on
   each board, plain and always there. */
.dq-nest-time { margin-top: 8px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.dq-nest-time small { display: block; }
.dq-nest-time b { font-size: 1.1em; }

/* Support access (ADR 0095): the key, shown once, wrapping on a phone. */
.support-key { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; }
.support-key small { display: block; }
.support-key code { word-break: break-all; font-size: .85em; }

/* The drawings' sheets (Dean, 5 November 2026): never wider than the
   screen; as many rows as they need, each name kept short. */
.dq-drawings-bar { flex-wrap: wrap; }
.dq-seg.dq-drawings-sheets { flex-wrap: wrap; flex: 1 1 100%; order: 3; max-width: 100%; overflow: visible; }
.dq-seg.dq-drawings-sheets button { font-size: .8em; padding: 4px 8px; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A kind of cut shown on the sheet (Dean, 5 November 2026): tapped in its
   board's cutters, picked out in red wherever it is. */
.dq-nest-group-name { all: unset; cursor: pointer; display: block; flex: 1 1 14em; min-width: 0; }
.dq-nest-group-name small { display: block; text-decoration: underline; text-decoration-style: dotted; }
.dq-nest-group.is-shown { border-color: #c0392b; background: #fdf1ef; }
.dq-nest-group-name:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.dq-nest-pick { flex-basis: 100%; margin-top: 6px; }
.dq-nest-sheet .is-picked { stroke: #c0392b !important; stroke-width: 6 !important; fill: rgba(192, 57, 43, 0.35) !important; opacity: 1 !important; }
/* A cut-out or outline is cut round its edge, the middle dropping out: shown as that red line, not filled as if milled away (Dean, 5 November 2026). */
.dq-nest-sheet .dq-nest-cutout.is-picked, .dq-nest-sheet .dq-nest-outline.is-picked { fill: none !important; stroke-width: 8 !important; }

/* Library cutters on a line: those that cannot make the cut, greyed with why. */
.dq-nest-pick-title { flex-basis: 100%; color: var(--muted, #6b6b6b); }
.dq-nest-tool.is-off { opacity: .55; cursor: not-allowed; text-align: left; }
.dq-nest-tool.is-off small { display: block; font-size: .78em; white-space: normal; }

/* The library as a small scrolling window (Dean, 5 November 2026: twenty
   cutters must not become a screen of buttons). */
.dq-nest-pick-list { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid var(--line, #d9dee6); border-radius: 10px; background: var(--surface, #fff); }
.dq-nest-pick-list .dq-nest-tool { width: 100%; text-align: left; flex: none; min-height: 0; padding: 6px 10px; line-height: 1.25; margin: 0; }

/* Change a cutter for another, in its own box (Constitution §35). */
.dq-cutter-swap { margin-top: 6px; }
.dq-nest-tool.is-new { font-weight: 600; }

/* How to cut this sheet, step by step (Dean, 5 November 2026). */
.dq-nest-run ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.dq-nest-run li { display: flex; gap: 10px; align-items: flex-start; opacity: .5; }
.dq-nest-run li.is-lit { opacity: 1; }
.dq-nest-run-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent, #2f6b3f); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85em; }
.dq-nest-run li.dq-nest-run-turn { opacity: 1; padding: 6px 10px; border-left: 3px solid var(--orange, #c8762d); background: rgba(200, 118, 45, .08); border-radius: 6px; }
.dq-nest-run-stay { color: var(--orange, #c8762d); font-weight: 600; }
/* Sloped faces the router does not cut yet, asked where the board is signed off. */
.dq-nest-slopes.is-needed { border-color: var(--amber, #d89a2b); background: rgba(216, 154, 43, .08); }

/* A part's card, tapped on the sheet (Dean, 6 November 2026): beside the
   sheet on a wide screen, up from the bottom on a phone. Made parts greyed
   and ticked on the sheet. */
.dq-nest-part-card { position: relative; display: grid; gap: 8px; border: 1px solid var(--line, #d9dee6); border-radius: 12px; background: var(--surface, #fff); padding: 12px 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .12); }
.dq-nest-part-card.is-made { border-color: #6a8f6f; }
.dq-nest-part-card-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding-right: 44px; }
.dq-nest-part-card-head span { color: var(--muted, #6b6b6b); flex: 1 1 auto; }
.dq-nest-part-close { position: absolute; top: 8px; right: 8px; min-width: 36px; min-height: 36px; padding: 2px 8px; font-size: 1.2em; line-height: 1; }
.dq-nest-part-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.dq-nest-part-facts div { display: contents; }
.dq-nest-part-facts dt { color: var(--muted, #6b6b6b); }
.dq-nest-part-facts dd { margin: 0; }
.dq-nest-part-made { margin: 0; color: #2f6b3f; font-weight: 600; }
.dq-nest-made { fill: rgba(120, 120, 120, .55); stroke: #555; stroke-width: 2; pointer-events: none; }
.dq-nest-made-word { fill: #1f3d24; font-weight: 700; text-anchor: middle; pointer-events: none; }
@media (max-width: 700px) {
  .dq-nest-part-card { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 40; max-height: 70vh; overflow: auto; }
}

/* What is cut into each part, by number, with its depths, before a board is
   signed off (Constitution §37, 7 November 2026). */
.dq-nest-depths ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.dq-nest-check-list li.dq-nest-depths, .dq-nest-card .dq-nest-check-list li.dq-nest-depths { display: block; }
.dq-nest-depths ul li, .dq-nest-card .dq-nest-check-list .dq-nest-depths ul li { display: block; border-bottom: 0; padding: 0; }

/* A board whose toolpaths wait to be made again, and the parts made and left
   off it (Dean, 7 November 2026). */
.dq-nest-relay.is-needed { border-color: var(--amber, #d89a2b); background: rgba(216, 154, 43, .08); display: grid; gap: 8px; }
.dq-nest-relay p { margin: 0; }
.dq-nest-made-sheet { background: #eeeeee; color: #555; }
.dq-nest-made-sheet ul { margin: 6px 0 0; padding-left: 18px; }
.dq-nest-relay-back { margin: 4px 0; }

/* Fitting a drawer box in the elevation (Dean, 9 November 2026): the lines
   clicked, and the one under the mouse, lit. */
.dq-fit-lines line { stroke-linecap: round; pointer-events: none; }
.dq-fit-picked { stroke: #2f6fde; }
.dq-fit-hover { stroke: #7fb2ff; }
.dq-drawing > .dq-cmd { position: absolute; top: 12px; right: 76px; z-index: 5; max-width: 340px; }

/* Sketching in the 3D view (Dean, 9 November 2026): the model behind the
   drawing, square to the face; the drawing clear over it. */
.sk-board { position: relative; flex: 1; display: flex; min-height: 360px; max-height: 70vh; border-radius: 10px; overflow: hidden; background: #fbf8f3; }
.sk-board > .sk-sheet { position: relative; z-index: 1; flex: 1; min-height: 0; max-height: none; }
.sk-board > .sk-sheet.is-over-model { background: transparent; }
.sk-backdrop.dq-3d { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; max-height: none; pointer-events: none; z-index: 0; }
.sk-backdrop .dq-3d-canvas { width: 100%; height: 100%; display: block; pointer-events: none; }
.sk-sheet.is-over-model .sk-face { fill: rgba(47, 111, 214, 0.07); stroke: #2f6fd6; }
.sk-sheet.is-over-model .sk-neighbour { fill: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* A part named by its number that points at the part (nest page). */
.dq-part-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px; margin: 2px 0; border: 1px solid #2f6fd6; border-radius: 999px; background: #eef3fc; color: #1d4fb0; font: inherit; font-weight: 600; cursor: pointer; }
.dq-part-chip:active { background: #dbe6fa; }

/* ── Phases, carry on and wide screens (UI review, 10 November 2026) ──────── */
.work-screen .work-phase-tabs {
  display: flex;
  grid-template-columns: none;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.work-screen .work-phase-tabs::-webkit-scrollbar { display: none; }
.work-phase-tabs .work-tab { flex: 0 0 auto; min-height: 42px; padding: 8px 12px; font-size: 14px; }
.work-phase-tabs .work-tab.is-on { background: var(--tile-colour, var(--primary)); border-color: var(--tile-colour, var(--primary)); }
.work-tags .work-live { background: #e4efe2; color: #3c6a37; }
.work-tags .work-dupe { background: #fdeadf; color: #b3521f; }

.home-navigation-tile { position: relative; }
.home-navigation-tile .tile-count {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tile-colour, var(--primary));
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.carry-on { margin: 0 0 14px; }
.carry-on-title { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.carry-on-list { display: grid; gap: 8px; }
.carry-on-item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.carry-on-item strong { font-size: 15px; color: var(--text); }
.carry-on-item small { font-size: 13px; color: var(--muted); }

.phase-board .pipeline-column .column-number { background: var(--tile-colour, var(--primary)); color: #ffffff; }
.phase-board .work-row { margin-bottom: 8px; }

.hq-phase-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hq-phase-badge { background: var(--tile-colour, var(--primary)) !important; color: #ffffff !important; }

/* Wider screens use their width: Home, Project HQ, the project list and Money
   stop being a phone column on a tablet or a desktop. */
@media (min-width: 1024px) {
  .screen.home .screen-inner,
  .screen.hq-main .screen-inner,
  .screen.work-screen .screen-inner,
  .screen.money-screen .screen-inner,
  .screen.business-hq-screen .screen-inner {
    width: min(100%, 1040px);
    padding-left: 24px;
    padding-right: 24px;
  }
  .home-navigation-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .home-navigation-tile { min-height: 110px; }
  .home-navigation-tile strong { font-size: 13px; }
  .carry-on-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .action-tile--full { grid-column: span 2; }
  .work-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .work-screen .work-phase-tabs { overflow: visible; }
  .work-phase-tabs .work-tab { flex: 1 1 0; }
}
.hq-journey { display: grid; gap: 10px; margin: 0 0 14px; padding: 12px 14px; }
.hq-journey-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.hq-journey-line span { flex: 1 1 220px; }
.hq-journey-line.needs span { color: #b3521f; font-weight: 600; }
.hq-live-badge { background: #e4efe2 !important; color: #3c6a37 !important; }
.sign-off-list { display: grid; gap: 6px; margin-bottom: 12px; }
.sign-off-list .dq-tick { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.sign-off-list .dq-tick span { display: grid; gap: 2px; }
.sign-off-list small { color: var(--muted); }
.stage-phase-field { display: grid; gap: 4px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.stage-phase-field select { min-height: 38px; }
.company-group { margin: 0 0 12px; padding: 14px; }
.company-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.company-group-head h2 { margin: 0; font-size: 17px; }
.company-list { display: grid; gap: 8px; }
.company-row { display: flex; align-items: center; gap: 8px; }
.company-open { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-align: left; font-family: inherit; cursor: pointer; }
@media (min-width: 1024px) {
  .screen.company-screen .screen-inner { width: min(100%, 1040px); padding-left: 24px; padding-right: 24px; }
  .business-group-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .action-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.workshop-screen .screen-inner { width: min(100%, 1100px); padding: 0 20px 100px; }
.workshop-jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.workshop-job { display: grid; gap: 6px; min-height: 140px; padding: 20px; border: 1px solid var(--border); border-left: 8px solid #3e5f73; border-radius: 14px; background: var(--surface); text-align: left; font-family: inherit; cursor: pointer; }
.workshop-job strong { font-size: 22px; }
.workshop-job span { font-size: 17px; color: var(--muted); }
.workshop-job small { font-size: 14px; font-weight: 700; color: #3e5f73; }
.workshop-job-who { margin: 0 0 14px; font-size: 18px; color: var(--muted); }
.workshop-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.workshop-big { min-height: 120px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-family: inherit; font-size: 22px; font-weight: 700; color: var(--text); cursor: pointer; }
.workshop-settings { margin-top: 18px; }
.dq-nest-gcode-line { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }
.dq-nest-left-inline { margin-top: 8px; font-size: 14px; }
.dq-nest-left-inline summary { cursor: pointer; font-weight: 600; }
.dq-nest-left-inline ul { margin: 6px 0; padding-left: 18px; }
/* The sheet is the thing being made, so it gets the room (UI review, 10
   November 2026): the steps narrower, the sheet as tall as the screen
   allows, what goes with it scrolling under. */
@media (min-width: 1100px) {
  .dq-nest-body { grid-template-columns: minmax(380px, 520px) minmax(0, 1fr); }
  .dq-nest .dq-nest-preview .dq-nest-svg { max-height: clamp(260px, calc(100vh - 300px), 72vh); }
  .dq-nest-preview-more { flex-basis: 140px; }
}
/* The page column is phone-wide on most screens whatever the window, so with
   Back showing the wordmark gives its room to the title there too ("Proje /
   ct HQ" in a tablet-wide window, 11 November 2026). The wide pages keep it. */
.title-row.has-back .internal-brand { display: none; }
@media (min-width: 1024px) {
  .screen.hq-main .title-row.has-back .internal-brand,
  .screen.work-screen .title-row.has-back .internal-brand,
  .screen.money-screen .title-row.has-back .internal-brand,
  .screen.business-hq-screen .title-row.has-back .internal-brand,
  .screen.company-screen .title-row.has-back .internal-brand { display: flex; }
}
.page-title-block h1 { hyphens: manual; }
.dq-3d-views { right: auto; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; grid-template-columns: none; }
.dq-3d-views-list { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; margin-top: 4px; padding: 4px; border: 1px solid var(--outline); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.dq-3d-views-toggle { font-size: 13px; padding: 7px 12px; }
.dq-nest-steps > .dq-nest-left-inline { order: 0; padding: 8px 12px; border: 1px solid #c9ced3; border-radius: 8px; background: #fff; }
.dq-nest-ask { margin-top: 8px; padding: 10px; display: grid; gap: 8px; }
.dq-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.dq-chip { padding: 6px 12px; border: 1px solid var(--outline, #c9ced3); border-radius: 999px; background: var(--surface, #fff); font-family: inherit; font-size: 14px; cursor: pointer; }
.dq-chip.is-on { background: var(--primary, #1f3a33); border-color: var(--primary, #1f3a33); color: #fff; }
.cutlist-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 12px; font-size: 15px; }
.cutlist-status { white-space: nowrap; font-size: 13px; }
.cutlist-state.is-done { color: #3c6a37; font-weight: 600; }
.cutlist-state.is-changed { color: #b3521f; font-weight: 700; }
.cutlist-state.is-off { color: var(--muted); }
.cutlist-tick { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.cutlist-not-needed td input { text-decoration: line-through; color: var(--muted); }
.cutlist-recut td:first-child { font-style: italic; }

/* The job a project screen is about, on every one of them (Dean, 11
   November 2026). */
.page-project {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 17px;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dq-bar-project {
  overflow: hidden;
  margin-left: 12px;
  font-size: 14px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dq-side-project {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Each part to finish by hand, with what it has and where (Dean, 11 November 2026). */
.dq-nest-slope-list { margin: 6px 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.dq-nest-slope-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }

/* A colour for each type of board, the same at every thickness (Dean, 11
   November 2026). 0 oak, 1 walnut, 2 plain MDF, 3 birch and ply; the rest in
   turn. Not Settings' family colours, not the steps' own. */
.dq-nest-tone-bt0 { --tone-bg: #fbf1c4; --tone-line: #e6cf6e; --tone-ink: #5f4d05; }
.dq-nest-tone-bt1 { --tone-bg: #f5e1e4; --tone-line: #d7a3ae; --tone-ink: #6a2233; }
.dq-nest-tone-bt2 { --tone-bg: #efe2d4; --tone-line: #cfae8c; --tone-ink: #5e3d1f; }
.dq-nest-tone-bt3 { --tone-bg: #fbf7ea; --tone-line: #e3d8b6; --tone-ink: #5a5130; }
.dq-nest-tone-bt4 { --tone-bg: #dff3ef; --tone-line: #9fd2c8; --tone-ink: #1d5a52; }
.dq-nest-tone-bt5 { --tone-bg: #fde6dc; --tone-line: #f0b39b; --tone-ink: #86361c; }
.dq-nest-tone-bt6 { --tone-bg: #eef0d8; --tone-line: #c8cd8e; --tone-ink: #4b511b; }
.dq-nest-tone-bt7 { --tone-bg: #f1e4f1; --tone-line: #d1abd1; --tone-ink: #5b2a5b; }
.dq-nest-tone-bt8 { --tone-bg: #e2ecf5; --tone-line: #a9c3dc; --tone-ink: #253f5c; }
.dq-nest-tone-bt9 { --tone-bg: #fdeed6; --tone-line: #efc684; --tone-ink: #73470c; }
.dq-nest-tone-bt10 { --tone-bg: #e5efdd; --tone-line: #b3cf9d; --tone-ink: #33512a; }
.dq-nest-tone-bt11 { --tone-bg: #e9e6f3; --tone-line: #bfb8dc; --tone-ink: #3d366a; }
.dq-bt-chip { background: var(--tone-bg); color: var(--tone-ink); border: 1px solid var(--tone-line); }

/* Which cutter for each cut (Dean, 11 November 2026). */
.dq-cut-standards { display: grid; gap: 8px; margin: 6px 0 8px; }
.dq-cut-standards.is-asking { opacity: 0.55; }
.dq-cut-standard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 4px 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--family-line, #d2d9e1); border-radius: 10px; background: #fff; }
.dq-cut-standard > label:first-child { display: grid; font-weight: 600; }
.dq-cut-standard > label:first-child small { font-weight: 400; color: var(--muted); }
.dq-cut-standard .dq-inline-field { grid-column: 2; }
@media (max-width: 600px) { .dq-cut-standard { grid-template-columns: 1fr; } .dq-cut-standard .dq-inline-field { grid-column: 1; } }

/* Needs you in red, done in green (Dean, 11 November 2026). Problems are
   said in words with the warning style, so they still read apart. */
.dq-nest-card.is-needed { border: 2px solid #d64545; }
.dq-state.is-needed { background: #fde8e8; color: #9b1c1c; border: 1px solid #d64545; }
.dq-nest-need.is-needed, .dq-cutter-check.is-needed, .dq-nest-check.is-needed { border: 2px solid #d64545; background: #fff6f6; }
.dq-nest-slopes.is-needed, .dq-nest-relay.is-needed { border-color: #d64545; background: #fff6f6; }
.dq-nest-todo { border-color: #d64545; background: #fff6f6; }
.dq-nest-todo p { color: #9b1c1c; }

/* The sheet's buttons on two rows, the view shorter, so how to cut it has
   room under it (Dean, 12 November 2026). */
.dq-nest-preview-bar, .dq-nest-sides-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dq-nest-preview-bar .ghost-button, .dq-nest-preview-bar .primary-button, .dq-nest-sides-row .ghost-button, .dq-nest-sides-row .primary-button { padding: 5px 10px; min-height: 32px; font-size: 0.85rem; }
.dq-nest-sides { display: inline-flex; gap: 6px; margin: 0; }
.dq-nest-preview { gap: 6px; }
@media (min-width: 1100px) {
  .dq-nest .dq-nest-preview .dq-nest-svg { max-height: clamp(220px, calc(100vh - 420px), 56vh); }
  .dq-nest-preview-more { flex-basis: 220px; }
}
.dq-nest-left-inline.dq-nest-left-needs { border: 2px solid #d64545; background: #fff6f6; border-radius: 10px; padding: 8px 12px; }
.dq-nest-left-inline.dq-nest-left-needs summary { color: #a12d2d; }

/* A sheet's size, clicked to change it to an offcut (Dean, 13 November 2026). */
.dq-nest-size-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.dq-nest-size-link:hover b, .dq-nest-size-link:focus-visible b { text-decoration: underline; }
.dq-nest-size-box { margin: 6px 0 8px; }

/* A recut: only the parts isolated in 3D (Dean, 13 November 2026). */
.dq-recut { border-color: #8c335d; }
.dq-recut .dq-row { align-items: center; }
.dq-recut-many { max-width: 110px; margin: 0; }

/* A box open over the page has the screen: the bottom bar steps aside so it
   never sits over the box's buttons (found driving Quick model, 14 November
   2026: "Start modelling" was under the bar on a 900px-high screen). */
body:has(.modal-backdrop) .nav { display: none; }

/* The part tapped on the nest, its actions above the sheet (Dean, 14 November 2026). */
.dq-nest-part-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 8px 0; }
.dq-nest-part-bar-head { flex-basis: 100%; display: flex; align-items: center; gap: 8px; margin: 0; }
.dq-nest-part-bar-head .dq-nest-part-close { margin-left: auto; }
.dq-nest-part-bar .dq-nest-qty { display: flex; align-items: flex-end; gap: 8px; }
.dq-nest-part-bar .dq-nest-qty .dq-field { max-width: 120px; margin: 0; }
.dq-nest-part-bar .button-row { margin: 0; }
.dq-nest-part-bar .dq-nest-alone { flex-basis: 100%; }
.dq-nest-over .button-row .ghost-button { flex: 0 1 auto; }
.dq-nest-part-bar .dq-nest-part-close { position: static; inset: auto; }
.dq-nest-over .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dq-nest-over .button-row > .ghost-button { flex: 0 0 auto; width: auto; min-width: 0; }

.dq-view-bar [hidden] { display: none !important; }

/* Figures are typed, never stepped (Dean, 17 November 2026): no up and
   down arrows in a number box. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Tabs on the sheet's preview: a short line across the outline at each one
   (Dean, 17 November 2026), shown with or without the toolpaths. */
.dq-nest-tab-tick { stroke: #1f2933; stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.dq-nest-tabs-own { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.dq-nest-tabs-said { margin: 4px 0; }
.dq-nest-tabs-said small { display: block; color: var(--muted, #667); }

/* The timeline (ADR 0119): every step that made the model, in order, under
   the 3D view; on a phone it swipes along. */
.dq-timeline { margin-top: 8px; }
.dq-steps { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.dq-step { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line, #d6d3cc); border-radius: 8px; background: #fff; font-size: 13px; color: inherit; cursor: pointer; max-width: 240px; }
.dq-step span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dq-step svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dq-step.is-on { border-color: #2f4a5c; box-shadow: 0 0 0 2px rgba(47, 74, 92, 0.18); }
.dq-step.is-broken { border-color: #c0392b; color: #a52a1e; background: #fdf0ee; }
.dq-step-card { border: 1px solid var(--line, #d6d3cc); border-radius: 8px; background: #fff; padding: 10px 12px; margin-bottom: 6px; }
.dq-step-card p { margin: 0 0 6px; }

/* Views from every side (Dean, 17 November 2026). */
.dq-views { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.dq-ortho-face { fill: #efe6d2; stroke: #efe6d2; cursor: pointer; }
.dq-ortho-face.is-picked { fill: #cfe0ec; stroke: #cfe0ec; }
.dq-ortho-edge { stroke: #2b2b2b; stroke-linecap: round; fill: none; pointer-events: none; }
.dq-ortho-dim { stroke: #5b6670; fill: none; }
.dq-ortho-figure { fill: #2b2b2b; }
.dq-ortho-face.is-boarded { fill: #bfe3c5; stroke: #bfe3c5; }
.dq-ortho-face.is-unboarded { fill: #f8c9a2; stroke: #f8c9a2; }
.dq-ortho-face.is-picked { fill: #cfe0ec; stroke: #cfe0ec; }
.dq-board-same { border-color: #c0392b; }

/* Red on the nest's sheet, said (Dean, 19 November 2026). */
.link-button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.dq-nest-needs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-color: #c0392b; }
.dq-nest-part-bar.is-needed { border-color: #c0392b; }
.dq-nest-part-trouble { margin: 6px 0; }

/* A grain run being picked (ADR 0125): what to do next in the red that
   waits on the maker, and the parts in order. */
.dq-needs-line { margin: 8px 0; padding: 6px 10px; border: 1px solid #c0392b; border-radius: 8px; color: #8e2b20; font-size: 0.92rem; }
.dq-run-list { margin: 6px 0 12px 1.4em; padding: 0; }
.dq-run-list li { margin: 4px 0; }

/* One sheet's G-code on its own (Dean, 26 November 2026). */
.dq-nest-sheet-gcode { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.dq-nest-sheet-gcode.is-needed { align-items: flex-start; flex-direction: column; }
.dq-nest-offcut-of { font-size: 13px; opacity: 0.75; align-self: center; }

/* Features: what the CNC cuts on this job, each kind ticked (ADR 0143). */
.dq-nest-tone-features { --tone-bg: #edf5f1; --tone-line: #c7ddd2; --tone-ink: #2e5e48; }
.dq-nest-features { display: grid; gap: 8px; }
.dq-nest-feature { border: 1px solid var(--line, #d8d8d8); border-radius: 8px; padding: 8px 10px; background: #fff; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.dq-nest-feature-line { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.dq-nest-feature-line input { margin-top: 3px; width: 18px; height: 18px; }
.dq-nest-feature-line span { display: grid; gap: 2px; }
.dq-nest-feature-line small { font-size: 0.78rem; color: #5b6168; }
.dq-nest-feature-parts { grid-column: 1 / -1; list-style: none; margin: 4px 0 0; padding: 6px 0 0 28px; border-top: 1px solid #eee; display: grid; gap: 4px; }
.dq-nest-feature-parts label { display: flex; gap: 8px; align-items: center; cursor: pointer; }

/* Lettering on a part (ADR 0142). */
.dq-choice-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dq-choice-row .is-on { border-color: var(--ink, #1f2a37); font-weight: 600; }
.dq-lettering-fonts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
@media (max-width: 520px) { .dq-lettering-fonts { grid-template-columns: 1fr; } }

/* Holes and fixings on a part (ADR 0145). */
.dq-box > .dq-check { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; cursor: pointer; }
.dq-box > .dq-check input { width: 18px; height: 18px; }
.dq-fix-pick { border-top: 1px solid #eee; margin-top: 6px; padding-top: 6px; }
