:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #17201c;
  --ink-2: #4b5650;
  --muted: #7a857f;
  --line: #e2e0d8;
  --accent: #0d6b4f;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ea;
  --warn-soft: #fbeedc;
  --warn: #9a5a00;
  --bad-soft: #f9e2e0;
  --bad: #a4302a;
  --info-soft: #e1ecf7;
  --info: #24507f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 32, 28, .06), 0 4px 16px rgba(23, 32, 28, .05);
  --font: "IBM Plex Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
code, pre { font-family: var(--mono); font-size: .875rem; }
pre {
  background: #1d2622; color: #e8eee9; padding: 1rem 1.1rem; border-radius: var(--radius);
  overflow-x: auto; margin: 0 0 1rem;
}
code { background: #ecebe5; padding: .1em .35em; border-radius: 4px; }
pre code { background: none; padding: 0; }

/* layout */
.top {
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 1080px; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); letter-spacing: -.02em; display: flex; align-items: center; gap: .5rem; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { padding: .4rem .55rem; border-radius: 6px; color: var(--ink-2); font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: .75rem; color: var(--ink-2); font-size: .9rem; }
.userbox form { margin: 0; }
main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin: 0; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 1rem; }

/* komponenter */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card + .card, .card + .grid, .grid + .card, .card + h2, .table-wrap + .card { margin-top: 1.25rem; }
.grid { display: grid; gap: 1.25rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin-top: .15rem; }
.stat .sub { color: var(--ink-2); font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.big { padding: .8rem 1.4rem; font-size: 1.05rem; }

form.stack { display: grid; gap: .9rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
label .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=month], textarea, select {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit;
  background: var(--surface); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 7rem; resize: vertical; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }
.help { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; border: 1px solid transparent; }
.flash.ok { background: var(--accent-soft); color: var(--accent); border-color: #bfe0d1; }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: #efc4c0; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0d8b2; }
.flash.info { background: var(--info-soft); color: var(--info); border-color: #c3d6ec; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.muted { background: #ecebe5; color: var(--ink-2); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .65rem .9rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: #faf9f6; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: .85rem; }
.trunc { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; color: var(--ink-2); }

.keybox { background: #1d2622; color: #e8eee9; padding: 1rem; border-radius: 8px; font-family: var(--mono); word-break: break-all; font-size: .95rem; }
.counter { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* landing */
.hero { padding: 3.5rem 0 2.5rem; max-width: 720px; }
.hero h1 { font-size: 2.6rem; margin-bottom: 1rem; }
.hero p.lead { font-size: 1.2rem; color: var(--ink-2); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; margin: 2rem 0; }
.feature h3 { margin-bottom: .35rem; }
.feature p { color: var(--ink-2); margin: 0; font-size: .95rem; }
.price { display: flex; align-items: baseline; gap: .5rem; }
.price .amount { font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; }

/* faktura */
.invoice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem; max-width: 820px; }
.invoice .head { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.invoice .head h1 { font-size: 2rem; }
.invoice .meta { text-align: right; font-size: .95rem; }
.invoice .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.invoice .parties h3 { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.invoice address { font-style: normal; white-space: pre-line; }
.invoice table { margin-bottom: 1.5rem; }
.invoice .totals { margin-left: auto; width: 320px; }
.invoice .totals td { padding: .35rem .5rem; }
.invoice .totals tr.grand td { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--ink); }
.invoice .pay { background: var(--bg); padding: 1rem 1.25rem; border-radius: 8px; margin-top: 1.5rem; }
@media print {
  .top, footer, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .invoice { border: none; box-shadow: none; padding: 0; max-width: none; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .invoice { padding: 1.25rem; }
  .invoice .parties, .invoice .head { grid-template-columns: 1fr; flex-direction: column; }
  .invoice .meta { text-align: left; }
}
