/* ---- Phase 4: paints, per-paint results, summary ---- */
:root { --info: #174a46; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] { --info: #a8e0da; } }
:root[data-theme="dark"] { --info: #a8e0da; }

/* Info buttons: darker glyph and a ring so they read as buttons. */
.info-btn { color: var(--info); font-weight: 700; font-size: 1.45rem; }
.info-btn:hover { background: var(--bg); }
.hint { margin: -4px 0 8px; }

.swatch { display: inline-block; flex: none; width: 1.3em; height: 1.3em; border-radius: 4px; border: 1px solid var(--border); vertical-align: middle; }
.swatch.big { width: 44px; height: 44px; border-radius: 8px; }
.swatch.none { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--border) 4px 6px); }

.print-btn { margin-top: 8px; width: 100%; }
@media (min-width: 900px) { .print-btn { width: auto; } }

.warn.fix { border-left-color: var(--danger); font-weight: 600; }
.notice-inline { margin-bottom: 12px; }
.item-grid.excl .field-err, .field-err { overflow-wrap: anywhere; }

/* results by paint */
/* scroll-margin keeps the heading clear of the sticky top bar */
.buy-h { scroll-margin-top: 70px; margin: 16px 0 0; padding-top: 12px; border-top: 2px solid var(--text); font-size: 1.05rem; }
.pgroup-h { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 1rem; overflow-wrap: anywhere; }
.pgroup { border-top: 0; }
.all-paints { margin: 8px 0 0; }
.caveat { margin-top: 8px; }
.room-paints { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.room-paints li { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; }
.room-paints .swatch { margin-top: 3px; }

/* my paints */
.paint-grid { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.paint-card { margin: 0; }
.paint-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.paint-head .swatch { width: 52px; height: 52px; }
.paint-title { min-width: 0; }
.paint-title h2 { margin: 0; overflow-wrap: anywhere; }
.paint-title h2 a { color: var(--text); text-decoration: none; }
.paint-title h2 a:hover { text-decoration: underline; }
.paint-title p { margin: 0; }
.used-in { overflow-wrap: anywhere; }
.paint-screen .card h2 { margin-bottom: 12px; }
.colour-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; margin-bottom: 8px; }
.colour-row .swatch.big { width: 64px; height: 64px; }
.item-grid.tin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.item-grid.tin .remove { grid-column: 1 / -1; }
.item-grid.tin .field-label { min-height: 1.4em; }
input[type="date"].input { min-width: 11em; }

/* tables: stacked labelled lines on narrow screens */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; padding: 4px 8px 6px 0; border-bottom: 2px solid var(--border); }
.tbl td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.tbl tfoot td { border-top: 2px solid var(--text); border-bottom: 0; font-weight: 700; }
.paint-cell { display: inline-flex; align-items: flex-start; gap: 8px; }
.paint-cell .swatch { margin-top: 2px; }
.cell-fig { display: inline-flex; align-items: center; gap: 2px; }
@media screen and (min-width: 560px) { .cell-fig { white-space: nowrap; } }
@media print { .cell-fig { white-space: nowrap; } }
.cell-fig .info-btn { width: 36px; height: 36px; margin: -6px 0; }
.print-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.print-row .select { min-width: 12em; }
.summary-rooms { display: grid; gap: 0; }
.summary-rooms h3 { margin: 0 0 8px; }
.by-room-h { margin: 8px 0 12px; }
.room-swatches { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.room-swatches li { display: inline-flex; align-items: center; gap: 8px; }
.saving { margin-top: 12px; }
.rooms-note { margin: -4px 0 12px; }
@media (max-width: 479px) {
  .pc-facts span { display: block; }
  .pc-facts .sep { display: none; }
}

@media screen and (max-width: 559px) {
  .tbl, .tbl tbody, .tbl tfoot, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .tbl td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; }
  .tbl td.first { font-weight: 600; justify-content: flex-start; text-align: left; }
  .tbl td.first::before { content: none; }
  .tbl td:empty { display: none; }
  .tbl tfoot tr { border-top: 2px solid var(--text); border-bottom: 0; }
}
@media (min-width: 600px) {
  .paint-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-grid.tin { grid-template-columns: 1fr 1fr auto; }
  .item-grid.tin .remove { grid-column: auto; }
}
@media (min-width: 900px) {
  .paint-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

#add-tin { margin-bottom: 12px; }

/* ---- house overview grid ---- */
.overview th.ov-head { vertical-align: bottom; }
.ov-colour { display: inline-flex; align-items: flex-start; gap: 6px; font-weight: 600; }
.ov-uses { font-size: 0.88rem; }
@media screen and (min-width: 560px) {
  .overview td:empty::before { content: '–'; color: var(--muted); }
}

/* ---- Suggest paint panel (Phase 9) ---- */
.dlg.dlg-wide { width: min(760px, calc(100vw - 24px)); }
.sp-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.sp-head p { margin: 0; }
.sp-target { width: 56px; height: 56px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border: 2px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.92rem; cursor: pointer; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.chip[disabled] { opacity: 0.6; cursor: default; }
.chip.all { border-style: dashed; }
.sp-filters { display: grid; gap: 4px; margin-bottom: 10px; }
.sp-filters p { margin: 0; }
.sp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sp-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 6px 8px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; }
.sp-row.sel { border-color: var(--accent); background: var(--accent-soft); }
.sp-row:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.sp-marks { color: var(--accent); font-weight: 700; }
.sp-pair { display: flex; width: 56px; height: 44px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.sp-half { flex: 1; }
.sp-info-col p { margin: 0; }
.sp-name { overflow-wrap: anywhere; }
.sp-close { display: flex; align-items: center; gap: 4px; }
.sp-info { font-size: 1.2rem; min-width: 32px; min-height: 32px; }
.sp-label.l-indistinguishable, .sp-label.l-very-close { font-weight: 700; color: var(--accent); }
.sp-notes { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.sp-notes p { margin: 0 0 4px; }
.paint-meta-line { margin: 0; }
.range-select { margin-bottom: 8px; }
.badge { display: inline-block; padding: 0 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; font-weight: 700; }

/* ---- Phase 11: Paint matches chips and actions ---- */
.chips { align-items: center; gap: 6px; }
.chip { min-height: 40px; padding: 0 12px; }
.chip.dim { color: var(--muted); background: var(--bg); border-color: var(--border); font-weight: 400; opacity: 0.8; }
.chip.dim:hover { opacity: 1; border-color: var(--accent); }
.sp-brand-info { width: 40px; height: 40px; }
.sp-act { min-height: 36px; padding: 0 10px; font-size: 0.85rem; }
.sp-err { grid-column: 1 / -1; margin: 0; }
@media (max-width: 599px) { .sp-act, .chip { min-height: 44px; } .sp-brand-info { width: 44px; height: 44px; } }
/* D87: one sticky action bar (the dialog footer) for the selected paint; two rows on a phone */
.sp-bar { flex: 1; display: grid; gap: 6px; min-width: 0; }
.sp-bar p { margin: 0; }
.sp-bar-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-bar-btns .sp-act, .sp-bar-btns .sp-done { flex: 1 1 auto; justify-content: center; }
@media (max-width: 599px) { .sp-bar-btns .sp-act, .sp-bar-btns .sp-done { flex: 1 1 30%; } }
.sp-done { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.sp-live { margin: 0 0 6px; min-height: 1.2em; color: var(--muted); }
@media (max-width: 699px) { .sp-done { min-height: 44px; } }
