:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #1f1a15;
  --muted: #6b6157;
  --border: #ddd3c7;
  --accent: #8a4b2f;
  --accent-text: #ffffff;
  --danger: #a4342a;
  --ok: #3f7d4f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1815;
    --surface: #262019;
    --text: #f0e9e1;
    --muted: #b3a89b;
    --border: #453b32;
    --accent: #cf8a5f;
    --accent-text: #241a12;
    --danger: #e08a80;
    --ok: #7fcb92;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1815;
  --surface: #262019;
  --text: #f0e9e1;
  --muted: #b3a89b;
  --border: #453b32;
  --accent: #cf8a5f;
  --accent-text: #241a12;
  --danger: #e08a80;
  --ok: #7fcb92;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, sans-serif;
  max-width: 32rem;
  margin: 0 auto;
  /* iOS PWA: viewport-fit=cover + a translucent status bar means content
     draws under the notch/clock/battery area unless we push it down explicitly. */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: max(3rem, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.1rem; margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.app-icon { width: 1.8rem; height: 1.8rem; border-radius: 0.4rem; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; }
.status { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 1rem; }
.status.ok { background: var(--ok); color: var(--accent-text); }
.status.bad { background: var(--danger); color: var(--accent-text); }
#settings-gear-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tabs .tab-btn {
  flex: 1 1 auto;
  min-width: 5rem;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.7rem 0.4rem;
  font-size: 0.85rem;
  border-bottom: 2px solid transparent;
}
.tabs .tab-btn.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

main { padding: 1rem; }
.view { margin-bottom: 2rem; }
.view h2 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.section-header-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.section-header-row h2 { margin: 0; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }

label { display: block; margin: 0.9rem 0 0.3rem; font-size: 0.85rem; color: var(--muted); }
textarea, input[type="text"], input[type="number"], input[type="date"], input[type="password"], select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}
textarea { resize: vertical; }

