:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #17171a;
  --muted: #6b6b73;
  --line: #e2e0da;
  --accent: #17171a;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #1a7f37;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113; --surface: #1c1c1f; --ink: #f2f2f4; --muted: #a0a0aa; --line: #2e2e33;
    --accent: #f2f2f4; --accent-ink: #111113;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }
header.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
header.top h1 { font-size: 22px; letter-spacing: -0.02em; margin: 0; }
header.top p { margin: 0; color: var(--muted); font-size: 14px; }

.layout { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .preview-col { position: sticky; top: 24px; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.panel + .panel { margin-top: 16px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 480px) { .grid { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; color: var(--muted); }
label span { display: block; margin-bottom: 4px; }
input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
input:focus, textarea:focus { border-color: var(--ink); }
textarea { resize: vertical; min-height: 72px; }
input[type=color] { padding: 2px; height: 42px; cursor: pointer; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { flex: 1; text-align: center; padding: 10px; cursor: pointer; color: var(--ink); font-size: 14px; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }

.images { display: flex; gap: 12px; flex-wrap: wrap; }
.img-pick { flex: 1; min-width: 140px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.img-pick img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.img-pick .t { font-size: 14px; color: var(--ink); }
.img-pick .s { font-size: 12px; color: var(--muted); }
.img-pick input { display: none; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; padding: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 15px; font-weight: 600; border-radius: 12px; padding: 13px 18px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.wallet { background: #000; color: #fff; border-color: #000; }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { display: grid; gap: 10px; margin-top: 16px; }
.msg { font-size: 14px; margin-top: 10px; min-height: 20px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ---- Pregled kartice (izgled kao Wallet kartica) ---- */
.pass { border-radius: 14px; padding: 16px 16px 20px; color: var(--pfg, #fff); background: var(--pbg, #1d1d1f); box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.pass .row1 { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.pass .row1 img.logo { max-height: 30px; max-width: 160px; }
.pass .row1 .org { font-weight: 600; font-size: 15px; }
.pass .main { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 18px; }
.pass .lbl { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; opacity: .75; }
.pass .name { font-size: 24px; font-weight: 400; line-height: 1.15; word-break: break-word; }
.pass img.thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; }
.pass .aux { display: flex; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.pass .aux div { min-width: 0; }
.pass .val { font-size: 14px; word-break: break-all; }
.pass .qr { background: #fff; border-radius: 8px; padding: 10px; width: 170px; margin: 22px auto 0; text-align: center; }
.pass .qr img, .pass .qr canvas, .pass .qr svg { display: block; width: 150px; height: 150px; }
.pass .qr small { display: block; color: #333; font-size: 11px; margin-top: 4px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; text-align: center; }

.done { border-color: var(--ok); }
.copyrow { display: flex; gap: 8px; }
.copyrow input { flex: 1; font-size: 14px; }
.copyrow button { flex: none; width: auto; }
.warn { font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }

/* ---- Dijeljenje (QR s fotografijom) ---- */
.share { background: var(--surface); border-radius: 28px; padding: 24px 16px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.08); }
.share-head { text-align: center; }
.share-head .avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 10px; }
.share-name { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.share-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.share-qr { background: #fff; border-radius: 20px; padding: 10px; margin: 18px auto 0; max-width: 320px; }
.share-qr svg { display: block; width: 100%; height: auto; }
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 18px 2px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; text-decoration: none; font-size: 11px; color: var(--muted); }
.chip-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.chip-ic svg { width: 24px; height: 24px; }
.round-btns { display: flex; justify-content: center; gap: 28px; margin-top: 20px; }
.round { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.round svg { width: 56px; height: 56px; padding: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.url-pill { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 18px; padding: 14px 18px; border-radius: 999px; border: 0; background: var(--bg); color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.url-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-pill svg { width: 18px; height: 18px; flex: none; }
.url-pill.copied::after { content: 'Kopirano'; font-size: 12px; color: var(--ok); }
.wallet-big { margin-top: 14px; border-radius: 999px; padding: 16px; background: #000; border-color: #000; color: #fff; font-size: 16px; }
@media (prefers-color-scheme: dark) { .wallet-big { background: #fff; border-color: #fff; color: #000; } }

/* ---- Profil (glavna stranica vizitke) ---- */
.profile-body { background: var(--surface); }
.profile { max-width: 480px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.p-top { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.p-brand { font-weight: 700; letter-spacing: -0.02em; font-size: 18px; }
.p-share { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.p-share svg { width: 20px; height: 20px; }
.p-head { text-align: center; padding: 18px 0 26px; }
.p-avatar { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 18px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.p-initials { display: grid; place-items: center; background: var(--ink); color: var(--surface); font-size: 44px; font-weight: 600; }
.p-name { font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.p-sub { margin: 8px 0 0; font-size: 16px; color: var(--muted); }
.p-note { margin: 14px auto 0; max-width: 34ch; font-size: 15px; color: var(--muted); white-space: pre-wrap; }
.p-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 18px; }
.p-tile { display: grid; justify-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.p-ic { width: 100%; aspect-ratio: 1; max-width: 104px; border-radius: 24%; display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); transition: transform .12s; }
.p-ic svg { width: 44%; height: 44%; stroke-width: 1.7; }
.p-tile:active .p-ic { transform: scale(.94); }
.p-tile:focus-visible .p-ic { outline: 3px solid var(--ink); outline-offset: 3px; }
.p-lbl { font-size: 14px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.p-dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px max(20px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: linear-gradient(to top, var(--surface) 65%, transparent); }
.p-cta { display: flex; align-items: center; justify-content: center; gap: 10px; max-width: 440px; margin: 0 auto; padding: 17px; border-radius: 999px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); font-size: 18px; font-weight: 700; text-decoration: none; }
.p-cta svg { width: 22px; height: 22px; }

/* ---- Prozor za dijeljenje (odozdo) ---- */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 94vh; overflow-y: auto; z-index: 11; background: var(--surface); border-radius: 26px 26px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s ease-out; max-width: 520px; margin: 0 auto; }
.sheet .share { box-shadow: none; padding-top: 6px; }
.sheet-open .sheet { transform: none; }
.sheet-open .sheet-back { opacity: 1; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 0; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.sheet-close svg { width: 18px; height: 18px; }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-back { transition: none; } }

/* ---- Javna stranica vizitke ---- */
.public { max-width: 420px; margin: 0 auto; padding: 24px 16px 48px; }
.contact-list { list-style: none; padding: 0; margin: 16px 0 0; }
.contact-list li a { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.contact-list li a span:first-child { color: var(--muted); font-size: 14px; }
.contact-list li a span:last-child { text-align: right; word-break: break-all; }
.note { color: var(--muted); font-size: 14px; margin-top: 16px; white-space: pre-wrap; }
footer.small { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; }
