/* Tehno klik e-fakture — jedan stil za ceo sajt, bez build alata.
   Motiv: službeni dokument i pečat. Mastilo plavo-ljubičasto, papir beo, tabele precizne. */

:root {
  --ink: #172033;
  --ink-soft: #4a5568;
  --paper: #ffffff;
  --desk: #eef2f7;
  --line: #d7dee8;
  --stamp: #4338ca;
  --stamp-dark: #3730a3;
  --stamp-tint: #eceafd;
  --good: #15803d;
  --good-tint: #e7f6ec;
  --bad: #b91c1c;
  --bad-tint: #fdecec;
  --info: #1d4ed8;
  --info-tint: #e8effd;
  --muted: #6b7280;
  --muted-tint: #f1f2f4;
  --radius: 6px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--desk);
}
a { color: var(--stamp); }
a:hover { color: var(--stamp-dark); }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 2px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 600; }
h2 { font-size: 1.6rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 1em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 480px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Zaglavlje */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; flex-shrink: 0; font-weight: 600; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid var(--stamp); color: var(--stamp);
  display: grid; place-items: center; font-size: .8rem; font-weight: 700; transform: rotate(-8deg);
}
.nav { display: flex; gap: 4px; margin-left: 12px; flex-wrap: nowrap; }
.topbar .company-name { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a { color: var(--ink-soft); text-decoration: none; padding: 8px 12px; border-radius: var(--radius); white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--desk); }
.topbar .spacer { flex: 1; }
.topbar form { margin: 0; }

/* Dugmad */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: .95rem;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent;
  background: var(--stamp); color: #fff; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--stamp-dark); color: #fff; }