button, .button-link {
  font-size: 1rem;
  padding: 0.7rem 1.1rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.secondary { background: transparent; }
#parse-btn, #save-btn, #purchase-parse-btn, #receipt-parse-btn { width: 100%; margin-top: 0.8rem; }
#ranking-expand-btn { display: block; width: auto; min-width: 10rem; margin: 0.8rem auto 0; }

.button-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.button-group button { flex: 1; min-width: 4.2rem; }
.button-group button.selected, .button-group button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.button-row { display: flex; gap: 0.6rem; margin-top: 1rem; }
.button-row button { flex: 1; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.toggle-row input { width: auto; }

.hint { font-size: 0.8rem; color: var(--muted); margin: 0.3rem 0 0; }
.status-line { font-size: 0.85rem; margin-top: 0.6rem; min-height: 1.2em; }
.status-line.error { color: var(--danger); }
.status-line.ok { color: var(--ok); }

#smoke-search-panel, #inventory-search-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.7rem; margin-bottom: 0.8rem; }
#recent-list, #inventory-list { list-style: none; padding: 0; margin: 0; }
#recent-list li, #inventory-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}
.status-icons { display: flex; gap: 0.3rem; flex-shrink: 0; padding-top: 0.15rem; }
.status-icon { display: inline-flex; }
.status-icon.icon-resting { color: var(--muted); }
.status-icon.icon-ready { color: var(--ok); }
.all-clear-row { display: flex; justify-content: center; }
.all-clear-icon { color: var(--ok); display: inline-flex; }
.status-icon.icon-low-stock { color: var(--danger); }
.inline-pin { display: inline-flex; vertical-align: -2px; color: var(--muted); }
.qty-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.78rem; line-height: 1; padding: 0.25rem 0.5rem; border-radius: 1rem; }

.sort-bar { display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem 0; flex-wrap: wrap; }
.sort-bar select { width: auto; padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.sort-btn, .filter-btn, .drift-dim-btn { padding: 0.35rem 0.6rem; font-size: 0.8rem; display: inline-flex; align-items: center; justify-content: center; min-width: 2.2rem; }
.sort-btn.active, .filter-btn.active, .drift-dim-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
/* Direction arrow on the active sort button. Rendered via ::after so it never
   clobbers the SVG icon these buttons set through innerHTML. */
.sort-btn.active::after { content: '\2191'; font-size: 0.75em; margin-left: 0.2rem; line-height: 1; }
.sort-btn.active.desc::after { content: '\2193'; }

.lot-edit-block { margin-top: 0.4rem; }
.editable-value-list { list-style: none; padding: 0; margin: 0 0 0.8rem; }
.editable-value-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; }
.editable-value-row .editable-value-input { flex: 1; }
.editable-value-row button { padding: 0.3rem 0.6rem; font-size: 0.8rem; flex-shrink: 0; }
.par-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.par-row label { margin: 0; font-size: 0.8rem; }
.par-row input { width: 4.5rem; padding: 0.3rem; }
.par-row input.wide-input { width: auto; flex: 1; }
.par-row button { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.par-row .icon-btn { padding: 0.35rem; }
.par-save-status { font-size: 0.8rem; }
.incomplete-flag { color: var(--danger); font-size: 0.75rem; }

.spec-grid { display: grid; grid-template-columns: auto 1fr; column-gap: 0.9rem; row-gap: 0.3rem; margin: 0.5rem 0 0.9rem; }
.spec-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0.15rem; }
.spec-value { color: var(--text); font-size: 0.92rem; }
.spec-empty { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; }

.inv-item { position: relative; padding-right: 4.5rem; padding-bottom: 1.6rem; min-height: 2.5rem; }
.inv-rating {
  position: absolute;
  right: 0.9rem;
  bottom: 0.5rem;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  text-align: right;
}
#inventory-list .inv-item { padding-bottom: 2.3rem; }
#inventory-list .inv-rating { top: 50%; bottom: auto; right: 0.9rem; text-align: right; transform: translateY(-50%); font-size: 2.1rem; }
#ranking-list .inv-rating { top: 50%; bottom: auto; transform: translateY(-50%); }
#inventory-list .inv-status-corner { position: absolute; right: 0.9rem; bottom: 0.6rem; display: flex; gap: 0.3rem; }
#inventory-list .inv-location-corner { position: absolute; left: 0.9rem; bottom: 0.6rem; display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
#inventory-list .inv-location-corner .country-flag { height: 1.1em; width: auto; aspect-ratio: 4 / 3; object-fit: cover; margin-top: 0; flex-shrink: 0; }
.flagship-row { display: flex; align-items: center; gap: 0.9rem; }
.flagship-photo { width: 5.5rem; height: 5.5rem; object-fit: cover; border-radius: 0.6rem; border: 1px solid var(--border); flex-shrink: 0; }
.flagship-info { flex: 1; min-width: 0; }
.cache-row { display: flex; align-items: flex-start; gap: 0.8rem; }
.cache-photo { width: 4.8rem; height: 4.8rem; object-fit: cover; border-radius: 0.6rem; border: 1px solid var(--border); flex-shrink: 0; }
.cache-info { flex: 1; min-width: 0; }
/* Recent Smokes card: a fixed (non-absolute) header zone for title/icons and
   score/bucket, so neither can ever be overlapped by the variable-height body
   below once the card is expanded — this replaces an earlier absolutely-
   positioned .inv-rating that pinned itself to the bottom of the whole <li>
   and drifted into the expanded notes text as that grew taller. */
.smoke-item { position: relative; }
.smoke-item-score-row { text-align: right; margin-top: 0.1rem; }
.smoke-item-score-row .inv-rating,
#recent-list .inv-rating { position: static; }
.smoke-item-body { overflow: hidden; margin-top: 0.4rem; }
.smoke-item-body .smoke-list-photo { float: left; margin: 0 0.8rem 0.4rem 0; }
.smoke-list-photo { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 0.6rem; border: 1px solid var(--border); }
.inv-rating .provisional-flag { display: block; font-size: 0.6rem; font-weight: 400; margin-top: 0.1rem; }
.inv-rating .rating-bucket, .smoke-history-rating .rating-bucket { display: block; font-size: 0.62rem; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; margin-top: 0.15rem; }
.inv-rating .rating-bucket.former-king { color: #a8842a; }
.smoke-history-rating { flex-shrink: 0; text-align: right; font-size: 1.4rem; font-weight: 700; color: var(--accent); line-height: 1; }
.inv-rating .crown-badge { display: block; font-size: 1rem; line-height: 1; margin-bottom: 0.1rem; }

.view h3 { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 1.4rem; }
.collapsible-section { margin-top: 1.4rem; }
.collapsible-section summary {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 0.3rem 0;
}
.collapsible-section ul { margin-top: 0.6rem; }

#ranking-list, #detail-sizes, #detail-lots, #detail-smokes, #detail-purchase-history { list-style: none; padding: 0; margin: 0; }
#ranking-list li, #detail-sizes li, #detail-lots li, #detail-smokes li, #detail-purchase-history li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
  cursor: default;
}
#detail-purchase-history li.best-price-row { border-color: #a8842a; background: rgba(168, 132, 42, 0.08); }
.best-price-badge { color: #a8842a; font-weight: 700; }
#ranking-list li.clickable { cursor: pointer; }
#ranking-list li.clickable:active { background: var(--bg); }

.clickable-list { list-style: none; padding: 0; margin: 0; }
.clickable-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}
.clickable-list li.clickable { cursor: pointer; }
.clickable-list li.clickable:active { background: var(--bg); }
#bearings-band-edit-row[hidden], #bearings-bv-edit-row[hidden] { display: none; }
.cs-hit { cursor: pointer; }
.clickable-list li.most-frequent-row { cursor: pointer; display: block; }
.vitola-breakdown-list { list-style: none; margin: 0.5rem 0 0; padding: 0.4rem 0 0 0.8rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.vitola-breakdown-list li { display: flex; justify-content: space-between; padding: 0.15rem 0; }
#bearings-within-cigar-aging { list-style: none; padding: 0; margin: 0; }
#bearings-within-cigar-aging li.within-cigar-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem;
  padding: 0.6rem 0.8rem; margin-bottom: 0.5rem; cursor: pointer;
}
.within-cigar-smokes { list-style: none; margin: 0.5rem 0 0; padding: 0.4rem 0 0 0.8rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.within-cigar-smokes li { display: flex; justify-content: space-between; padding: 0.15rem 0; }
.share-over-time-list { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.share-over-time-list li { margin-bottom: 0.7rem; }
.share-month-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.2rem; }
.share-bar { display: flex; height: 1.4rem; border-radius: 0.3rem; overflow: hidden; border: 1px solid var(--border); }
.share-segment { border: none; border-radius: 0; padding: 0; margin: 0; cursor: pointer; min-width: 2px; }
.share-segment:active { filter: brightness(0.85); }
.share-legend { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0; font-size: 0.78rem; }
.share-legend-swatch { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 0.15rem; margin-right: 0.3rem; vertical-align: -0.05rem; }
.inline-link-btn {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--accent); text-decoration: underline; cursor: pointer; font-size: inherit;
}
.inline-link-btn:active { opacity: 0.7; }
#bearings-drill-list { list-style: none; padding: 0; margin: 0; }
#bearings-drill-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}
.rank-number { display: inline-block; min-width: 1.6rem; margin-right: 0.3rem; color: var(--muted); font-weight: 600; }
.rank-score { font-weight: 700; }
.provisional-flag { font-size: 0.72rem; color: var(--muted); font-style: italic; }
#detail-back-btn, #stock-back-btn, .back-to-settings-btn { margin-bottom: 0.6rem; }

.add-fab {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

#discovery-list { list-style: none; padding: 0; margin: 1rem 0 0; }
#discovery-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.6rem;
}
.discovery-reason { font-size: 0.9rem; margin: 0.4rem 0; }
.discovery-specs { margin: 0; min-width: 0; }
/* Price and the predicted-rating box sit on one centered line below the
   specs — previously the rating was pinned to the far right of a row shared
   with specs; now it's its own row, centered as a pair with the price. */
.discovery-price-row { display: flex; align-items: center; justify-content: center; gap: 1.2rem; margin: 0.6rem 0; }
.discovery-predicted-big { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 5.5rem; }
.discovery-predicted-value { font-size: 1.9rem; font-weight: 700; color: var(--accent); line-height: 1; margin-top: 0.2rem; }
.discovery-predicted-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }

