/* NFC vizit karta: stilovi kartice, konzole i editora (bez inline stilova zbog strogog CSP-a). */
/* ---------- Fonts (self-hosted, variable) ---------- */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/fraunces-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/jakarta-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/jakarta-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Metric-matched fallbacks (size-adjust from the fonts' average glyph width), so text does not shift when the real fonts arrive. */
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia"), local("Gelasio");
  size-adjust: 105.2%;
  ascent-override: 92.96%;
  descent-override: 24.24%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Jakarta Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("Liberation Sans"), local("Arimo");
  size-adjust: 104.98%;
  ascent-override: 98.88%;
  descent-override: 21.15%;
  line-gap-override: 0%;
}

/* ---------- Theme tokens (same markup for both themes) ---------- */
:root, [data-theme="dark"] {
  --bg: #0E0D0B;
  --surface: #1A1712;
  --text: #F4EFE6;
  --text-rgb: 244, 239, 230;
  --muted: #A8A094;
  --gold: #D4AF6A;
  --line: rgba(212, 175, 106, .22);
  --line-strong: rgba(212, 175, 106, .48);
  --tag: rgba(255, 255, 255, .06);
  --ink: #14100A;
  --banner: radial-gradient(120% 140% at 50% 0%, #2B2214 0%, #17120B 55%, #0E0D0B 100%);
  --banner-ink: initial; /* company name in the banner: falls back to --gold */
  --photo-bg: #1D1810;
  --photo-shadow: 0 16px 32px rgba(0, 0, 0, .45);
  --row-shadow: none;
  --save-bg: linear-gradient(135deg, #EAD7A8 0%, #D4AF6A 48%, #B8925A 100%);
  --save-ink: #14100A;
  --save-shadow: 0 12px 32px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .35);
  --save-sheen: #FFF6DE;  /* light band across the gold button */
  --glow-alpha: 26%;      /* soft gold glow under the save button */
  --blur-tint: rgba(14, 13, 11, .62);
  --banner-shade: linear-gradient(to bottom, rgba(14, 13, 11, .58) 0%, rgba(14, 13, 11, .18) 48%, rgba(14, 13, 11, .42) 100%);
  --error: #F0A094;
  color-scheme: dark;
  /* Other dark palettes for later (bg / surface):
     neutral #0F0F11 / #1A1A1E, navy #0A0E16 / #131B29, espresso #14100C / #221B14 */
}
[data-theme="light"] {
  --bg: #F7F3EB;
  --surface: #FFFFFF;
  --text: #1B1812;
  --text-rgb: 27, 24, 18;
  --muted: #5F5849;
  --gold: #7D5E1C; /* text/icons, 5.4:1 on --bg */
  --line: rgba(125, 94, 28, .20);
  --line-strong: rgba(125, 94, 28, .45);
  --tag: rgba(23, 20, 15, .05);
  --ink: #14100A;
  --banner: linear-gradient(165deg, #F4ECDA, #EADDC0);
  --banner-ink: #3A2E14;
  --photo-bg: #FFFFFF;
  --photo-shadow: 0 14px 28px rgba(60, 40, 10, .18);
  --row-shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 6px 16px rgba(60, 40, 10, .05);
  --save-bg: #17140F;
  --save-ink: #F1DFB0;
  --save-shadow: 0 12px 28px rgba(60, 40, 10, .30);
  --save-sheen: #F1DFB0;  /* warm light band across the dark button */
  --glow-alpha: 22%;
  --blur-tint: rgba(247, 243, 235, .66);
  --banner-shade: linear-gradient(to bottom, rgba(247, 243, 235, .62) 0%, rgba(247, 243, 235, .2) 48%, rgba(247, 243, 235, .45) 100%);
  --error: #A3352A;
  color-scheme: light;
}
:root {
  --serif: Fraunces, "Fraunces Fallback", Georgia, serif;
  --sans: "Plus Jakarta Sans", "Jakarta Fallback", system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s, color .2s;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Card ---------- */
.card {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  color: var(--text);
  /* save bar 56 + its bottom margin 16 + 32 gap + safe area; +1px absorbs sub-pixel scroll rounding */
  padding-bottom: calc(56px + 16px + 32px + 1px + var(--sab));
}
.banner {
  position: relative;
  height: calc(192px + var(--sat));
  background: var(--banner);
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0 0 32px 32px;
  overflow: hidden;
  transition: border-color .2s;
}
.banner--compact { height: calc(120px + var(--sat)); }
/* Banner image: covers the banner, a soft shade keeps the logo and the top blur readable, logo stays on top. */
.banner-img { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.banner--image::after { content: ""; position: absolute; inset: 0; z-index: 0; background: var(--banner-shade); pointer-events: none; }
.banner--image .banner-name { text-shadow: 0 1px 12px rgba(0, 0, 0, .35); }
.banner-logo {
  position: relative;
  z-index: 1;
  height: calc(140px + var(--sat));
  padding: var(--sat) calc(24px + var(--sar)) 0 calc(24px + var(--sal));
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner--compact .banner-logo { display: none; }
.banner-logo img {
  width: auto;
  height: auto;
  max-height: 52px;
  max-width: 70%;
  object-fit: contain;
}
.banner-name {
  font: 500 28px/1.1 var(--serif);
  font-variation-settings: "SOFT" 0, "WONK" 0;
  letter-spacing: .01em;
  text-align: center;
  color: var(--banner-ink, var(--gold));
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.avatar {
  position: relative;
  z-index: 2;
  width: 104px;
  height: 104px;
  margin: -52px auto 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  overflow: hidden;
  background: var(--photo-bg);
  box-shadow: 0 0 0 6px var(--bg), var(--photo-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s, border-color .2s, box-shadow .2s;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.initials {
  font: 450 36px/1 var(--serif);
  font-variation-settings: "SOFT" 0, "WONK" 0;
  letter-spacing: .02em;
  color: var(--gold);
}
.identity {
  padding: 16px calc(24px + var(--sar)) 0 calc(24px + var(--sal));
  text-align: center;
}
.name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 450;
  font-size: clamp(30px, 10.4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 0, "WONK" 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.title {
  margin: 12px 0 0;
  padding-left: .2em;
  font: 600 11.5px/1.5 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  overflow-wrap: anywhere;
}
.company {
  margin: 8px 0 0;
  font: 500 15px/1.3 var(--sans);
  color: rgba(var(--text-rgb), .82);
  overflow-wrap: anywhere;
}
.slogan {
  margin: 12px 0 0;
  font: italic 400 18px/1.35 var(--serif);
  color: var(--muted);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
/* Social icons under the slogan. --cols is set from JS so rows split evenly (6 = 3+3, 7 = 4+3, ...). */
.social {
  --soc: 48px;
  --soc-gap: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--soc-gap);
  max-width: calc(var(--cols, 5) * var(--soc) + (var(--cols, 5) - 1) * var(--soc-gap));
  margin: 28px auto 0;
}
@media (max-width: 359.98px) {
  .social { --soc: 44px; --soc-gap: 10px; }
}
.soc {
  flex: none;
  width: var(--soc);
  height: var(--soc);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--tag);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 80ms, background-color .2s, border-color .2s, color .2s;
}
.soc svg { width: 20px; height: 20px; }
.soc:hover { border-color: var(--gold); }
.divider {
  height: 1px;
  margin: 32px 24px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 calc(24px + var(--sar)) 0 calc(24px + var(--sal));
}
.rows--spaced { margin-top: 32px; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--row-shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 80ms, background-color .2s, border-color .2s, color .2s;
}
.row:hover { border-color: var(--line-strong); }
.row-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}
.row-icon svg { width: 18px; height: 18px; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.row-label {
  display: block;
  font: 600 10px/1.2 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.row-value {
  display: block;
  margin-top: 6px;
  font: 500 16px/1.25 var(--sans);
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.row-go { flex: none; width: 16px; height: 16px; margin-left: auto; color: var(--muted); opacity: .8; }
.share {
  display: flex;
  justify-content: center;
  margin-top: 32px;
  padding: 0 24px;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 200px;
  height: 48px;
  padding: 0 28px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font: 600 13px/1 var(--sans);
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform 80ms, background-color .2s, border-color .2s, color .2s;
}
.pill svg { width: 18px; height: 18px; }
.pill:hover { background: var(--tag); }
.row:active, .soc:active, .pill:active, .save:active { transform: scale(.98); }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--sab));
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--gold);
  font: 600 13px/1.3 var(--sans);
  letter-spacing: .04em;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .25s, transform .25s var(--ease);
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.credit {
  margin: 32px 24px 0;
  font-size: 11px;
  letter-spacing: .12em;
  text-align: center;
  color: var(--muted);
}
.savebar {
  position: fixed;
  left: calc(16px + var(--sal));
  right: calc(16px + var(--sar));
  bottom: calc(16px + var(--sab));
  z-index: 40;
  max-width: 448px;
  margin: 0 auto;
}
.save {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px 0 calc(16px + .2em);
  border: 0;
  border-radius: 16px;
  background: var(--save-bg);
  color: var(--save-ink);
  box-shadow: var(--save-shadow);
  font: 700 12.5px/1 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 80ms, color .2s, box-shadow .2s;
}
.save svg { width: 18px; height: 18px; flex: none; }

/* Button motion (public card only): a soft sheen crosses "Sačuvaj kontakt" every 5.5 s, starting 1.5 s after load.
   Only transform and opacity animate. The share button has no motion. Under it a static gold glow. */
.savebar::before {               /* static gold glow; hover raises it through opacity only */
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 6px 10px 0;
  z-index: -1;
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(212, 175, 106, .26);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--gold) var(--glow-alpha), transparent);
  opacity: .75;
  transition: opacity .25s ease;
}
@media (hover: hover) { .savebar:hover::before { opacity: 1; } }
.save { position: relative; overflow: hidden; isolation: isolate; }
.save::before {                  /* sheen: a soft diagonal band of light that crosses the button */
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 25%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, var(--save-sheen) 50%, transparent 100%);
  opacity: 0;
  transform: translateX(-130%) skewX(-20deg);
  will-change: transform, opacity;
  animation: sheen 5.5s ease-in-out 1.5s infinite;
}
@keyframes sheen {
  0% { opacity: 0; transform: translateX(-130%) skewX(-20deg); }
  6% { opacity: .35; }
  30% { opacity: .35; }
  36%, 100% { opacity: 0; transform: translateX(520%) skewX(-20deg); }
}
/* The sheen stops for good after the first tap on either button (class set from JS), and never runs in previews. */
.card.is-calm .save::before, .is-preview .save::before { animation: none; }

/* Progressive blur: 5 layers, each a stronger blur masked to a shorter band at the edge. */
.blur {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 30;
  pointer-events: none;
}
.blur--top { top: 0; height: calc(72px + var(--sat)); }
.blur--bottom { bottom: 0; height: calc(88px + var(--sab)); }
.blur > i { position: absolute; inset: 0; }
.blur > i:nth-child(1) { -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); --x: 100%; }
.blur > i:nth-child(2) { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); --x: 80%; }
.blur > i:nth-child(3) { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); --x: 60%; }
.blur > i:nth-child(4) { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); --x: 40%; }
.blur > i:nth-child(5) { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); --x: 22%; }
.blur--top > i {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, transparent var(--x));
  mask-image: linear-gradient(to bottom, #000 0, transparent var(--x));
}
.blur--bottom > i {
  -webkit-mask-image: linear-gradient(to top, #000 0, transparent var(--x));
  mask-image: linear-gradient(to top, #000 0, transparent var(--x));
}
.blur::after { content: ""; position: absolute; inset: 0; }
.blur--top::after { background: linear-gradient(to bottom, var(--blur-tint), transparent); }
.blur--bottom::after { background: linear-gradient(to top, var(--blur-tint), transparent); }
/* The top blur shows only while scrolling down (toggled from JS); scrolling up or reaching the top hides it.
   Opacity sits on the layers themselves: on the parent it would cut off their backdrop. */
.blur--top > i, .blur--top::after { opacity: 0; transition: opacity .15s ease; }
.is-scrolling-down .blur--top > i, .is-scrolling-down .blur--top::after { opacity: 1; }
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .blur > i { display: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .blur > i { display: none; }
}

/* Entrance animation (fill backwards only, so :active transforms still work afterwards) */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.anim { animation: rise .25s ease-out backwards; animation-delay: calc(var(--d, 0) * 40ms); }

/* Preview inside the generator: same markup, scrolls inside its frame */
.card.is-preview { min-height: 100%; padding-bottom: 0; display: flex; flex-direction: column; --sat: 0px; --sab: 0px; --sal: 0px; --sar: 0px; }
.is-preview .share { margin-bottom: 32px; }
.is-preview .savebar { position: sticky; left: auto; right: auto; bottom: 16px; width: auto; max-width: none; margin: auto 16px 16px; }
.is-preview .anim { animation: none; }

/* Placeholder while the client data loads: banner + photo outline, no text */
.card--skeleton .banner { border-bottom-color: var(--line); }
.card--skeleton .avatar { border-color: var(--line-strong); box-shadow: 0 0 0 6px var(--bg); }

/* Messages (not found, offline) */
.msg {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}
.msg h1 { margin: 0; font: 450 28px/1.2 var(--serif); }
.msg p { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- Generator (?admin) ---------- */
.admin {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(32px + var(--sat)) calc(16px + var(--sar)) calc(48px + var(--sab)) calc(16px + var(--sal));
}
.admin-head h1 { margin: 0; font: 450 36px/1.1 var(--serif); font-variation-settings: "SOFT" 0, "WONK" 0; letter-spacing: -0.01em; }
.admin-head p { margin: 8px 0 0; color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 32px; }
@media (min-width: 960px) {
  .admin { padding-left: 32px; padding-right: 32px; }
  .admin-grid { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .admin-preview { position: sticky; top: 24px; }
}
.admin-form { min-width: 0; }
.fieldset {
  min-width: 0;
  margin: 0 0 24px;
  padding: 24px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--row-shadow);
}
@media (min-width: 600px) {
  .fieldset { padding: 24px 24px 8px; }
  .fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .field--wide { grid-column: 1 / -1; }
}
.fieldset legend, .kicker {
  padding: 0 8px;
  font: 600 10.5px/1.4 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
}
.kicker { margin: 0; padding: 0 0 0 .2em; }
.field { margin-bottom: 16px; min-width: 0; }
.field label { display: block; margin-bottom: 8px; font: 600 13px/1.4 var(--sans); }
.req { color: var(--gold); }
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.4 var(--sans);
  transition: border-color .2s, background-color .2s, color .2s;
}
.input::placeholder { color: var(--muted); opacity: .7; }
.input:focus { outline: none; border-color: var(--gold); }
.input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.input[aria-invalid="true"] { border-color: var(--error); }
.color-wrap { display: flex; gap: 8px; }
.color-wrap .input { flex: 1; min-width: 0; }
.swatch {
  flex: none;
  width: 48px;
  height: 48px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.swatch::-webkit-color-swatch-wrapper { padding: 0; }
.swatch::-webkit-color-swatch { border: 0; border-radius: 8px; }
.swatch::-moz-color-swatch { border: 0; border-radius: 8px; }
.hint, .error { display: block; margin-top: 8px; font-size: 12px; line-height: 1.45; }
.hint { color: var(--muted); }
.error { color: var(--error); }
.error:empty { display: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 24px; }
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font: 600 13px/1 var(--sans);
  letter-spacing: .06em;
  cursor: pointer;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn { white-space: nowrap; }
.field label.btn { display: inline-flex; margin-bottom: 0; font: 600 12px/1 var(--sans); letter-spacing: .06em; }
.btn:hover { background: var(--tag); }
.btn:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn--primary {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--save-bg);
  color: var(--save-ink);
  box-shadow: var(--save-shadow);
  font: 700 12.5px/1 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.btn--primary:hover { background: var(--save-bg); filter: brightness(1.04); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.linkbox {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--tag);
}
.linkbox-label { font: 600 10.5px/1.4 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.linkbox-url {
  display: block;
  margin-top: 8px;
  font: 500 16px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}
.status { min-height: 20px; margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.status.is-error { color: var(--error); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 auto 16px; max-width: 400px; }
.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--tag);
}
.seg button {
  min-width: 72px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 12px/1 var(--sans);
  letter-spacing: .06em;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--gold); box-shadow: var(--row-shadow); }
.phone {
  height: min(820px, calc(100vh - 120px));
  min-height: 560px;
  max-width: 400px;
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 32px;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .55);
  transition: background-color .2s;
}
.phone > .card { min-height: 100%; }
.soc-editor { padding-bottom: 16px; }
.soc-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.soc-item { padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.soc-item-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.soc-item-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}
.soc-item-icon svg { width: 20px; height: 20px; }
.soc-item-name { flex: 1; min-width: 0; font: 600 14px/1.3 var(--sans); }
.soc-item-tools { display: flex; gap: 4px; }
.tool {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tool svg { width: 18px; height: 18px; }
.tool:hover:not(:disabled) { border-color: var(--line); background: var(--tag); color: var(--text); }
.tool:disabled { opacity: .3; cursor: default; }
.soc-item-fields { display: grid; gap: 8px; }
@media (min-width: 600px) { .soc-item-fields--custom { grid-template-columns: 1fr 2fr; } }
.soc-empty { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.soc-add { margin-top: 16px; }
.soc-add label { display: block; margin-bottom: 8px; font: 600 13px/1.4 var(--sans); }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 21px) 50%, calc(100% - 16px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select.input:disabled { opacity: .45; cursor: default; }
select.input option { background: var(--surface); color: var(--text); }

/* ---------- Owner console ---------- */
a.btn { text-decoration: none; }
.btn--small { min-height: 44px; padding: 0 16px; font-size: 12px; }
.btn--accent { background: var(--save-bg); color: var(--save-ink); border-color: transparent; }
.btn--accent:hover { background: var(--save-bg); filter: brightness(1.04); }
.btn--danger { color: var(--error); border-color: color-mix(in srgb, var(--error) 55%, transparent); }
.btn.is-armed { background: var(--error); color: var(--bg); border-color: var(--error); }
.btn:disabled { opacity: .5; cursor: default; }
.toolbar--after { margin: 16px 0 0; }
.admin-head + .toolbar { margin-top: 24px; }
.admin-head .notice { margin-top: 16px; overflow-wrap: anywhere; }
.settings { margin-top: 32px; }
.notice--warn { border-color: #C9A227 !important; background: rgba(201, 162, 39, .14) !important; }
[data-theme="light"] .notice--warn { border-color: #9A7B12 !important; background: #FFF4CC !important; }
.notice { padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--tag); color: var(--text) !important; }
.admin-narrow { max-width: 520px; margin-top: 32px; }
.login .btn--primary { margin-top: 8px; margin-bottom: 16px; }
.admin-head a { color: var(--gold); }
.client-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.client {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--row-shadow);
}
.client.is-off { opacity: .72; }
.client-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 240px; }
.client-name { font: 450 22px/1.2 var(--serif); font-variation-settings: "SOFT" 0, "WONK" 0; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.client-name:hover { color: var(--gold); }
.client-meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge { padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font: 600 10.5px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.badge--on { color: var(--gold); }
.client-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.restore-box { margin: 0 0 16px; padding: 16px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--tag); }
.restore-box p { margin: 0 0 12px; }
.owner-panel .fieldset { padding-bottom: 16px; }
.owner-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.owner-row .toolbar { margin: 0; gap: 8px; }
.owner-row--end { justify-content: flex-end; border-bottom: 0; padding-top: 16px; }
.versions { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.versions li { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

/* ---------- Image pickers and photo crop ---------- */
.picker { display: flex; align-items: center; gap: 16px; }
.picker-thumb {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--tag);
  color: var(--muted);
}
.picker-thumb svg { width: 24px; height: 24px; }
.picker-thumb--photo { width: 72px; height: 72px; border-radius: 50%; }
.picker-thumb--photo img { width: 100%; height: 100%; object-fit: cover; }
.picker-thumb--logo { width: 128px; height: 72px; padding: 8px; border-radius: 12px; }
.picker-thumb--logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.picker-thumb--banner { width: 144px; height: 72px; border-radius: 12px; }
.picker-thumb--banner img { width: 100%; height: 100%; object-fit: cover; }
.picker-warn { color: var(--gold); }
.picker-warn:empty { display: none; }
.advanced { margin-top: 8px; }
.advanced summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font: 600 12px/1 var(--sans); letter-spacing: .06em; color: var(--muted); }
.advanced summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.advanced[open] summary { color: var(--gold); }
.picker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.picker-busy { margin: 0; }
.picker-path { margin-top: 8px; }
.picker-path .hint { margin: 0 0 6px; }
.crop-dialog {
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
}
.crop-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.crop-dialog h2 { margin: 0 0 8px; font: 450 24px/1.2 var(--serif); font-variation-settings: "SOFT" 0, "WONK" 0; }
.crop-stage {
  position: relative;
  margin: 16px auto;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  background: repeating-conic-gradient(#2a2a2c 0% 25%, #222224 0% 50%) 0 0 / 16px 16px;
}
.crop-canvas { display: block; cursor: grab; touch-action: none; }
.crop-canvas:active { cursor: grabbing; }
.crop-frame { position: absolute; inset: 0; outline: 2px solid var(--gold); outline-offset: -2px; pointer-events: none; }
.crop-stage--round .crop-frame { border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); }
.crop-label { display: block; font: 600 13px/1.4 var(--sans); }
.crop-zoom { width: 100%; min-height: 44px; accent-color: var(--gold); }
.crop-dialog .toolbar { justify-content: flex-end; margin: 8px 0 0; }

/* ---------- Client editor ---------- */
.admin--client .linkbox { margin: 24px 0 8px; }
.toolbar--tight { margin: 12px 0 0; gap: 8px; }
.preview-toggle { display: none; }
@media (max-width: 959.98px) {
  .preview-toggle { display: inline-flex; margin-bottom: 16px; }
  .admin-preview.is-collapsed { display: none; }
}
@media (min-width: 960px) {
  .admin-grid--client .preview-wrap { order: 2; position: sticky; top: 24px; }
  .admin-grid--client .admin-preview { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
