/*
 * The quote app's one stylesheet, served at /ui/ee.css (part m3-14). It carries the approved design package
 * STITCH-CLAUDE-HANDOFF-2026-10-13 (approved 2026-10-12, Kamloops time), in this order:
 *   1. the Inter faces of assets/fonts/fonts.css, served from /fonts;
 *   2. the DESIGN.md section 2 colours as custom properties;
 *   3. the rules of exports/approved/code/design-approved.css, then staff.css: the same selectors and values in the
 *      same order, written out one declaration a line, a token's colour named by its custom property;
 *   4. what DESIGN.md asks for that those two files lack.
 * Every page links it: the React pages through app/layout.tsx, the HTML-string pages through lib/ui/shell.ts. A page's
 * own rules live beside the page (a CSS module, or public/ui/pages.css for the HTML-string pages), not here.
 * Motion: only the mascot's entrance and saved-success, once, and 160 ms colour, opacity and transform changes on
 * controls; nothing else moves, and under prefers-reduced-motion nothing moves at all.
 */

/* 1. Inter, the original website's own Latin files (OFL.txt beside them). */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/inter-latin-700.woff2') format('woff2');
}

/* 2. The colours (DESIGN.md, section 2). The first nine keep the approved file's short names. */
:root {
  --navy: #081D3A;
  --royal: #17236C;
  --orange: #F58905;
  --canvas: #F4F7FA;
  --surface: #FCFDFE;
  --text: #253750;
  --muted: #4A5A70;
  --border: #7C8B9F;
  --divider: #D7DFE8;
  --success: #176447;
  --success-bg: #EAF5EE;
  --warning: #835000;
  --warning-bg: #FFF5DF;
  --error: #A92323;
  --error-bg: #FFF1F1;
  --info: #24497A;
  --info-bg: #EDF3FB;
  --inverse: #F7FAFF;
}

