:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #17233a;
  --muted: #5a6a85;
  --line: #d9e0ea;
  --accent: #1d4ed8;
  --accent-dark: #173db0;
  --green: #0e7a4a;
  --green-bg: #e6f4ec;
  --red: #b3341f;
  --red-bg: #fbeae6;
  --amber: #8a6114;
  --amber-bg: #faf3df;
}

* { box-sizing: border-box; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand span { color: var(--accent); font-weight: 600; }
.badges { display: flex; gap: 0.5rem; }
.badge {
  font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.6rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.badge-green { background: var(--green-bg); color: var(--green); border-color: transparent; }

.hero { padding: 2.2rem 1rem 1.2rem; }
.hero h1 { font-size: 2rem; letter-spacing: -0.02em; }
.hero p { color: var(--muted); max-width: 60ch; margin-top: 0.5rem; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.25rem; align-items: start; padding-bottom: 2rem; }
@media (max-width: 60rem) { .layout { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.4rem; margin-bottom: 1.1rem; }
.card h2 { font-size: 1.05rem; margin-bottom: 0.9rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 0.4rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 1rem; }
@media (max-width: 40rem) { .grid-2 { grid-template-columns: 1fr; } }

label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.5rem 0.65rem;
  border: 1px solid var(--line); border-radius: 7px; font: inherit; color: var(--ink);
  background: var(--surface);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
label small { display: block; font-weight: 400; margin-top: 0.3rem; color: var(--muted); }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; margin: 0.9rem 0; color: var(--ink); }
.checkbox-row input { width: auto; margin: 0; }
form .card label + label { margin-top: 0.8rem; }

.line-row { display: grid; grid-template-columns: minmax(8rem, 2fr) 4.5rem 5.5rem 6.5rem 5rem 2rem; gap: 0.5rem; align-items: end; margin-bottom: 0.6rem; }
@media (max-width: 40rem) { .line-row { grid-template-columns: 1fr 1fr; } }
.line-row .remove {
  border: none; background: none; color: var(--red); font-size: 1.1rem; cursor: pointer;
  padding: 0.4rem 0; align-self: end;
}
.line-net { font-size: 0.8rem; color: var(--muted); margin: -0.2rem 0 0.7rem; }

button { font: inherit; cursor: pointer; }
.primary {
  display: block; width: 100%; background: var(--accent); color: #fff; border: none;
  padding: 0.7rem 1rem; border-radius: 8px; font-weight: 700; margin-top: 0.9rem;
}
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.ghost {
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 0.45rem 0.8rem; font-size: 0.85rem; font-weight: 600; color: var(--ink);
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.linklike { background: none; border: none; color: var(--muted); font-size: 0.8rem; text-decoration: underline; padding: 0; }
.tiny-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 0.7rem; }

.panel .sticky { position: sticky; top: 1rem; }
.status { border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.88rem; font-weight: 600; }
.status-empty { background: var(--bg); color: var(--muted); }
.status-ok { background: var(--green-bg); color: var(--green); }
.status-error { background: var(--red-bg); color: var(--red); }
.issues { list-style: none; padding: 0; margin: 0.6rem 0 0; font-size: 0.82rem; display: flex; flex-direction: column; gap: 0.35rem; }
.issues li { padding-left: 1.1rem; position: relative; }
.issues li::before { content: "•"; position: absolute; left: 0.2rem; }
.issues li.err { color: var(--red); }
.issues li.warn { color: var(--amber); }

.totals { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.8rem; font-size: 0.9rem; }
.totals div { display: flex; justify-content: space-between; padding: 0.15rem 0; color: var(--muted); }
.totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.total-gross { font-size: 1rem; }
.total-gross strong { font-size: 1.1rem; }
.privacy-note { font-size: 0.75rem; color: var(--muted); margin-top: 0.9rem; }

.pro-box { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.pro-state { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.pro-state.pro-active { color: var(--green); }
.pro-buy {
  display: block; text-align: center; background: var(--green-bg); color: var(--green);
  font-weight: 700; font-size: 0.9rem; padding: 0.55rem 0.8rem; border-radius: 8px;
  text-decoration: none; border: 1px solid transparent;
}
.pro-buy:hover { border-color: var(--green); }
#license-form { display: flex; flex-wrap: wrap; gap: 0.4rem; }
#license-form input { flex: 1 1 10rem; margin-top: 0; }
.license-msg { flex-basis: 100%; font-size: 0.78rem; color: var(--muted); }

.preview-wrap { padding-bottom: 2rem; }
.preview-wrap pre {
  background: #101827; color: #d7e1f0; border-radius: 10px; padding: 1rem 1.2rem;
  overflow-x: auto; font-size: 0.78rem; line-height: 1.45;
}

.content { padding: 1rem 1rem 3rem; max-width: 52rem; }
.content h2 { margin: 1.8rem 0 0.6rem; font-size: 1.25rem; }
.content p { color: var(--ink); max-width: 65ch; }
.table-scroll { overflow-x: auto; }
.content table { border-collapse: collapse; width: 100%; margin: 0.8rem 0; font-size: 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.content th, .content td { text-align: left; padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--line); }
.content th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 1rem; margin-bottom: 0.5rem; }
details summary { font-weight: 600; cursor: pointer; }
details p { margin-top: 0.5rem; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.2rem 0 1.6rem; color: var(--muted); font-size: 0.85rem; }
.footer-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-row a { color: var(--muted); margin-left: 1rem; }
.fineprint { font-size: 0.75rem; color: var(--muted); margin-top: 0.6rem; }
