/*
 * Texas Patios admin.
 *
 * The photography is the product, so the chrome is cool and quiet and lets
 * cedar, flagstone and pool water carry every warm note on the screen. The
 * reference is a job-site spec sheet: measured, material, legible at arm's
 * length, nothing decorative.
 *
 * Two colours carry meaning and nothing else does: water teal means "this
 * acts", copper means "this destroys or needs attention". A colour that
 * appears for looks alone would make those two stop reading as signals.
 */

:root {
  /* Materials, cool on purpose: warm photos sit on top of these. */
  /*
   * Taken from the public site's own stylesheet rather than invented: #cf1717
   * is its most-used colour by a distance (60 occurrences), #0e7c7c and
   * #212529 are next. The admin should look like the same company.
   *
   * Red is the brand, so it is spent carefully: the logo carries it, and the
   * only controls wearing it are the ones that destroy something. Actions use
   * the brand teal, so "this acts" and "this deletes" can never be confused.
   */
  --ink:        #212529;  /* the site's own near-black */
  --slate:      #343A40;
  --limestone:  #EDEFF1;  /* ground, cool grey to match the site */
  --paper:      #FFFFFF;
  --water:      #0E7C7C;  /* their teal: the action colour */
  --water-deep: #0A5E5E;
  --copper:     #CF1717;  /* their red: destroys, or needs attention */
  --copper-pale:#FCEBEB;
  --brand:      #CF1717;

  --line:       #DEE2E6;   /* the site's own hairline */
  --text:       #212529;
  /* 7.28:1 on limestone, 8.80:1 on paper. The old #5E6B67 measured 4.60:1
     on the page background -- just over the minimum, for text carrying most
     of the secondary information on every screen. */
  --text-quiet: #495057;   /* the site's own muted grey, 7.4:1 on paper */

  --shadow: 0 1px 2px rgba(22,33,31,.06), 0 8px 24px rgba(22,33,31,.06);

  --gap: 20px;
  --radius: 3px;   /* almost square: this is a tool, not a toy */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Signage face for labels and nav, system stack for dense data. */
@font-face {
  font-family: 'Barlow Condensed Fallback';
  src: local('Arial Narrow'), local('Helvetica Neue Condensed');
  size-adjust: 104%;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--limestone);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the label voice ---------- */
.eyebrow,
th,
.nav a,
.btn,
.pill,
legend {
  font-family: "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

/*
 * Labels are not eyebrows. Uppercasing every one turned "Hide from the public
 * gallery" into a phrase shouting louder than the value beside it. A label
 * names its control quietly and gets out of the way.
 */
label {
  font-size: 12px;
  color: var(--text-quiet);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.eyebrow {
  font-size: 12px;
  color: var(--text-quiet);
  display: block;
  margin-bottom: 6px;
}

/* ---------- header ---------- */
.masthead {
  gap: 22px;
  background: var(--paper);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 58px;
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Their actual logo, at the size the public header uses it. */
.masthead .wordmark { display: flex; align-items: center; flex: 0 0 auto; padding: 4px 0; }
.masthead .wordmark img { height: 38px; width: auto; display: block; }

/*
 * Sign out sits on a light bar now, so the old light-on-dark treatment left it
 * almost invisible. It is a real control and reads like one, but stays quiet:
 * nobody should hit it reaching for the nav.
 */
.masthead button.link {
  background: none;
  border: 1px solid transparent;
  color: var(--text-quiet);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: var(--radius);
}
.masthead button.link:hover {
  color: var(--ink);
  background: var(--limestone);
  border-color: var(--line);
}

.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  /* The masthead is white (var(--paper)), not the dark bar this colour was
     picked for, so #CDD8D4 read as almost nothing: about 1.4:1 on white.
     var(--text-quiet) is 7.4:1 on paper and reads on a phone. */
  color: var(--text-quiet);
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: var(--radius);
}
.nav a:hover { color: var(--ink); background: var(--limestone); }
/* The hamburger button is a phone affordance; the desktop nav is inline. */
.nav-burger { display: none; }
/* You-are-here is teal, not red: red on this admin means destruction. */
.nav a[aria-current="page"] {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 -3px 0 var(--water);
  border-radius: 0;
}

.whoami { font-size: 12.5px; color: var(--text-quiet); white-space: nowrap; }

/* ---------- page frame ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 72px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { margin: 0; font-size: 27px; font-weight: 640; letter-spacing: -.015em; }
.page-head p  { margin: 5px 0 0; color: var(--text-quiet); font-size: 14px; }

/* ---------- panels ---------- */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.panel + .panel { margin-top: 0; }

/* ---------- the signature: a material swatch ---------- */
/*
 * Every photo reference on every screen renders as the same object: a square
 * sample with a hairline inset, the way a material sample gets stapled to a
 * spec sheet. It is the one idea repeated across heroes, leads and
 * categories, and it is what makes this admin belong to a builder.
 */
.swatch {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  background: var(--limestone);
  box-shadow: inset 0 0 0 1px rgba(22,33,31,.10), 0 0 0 4px var(--paper), 0 0 0 5px var(--line);
}
.swatch-lg { width: 108px; height: 108px; flex-basis: 108px; }
.swatch-none {
  width: 68px; height: 68px; flex: 0 0 68px;
  border: 1px dashed var(--line);
  border-radius: 2px;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--text-quiet);
  text-align: center;
}

/* ---------- rows ---------- */
.row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 15.5px; }
.row-meta  { color: var(--text-quiet); font-size: 13px; margin-top: 3px; }
.row-meta code { font-size: 12.5px; background: var(--limestone); padding: 1px 5px; border-radius: 2px; }

/* ---------- status pills ---------- */
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-quiet);
  background: var(--paper);
  white-space: nowrap;
}
.pill-new       { border-color: var(--water); color: var(--water-deep); background: #E9F3F1; }
.pill-contacted,
.pill-quoted    { border-color: #C3A94B; color: #7A6413; background: #FBF5E2; }
.pill-won       { border-color: #3E8E4F; color: #2C6B39; background: #EAF4EC; }
.pill-lost      { border-color: var(--line); color: var(--text-quiet); background: var(--limestone); }
.pill-problem   { border-color: var(--copper); color: var(--copper); background: var(--copper-pale); }

/* ---------- controls ---------- */
.btn {
  font-size: 13px;
  padding: 8px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--water);
  background: var(--water);
  color: #fff;
  cursor: pointer;
  line-height: 1.2;
}
.btn:hover { background: var(--water-deep); border-color: var(--water-deep); }
.btn-quiet { background: var(--paper); color: var(--slate); border-color: var(--line); }
.btn-quiet:hover { background: var(--limestone); border-color: #BFC7C2; }
.btn-danger { background: var(--paper); color: var(--copper); border-color: var(--copper); }
.btn-danger:hover { background: var(--copper); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

select, input[type="text"], input[type="search"], input[type="date"], input[type="time"], textarea {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--water);
  outline-offset: 2px;
}

/* ---------- filter bar ---------- */
.filters {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.filters label { font-size: 11px; color: var(--text-quiet); display: block; margin-bottom: 4px; }

/* ---------- tables, for genuinely tabular data ---------- */
table { width: 100%; border-collapse: collapse; background: var(--paper); }
th {
  text-align: left;
  font-size: 11.5px;
  color: var(--text-quiet);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--limestone);
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F6F8F7; }

a { color: var(--water-deep); }
a:hover { color: var(--ink); }

/* ---------- notices ---------- */
.notice {
  border-left: 3px solid var(--water);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.notice-problem { border-left-color: var(--copper); background: var(--copper-pale); }

/* ---------- empty state: an invitation, not a shrug ---------- */
.empty {
  text-align: center;
  padding: 56px 24px;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-quiet);
}
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  /*
   * On a phone the nav is a hamburger. Eight items no longer fit on one line,
   * and the sideways-scrolling row this replaced hid whatever sat off the right
   * edge. The masthead lays out with flex-wrap: the wordmark, burger, version
   * badge and sign-out share the top line; the nav has flex-basis:100% so it
   * wraps to its own line, and it is hidden until the burger opens it.
   */
  .masthead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 12px 16px;
  }
  .masthead .wordmark { font-size: 15px; margin-right: auto; }
  .whoami { display: none; }               /* the sign-out button already says whose session this is */

  .nav-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px; height: 34px;
    padding: 0 9px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
  }
  .nav-burger span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
  .nav-burger[aria-expanded="true"] { border-color: var(--water); }

  .nav {
    order: 9;                 /* after everything else on the top line */
    flex-basis: 100%;
    display: none;            /* closed by default; the burger opens it */
    flex-direction: column;
    gap: 2px;
    margin: 6px 0 0;
  }
  .nav.open { display: flex; }
  .nav a {
    white-space: nowrap;
    padding: 12px 12px;
    font-size: 15px;
    border-radius: 8px;
  }
  .nav a[aria-current="page"] {
    box-shadow: none;
    background: var(--limestone);
  }

  /* The photo still leads on a phone: full width, then the detail beneath. */
  .hero-row { grid-template-columns: 1fr !important; }
  .row-shot { min-height: 190px !important; }
  .hero-row > details { padding: 0 18px 18px !important; }
  .row-info { padding: 16px 18px 8px !important; }
}

