/* Shared components for every screen. Class names are stable: later screens build on them.
   Values come from the tokens in app.css. */

/* Page heading: <div class="page-head"><h1>…</h1><p class="page-sub">…</p></div> */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
  margin: 0 0 var(--space-3);
}
.page-sub { color: var(--muted); }
/* A row of buttons with a note beside them. */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
}

/* Buttons. One .btn-primary per screen; it carries the arrow. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--control);
  padding: 0 calc(var(--space-1) * 2.5);
  font: 500 var(--text)/1.2 var(--font-body);
  text-decoration: none;
  border: var(--border) solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-primary { color: var(--on-accent); background: var(--accent); }
.btn-primary:hover { color: var(--on-accent); background: var(--accent-hover); }
.btn-primary::after { content: "\2192"; content: "\2192" / ""; }
.btn-secondary { color: var(--fg); background: transparent; border-color: var(--line-strong); }
.btn-secondary:hover { color: var(--fg); border-color: var(--muted); }
.btn-danger { color: var(--danger); background: transparent; border-color: var(--danger); }
.btn-danger:hover { color: var(--danger); background: var(--panel-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
/* A button that looks like a link (Sign out). */
.link-button {
  padding: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
/* Row actions such as "edit" and "flip →". */
.action-link { color: var(--link); font-weight: 500; text-decoration: none; white-space: nowrap; }
.action-link:hover { text-decoration: underline; }

/* Chips: pills. The chosen one is filled (.is-selected, aria-pressed="true", or a checked
   radio/checkbox inside the chip's label); the others are outlined. */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-half);
  min-height: var(--chip-height);
  padding: 0 calc(var(--space-1) * 1.75);
  font: 400 var(--text-sm)/1 var(--font-body);
  color: var(--fg);
  text-decoration: none;
  background: transparent;
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip.is-selected, .chip[aria-pressed="true"], .chip:has(> input:checked) {
  color: var(--chip-on-fg);
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
}
.chip > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.chip:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Form controls */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
label { font-weight: 500; }
input[type="text"], input[type="email"], input[type="number"], input[type="search"],
input[type="url"], textarea, select {
  width: 100%;
  padding: calc(var(--space-1) * 1.25) calc(var(--space-1) * 1.5);
  font: 400 var(--text)/1.5 var(--font-body);
  color: var(--fg);
  background: var(--panel);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius);
}
textarea { min-height: 160px; line-height: 1.7; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="file"] { font: inherit; color: var(--fg-2); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); }
.consent { display: flex; align-items: flex-start; gap: var(--space-1); font-weight: 400; }
.consent input { flex: none; margin-top: 3px; }

/* Cards (candidates, project tiles) and panels (page sections). */
.card {
  padding: var(--space-2);
  background: var(--panel);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
/* The chosen candidate: a 2 px accent border; pair it with aria-pressed for colour-blind readers. */
.card.is-selected, .card[aria-pressed="true"] {
  padding: calc(var(--space-2) - 1px);
  border: var(--border-selected) solid var(--accent);
}
.panel {
  padding: var(--space-3);
  background: var(--panel);
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel-title { margin: 0 0 var(--space-2); font: 600 var(--text-lg)/1.3 var(--font-head); }
/* "Not checked yet": a panel with a warn border. */
.panel-warn { border-color: var(--warn); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-2); }
/* Product photos sit on a light tile, also in the dark theme. */
.photo-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--photo-tile);
  border-radius: var(--radius);
}

/* Lists and tables with row lines only (requirements, parts, decisions). */
.rows { margin: 0; padding: 0; list-style: none; }
.rows > li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: calc(var(--space-1) * 1.5) 0;
  border-bottom: var(--border) solid var(--line);
}
.rows > li:last-child { border-bottom: 0; }
table.rows { width: 100%; border-collapse: collapse; }
table.rows th, table.rows td {
  padding: calc(var(--space-1) * 1.25) var(--space-1);
  text-align: left;
  border-bottom: var(--border) solid var(--line);
}
table.rows th { font-weight: 400; color: var(--muted); }
table.rows tr:last-child > * { border-bottom: 0; }
/* A table wider than its box (a phone) scrolls inside the box, never the page. */
.table-wrap { overflow-x: auto; }

/* Where a number came from (G1): from your brief / from the datasheet / we assumed. */
.source {
  display: inline-block;
  padding: 2px var(--space-1);
  font: 400 var(--text-xs)/1.4 var(--font-body);
  color: var(--fg-2);
  white-space: nowrap;
  border: var(--border) solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.source-assumed { color: var(--warn); border-color: var(--warn); }

/* A question for the customer: a warn bar on the left, a faint warm ground. */
.question {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--warn-soft);
  border-left: var(--bar) solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Notices and errors */
.notice { color: var(--muted); font-size: var(--text-sm); }
.field-error { color: var(--danger); font-size: var(--text-sm); }
.error {
  padding: calc(var(--space-1) * 1.5) var(--space-2);
  color: var(--danger);
  background: var(--panel-2);
  border-left: var(--bar) solid var(--danger);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* A plain heads-up that is not an error (Invite only): a warn bar on a quiet ground. */
.callout {
  padding: calc(var(--space-1) * 1.5) var(--space-2);
  color: var(--fg);
  background: var(--panel-2);
  border-left: var(--bar) solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Badges and tags */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-1);
  font: 500 var(--text-xs)/1.4 var(--font-body);
  border-radius: var(--radius-pill);
}
/* "Look preview" on AI-made pictures. */
.badge-preview { color: var(--link); background: var(--panel); border: var(--border) solid var(--line-strong); }
/* "paid" next to Engineering design. */
.tag-paid {
  flex: none;
  padding: 1px 6px;
  font: 500 var(--text-xs)/1.4 var(--font-body);
  color: var(--warn);
  border: var(--border) solid var(--warn);
  border-radius: var(--radius-sm);
}

/* Prices read as prices (유락 10-29, style only): the figure bold, a size up, tabular, in the
   default colour; its unit and basis smaller and quieter; a saving as a small chip in the colour of good
   news, its words still saying it. In a heading or a dense line the figure keeps that line's size. */
.money {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.money-unit { font-size: var(--text-sm); color: var(--muted); }
.money-save {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ok);
  border: var(--border) solid currentColor;  /* a chip, so it never reads as a link */
  border-radius: var(--radius-pill);
  padding: 0 var(--space-1);
}
h1 .money, .part-terms .money, .price-change .money { font-size: inherit; }
.part-list .part-terms .money { font-weight: 600; }  /* over .part-list strong */
.price-change .money-unit { font-size: inherit; }

/* The production timeline (G3's card and the review results page): a quiet list of rows, a tag
   beside the title and one on each point the customer decides, the weeks on the right. */
.timeline { display: grid; gap: var(--space-1); margin-top: var(--space-3); }
.panel > .timeline { margin-top: 0; }  /* the panel's padding is the gap */
.timeline p { margin: 0; }
.timeline-title, .timeline-tier-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin: 0; }
.timeline-tier { display: grid; gap: var(--space-1); margin-top: var(--space-2); }
.timeline-tier-title { font-size: var(--text); font-weight: 500; }
.timeline-tag {
  flex: none;
  padding: 1px 6px;
  font: 500 var(--text-xs)/1.4 var(--font-body);
  color: var(--warn);
  border: var(--border) solid var(--warn);
  border-radius: var(--radius-sm);
}
.timeline-rows > .timeline-row { flex-wrap: wrap; gap: var(--space-half) var(--space-1); }
.timeline-label { flex: 1 1 14rem; }
.timeline-when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline-fine { font-size: var(--text-sm); }