.humidor-stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0; }
.humidor-stat { flex: 1 1 6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.6rem; text-align: center; }
.humidor-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.humidor-stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.2rem; }
.discovery-price-row .discovery-price { font-size: 0.85rem; color: var(--muted); margin: 0; }
.discovery-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 0.6rem; }
.discovery-buy-btn { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

.undo-bar:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.8rem;
  margin-top: 0.6rem;
}
.undo-bar button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.smoke-this-card {
  position: relative;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.8rem;
  padding-right: 4.5rem;
  margin-bottom: 0.6rem;
}
.smoke-this-photo { border-radius: 0.5rem; object-fit: cover; flex-shrink: 0; }
.smoke-this-photo-primary { width: 5.5rem; height: 5.5rem; }
.smoke-this-photo-alt, .smoke-this-photo-sea-trial { width: 3rem; height: 3rem; }
.smoke-this-info { flex: 1; min-width: 0; }
.smoke-this-why { margin: 0.3rem 0; }
.smoke-this-card .smoke-this-pick-btn { margin-top: 0.5rem; }
.smoke-this-card .inv-rating { position: absolute; right: 0.9rem; top: 50%; bottom: auto; transform: translateY(-50%); font-size: 1.3rem; }
#smoke-this-skip-btn { margin-top: 0.2rem; width: 100%; }
#sea-trial-toggle-btn { margin-top: 0.6rem; width: 100%; }
#sea-trial-panel { margin-top: 0.6rem; }
#sea-trial-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
#sea-trial-list li { margin-bottom: 0; }

