:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #56606e;
  --line: #d9dee5;
  --accent: #0b6e69;
  --accent-dark: #084f4b;
  --neg: #b42318;
  --focus: #2563eb;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }

.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.brand span { color: var(--accent); }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-header nav a { text-decoration: none; padding: 4px 0; }
.site-header nav a[aria-current="page"] { font-weight: 600; text-decoration: underline; }

main { padding: 24px 0 48px; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 8px; }
.lead { color: var(--muted); margin-top: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.card h2 { margin-top: 0; }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cards .card { margin: 0; }
.cards h2 { font-size: 1.1rem; }

.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
label, legend { font-weight: 600; font-size: .92rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 8px 0 0; }
.sub { font-weight: 600; margin: 8px 0; }
.hint, .muted { color: var(--muted); font-size: .88rem; }

input, select, button { font: inherit; }
input[type="number"], input[type="text"], select {
  width: 100%; padding: 8px 10px; border: 1px solid #9aa4b1; border-radius: 6px; background: #fff; color: var(--text);
}
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
input[type="color"] { width: 64px; height: 40px; padding: 2px; border: 1px solid #9aa4b1; border-radius: 6px; }
input[type="range"] { accent-color: var(--accent); }

button, .btn-secondary {
  display: inline-block; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
}
button:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--accent); }
.btn-secondary:hover { background: #eef6f5; color: var(--accent-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.result table { width: 100%; border-collapse: collapse; }
.result th, .result td { padding: 8px 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.result td { text-align: right; font-variant-numeric: tabular-nums; }
.result .fee th { padding-left: 12px; color: var(--muted); }
.result .total th, .result .total td { font-weight: 600; }
.result .profit th, .result .profit td { font-weight: 700; font-size: 1.15rem; color: var(--accent-dark); }
.result .profit.neg td { color: var(--neg); }

.thumbs { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.thumbs li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.thumbs img { width: 100%; height: auto; border-radius: 4px; }

details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 8px 0; }
summary { font-weight: 600; cursor: pointer; }

.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 16px 0; font-size: .92rem; }

@media (min-width: 800px) {
  .calc { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
  .calc .result { position: sticky; top: 16px; }
}