/* 3a. design-approved.css */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 400 16px/1.5 Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 32px;
  line-height: 1.2;
  color: var(--navy);
  font-weight: 700;
}
h2,
legend {
  font-size: 22px;
  line-height: 1.35;
  color: var(--navy);
  font-weight: 600;
}
h3 {
  font-size: 18px;
  color: var(--navy);
}
a {
  color: var(--royal);
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button.primary,
.primary {
  background: var(--navy);
  color: var(--inverse);
  border-color: var(--navy);
}
button:disabled {
  background: #E2E7EF;
  color: var(--muted);
  cursor: default;
}
input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]),
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
}
textarea {
  min-height: 120px;
  resize: vertical;
}
input[type=checkbox],
input[type=radio] {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 2px 0 0;
  accent-color: var(--navy);
}
:focus-visible {
  outline: 3px solid var(--royal) !important;
  outline-offset: 3px !important;
}
label.choice:focus-within {
  outline: 3px solid var(--royal);
  outline-offset: 3px;
}
header {
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
}
.header-inner {
  max-width: 1280px;
  margin: auto;
  min-height: 72px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo {
  width: 200px;
  height: auto;
  object-fit: contain;
}
.contact-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  font-weight: 600;
  color: var(--navy);
}
main.customer {
  max-width: 680px;
  margin: 48px auto;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 10px;
  box-shadow: 0 1px 3px #081D3A0D;
  overflow: hidden;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 32px 40px 24px;
  border-bottom: 1px solid var(--divider);
}
.mascot {
  height: 140px;
  width: auto;
  max-width: 30%;
  object-fit: contain;
  animation: enter .4s cubic-bezier(.22,1,.36,1) both;
}
.content {
  padding: 32px 40px 40px;
}
.section {
  margin: 0 0 32px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.section:last-child {
  margin-bottom: 0;
}
.section > h2,
.section > legend {
  margin-bottom: 12px;
}
.field {
  margin: 0 0 24px;
}
.field > label,
.field > legend {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.hint,
.meta {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.field .hint {
  margin: 4px 0 10px;
}
.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.options.single {
  grid-template-columns: 1fr;
}
.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  background: var(--surface);
}
.choice:has(input:checked) {
  background: var(--info-bg);
  border-color: var(--royal);
}
.choice span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.inline-options .choice {
  flex: 1;
  min-width: 100px;
}
.optional {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}
.actions > * {
  flex: 1;
}
.photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.photo {
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 8px;
  min-width: 0;
}
.placeholder {
  background: #E6EDF4;
  min-height: 90px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  border-radius: 6px;
  text-align: center;
  padding: 8px;
}
.photo button {
  min-height: 48px;
  width: 100%;
  padding: 8px;
  font-size: 16px;
  margin-top: 6px;
}
.notice {
  padding: 16px;
  border: 1px solid #A0B6D0;
  background: var(--info-bg);
  color: var(--info);
  border-radius: 10px;
  margin: 16px 0;
}
.notice.warning {
  border-color: #B89868;
  background: var(--warning-bg);
  color: var(--warning);
}
.notice.error {
  border-color: #B45F5F;
  background: var(--error-bg);
  color: var(--error);
}
.notice.success {
  border-color: #6FA48B;
  background: var(--success-bg);
  color: var(--success);
}
.notice h2,
.notice h3 {
  color: inherit;
}
.notice ul {
  padding-left: 22px;
  margin: 8px 0 0;
}
.notice a {
  color: inherit;
  display: inline-block;
  min-height: 32px;
}
.error-text {
  color: var(--error);
  font-size: 14px;
  margin-top: 8px;
}
.privacy {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 16px;
}
.send {
  width: 100%;
  margin-top: 20px;
}
.summary {
  padding: 16px 0;
  border-top: 1px solid var(--divider);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}
.summary-row a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.success-body {
  text-align: center;
  padding: 40px;
}
.success-body .mascot {
  max-width: 100%;
  height: 160px;
  margin: 0 auto 24px;
  animation: success .5s cubic-bezier(.22,1,.36,1) both;
}
.success-body p {
  margin-top: 16px;
}
.success-body .notice {
  text-align: left;
}
.bottom {
  max-width: 680px;
  margin: 24px auto 48px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 14px;
}
.hidden,
[hidden] {
  display: none !important;
}
svg.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
input[aria-invalid=true],
textarea[aria-invalid=true] {
  border-color: var(--error) !important;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes success {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 767px) {
  .header-inner {
    padding: 12px 20px;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .logo {
    width: 180px;
  }
  .contact-link {
    font-size: 14px;
  }
  main.customer {
    margin: 24px 20px;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
  .intro {
    padding: 24px 0;
    border-bottom: 1px solid var(--divider);
  }
  .intro .mascot {
    height: 96px;
    max-width: 30%;
  }
  .content {
    padding: 24px 0 32px;
  }
  .options {
    grid-template-columns: 1fr;
  }
  .inline-options .choice {
    flex: 1 1 100px;
  }
  h1 {
    font-size: 28px;
  }
  h2,
  legend {
    font-size: 20px;
  }
  .success-body {
    padding: 32px 0;
  }
  .actions {
    flex-direction: column;
  }
  .photos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Review corrections: retain semantics, reduce redundant boundaries. */
fieldset.field {
  border: 0;
  padding: 0;
  min-width: 0;
}
fieldset.field legend {
  padding: 0;
  margin-bottom: 8px;
}
.field .options {
  padding: 0;
}
.summary-row {
  align-items: flex-start;
}
.summary-question {
  display: block;
  color: var(--muted);
  font-size: 14px;
}
.summary-value {
  display: block;
  overflow-wrap: anywhere;
}
.summary-row > a {
  flex: 0 0 auto;
}
.choice,
button,
.button {
  transition: background-color 160ms, color 160ms, opacity 160ms, transform 160ms;
}
.choice:hover {
  background: var(--info-bg);
}
:where(button:not(:disabled)):hover,
:where(.button):hover {
  background: #E7EDF5;
}
button.primary:not(:disabled):hover,
.button.primary:hover {
  background: var(--royal);
  color: var(--inverse);
}
button:not(:disabled):active,
.button:active {
  transform: translateY(1px);
}
@media (max-width: 767px) {
  #town .options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  button:active,
  .button:active {
    transform: none;
  }
}

/* Long references and enlarged text remain inside narrow layouts. */
h1,
h2,
h3,
.request-meta,
.status,
.staff-name,
.nav-link {
  overflow-wrap: anywhere;
}
.top-row > * {
  min-width: 0;
}
body {
  overflow-wrap: anywhere;
}

/* 3b. staff.css */
.staff {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 24px 48px;
}
.staff.narrow {
  max-width: 560px;
}
.staff .page-heading {
  margin-bottom: 24px;
}
.staff h1 {
  font-size: 28px;
}
.staff h2 {
  font-size: 22px;
  margin-bottom: 16px;
}
.staff h3 {
  margin: 20px 0 10px;
}
.staff p {
  max-width: 70ch;
}
.nav-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  color: var(--navy);
  font-weight: 600;
}
.header-inner {
  flex-wrap: wrap;
}
.staff-name {
  margin-left: auto;
  font-size: 14px;
  color: var(--muted);
}
.work-section {
  padding: 24px 0;
  border-top: 1px solid var(--divider);
  margin-top: 24px;
}
.work-section:first-child {
  margin-top: 0;
}
.workspace {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 28px;
  min-width: 0;
}
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
}
.detail-grid > aside {
  grid-column: 2;
  grid-row: 1;
}
.detail-grid > .detail-main {
  grid-column: 1;
  grid-row: 1;
}
.next-actions {
  border-top: 3px solid var(--navy);
  padding: 20px 0;
}
.next-actions .actions {
  flex-direction: column;
}
.key-values {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(0, 1.2fr);
  gap: 12px 24px;
  margin: 0;
}
.key-values dt {
  color: var(--muted);
  font-size: 14px;
}
.key-values dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.answers > div {
  padding: 14px 0;
  border-bottom: 1px solid var(--divider);
}
.answers dt {
  font-size: 14px;
  color: var(--muted);
}
.answers dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}
.status {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: var(--info-bg);
  color: var(--info);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 600;
}
.status.success {
  background: var(--success-bg);
  color: var(--success);
}
.status.warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}
.filter-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: end;
  margin: 24px 0;
}
.filter-row .field {
  margin: 0;
  flex: 1;
  min-width: 180px;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
th {
  color: var(--muted);
  font-weight: 600;
  background: var(--canvas);
}
th,
td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--divider);
  vertical-align: top;
  overflow-wrap: anywhere;
}
table a {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  font-weight: 600;
}
.table-wrap {
  overflow: auto;
  max-width: 100%;
}
.mobile-requests {
  display: none;
}
.map-placeholder {
  min-height: 400px;
  background: #E3EBF3;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  position: relative;
  margin: 16px 0;
}
.map-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.map-controls button,
.map-controls .button,
.map-tools button,
.draw-controls button {
  min-height: 56px;
}
.measurement-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 32px;
}
.line-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 20px;
  margin-bottom: 16px;
}
.line-entry .field {
  margin: 0;
}
.totals {
  border-top: 1px solid var(--divider);
  padding-top: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 24px;
  font-variant-numeric: tabular-nums;
}
.totals strong {
  font-size: 22px;
  color: var(--navy);
}
.email-preview {
  width: 100%;
  min-height: 330px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin: 16px 0;
}
details {
  padding: 16px 0;
  border-top: 1px solid var(--divider);
}
summary {
  cursor: pointer;
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--navy);
}
.history {
  padding-left: 22px;
  color: var(--muted);
}
.history li {
  padding: 8px 0;
}
.checklist {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}
.blank-art {
  display: block;
  height: 130px;
  width: auto;
  max-width: 100%;
  margin: 20px auto;
}
.review-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.review-actions > * {
  flex: 1;
}
.large-choice button {
  min-height: 56px;
  width: 100%;
  margin: 6px 0;
}
.license {
  font-size: 14px;
  color: var(--muted);
  margin-top: 20px;
}
.trace-layout {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 24px 40px;
}
.trace-map {
  min-height: 400px;
}
.trace-shape {
  width: 75%;
  height: 300px;
  max-width: 520px;
}
.trace-skip {
  min-height: 56px;
  border: 1px solid var(--navy);
  color: var(--navy);
  font-weight: 600;
}
.trace-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.trace-toolbar > * {
  min-height: 56px;
  flex: 1;
}
.field > select {
  margin-top: 8px;
}
.field label.choice {
  font-weight: 400;
}
.delivery-states > article {
  padding: 24px 0;
  border-bottom: 1px solid var(--divider);
}
@media (max-width: 767px) {
  .staff {
    margin: 24px auto;
    padding: 0 20px 40px;
  }
  .staff h1 {
    font-size: 24px;
  }
  .staff h2 {
    font-size: 20px;
  }
  .workspace {
    padding: 20px 0;
    border: 0;
    background: var(--surface);
  }
  .detail-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .detail-grid > aside {
    order: 0;
    width: 100%;
  }
  .detail-main {
    order: 1;
    width: 100%;
  }
  .staff-name {
    margin-left: 0;
  }
  .header-inner {
    flex-direction: row;
    align-items: center;
    gap: 8px 16px;
  }
  .header-inner .logo {
    margin-right: auto;
  }
  .header-inner .nav-link {
    margin: 0;
  }
  .header-inner .staff-name {
    width: 100%;
  }
  .key-values {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .key-values dd {
    margin-bottom: 14px;
  }
  .table-wrap {
    display: none;
  }
  .mobile-requests {
    display: block;
  }
  .request-row {
    padding: 20px 0;
    border-bottom: 1px solid var(--divider);
  }
  .request-row .top-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
  }
  .request-row p {
    margin: 8px 0;
  }
  .request-row a {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
  }
  .measurement-grid {
    display: block;
  }
  .line-entry {
    grid-template-columns: 1fr;
  }
  .review-actions {
    flex-direction: column;
  }
  .map-placeholder {
    min-height: 340px;
  }
  .trace-layout {
    padding: 0 20px 32px;
  }
  .trace-toolbar {
    flex-direction: column;
  }
  .trace-map {
    min-height: 40vh;
  }
  .trace-shape {
    height: 240px;
  }
}

