/* Art by Nenad – kalkulator cijena. Mobile first. */
:root {
  --ink: #212121;
  --ink-soft: #5f5f5f;
  --muted: #8a8a8a;
  --line: #e6e4e0;
  --paper: #ffffff;
  --canvas: #f7f6f3;
  --accent: #212121;
  --ok: #2f6b3a;
  --ok-bg: #eef5ef;
  --err: #a23b2a;
  --err-bg: #fbefec;
  --info-bg: #f3f1ec;
  --radius: 2px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
}
a { color: var(--ink); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- Zaglavlje ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-art { font-family: var(--serif); font-style: italic; font-size: 32px; line-height: 1; letter-spacing: -0.02em; }
.brand-by { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; }
.main-nav { display: flex; align-items: center; gap: 20px; }
.main-nav a, .link-btn {
  font: inherit; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; background: none; border: 0; padding: 6px 0; cursor: pointer;
  border-bottom: 1px solid transparent;
}
.main-nav a:hover, .link-btn:hover, .main-nav a[aria-current="page"] { border-bottom-color: var(--ink); }
form.inline { display: inline; margin: 0; }

main.wrap { padding-top: 20px; padding-bottom: 32px; }
.site-footer { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; padding-bottom: 24px; text-align: center; }

/* ---------- Kartice i naslovi ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; margin-bottom: 16px; }
.section-title, .page-title {
  margin: 0 0 16px; font-weight: 400; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink);
}
.page-title { font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0; font-size: 28px; margin-bottom: 12px; }
.sub-title { font-size: 12px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 24px 0 8px; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.center { text-align: center; }

/* ---------- Obrasci ---------- */
.field { margin-bottom: 14px; }
label { display: block; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
label .opt { text-transform: none; letter-spacing: 0; color: var(--muted); }
input, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid #cfccc6; border-radius: var(--radius); padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-error { color: var(--err); font-size: 14px; margin: 4px 0 0; }

/* ---------- Gumbi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
}
.btn:hover { background: var(--canvas); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-ghost { border-color: #cfccc6; }
.btn-danger { color: var(--err); border-color: #e0c2bb; }
.btn-danger:hover { background: var(--err-bg); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible, .link-btn:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1 1 140px; white-space: nowrap; padding-left: 12px; padding-right: 12px; letter-spacing: 0.08em; }

/* ---------- Poruke ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; border-left: 3px solid; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.alert-error { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.alert-info { background: var(--info-bg); border-color: var(--ink-soft); color: var(--ink); }
.save-msg { margin: 12px 0 0; font-size: 14px; color: var(--ok); }
.save-msg.is-error { color: var(--err); }

/* ---------- Prijava ---------- */
.login-card { max-width: 360px; margin: 8vh auto 0; background: var(--paper); border: 1px solid var(--line); padding: 32px 24px; text-align: center; }
.login-card h1 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 30px; margin: 0 0 4px; }
.login-card form { text-align: left; margin-top: 20px; }
.pin-input { text-align: center; font-size: 24px; letter-spacing: 0.5em; margin-bottom: 16px; }

/* ---------- Rezultat ---------- */
.result-list { margin: 0; }
.result-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.result-list dt { color: var(--ink-soft); font-size: 14px; }
.result-list dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: pre-wrap; }
.final { margin-top: 18px; background: var(--ink); color: #fff; padding: 18px 16px; display: flex; flex-direction: column; gap: 2px; }
.final-label { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.75; }
.final-value { font-family: var(--serif); font-size: 44px; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* ---------- Povijest ---------- */
.history-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.history-head .section-title { margin: 0; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table thead { display: none; }
.history-table tr { display: block; border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 10px; }
.history-table td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 14px; }
.history-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.history-table td.c-name { font-weight: 600; font-size: 15px; }
.history-table td.c-name::before, .history-table td.c-actions::before { content: none; }
.history-table td.c-name { order: -1; }
.history-table td.c-price { font-family: var(--serif); font-size: 20px; align-items: baseline; }
.history-table td.c-price::before { font-family: var(--font); }
.history-table td.c-actions { justify-content: flex-end; gap: 8px; padding-top: 8px; }
.history-table tr { display: flex; flex-direction: column; }

/* ---------- Postavke ---------- */
.sub-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 16px; }
.sub-nav a { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.tech-head, .corr-head { display: none; }
.tech-row { border-bottom: 1px solid var(--line); padding: 12px 0; }
.tech-row form.js-confirm { display: none; }
.tech-form, .corr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.tech-form label:first-of-type { grid-column: 1 / -1; }
.tech-form label, .corr-row label { margin: 0; }
.row-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.corr-row { grid-template-columns: 1fr 1fr 1fr; border-bottom: 1px solid var(--line); padding: 12px 0; }
.corr-row .js-remove-row { grid-column: 1 / -1; justify-self: start; }
.narrow { max-width: 360px; }

/* ---------- Tablet / desktop ---------- */
@media (min-width: 720px) {
  .card { padding: 28px; }
  .history-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .history-head input { max-width: 300px; }
  .history-table thead { display: table-header-group; }
  .history-table tr { display: table-row; border: 0; padding: 0; margin: 0; }
  .history-table th { text-align: left; font-weight: 400; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--ink); }
  .history-table td { display: table-cell; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
  .history-table td::before { content: none; }
  .history-table td.c-name { font-size: 14px; }
  .history-table td.c-price { font-size: 18px; white-space: nowrap; }
  .history-table td.c-date { white-space: nowrap; color: var(--ink-soft); }
  .history-table td.c-actions { white-space: nowrap; text-align: right; }
  .history-table td.c-actions .btn + .btn { margin-left: 6px; }
  .history-table .num, .history-table th.num { text-align: right; }
  .history-table tbody tr:hover { background: var(--canvas); }

  .m-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tech-head, .corr-head { display: grid; gap: 12px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
  .tech-head, .tech-form { grid-template-columns: 2fr 1fr 1fr 170px; }
  .tech-form { gap: 12px; align-items: center; }
  .tech-form label:first-of-type, .row-actions { grid-column: auto; }
  .tech-new { margin-top: 0; }
  .corr-head, .corr-row { grid-template-columns: 1fr 1fr 1fr 90px; gap: 12px; align-items: center; }
  .corr-row .js-remove-row { grid-column: auto; }
}

@media (min-width: 900px) {
  .calc-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
  .final-value { font-size: 52px; }
}
