/* compáre — look tokens from docs/compare-app-spec.md → Look */
:root {
  --bg: #F4EEDF;
  --card: #FFFDF8;
  --line: #E4DAC4;
  --text: #241F2E;
  --muted: #6B6257;
  --green: #00693E;
  --green-dark: #00502F;
  --green-tint: #E3EFD6;
  --lowest: #2F5E24;
  --more: #8E3318;
  --radius: 14px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* classes below set display; hidden must still win */
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green-dark); }

.app { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }

/* Header */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 0 20px; }
.brand { text-decoration: none; color: var(--text); }
.wordmark { font-family: var(--serif); font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: -0.01em; margin: 0; }
.family { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; text-decoration: none; }
.family:hover { text-decoration: underline; }
.lang { display: flex; gap: 2px; font-size: 13px; font-weight: 600; }
.lang button { background: none; border: 0; padding: 10px 6px; min-height: 44px; color: var(--muted); cursor: pointer; }
.lang button[aria-pressed="true"] { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.lang span { color: var(--line); align-self: center; }

.bar { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; }
.bar h1 { font-family: var(--serif); font-size: 24px; margin: 0; flex: 1; line-height: 1.15; }
.back { background: none; border: 0; min-width: 44px; min-height: 44px; font-size: 22px; cursor: pointer; color: var(--text); margin-left: -10px; }

h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin: 24px 0 8px; }

/* Cards and rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 10px; }
.compare-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.compare-link .title { font-weight: 700; }
.compare-link .meta { font-size: 14px; color: var(--muted); }
.compare-link .grow { flex: 1; min-width: 0; }
.compare-link .price { font-family: var(--mono); font-weight: 700; }

.icon { width: 44px; height: 44px; flex: none; object-fit: contain; }
.icon.big { width: 56px; height: 56px; }
.icon-blank { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: var(--muted); }

.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.row .place { font-weight: 700; }
.row .sub { font-size: 14px; color: var(--muted); }
.row .pricebox { display: flex; align-items: center; gap: 8px; justify-self: end; }
.row .amount { font-family: var(--mono); font-weight: 700; font-size: 20px; }
.row .note { font-size: 13px; color: var(--muted); grid-column: 1 / -1; }
.row .actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.row.is-lowest { border-color: var(--lowest); box-shadow: 0 0 0 1px var(--lowest) inset; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.lowest { background: var(--green-tint); color: var(--lowest); }
.badge.more { color: var(--more); background: #F6E6DF; }
.badge.old { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.ghost { background: none; border-color: transparent; color: var(--green-dark); }
.btn.danger { color: var(--more); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); width: min(528px, calc(100% - 32px)); box-shadow: 0 6px 20px rgba(36, 31, 46, 0.18); }
.add-option { width: 100%; margin-top: 10px; border-style: dashed; color: var(--green-dark); }

/* Capture */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card); padding: 12px; }
.drop.over { border-color: var(--green); background: var(--green-tint); }
.drop textarea { width: 100%; min-height: 140px; border: 0; background: transparent; resize: vertical; outline: none; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: var(--green); width: 0; transition: width 0.2s; }

/* Check form */
label.field, div.field > span { display: block; margin-top: 14px; font-weight: 600; font-size: 14px; }
.field input, .field select, .item input, .item select { width: 100%; margin-top: 4px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.shot { display: block; width: 100%; max-height: 280px; object-fit: contain; object-position: top; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
details.raw { margin-top: 10px; font-size: 14px; }
details.raw pre { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 200px; overflow: auto; font-family: var(--mono); font-size: 12px; }
.item { display: grid; grid-template-columns: auto 1fr 7.5em; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--green); }
.item .target { grid-column: 2 / -1; font-size: 14px; }
.item .target select { min-height: 40px; }
.price-input { font-family: var(--mono); text-align: right; }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }
.error { color: var(--more); font-weight: 600; font-size: 14px; }

.foot { margin-top: 28px; font-size: 13px; color: var(--muted); text-align: center; }
.empty { text-align: center; padding: 28px 12px; }
.empty .icons { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.empty h2 { font-family: var(--serif); font-size: 22px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0; }

.context { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.context .meta { font-size: 14px; color: var(--muted); }
.chip.ghost { border-style: dashed; color: var(--green-dark); }
.drop-hint { position: fixed; inset: 12px; border: 3px dashed var(--green); border-radius: 20px; background: rgba(227, 239, 214, 0.92); display: grid; place-items: center; font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--green-dark); z-index: 20; pointer-events: none; }
body.dragging .drop { border-color: var(--green); background: var(--green-tint); }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 10; }

@media (min-width: 720px) {
  .app { padding-top: 32px; }
  .wordmark { font-size: 40px; }
}