.btn-quiet { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--desk); color: var(--ink); }
.btn-danger { background: var(--paper); color: var(--bad); border-color: #f1c2c2; }
.btn-danger:hover { background: var(--bad-tint); color: var(--bad); }
.btn-link { background: none; border: 0; color: var(--ink-soft); padding: 8px 10px; }
.btn-link:hover { background: var(--desk); color: var(--ink); }
.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Poruke */
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 0 0 20px; border: 1px solid; }
.flash-success { background: var(--good-tint); border-color: #b9e2c6; color: #14532d; }
.flash-error { background: var(--bad-tint); border-color: #f1c2c2; color: #7f1d1d; }

/* Početna strana */
.hero { background: var(--paper); border-bottom: 1px solid var(--line); overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; padding-top: 72px; padding-bottom: 80px; }
.hero h1 { max-width: 14ch; }
.hero .lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-note { margin-top: 16px; font-size: .9rem; color: var(--ink-soft); }

/* Faktura kao predmet: papir sa pečatom */
.sheet {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: 4px; padding: 28px 28px 96px; font-size: .86rem;
  box-shadow: 0 1px 0 var(--line), 12px 14px 0 -2px var(--desk), 12px 14px 0 -1px var(--line);
  transform: rotate(1.2deg);
}
.sheet-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.sheet-head strong { font-size: 1.05rem; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.sheet td:last-child { text-align: right; }
.sheet .sum td { border-bottom: 0; font-weight: 600; font-size: 1rem; padding-top: 12px; }
.stamp {
  position: absolute; right: 30px; bottom: 22px;
  border: 3px solid var(--stamp); color: var(--stamp); border-radius: 10px;
  padding: 8px 14px; text-align: center; line-height: 1.2; transform: rotate(-11deg);
  background: rgba(255,255,255,.75); opacity: 0;
  animation: stamp .45s cubic-bezier(.2,.9,.3,1.3) .6s forwards;
}
.stamp b { display: block; font-size: 1.15rem; letter-spacing: .02em; }
.stamp span { font-size: .72rem; }
@keyframes stamp {
  from { opacity: 0; transform: rotate(-11deg) scale(1.8); }
  to { opacity: .92; transform: rotate(-11deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .stamp { animation: none; opacity: .92; }
}

.section { padding: 72px 0; }
.section-alt { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 60ch; margin-bottom: 36px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 16px; }
.steps li::before { content: counter(step); display: block; font-size: 2.2rem; font-weight: 300; color: var(--stamp); line-height: 1; margin-bottom: 10px; }

.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 48px; }
.features div { padding-left: 18px; border-left: 3px solid var(--stamp-tint); }

.pricing { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pricing th, .pricing td { padding: 16px 20px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.pricing thead th { background: var(--desk); font-weight: 600; }
.pricing thead th + th { width: 30%; }
.pricing .price { font-size: 1.9rem; font-weight: 600; }
.pricing tr:last-child td { border-bottom: 0; }
.pricing-note { margin-top: 14px; color: var(--ink-soft); font-size: .92rem; }

.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq details p { margin: 10px 0 0; color: var(--ink-soft); max-width: 70ch; }

.footer { padding: 32px 0 48px; color: var(--ink-soft); font-size: .9rem; }
.footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Aplikacija */
.page { padding: 32px 0 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.75rem; margin: 0; }
.page-head p { margin: 4px 0 0; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.panel h2 { font-size: 1.15rem; margin-bottom: 14px; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush > h2 { padding: 20px 24px 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 24px; }
.stats div { padding: 18px 22px; border-left: 1px solid var(--line); }
.stats div:first-child { border-left: 0; }
.stats dt { color: var(--ink-soft); font-size: .88rem; }
.stats dd { margin: 4px 0 0; font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-weight: 500; color: var(--ink-soft); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .right { text-align: right; }
.table a.row-link { color: var(--ink); font-weight: 500; text-decoration: none; }
.table a.row-link:hover { color: var(--stamp); text-decoration: underline; }
.table-scroll { overflow-x: auto; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 500; white-space: nowrap; }
.pill-good { background: var(--good-tint); color: var(--good); }
.pill-bad { background: var(--bad-tint); color: var(--bad); }
.pill-info { background: var(--info-tint); color: var(--info); }
.pill-muted { background: var(--muted-tint); color: var(--muted); }

.empty { text-align: center; padding: 48px 24px; color: var(--ink-soft); }
.empty p { max-width: 42ch; margin: 0 auto 18px; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
.dl dt { color: var(--ink-soft); }
.dl dd { margin: 0; }

/* Forme */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: 6px; }
.field .hint { font-size: .84rem; color: var(--ink-soft); margin-top: 4px; }
.field .error { font-size: .86rem; color: var(--bad); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 9px 12px; border: 1px solid #c3ccd8; border-radius: var(--radius); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--stamp); outline-offset: 0; border-color: var(--stamp); }
.has-error input, .has-error select { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 5px; width: 16px; height: 16px; }
fieldset { border: 0; padding: 0; margin: 0 0 24px; }
legend { font-weight: 600; font-size: 1.1rem; margin-bottom: 14px; padding: 0; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.auth { min-height: calc(100vh - 65px); display: grid; place-items: start center; padding: 56px 24px; }
.auth .panel { width: 100%; }
.auth-wide { max-width: 760px; }

/* Stavke fakture */
.lines { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-weight: 500; font-size: .85rem; color: var(--ink-soft); padding: 0 6px 8px; }
.lines td { padding: 4px 6px; vertical-align: top; }
.lines input, .lines select { padding: 8px 9px; }
.lines .c-name { min-width: 200px; }
.lines .c-qty { width: 90px; }
.lines .c-unit { width: 90px; }
.lines .c-price { width: 130px; }
.lines .c-disc { width: 80px; }
.lines .c-tax { width: 210px; }
.lines .c-total { width: 120px; text-align: right; padding-top: 13px; }
.lines .c-del { width: 40px; }
.lines .exemption-row td { padding-top: 0; }
.totals { margin-left: auto; min-width: 300px; border-collapse: collapse; margin-top: 16px; }
.totals td { padding: 6px 0; }
.totals td:last-child { text-align: right; padding-left: 32px; }
.totals .grand td { border-top: 2px solid var(--ink); font-weight: 600; font-size: 1.15rem; padding-top: 10px; }
.icon-btn { background: none; border: 0; color: var(--ink-soft); font-size: 1.3rem; line-height: 1; padding: 6px 8px; cursor: pointer; border-radius: var(--radius); }
.icon-btn:hover { background: var(--bad-tint); color: var(--bad); }
.check-result { font-size: .86rem; margin-top: 4px; }
.check-result.ok { color: var(--good); }
.check-result.fail { color: var(--bad); }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 16px 0 0; list-style: none; margin: 0; }
.pagination a, .pagination span { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); text-decoration: none; color: var(--ink); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type=text] { max-width: 280px; }
.filters select { max-width: 200px; }

@media (max-width: 1180px) {
  .topbar .company-name { max-width: 140px; }
}
@media (max-width: 900px) {
  .topbar .wrap { flex-wrap: wrap; gap: 4px 16px; padding-top: 10px; padding-bottom: 10px; }
  .topbar .nav { order: 3; width: 100%; margin-left: -12px; flex-wrap: wrap; }
  .hero .wrap { grid-template-columns: 1fr; padding-top: 48px; gap: 40px; }
  .sheet { transform: none; }
  .steps, .features { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(3) { border-left: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; }
  .lines thead { display: none; }
  .lines tr.line-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .lines tr.line-row td { width: auto; padding: 0; }
  .lines tr.line-row .c-name, .lines tr.line-row .c-tax { grid-column: 1 / -1; }
  .totals { min-width: 0; width: 100%; }
}
@media (max-width: 560px) {
  .topbar .wrap { flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; padding-bottom: 10px; }
  .nav { order: 3; width: 100%; margin-left: -12px; }
  .pricing th, .pricing td { padding: 12px; }
}

/* Izbor firme u zaglavlju */
.switcher { position: relative; }
.switcher summary { list-style: none; cursor: pointer; padding: 8px 10px; border-radius: var(--radius); color: var(--ink-soft); font-size: .875rem; }
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary::after { content: " ▾"; }
.switcher summary:hover { background: var(--desk); color: var(--ink); }
.switcher-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 280px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; box-shadow: 0 8px 24px rgba(23, 32, 51, .12); }
.switcher-menu form { margin: 0; }
.switcher-menu button, .switcher-menu a { display: block; width: 100%; text-align: left; font: inherit; font-size: .92rem; padding: 8px 10px; border: 0; background: none; color: var(--ink); border-radius: var(--radius); cursor: pointer; text-decoration: none; }
.switcher-menu button:hover, .switcher-menu a:hover { background: var(--desk); }
.switcher-menu button[aria-current] { font-weight: 600; }
.switcher-menu a { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; color: var(--stamp); }

.notice-bar { background: #fff7e0; border-bottom: 1px solid #f0dca0; font-size: .92rem; padding: 10px 0; color: #5c4400; }
.btn-inline { background: none; border: 0; padding: 0 0 0 6px; font: inherit; color: var(--stamp); text-decoration: underline; cursor: pointer; }

.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* Podmeni podešavanja */
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.subnav a { padding: 10px 14px; color: var(--ink-soft); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--stamp); font-weight: 500; }

.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.plan-option { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: block; cursor: pointer; }
.plan-option:has(input:checked) { border-color: var(--stamp); outline: 1px solid var(--stamp); }
.plan-option input { margin-right: 8px; }
.pay-box { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; }
.qr { width: 180px; height: 180px; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.6em; font-size: 1.2rem; }
.prose p, .prose li { color: var(--ink); }
@media (max-width: 700px) {
  .plan-grid, .pay-box { grid-template-columns: 1fr; }
}

/* Polje za datum dd.mm.gggg (public/js/datumi.js) */
.date-field { position: relative; }
.date-field input[type=text] { padding-right: 42px; }
.date-field.readonly input[type=text] { padding-right: 12px; }
.date-field input.invalid { border-color: var(--bad); }
.date-field .date-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
.date-button { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: grid; place-items: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--radius); background: none; color: var(--ink-soft); cursor: pointer; }
.date-button:hover { background: var(--desk); color: var(--ink); }
.date-button:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

/* Moj nalog: dvofaktorska prijava */
.steps { padding-left: 1.2em; }
.steps li { margin-bottom: 12px; }
.totp-qr { margin: 12px 0 8px; width: 180px; height: 180px; background: #fff; padding: 8px; box-sizing: content-box; border: 1px solid var(--line); border-radius: var(--radius); }
.secret { font-size: .95rem; letter-spacing: .05em; user-select: all; }
.recovery-codes { columns: 2; list-style: none; padding: 0; margin: 12px 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; }
.recovery-codes li { padding: 4px 0; }