@media (max-width: 680px) {
  .masthead { padding: 12px 16px 0; }
  .page { padding: 20px 16px 56px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .swatch, .swatch-none { width: 56px; height: 56px; flex-basis: 56px; }
  /*
   * Stacked, and no wider than the phone.
   *
   * Turning the bar into a column is not enough on its own. flex-wrap stays
   * on from the desktop rule, and a wrapping column grows its line to the
   * widest item, so one long <option> sets the width of every control beside
   * it: the "Told us" select carries appliance names, and "InfraTech Single
   * Element 1600 Watt Heater (120V)" made all four children 407px inside a
   * 339px bar, 54px past a 390px screen. max-width on the select cannot fix
   * that, because the select is what widened the parent it measures against.
   *
   * nowrap keeps one column, min-width lets the items shrink into it, and
   * width settles the controls at the bar's width instead of their content's.
   */
  .filters { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .filters > * { min-width: 0; }
  .filters select, .filters input { width: 100%; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  td { border-bottom: 0; padding: 4px 12px; }
  tbody tr { border-bottom: 1px solid var(--line); padding: 10px 0; display: block; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- adding photos ---------- */
/*
 * The panel could publish, hide, pin and trash photos long before it could
 * add one. This sits above the filters because it is the first thing an
 * operator with a card full of job photos is looking for.
 */
.upload {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: var(--gap);
}
.upload .eyebrow { flex: 0 0 100%; color: var(--text-quiet); font-size: 12px; }
.upload label { display: grid; gap: 5px; font-size: 13px; color: var(--text-quiet); }
.upload select,
.upload input[type="file"] {
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}
.upload input[type="file"] { padding: 7px 8px; max-width: 320px; }
.upload .hint { font-size: 13px; color: var(--text-quiet); margin-left: auto; }

@media (max-width: 680px) {
  .upload { gap: 12px; }
  .upload label { flex: 1 1 100%; }
  .upload input[type="file"] { max-width: none; }
  .upload .hint { margin-left: 0; flex: 1 1 100%; }

  /*
   * min-width on every flex child, because a flex item defaults to
   * min-width:auto -- its content width -- and refuses to shrink below it.
   * A <select> sizes to its longest option, and "Fireplace or fire pit (295)"
   * is wide enough that the selection bar measured 450px inside a 386px
   * phone: the tagger hung 48px off the right edge and the whole admin page
   * scrolled sideways.
   */
  .upload label,
  .upload select,
  .upload input[type="file"] { min-width: 0; }

  /* The tagger takes its own row rather than being pushed right by
     margin-left:auto into space a phone does not have. */
  .bar .tagger {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    flex: 1 1 100%;
    flex-wrap: wrap;
  }
  .bar .tagger select {
    flex: 1 1 130px;
    min-width: 0;
    max-width: 100%;
  }
  .bar .count { margin-right: 0; flex: 1 1 100%; }
}

/* ---------- lead pager ---------- */
.pager {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: var(--gap);
  font-size: 14px;
  color: var(--text-quiet);
}
.pager a { color: var(--water-deep); text-decoration: none; }
.pager a:hover { text-decoration: underline; }
.pager .off { color: var(--line); }

/* ---------- the tagger in the selection bar ---------- */
/*
 * Sits at the right of the bar, away from Delete. Applying a tag and moving a
 * photo to trash should not be neighbours.
 */
.bar .tagger {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.bar .tagger label {
  font-family: "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--text-quiet);
}
.bar .tagger select {
  font: inherit;
  font-size: 14px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

/* ---------- right-click tagging ---------- */
#tag-menu {
  position: absolute;
  z-index: 60;
  min-width: 210px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(22,33,31,.18);
  display: flex;
  flex-direction: column;
}
#tag-menu[hidden] { display: none; }
#tag-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}
#tag-menu button:hover { background: var(--limestone); }
/* The tick is the state. An empty box reads as "not filed under this" without
   needing a second column of text to say so. */
#tag-menu .tick {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}
#tag-menu button.on .tick {
  border-color: var(--water);
  background: var(--water);
  box-shadow: inset 0 0 0 2px #fff;
}
#tag-menu button.on { color: var(--water-deep); }

/* The grid suppresses the browser menu on a tile, so say why it did. */
.tile { position: relative; }

/* ---------- site logo picker ---------- */
/*
 * The logos are wide and thin, so they are shown at the width they will
 * actually be used at rather than cropped into a square tile: choosing a
 * wordmark from a thumbnail that hides half the words is guesswork.
 */
.logo-picker .logo-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.logo-option {
  display: block;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
}
.logo-option:hover { border-color: var(--water); }
.logo-option.on {
  border-color: var(--water);
  box-shadow: inset 0 0 0 1px var(--water);
  background: #F2F8F7;
}
.logo-option img {
  display: block;
  width: 100%;
  height: 54px;
  object-fit: contain;
  margin-bottom: 10px;
}
/* The white variant is invisible on a white card, so it gets a dark bed. */
.logo-option img[src*="white"] { background: var(--ink); border-radius: 2px; padding: 6px; }
.logo-option span { font-size: 13px; color: var(--text-quiet); }
.logo-option input { accent-color: var(--water); margin-right: 6px; }
.logo-actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.logo-actions .hint { font-size: 13px; color: var(--text-quiet); }

/* ---------- stacked tables carry their own labels ---------- */
/*
 * Below 680px every cell becomes a block and the header row is hidden, so a
 * value has nothing above it saying what it is: a category slug and a file
 * size read as two anonymous lines. Any cell given a data-label prints it.
 */
@media (max-width: 680px) {
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-size: 11px;
    color: var(--text-quiet);
    margin-bottom: 2px;
  }
}

/* ---------- where lead emails go ---------- */
.recipients-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.recipients-panel summary {
  cursor: pointer;
  padding: 12px 16px;
  font-family: "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 13px;
  color: var(--text-quiet);
}
.recipients-panel[open] summary { border-bottom: 1px solid var(--line); }
.recipients-form { padding: 16px; display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.recipients-form label { font-size: 11px; color: var(--text-quiet); text-transform: uppercase; letter-spacing: .04em; }
.recipients-form input[type="text"] { padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.recipients-form .hint { font-size: 12px; color: var(--text-quiet); margin: 2px 0 6px; }
.recipients-form button { align-self: flex-start; }
.flash {
  background: #EAF6EF;
  border: 1px solid #BFE3CE;
  color: #1B5E3A;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
}

/* ---------- quote-question builder ---------- */
.builder-note {
  font-size: 13px; color: var(--text-quiet); max-width: 640px; margin: 0 0 18px;
}
.builder-q { position: relative; }
.builder-q.is-hidden, .builder-option.is-hidden { opacity: .55; }
.builder-q-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.builder-order { display: inline-flex; gap: 4px; }
.builder-order button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer; font-size: 13px; line-height: 1; color: var(--ink);
}
.builder-order button:hover { border-color: var(--water); }
.builder-edit {
  display: grid; grid-template-columns: 2fr 2fr 1fr auto; gap: 12px; align-items: end;
}
.builder-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 11px;
  color: var(--text-quiet); text-transform: uppercase; letter-spacing: .04em; }
.builder-edit input[type="text"], .builder-edit select,
.builder-option-edit input[type="text"], .builder-add-option input[type="text"] {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px;
}
.builder-options { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.builder-option { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.builder-option-edit { display: flex; gap: 6px; flex: 1 1 auto; align-items: center; }
.builder-option-edit input[type="text"] { flex: 1 1 auto; }
.builder-add-option { display: flex; gap: 6px; margin-top: 12px; }
.builder-add-option input[type="text"] { flex: 1 1 260px; }
.btn-quiet {
  border: 1px solid var(--line); background: var(--paper); border-radius: 6px;
  padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--text-quiet);
}
.btn-quiet:hover { border-color: var(--water); color: var(--ink); }

@media (max-width: 680px) {
  .builder-edit { grid-template-columns: 1fr; }
  .builder-q-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .builder-option { flex-wrap: wrap; }
  .builder-option-edit { flex: 1 1 100%; }
}

/* ---------- appliance builder (extends the question-builder styles) ---------- */
.flash-warn { background: #FBF3E3; border-color: #E7D6A8; color: #7A5A16; }
.builder-code { font-size: 11px; color: var(--text-quiet); white-space: nowrap; }
.builder-group summary { list-style: none; }
.builder-product { border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; background: var(--paper); }
.builder-product > summary {
  cursor: pointer; padding: 12px 14px; display: flex; align-items: baseline;
  justify-content: space-between; gap: 12px; list-style: none;
}
.builder-product > summary::-webkit-details-marker { display: none; }
.builder-product-title em { color: var(--text-quiet); font-style: normal; text-transform: uppercase;
  letter-spacing: .04em; font-size: 11px; margin-right: 6px; }
.builder-product-sku { font-size: 12px; color: var(--text-quiet); }
.builder-product-body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.builder-order-row { display: flex; gap: 8px; margin: 12px 0; }
.builder-product-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.builder-product-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 11px;
  color: var(--text-quiet); text-transform: uppercase; letter-spacing: .04em; }
.builder-product-edit label.wide { grid-column: 1 / -1; text-transform: none; letter-spacing: 0; font-size: 12px; }
.builder-product-edit input[type="text"], .builder-product-edit select, .builder-product-edit textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit;
}
.builder-product-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.builder-add-product { margin-top: 10px; }
.builder-add-product > summary { cursor: pointer; font-size: 13px; color: var(--water); padding: 8px 0; }
.builder-add-product .builder-product-edit { margin-top: 10px; }

@media (max-width: 680px) {
  .builder-product-edit { grid-template-columns: 1fr; }
  .builder-product > summary { flex-direction: column; gap: 4px; }
}

.builder-img-field { flex: 1 1 180px; }

/* ---------- image pick: thumbnail + upload ---------- */
.builder-thumb {
  width: 40px; height: 40px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; flex: none;
}
.builder-thumb-lg { width: 84px; height: 84px; object-fit: contain; }
.builder-upload { display: inline-flex; flex-direction: column; gap: 2px; font-size: 10px;
  color: var(--text-quiet); text-transform: uppercase; letter-spacing: .04em; }
.builder-upload input[type="file"] { font-size: 12px; max-width: 190px; }
.builder-picture-row { display: flex; align-items: center; gap: 12px; }

/* ---------- photo-step coverage on the questions builder ---------- */
.photo-coverage { margin-top: 12px; }
.photo-coverage table { width: auto; }
.photo-coverage td { padding: 3px 16px 3px 0; font-size: 13px; border: 0; }
.photo-coverage code { font-size: 11px; color: var(--text-quiet); }
.photo-coverage-empty td { color: #A15; }

/* ---------- follow-up condition picker ---------- */
.builder-triggers { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.builder-triggers > summary { cursor: pointer; font-size: 13px; color: var(--water); }
.builder-triggers-state { color: var(--text-quiet); font-size: 12px; margin-left: 4px; }
.builder-trigger-group { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 8px 0; }
.builder-trigger-group legend { font-size: 11px; color: var(--text-quiet); text-transform: uppercase; letter-spacing: .04em; padding: 0 4px; }
.builder-trigger-opt { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 4px 0; font-size: 14px; }

/* ---------- version badge + changelog ---------- */
.version-badge {
  font-family: "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, system-ui, sans-serif;
  font-size: 12px; letter-spacing: .04em; color: var(--text-quiet);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
  text-decoration: none; white-space: nowrap; margin-left: auto;
}
.version-badge:hover { border-color: var(--water); color: var(--water); }
.changelog-release { max-width: 760px; }
.changelog-head { display: flex; align-items: baseline; gap: 12px; }
.changelog-version {
  font-family: "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, system-ui, sans-serif;
  font-weight: 600; font-size: 18px; color: var(--ink);
}
.changelog-date { font-size: 13px; color: var(--text-quiet); }
.changelog-headline { font-size: 18px; margin: 4px 0 12px; }
.changelog-changes { margin: 0; padding-left: 20px; }
.changelog-changes li { margin: 8px 0; line-height: 1.5; }

.changelog-intro { font-size: 15px; color: var(--ink); margin: 0 0 18px; max-width: 660px; line-height: 1.55; }
.changelog-section { margin: 18px 0; }
.changelog-section h3 { font-size: 15px; margin: 0 0 6px; }
.changelog-section p { margin: 0 0 8px; line-height: 1.55; max-width: 680px; }
.changelog-section ul { margin: 6px 0; padding-left: 20px; }
.changelog-section li { margin: 5px 0; line-height: 1.5; max-width: 660px; }

/* ---------- users screen ---------- */
.user-inactive { opacity: .55; }
.user-you { font-size: 11px; color: var(--text-quiet); text-transform: uppercase; letter-spacing: .05em; }
.user-role-form { display: inline; }
.user-role-form select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.user-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.user-add { display: grid; grid-template-columns: repeat(2, 1fr) auto; gap: 12px; align-items: end; }
.user-add label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-quiet);
  text-transform: uppercase; letter-spacing: .04em; }
.user-add input[type="text"], .user-add input[type="email"], .user-add select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.user-add .hint { grid-column: 1 / -1; }
@media (max-width: 680px) { .user-add { grid-template-columns: 1fr; } }

/* ---------- in-admin docs page ---------- */
.doc-page .panel.doc { max-width: 760px; }
.doc h2 { font-size: 20px; margin: 0 0 8px; }
.doc h3 { font-size: 15px; margin: 22px 0 4px; }
.doc p { line-height: 1.6; margin: 10px 0; color: var(--ink); }
.doc-key {
  background: var(--limestone); border: 1px solid var(--line); border-left: 4px solid var(--water);
  border-radius: 8px; padding: 14px 16px; margin: 16px 0;
}
.doc-key p:first-child { margin-top: 0; }
.doc-key p:last-child { margin-bottom: 0; }
.doc-list { margin: 10px 0; padding-left: 20px; }
.doc-list li { margin: 8px 0; line-height: 1.55; }
.doc-defs { margin: 8px 0; }
.doc-defs div { display: grid; grid-template-columns: 110px 1fr; gap: 4px 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.doc-defs div:last-child { border-bottom: 1px solid var(--line); }
.doc-defs dt { font-weight: 600; }
.doc-defs dd { margin: 0; color: var(--text-quiet); }
@media (max-width: 560px) { .doc-defs div { grid-template-columns: 1fr; gap: 2px; } }

/* ==========================================================================
   Builder redesign: the walkthrough as an ordered flow, appliances as a grid
   ========================================================================== */

/* ---- Questions: a numbered spine of steps ---- */
.flow { position: relative; padding-left: 54px; margin-top: 6px; }
.flow::before {
  content: ""; position: absolute; left: 18px; top: 10px; bottom: 40px; width: 2px;
  background: linear-gradient(var(--water), #cfe2e0);
}
.flow .builder-q {
  position: relative; margin: 0 0 16px; padding: 16px 20px 6px; overflow: visible;
}
.q-node {
  position: absolute; left: -54px; top: 16px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--water); color: var(--water);
  display: grid; place-items: center; z-index: 1;
  font: 700 17px/1 "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, sans-serif;
}
.flow .builder-q.is-photos .q-node { border-style: dashed; }
.flow .builder-q.is-hidden { opacity: .55; }
.flow .builder-q.is-hidden .q-node { border-color: var(--line); color: var(--text-quiet); }
.q-node-add { border-style: dashed; border-color: var(--line); color: var(--text-quiet); }
.flow .builder-add { border-style: dashed; background: transparent; box-shadow: none; }

/* head: the eyebrow + the reorder/remove tools, quiet until hover */
.flow .builder-q-head { margin-bottom: 6px; }
.flow .builder-q-head .eyebrow { font-size: 11px; }
.flow .builder-order { gap: 3px; opacity: .3; transition: opacity .12s; }
.flow .builder-q:hover .builder-order { opacity: 1; }
.flow .builder-order button { width: 30px; height: 26px; }
.flow .builder-q-head .btn-quiet { padding: 6px 11px; }

/* the edit form: title reads like a heading, hint quiet, kind a pill, save calm */
.flow .builder-edit { display: block; }
.flow .builder-edit > label { display: block; text-transform: none; letter-spacing: 0; }
.flow .builder-edit > label:first-of-type { font-size: 0; }        /* hide the "Question" text label */
.flow .builder-edit input[name="title"] {
  width: 100%; font: 650 19px/1.3 var(--sans, inherit); letter-spacing: -.01em; color: var(--ink);
  border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: transparent; padding: 2px 0;
}
.flow .builder-edit input[name="title"]:hover { border-bottom-color: var(--line); }
.flow .builder-edit input[name="title"]:focus { outline: none; border-bottom-color: var(--water); }
.flow .builder-edit label:nth-of-type(2) { font-size: 0; margin-top: 2px; }
.flow .builder-edit input[name="hint"] {
  width: 100%; font-size: 13px; color: var(--text-quiet); border: 0; background: transparent; padding: 3px 0;
}
.flow .builder-edit input[name="hint"]:focus { outline: none; }
.flow .builder-edit label:nth-of-type(3) { display: inline-block; margin: 10px 12px 0 0; }
.flow .builder-edit select[name="kind"] {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; background: var(--paper);
}
.flow .builder-edit button[type="submit"] {
  margin-top: 10px; background: transparent; color: var(--water); border-color: var(--water); padding: 8px 14px;
}
.flow .builder-edit button[type="submit"]:hover { background: var(--water); color: #fff; }

/* answers as a tidy list; a picture answer leads with its thumbnail */
.flow .builder-options { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.flow .builder-option {
  gap: 8px; padding: 6px 8px; border-radius: 6px; margin: 4px 0;
}
.flow .builder-option:hover { background: var(--limestone); }
.flow .builder-option .builder-order { opacity: .3; }
.flow .builder-option:hover .builder-order { opacity: 1; }
.flow .builder-thumb { width: 34px; height: 34px; }
.flow .builder-option-edit input[type="text"] { border-color: transparent; background: transparent; }
.flow .builder-option:hover .builder-option-edit input[type="text"] { border-color: var(--line); background: var(--paper); }

/* coverage: read the table rows as a clean strip */
.flow .photo-coverage { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }

/* the follow-up strip */
.flow .builder-triggers { background: color-mix(in srgb, var(--water) 4%, transparent); border-radius: 0 0 3px 3px; margin: 12px -20px -6px; padding: 11px 20px; }
.flow .builder-triggers > summary { color: var(--water); }

/* ---- Appliances: a product grid ---- */
.builder-group .group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.group-name { font: 650 20px/1 var(--sans, inherit); letter-spacing: -.01em; margin: 0; }
.group-count {
  font: 600 11px/1 "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, sans-serif;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-quiet);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px;
}
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.pgrid .builder-product { margin: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); overflow: hidden; }
.pgrid .builder-product:hover { border-color: #c4c9cd; box-shadow: 0 3px 14px rgba(22,33,31,.1); }
.pgrid .builder-product > summary { display: block; padding: 0; }
.product-shot { display: grid; place-items: center; height: 130px; background: #fff; border-bottom: 1px solid var(--line); }
.product-shot img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-noshot { font-size: 12px; color: #aeb4b8; }
.product-meta { display: block; padding: 11px 12px 13px; }
.product-brand {
  display: block; font: 600 10px/1 "Barlow Condensed", "Barlow Condensed Fallback", Arial Narrow, sans-serif;
  letter-spacing: .1em; text-transform: uppercase; color: var(--water); margin-bottom: 4px;
}
.product-name { display: block; font-size: 14px; line-height: 1.3; }
.pgrid .builder-product-sku { display: block; font-size: 11px; color: var(--text-quiet); margin-top: 6px; }
.pgrid .builder-product-body { padding: 12px; border-top: 1px solid var(--line); }
.pgrid .builder-product-edit { grid-template-columns: 1fr; }
.builder-add-product { margin-top: 14px; }

@media (max-width: 680px) {
  .flow { padding-left: 40px; }
  .flow::before { left: 13px; }
  .q-node { left: -40px; width: 30px; height: 30px; font-size: 14px; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---- Questions redesign, refinements ---- */
/* The title reads as a heading; keep the field visible even though its label text is hidden. */
.flow .builder-edit input[name="title"] { font-size: 19px !important; color: var(--ink); min-height: 28px; }
.flow .builder-edit input[name="hint"] { font-size: 13px !important; }

/* An answer is a calm row: label leads, the picture upload & controls stay out
   of the way until you hover it. */
.flow .builder-option { align-items: center; }
.flow .builder-option-edit { align-items: center; gap: 8px; }
.flow .builder-option .builder-upload,
.flow .builder-option .builder-option-edit > button,
.flow .builder-option > form:last-child button {
  opacity: 0; transition: opacity .12s;
}
.flow .builder-option:hover .builder-upload,
.flow .builder-option:hover .builder-option-edit > button,
.flow .builder-option:hover > form:last-child button { opacity: 1; }
.flow .builder-upload { flex-direction: row; align-items: center; gap: 6px; }
.flow .builder-upload span { font-size: 10px; }
.flow .builder-upload input[type="file"] { max-width: 150px; font-size: 11px; }
.flow .builder-option-edit input[name="label"] { flex: 1 1 auto; font-size: 15px; }

/* the add-option row, quiet */
.flow .builder-add-option { border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px; margin-top: 10px; }
.flow .builder-add-option input[name="label"] { border: 0; background: transparent; }

/* the answers header + kind pill read quieter */
.flow .builder-options .eyebrow { font-size: 10px; letter-spacing: .1em; }

/* ---- Appliances: tidy the group & brand rows to match the product grid ---- */
#groups .builder-option, #brands .builder-option { align-items: center; padding: 5px 8px; border-radius: 6px; margin: 3px 0; }
#groups .builder-option:hover, #brands .builder-option:hover { background: var(--limestone); }
#groups .builder-option .builder-order, #brands .builder-option .builder-order { opacity: .3; transition: opacity .12s; }
#groups .builder-option:hover .builder-order, #brands .builder-option:hover .builder-order { opacity: 1; }
#groups .builder-option .btn-quiet, #brands .builder-option .btn-quiet { opacity: 0; transition: opacity .12s; }
#groups .builder-option:hover .btn-quiet, #brands .builder-option:hover .btn-quiet { opacity: 1; }
#groups .builder-option-edit input[type="text"], #brands .builder-option-edit input[type="text"] { border-color: transparent; background: transparent; font-size: 15px; }
#groups .builder-option:hover input[type="text"], #brands .builder-option:hover input[type="text"] { border-color: var(--line); background: var(--paper); }

/* ---- picture field: preview + choose-from-library + upload ---- */
.pic-field { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pic-preview { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.pic-lib { padding: 6px 11px; white-space: nowrap; }
.pic-upload { font-size: 11px; color: var(--text-quiet); display: inline-flex; align-items: center; gap: 5px; text-transform: none; letter-spacing: 0; }
.pic-upload input[type="file"] { max-width: 130px; font-size: 11px; }
/* on the appliance product form the picture field gets its own line */
.builder-product-edit .pic-field { margin-top: 4px; }

/* in the tight question option rows, keep the preview but reveal the controls on hover */
.flow .builder-option .pic-lib,
.flow .builder-option .pic-upload { opacity: 0; transition: opacity .12s; }
.flow .builder-option:hover .pic-lib,
.flow .builder-option:hover .pic-upload { opacity: 1; }

/* ---- the library picker overlay ---- */
.lib-picker { position: fixed; inset: 0; z-index: 100; background: rgba(20,25,28,.55);
  display: grid; place-items: center; padding: 24px; }
.lib-picker[hidden] { display: none; }
.lib-panel { background: var(--paper); width: min(900px, 94vw); max-height: 84vh;
  border-radius: 6px; box-shadow: 0 30px 80px rgba(0,0,0,.4); display: flex; flex-direction: column; overflow: hidden; }
.lib-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.lib-head strong { font-size: 15px; }
.lib-search { flex: 1; padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.lib-close { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--paper);
  border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1; color: var(--text-quiet); }
.lib-close:hover { border-color: var(--copper); color: var(--copper); }
.lib-grid { overflow-y: auto; padding: 14px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.lib-empty { color: var(--text-quiet); font-size: 14px; padding: 20px; grid-column: 1 / -1; }
.lib-item { display: block; height: 88px; padding: 0; border: 1px solid var(--line); border-radius: 5px;
  overflow: hidden; cursor: pointer; background: var(--paper); }
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item:hover { border-color: var(--water); box-shadow: inset 0 0 0 2px var(--water); }
