/* Facturio — single stylesheet for all pages. Light-first, dark via prefers-color-scheme. */
:root {
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --rule: #e5e7eb;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --shadow: 0 1px 3px rgba(17, 24, 39, .07), 0 8px 24px rgba(17, 24, 39, .06);
  --radius: 10px;
  --ok: #059669;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-soft: #171a21;
    --bg-card: #1a1e26;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --faint: #6b7280;
    --rule: #2a2f3a;
    --input-bg: #12151b;
    --input-border: #353b48;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }

/* ---------- header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky; top: 0; z-index: 40;
}
.site-header .container { display: flex; align-items: center; gap: 18px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand svg { flex: 0 0 auto; }
.nav-links { display: flex; gap: 16px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14.5px; }
.nav-links a:hover { color: var(--text); }
.lang-switch { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.lang-switch a { color: var(--faint); text-decoration: none; padding: 2px 5px; border-radius: 5px; }
.lang-switch a.on { color: var(--text); font-weight: 600; background: var(--bg-soft); }

/* ---------- hero ---------- */
.hero { padding: 42px 0 10px; }
.hero h1 { font-size: clamp(26px, 4.2vw, 40px); margin: 0 0 10px; letter-spacing: -.02em; }
.hero .sub { color: var(--muted); font-size: 17.5px; max-width: 720px; margin: 0 0 14px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; padding: 0; list-style: none; }
.hero-badges li {
  font-size: 13px; color: var(--muted);
  background: var(--bg-soft); border: 1px solid var(--rule);
  padding: 4px 11px; border-radius: 999px;
}

/* ---------- tool layout ---------- */
.tool-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 46%); gap: 26px; padding: 24px 0 44px; align-items: start; }
.preview-col { position: sticky; top: 76px; }
.preview-col .frame-box {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
#pdf-preview { width: 100%; height: min(78vh, 860px); border: 0; display: block; background: #525659; }
.preview-note { font-size: 12.5px; color: var(--faint); margin: 8px 2px; }
#preview-mobile { display: none; }

/* ---------- form ---------- */
fieldset {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin: 0 0 18px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
}
legend { font-weight: 700; font-size: 14px; padding: 0 8px; letter-spacing: .01em; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="date"], input[type="month"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
.hint { font-size: 12.5px; color: var(--faint); margin: 4px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid2 > div { min-width: 0; }

/* segmented control */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 9px; padding: 3px; margin-bottom: 14px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 16px; border-radius: 7px; cursor: pointer; }
.seg-btn.on { background: var(--accent); color: #fff; }

/* items */
.item-head, .item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 64px 86px 74px 30px;
  gap: 6px;
  align-items: center;
}
.item-head { font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.item-row { margin-bottom: 6px; }
.item-row input, .item-row select { padding: 7px 8px; font-size: 13.5px; }
.it-del { border: 0; background: transparent; color: var(--faint); font-size: 17px; cursor: pointer; border-radius: 6px; }
.it-del:hover { color: #dc2626; background: var(--bg-soft); }
.totals-live { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); font-size: 14px; color: var(--muted); }
.totals-live .sep { margin: 0 9px; color: var(--faint); }
.totals-live .tot { color: var(--accent); font-size: 16px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--input-border);
  background: var(--bg-card);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn-small { padding: 5px 12px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-big { padding: 12px 26px; font-size: 16.5px; border-radius: 11px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.action-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 6px; }
.dl-ok { color: var(--ok); font-weight: 600; font-size: 14px; opacity: 0; transition: opacity .3s; }
.dl-ok.show { opacity: 1; }
.privacy-note { font-size: 12.5px; color: var(--faint); }

/* pro */
.lock {
  font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--accent); color: #fff; border-radius: 4px; padding: 1.5px 5px; margin-right: 7px;
}
.lockable:not(.locked) .lock { display: none; }
#pro-status { margin-left: auto; }
.pro-on { color: var(--ok); font-weight: 700; font-size: 14px; }
.btn-pro-cta {
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  font: inherit; font-size: 13.5px; font-weight: 700;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.btn-pro-cta:hover { background: var(--accent); color: #fff; }
.tool-bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }

.accent-row { display: flex; gap: 8px; }
.accent-dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  font-size: 10px; line-height: 1; color: #fff; padding: 0;
}
.accent-dot.sel { outline: 2px solid var(--text); outline-offset: 2px; }
.logo-row { display: flex; gap: 10px; align-items: center; }
.logo-row input[type="file"] { font-size: 13px; }

/* modal */
.modal {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 12, 18, .55);
  padding: 20px;
}
.modal.open { display: flex; align-items: center; justify-content: center; }
.modal-box {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--rule);
  max-width: 470px; width: 100%;
  max-height: 86vh; overflow: auto;
  padding: 24px 26px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal-box h3 { margin: 2px 0 12px; font-size: 20px; }
.modal-close {
  position: absolute; top: 10px; right: 12px;
  border: 0; background: transparent; color: var(--faint);
  font-size: 26px; cursor: pointer; line-height: 1;
}
.pro-list { margin: 0 0 12px; padding-left: 20px; }
.pro-list li { margin: 5px 0; font-size: 14.5px; }
.pro-price { font-weight: 700; margin: 10px 0; }
.btn-buy { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
.license-row { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rule); }
.license-row label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.license-input { display: flex; gap: 8px; margin-top: 7px; }
.license-input input { flex: 1; }
.license-msg { font-size: 13.5px; color: var(--muted); min-height: 18px; margin: 8px 0 0; }
.pick-list { max-height: 50vh; overflow: auto; }
.pick-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.pick-btn {
  flex: 1; text-align: left; border: 1px solid var(--rule); background: var(--bg-soft);
  color: var(--text); font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 8px; cursor: pointer;
}
.pick-btn:hover { border-color: var(--accent); }
.pick-del { border: 0; background: transparent; cursor: pointer; font-size: 14px; opacity: .6; }
.pick-del:hover { opacity: 1; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* ---------- content sections (landing / guides) ---------- */
.section { padding: 34px 0; }
.section h2 { font-size: 25px; margin: 0 0 14px; letter-spacing: -.01em; }
.section h3 { font-size: 18px; }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.card h3 { margin: 2px 0 8px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.card a { text-decoration: none; font-weight: 600; }

.faq details {
  border: 1px solid var(--rule); border-radius: 10px; background: var(--bg-card);
  padding: 13px 18px; margin-bottom: 10px;
}
.faq summary { font-weight: 600; cursor: pointer; font-size: 15.5px; }
.faq p { color: var(--muted); font-size: 14.5px; margin: 10px 0 2px; }

.pricing-box {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px;
}
.price-card { border: 1px solid var(--rule); border-radius: 14px; padding: 22px 24px; background: var(--bg-card); box-shadow: var(--shadow); }
.price-card.hl { border-color: var(--accent); border-width: 2px; }
.price-card .amount { font-size: 30px; font-weight: 800; margin: 4px 0; }
.price-card .amount small { font-size: 14px; color: var(--muted); font-weight: 500; }
.price-card ul { padding-left: 19px; margin: 10px 0; }
.price-card li { margin: 5px 0; font-size: 14.5px; }

/* guide articles */
.article { padding: 34px 0 60px; }
.article h1 { font-size: clamp(24px, 3.6vw, 34px); letter-spacing: -.02em; }
.article .meta { color: var(--faint); font-size: 13.5px; margin-bottom: 22px; }
.article h2 { margin-top: 34px; font-size: 22px; }
.article p, .article li { font-size: 16px; color: var(--text); }
.article .lead { font-size: 18px; color: var(--muted); }
.article table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 14.5px; }
.article th, .article td { border: 1px solid var(--rule); padding: 8px 12px; text-align: left; }
.article th { background: var(--bg-soft); }
.article code { background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 5px; padding: 1px 6px; font-size: 14px; }
.cta-box {
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 12px;
  padding: 18px 22px; margin: 26px 0;
}
.cta-box p { margin: 0 0 10px; }
.toc { background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 18px; font-size: 14.5px; }
.toc a { text-decoration: none; }

/* footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 30px; padding: 28px 0 40px; font-size: 13.5px; color: var(--muted); }
.site-footer .cols { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.site-footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 0 0 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 4px 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footnote { margin-top: 22px; color: var(--faint); font-size: 12.5px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .tool-wrap { grid-template-columns: 1fr; }
  .preview-col { display: none; }
  #preview-mobile { display: inline-flex; }
  .cards3 { grid-template-columns: 1fr; }
  .pricing-box { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .grid2 { grid-template-columns: 1fr; }
  .item-head { display: none; }
  .item-row { grid-template-columns: 1fr 52px 56px 78px 64px 26px; }
  .nav-links { gap: 10px; }
  .nav-links a.hide-mobile { display: none; }
}

@media print {
  .site-header, .site-footer, .form-col, .preview-note { display: none; }
}