.button-link { display: inline-block; text-align: center; text-decoration: none; }

#drift-chart svg { display: block; max-width: none; }
#drift-chart { background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.6rem; overflow-x: auto; }

#drift-averages-list, #trusted-shop-list, #incomplete-attrs-list, #similar-spellings-list, #smoke-stats-countries, #smoke-stats-factories { list-style: none; padding: 0; margin: 0.6rem 0; }
#similar-spellings-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.6rem 0.8rem; margin-bottom: 0.5rem; }
#similar-spellings-list .recent-meta { text-transform: capitalize; margin-bottom: 0.3rem; }
#similar-spellings-list .button-row button { font-size: 0.8rem; padding: 0.5rem 0.6rem; }
#drift-averages-list li, #incomplete-attrs-list li, #smoke-stats-countries li, #smoke-stats-factories li {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem;
  padding: 0.5rem 0.8rem; margin-bottom: 0.4rem; display: flex; justify-content: space-between; font-size: 0.9rem;
}
#trusted-shop-list li {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem;
  padding: 0.5rem 0.8rem; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.6rem;
}

/* The four Settings "nudge" checklists (incomplete attrs, missing prices,
   similar spellings x2) share one look: white boxed rows, and a centered
   green checkmark row in place of the list when there's nothing to fix. */
#missing-prices-list, #lot-spellings-list { list-style: none; padding: 0; margin: 0.6rem 0; }
#missing-prices-list li, #lot-spellings-list li {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem;
  padding: 0.6rem 0.8rem; margin-bottom: 0.5rem; font-size: 0.9rem;
}
#missing-prices-list li { display: flex; align-items: center; justify-content: space-between; }
#incomplete-attrs-list li.all-clear-row, #missing-prices-list li.all-clear-row,
#similar-spellings-list li.all-clear-row, #lot-spellings-list li.all-clear-row {
  display: flex; justify-content: center;
}
#trusted-shop-list input[type="number"] { width: 3.5rem; }
#trusted-shop-list span.shop-name { flex: 1; }

