:root {
  --bg: #f4f5f8;
  --card: #fff;
  --text: #1b1f2a;
  --muted: #5d6578;
  --line: #e2e5ec;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --good: #0f8a5f;
  --radius: 14px;
}
body[data-mode="acrilico"] {
  --accent: #0e8fa8;
  --accent-soft: #e6f6fa;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top { text-align: center; padding: 28px 16px 8px; }
.top h1 { margin: 0 0 4px; font-size: 1.6rem; }
.sub { margin: 0 0 18px; color: var(--muted); }

.switch {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 8px 22px;
  border-radius: 999px;
  cursor: pointer;
}
.switch button[aria-selected="true"] { background: var(--accent); color: #fff; }
.switch button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px;
  max-width: 1100px;
  margin: 20px auto 40px;
  padding: 0 16px;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

fieldset { border: 0; margin: 0 0 20px; padding: 0; }
legend {
  font-weight: 700;
  padding: 0;
  margin-bottom: 10px;
  border-left: 4px solid var(--accent);
  padding-left: 8px;
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.field input {
  font: inherit;
  color: var(--text);
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
.field input:focus { outline: 2px solid var(--accent); border-color: transparent; }

button { font: inherit; cursor: pointer; }
.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 14px;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }

.result { position: sticky; top: 16px; }
.result h2 { font-size: 1rem; margin: 0 0 8px; }
.empty { color: var(--muted); text-align: center; padding: 28px 8px; }

dl { margin: 0 0 18px; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
dl .sum { background: #f7f8fa; margin: 6px -8px 0; padding: 8px; border-radius: 6px; border: 0; }
dl .profit dd { color: var(--good); }

.price { display: grid; gap: 8px; margin-bottom: 16px; }
.price > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
}
.price strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.price .total { background: var(--accent); color: #fff; }
.price .total strong { font-size: 1.5rem; }

#download {
  width: 100%;
  border: 0;
  background: var(--text);
  color: #fff;
  padding: 11px;
  border-radius: 10px;
  font-weight: 600;
}
#download:hover { opacity: .9; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  padding: 0 16px 28px;
}
.foot a { color: var(--accent); font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .result { position: static; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
}