/* Readable customer/service values; quieter table metadata. */
table {
  font-size: 16px;
}
th,
td:nth-child(2) {
  font-size: 14px;
}

/* 4. What DESIGN.md asks for that the approved files lack. */

/* Staff headings, 28 px and 24 px on phones (DESIGN.md, section 3), are staff.css's own .staff h1 rules above. */

/* Money and dates in tabular numerals (DESIGN.md, section 3). */
.num {
  font-variant-numeric: tabular-nums;
}

/* Controls change colour, background, border, opacity and transform over 160 ms, and nothing else (section 6). */
a,
button,
.button,
.choice,
input,
select,
textarea,
summary {
  transition: color 160ms, background-color 160ms, border-color 160ms, opacity 160ms, transform 160ms;
}

/* Read by a screen reader, not shown. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* The mascot's motion (section 6), once each: the entrance, and the saved-success only after the request is saved.
   The approved prefers-reduced-motion rule above stops both, leaving the final still picture at once. */
.mascot-enter {
  animation: enter 400ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;
}
.mascot-success {
  animation: success 500ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;
}

/* The Mascot component's <picture> adds no box of its own, so its image lays out as the approved files' bare <img>
   (a flex item in .intro, sized against the panel, not against the picture). */
picture {
  display: contents;
}
/* Its <source> elements, which no browser hides by default, would otherwise join the parent's flex or grid as items of
   their own (they widened the gap beside the quote form's heading on phones). A <source> never draws anything; hiding
   it changes no image the browser picks. */
picture > source {
  display: none;
}
/* A mascot that stands still (Mascot with motion 'none'): a class rather than an inline style, weighing more than the
   approved .mascot and .success-body .mascot rules, which run a motion by default. */
img.mascot.mascot-still {
  animation: none;
}
/* Every disclosure says it opens: summary is a flex box, which draws no marker of its own, so a chevron does, turned
   when it is open (transform only, over 160 ms; still under reduced motion like every transition). */
summary::before {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin: 0 14px 0 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 160ms;
}
details[open] > summary::before {
  transform: rotate(45deg);
}