.stock-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.8rem;
  margin-bottom: 1rem;
}
.stock-item-card .item-title { font-weight: 600; margin-bottom: 0.4rem; }
.stock-item-card .new-cigar-fields { border-top: 1px dashed var(--border); margin-top: 0.6rem; padding-top: 0.6rem; }
.combo-unconfirmed { border: 1px solid #b45309; border-radius: 0.4rem; padding: 0.4rem; background: rgba(180, 83, 9, 0.07); }
.combo-unconfirmed label::after { content: " — new, check spelling"; color: #b45309; font-weight: 400; text-transform: none; letter-spacing: normal; }
.field-row { display: flex; gap: 0.5rem; }
.field-row > div { flex: 1; }
.combo-new:not([hidden]) { margin-top: 0.4rem; }
.item-exclude-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.85rem; }
.item-exclude-row input { width: auto; }
.verify-attrs-btn { margin-top: 0.8rem; }
.attr-verify-result { margin-top: 0.5rem; }
.attr-conflict-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.5rem 0.7rem; margin-top: 0.4rem; font-size: 0.82rem; }
.attr-conflict-row button { flex-shrink: 0; padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.recent-title { font-weight: 600; }
.cigar-title-3line { display: flex; flex-direction: column; gap: 0.05rem; line-height: 1.25; }
.cigar-title-brand { font-weight: 700; }
.cigar-title-line { font-weight: 600; }
.cigar-title-size { font-weight: 400; font-size: 0.85em; color: var(--muted); }
.recent-meta { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.lot-sub-row { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.3rem; padding-left: 0.2rem; }
.lot-edit-row { margin: 0.3rem 0 0.7rem 0.2rem; padding-bottom: 0.6rem; border-bottom: 1px dashed var(--border); }

.smoke-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.smoke-header .recent-title { min-height: 2.8em; }
.icon-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.icon-btn {
  padding: 0.35rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border-color: var(--border);
}
.icon-btn.confirming { background: var(--danger); color: var(--accent-text); border-color: var(--danger); }

.smoke-expanded { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.expanded-field { font-size: 0.85rem; margin: 0.3rem 0; }
.expanded-field strong { color: var(--muted); font-weight: 600; }

#login-view {
  max-width: 22rem;
  margin: 4rem auto 0;
  padding: 1.5rem;
}
#login-view h1 { font-size: 1.3rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 1.5rem; }
#login-view h1 .app-icon { width: 2.2rem; height: 2.2rem; }
#login-form button[type="submit"] { width: 100%; margin-top: 1rem; }
.login-hero-image { display: block; width: 100%; height: auto; margin: 2rem auto 0; }

#pull-refresh-indicator {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  margin-top: -3rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg);
  transition: transform 0.15s ease-out;
  z-index: 50;
  pointer-events: none;
}

.photo-input-row { display: flex; gap: 0.6rem; margin-top: 0.6rem; }
.photo-input-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.5rem;
  border: 1.5px dashed var(--accent);
  border-radius: 0.6rem;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  cursor: pointer;
}

#smoke-photo-preview-wrap:not([hidden]) { margin-top: 0.6rem; display: flex; align-items: center; gap: 0.6rem; }
#smoke-photo-preview { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 0.5rem; border: 1px solid var(--border); }
#cigar-photo-preview-wrap:not([hidden]) { margin-top: 0.6rem; display: flex; align-items: center; gap: 0.6rem; }
#cigar-photo-preview { width: 6rem; height: 6rem; object-fit: cover; border-radius: 0.5rem; border: 1px solid var(--border); }
.smoke-photo { display: block; width: 100%; max-width: 16rem; border-radius: 0.6rem; margin-bottom: 0.6rem; }

/* Click-to-enlarge lightbox — covers any image across the app (Cache, Flagships,
   Recent Smokes, cigar attribute photo, smoke photo). Dismiss via the X,
   tapping the dark backdrop, or Escape. */
.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  cursor: zoom-out;
}
.photo-lightbox[hidden] { display: none; }
.photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  cursor: default;
}
.photo-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
}
.cache-photo, .flagship-photo, .smoke-list-photo, .smoke-photo, .smoke-this-photo,
#cigar-photo-preview, #smoke-photo-preview { cursor: zoom-in; }

.item-exclude-row.gift-row { margin-top: 0.4rem; }

/* Shown on a list while its data is being (re)fetched — e.g. returning from
   the detail view after an edit — so the previous render is visibly "old"
   rather than indistinguishable from current while the network round-trip is
   in flight. */
.list-refetching { opacity: 0.45; pointer-events: none; transition: opacity 0.15s ease; }

.country-flag { width: 16px; height: 12px; object-fit: cover; border-radius: 0.15rem; flex-shrink: 0; margin-top: 0.2rem; }
.cache-smoke-this-btn { margin-top: 0.5rem; }
.scan-candidates-panel:not([hidden]) { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.scan-candidates-panel button { text-align: left; }

/* Generic small modal — used for the "which size?" vitola picker. */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 900; padding: 1.2rem;
}
.modal-overlay[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 0.7rem; padding: 1.2rem; max-width: 24rem; width: 100%; max-height: 80vh; overflow-y: auto; }
.modal-box h3 { margin-top: 0; }
.modal-box ul { list-style: none; padding: 0; margin: 0 0 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.modal-box li button { width: 100%; text-align: left; }
.cache-title-row { display: flex; align-items: flex-start; gap: 0.35rem; min-width: 0; }
.cache-title-row .recent-title { min-width: 0; }
