:root {
  color-scheme: light;
  --bg: #f1f4ef;
  --card: #ffffff;
  --ink: #121b18;
  --muted: #68726e;
  --line: #d9e0dc;
  --green: #177245;
  --green-dark: #0f5132;
  --yellow: #f4c95d;
  --red: #b74235;
  --blue: #245e9d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.secondary {
  background: #e7f0eb;
  color: var(--green-dark);
}

button:active {
  transform: translateY(1px);
}

.app {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 14px;
}

.topbar p,
.topbar h1 {
  margin: 0;
}

.topbar p {
  color: var(--green-dark);
  font-size: .85rem;
  font-weight: 800;
}

.topbar h1 {
  font-size: 2.2rem;
  line-height: 1;
  letter-spacing: 0;
}

.topbar span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #dff0e7;
  color: var(--green-dark);
  padding: 8px 11px;
  font-size: .85rem;
  font-weight: 900;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
}

label small {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.25;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cbd5d0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 1rem;
}

input:focus,
select:focus {
  outline: 3px solid rgba(23, 114, 69, .17);
  border-color: var(--green);
}

.currency-row,
.price-grid {
  display: grid;
  grid-template-columns: .78fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.product-card {
  display: grid;
  gap: 12px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.photo-tile {
  min-height: 142px;
  border: 1px dashed #b9c7c0;
  border-radius: 8px;
  background: #f7faf8;
  overflow: hidden;
  color: var(--green-dark);
}

.photo-tile input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.photo-tile span {
  min-height: 142px;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-weight: 900;
}

.photo-tile img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
}

.hint {
  border-radius: 8px;
  background: #f4f7f5;
  color: var(--muted);
  padding: 11px;
  line-height: 1.35;
  font-size: .92rem;
}

.hint strong {
  color: var(--ink);
}

.calculator-card {
  display: grid;
  gap: 10px;
}

.result {
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 5px;
}

.result strong {
  font-size: 1.45rem;
  line-height: 1.05;
}

.result span {
  color: inherit;
  line-height: 1.35;
}

.result.empty {
  background: #eef3ef;
  color: var(--muted);
}

.result.buy {
  background: #dff4e8;
  color: var(--green-dark);
}

.result.close {
  background: #fff4ce;
  color: #755507;
}

.result.no {
  background: #fff0ed;
  color: var(--red);
}

.money-lines {
  margin: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.money-lines div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  font-weight: 900;
}

.links-card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

#quickLinks {
  display: grid;
  gap: 8px;
}

#quickLinks a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  padding: 11px;
  text-decoration: none;
  font-weight: 800;
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: start center;
  }
}

@media (max-width: 360px) {
  .action-row,
  .currency-row,
  .price-grid {
    grid-template-columns: 1fr;
  }
}
