/* QR Code Connect. Styles match the original site: Inter, slate text, indigo-600 to blue-600, white rounded cards. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.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: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.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;
}

:root {
  --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1; --slate-400: #94a3b8;
  --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155; --slate-800: #1e293b; --slate-900: #0f172a;
  --indigo-50: #eef2ff; --indigo-100: #e0e7ff; --indigo-200: #c7d2fe; --indigo-300: #a5b4fc; --indigo-500: #6366f1;
  --indigo-600: #4f46e5; --indigo-700: #4338ca; --indigo-800: #3730a3;
  --blue-50: #eff6ff; --blue-600: #2563eb; --blue-700: #1d4ed8;
  --emerald-50: #ecfdf5; --emerald-600: #059669; --emerald-700: #047857;
  --amber-50: #fffbeb; --amber-200: #fde68a; --amber-700: #b45309;
  --rose-50: #fff1f2; --rose-200: #fecdd3; --rose-600: #e11d48;
  --grad: linear-gradient(to right, var(--indigo-600), var(--blue-600));
  --grad-hover: linear-gradient(to right, var(--indigo-700), var(--blue-700));
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius: 1rem;
  --ring: 0 0 0 3px rgb(99 102 241 / 0.35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--slate-900);
  line-height: 1.5;
  background-color: var(--slate-50);
  background-image: linear-gradient(to bottom right, var(--slate-50), var(--blue-50), var(--indigo-50));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--indigo-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); }

.ico { width: 1rem; height: 1rem; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }
.ico-5 { width: 1.25rem; height: 1.25rem; }
.ico-6 { width: 1.5rem; height: 1.5rem; }
.ico-8 { width: 2rem; height: 2rem; }
.ico-12 { width: 3rem; height: 3rem; }
.ico-16 { width: 4rem; height: 4rem; }
.t-indigo { color: var(--indigo-600); }
.t-muted { color: var(--slate-500); }
.t-soft { color: var(--slate-600); }
.t-sm { font-size: 0.875rem; }
.t-xs { font-size: 0.75rem; }
.mono { font-family: var(--mono); }
.break { word-break: break-all; }

/* ---------- Top bar and navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgb(255 255 255 / 0.82);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgb(226 232 240 / 0.8);
}
.topbar-in { max-width: 80rem; margin: 0 auto; padding: 0.625rem 1rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--slate-900); font-size: 1.05rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 2rem; height: 2rem; border-radius: 0.5rem; }
.nav { display: flex; gap: 0.25rem; margin-left: auto; }
.nav a {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 0.8rem; border-radius: 999px;
  color: var(--slate-600); font-size: 0.9rem; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--indigo-50); color: var(--indigo-700); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--grad); color: #fff; box-shadow: var(--shadow-md); }
.nav a .ico { width: 1rem; height: 1rem; }
.mycards-btn { position: relative; }
.badge {
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; background: var(--indigo-100); color: var(--indigo-700);
}
.nav a[aria-current="page"] .badge { background: rgb(255 255 255 / 0.25); color: #fff; }
@media (max-width: 1023px) {
  .topbar-in { flex-wrap: wrap; row-gap: 0.5rem; }
  .nav { order: 3; width: 100%; margin: 0 -1rem; padding: 0 1rem 0.15rem; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 92%, transparent); mask-image: linear-gradient(to right, #000 92%, transparent); }
  .nav::-webkit-scrollbar { display: none; }
}

.mode-banner {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.55rem 1rem; font-size: 0.85rem; text-align: center; color: var(--amber-700); background: var(--amber-50); border-bottom: 1px solid var(--amber-200);
}
.mode-banner a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- Page and hero (matches original: text-5xl gradient title) ---------- */
.page { min-height: 70vh; padding: 2rem 1rem; }
.wrap { max-width: 80rem; margin: 0 auto; }
.view { display: none; }
.view.is-active { display: block; animation: view-in .45s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero { text-align: center; margin-bottom: 3rem; }
.hero-title { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1rem; }
.hero-title .ico { width: 3rem; height: 3rem; color: var(--indigo-600); }
.hero h1 {
  font-size: 3rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 0.1em;
}
.hero p { font-size: 1.125rem; line-height: 1.75rem; color: var(--slate-600); max-width: 42rem; margin: 0 auto; }
@media (max-width: 640px) {
  .page { padding: 1.5rem 1rem; }
  .hero { margin-bottom: 2rem; }
  .hero-title { flex-direction: column; gap: 0.5rem; }
  .hero h1 { font-size: 2.15rem; }
  .hero-title .ico { width: 2.5rem; height: 2.5rem; }
  .hero p { font-size: 1rem; line-height: 1.6rem; }
}

/* ---------- Layout ---------- */
.grid2 { display: grid; gap: 2rem; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid2.wide-left { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); } }
.stack > * + * { margin-top: 1.25rem; }
.stack-sm > * + * { margin-top: 0.75rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cols2 { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .cols2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.sticky { position: sticky; top: 5.5rem; }
@media (max-width: 1023px) { .sticky { position: static; } .preview-first > .sticky { order: -1; } }

/* ---------- Cards ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2rem; border: 1px solid var(--slate-200); }
.card + .card { margin-top: 1.5rem; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin-bottom: 1.5rem; }
.card-head .ico { width: 1.5rem; height: 1.5rem; color: var(--indigo-600); }
.card-head h2 { font-size: 1.5rem; line-height: 2rem; font-weight: 700; color: var(--slate-900); }
.card-head .spacer { flex: 1; }
.card-sub { margin: -1rem 0 1.5rem; color: var(--slate-500); font-size: 0.9rem; }
@media (max-width: 640px) { .card { padding: 1.25rem; } .card-head h2 { font-size: 1.25rem; } }
.panel { background: var(--slate-50); border-radius: 0.75rem; padding: 1rem; }
.divider { height: 1px; background: var(--slate-200); margin: 1.5rem 0; border: 0; }

/* ---------- Forms (shadcn-style inputs from the original site) ---------- */
.field label, .label {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem;
  font-size: 0.875rem; font-weight: 500; line-height: 1; color: var(--slate-700);
}
.field label .ico, .label .ico { color: var(--indigo-600); }
.field .opt, .label .opt { margin-left: auto; font-weight: 400; color: var(--slate-400); font-size: 0.75rem; }
.input, .textarea, .select {
  display: flex; width: 100%; height: 2.5rem; border-radius: 0.375rem; border: 1px solid var(--slate-300); background: #fff;
  padding: 0.5rem 0.75rem; font-size: 0.875rem; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 100px; height: auto; resize: vertical; line-height: 1.45; }
.select { appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 1rem; }
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--indigo-500); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--rose-600); box-shadow: 0 0 0 3px rgb(225 29 72 / 0.15); }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix {
  display: flex; align-items: center; padding: 0 0.75rem; border: 1px solid var(--slate-300); border-right: 0;
  border-radius: 0.375rem 0 0 0.375rem; background: var(--slate-50); color: var(--slate-500); font-size: 0.85rem; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis;
}
.input-group .input { border-radius: 0 0.375rem 0.375rem 0; min-width: 0; }
.hint { margin-top: 0.4rem; font-size: 0.78rem; color: var(--slate-500); }
.hint.err { color: var(--rose-600); }
input[type="color"] { width: 2.5rem; height: 2.5rem; padding: 0.15rem; border: 1px solid var(--slate-300); border-radius: 0.375rem; background: #fff; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--indigo-600); }
/* iOS zooms into inputs smaller than 16px; keep phones at 16px */
@media (max-width: 640px) { .input, .textarea, .select { font-size: 16px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; height: 2.5rem; padding: 0 1rem;
  border-radius: 0.375rem; border: 1px solid transparent; font-size: 0.875rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s; text-decoration: none; user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:hover { background: var(--grad-hover); color: #fff; }
.btn-outline { background: #fff; border-color: var(--indigo-200); color: var(--slate-900); }
.btn-outline:hover { background: var(--indigo-50); border-color: var(--indigo-300); }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-900); }
.btn-danger { background: #fff; border-color: var(--rose-200); color: var(--rose-600); }
.btn-danger:hover { background: var(--rose-50); }
.btn-dark { background: var(--slate-900); color: #fff; }
.btn-dark:hover { background: var(--slate-800); color: #fff; }
.btn-lg { height: 2.75rem; padding: 0 2rem; font-size: 0.95rem; }
.btn-grid > .btn-sm { min-height: 2.1rem; }
.btn-sm { height: 2.1rem; padding: 0 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-icon { width: 2.5rem; padding: 0; }
.btn .ico { width: 1rem; height: 1rem; }
.btn-lg .ico { width: 1.25rem; height: 1.25rem; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid rgb(255 255 255 / 0.5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-outline.is-busy::after, .btn-ghost.is-busy::after { border-color: var(--indigo-200); border-top-color: var(--indigo-600); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
.btn-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn-grid > .btn { min-width: 0; height: auto; min-height: 2.5rem; padding-block: 0.4rem; white-space: normal; line-height: 1.2; text-align: center; }
@media (max-width: 420px) { .btn-grid.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* ---------- Segmented control (tabs) ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.25rem; padding: 0.25rem; background: var(--slate-100); border-radius: 0.75rem; }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; border: 0; background: transparent;
  padding: 0.6rem 0.75rem; border-radius: 0.55rem; font-size: 0.875rem; font-weight: 600; color: var(--slate-600); cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
}
.seg button:hover { color: var(--slate-900); }
.seg button[aria-selected="true"] { background: #fff; color: var(--indigo-700); box-shadow: var(--shadow-md); }
.seg.small button { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
.seg-wrap { margin-bottom: 1.5rem; }

/* ---------- Choice tiles (with/without photo, pass type) ---------- */
.tiles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
.tile {
  position: relative; display: flex; gap: 0.75rem; align-items: flex-start; text-align: left; padding: 0.9rem; border-radius: 0.75rem;
  border: 2px solid var(--slate-200); background: #fff; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--indigo-200); }
.tile[aria-checked="true"], .tile[aria-selected="true"] { border-color: var(--indigo-600); background: var(--indigo-50); box-shadow: var(--shadow-sm); }
.tile .ico { width: 1.25rem; height: 1.25rem; color: var(--indigo-600); margin-top: 0.1rem; }
.tile strong { display: block; font-size: 0.9rem; color: var(--slate-900); }
.tile span { display: block; font-size: 0.78rem; color: var(--slate-500); margin-top: 0.15rem; line-height: 1.35; }
@media (max-width: 400px) { .tiles { grid-template-columns: 1fr; } }

/* ---------- Toggle ---------- */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { flex: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--slate-300); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .track { background: var(--indigo-600); }
.switch input:checked + .track::after { transform: translateX(1.1rem); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch .txt strong { display: block; font-size: 0.875rem; font-weight: 600; }
.switch .txt span { display: block; font-size: 0.78rem; color: var(--slate-500); }

/* ---------- Photo picker ---------- */
.photo-picker { display: flex; gap: 1rem; align-items: center; }
.avatar {
  flex: none; width: 5rem; height: 5rem; border-radius: 50%; overflow: hidden; background: var(--indigo-50); border: 2px dashed var(--indigo-200);
  display: flex; align-items: center; justify-content: center; color: var(--indigo-500);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.has-img { border-style: solid; border-color: #fff; box-shadow: var(--shadow-md); }
.avatar.square { border-radius: 0.75rem; background: var(--slate-100); }
.avatar.square.has-img { background: repeating-conic-gradient(var(--slate-200) 0 25%, #fff 0 50%) 50% / 14px 14px; }
.avatar.square img { object-fit: contain; padding: 0.35rem; }
.photo-picker .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dropzone.is-over .avatar { border-color: var(--indigo-600); background: var(--indigo-100); }

/* ---------- QR preview panel ---------- */
.qr-stage { display: flex; flex-direction: column; align-items: center; }
.qr-frame { background: #fff; padding: 1.5rem; border-radius: 0.75rem; box-shadow: var(--shadow-md); border: 2px solid var(--indigo-100); margin-bottom: 1.5rem; animation: pop .4s ease both; max-width: 100%; }
@media (max-width: 640px) { .qr-frame { padding: 0.85rem; } .frame-wrap { padding: 0.75rem 0.75rem 0.65rem; } }
.qr-frame canvas, .qr-frame svg, .qr-frame img { width: 300px; height: auto; aspect-ratio: 1 / 1; max-width: 100%; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.qr-empty {
  width: 300px; height: 300px; max-width: 100%; background: var(--slate-100); border-radius: 0.75rem; border: 2px dashed var(--slate-300);
  display: flex; align-items: center; justify-content: center; text-align: center; margin-bottom: 1.5rem; color: var(--slate-500); padding: 1rem;
}
.qr-empty .ico { width: 4rem; height: 4rem; color: var(--slate-400); margin: 0 auto 0.75rem; }
.url-box { width: 100%; background: var(--slate-50); padding: 1rem; border-radius: 0.5rem; margin-bottom: 1rem; }
.url-box .k { font-size: 0.875rem; color: var(--slate-600); margin-bottom: 0.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.url-box .v { font-size: 0.875rem; font-family: var(--mono); color: var(--indigo-600); word-break: break-all; }
.url-box .v a { color: inherit; }
.result { width: 100%; }
.result > * + * { margin-top: 0.75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--slate-100); color: var(--slate-600); }
.chip .ico { width: 0.8rem; height: 0.8rem; }
.chip.ok { background: var(--emerald-50); color: var(--emerald-700); }
.chip.warn { background: var(--amber-50); color: var(--amber-700); }
.chip.info { background: var(--indigo-50); color: var(--indigo-700); }
.chip.err { background: var(--rose-50); color: var(--rose-600); }
.qr-mode { width: 100%; margin-bottom: 1rem; }
.qr-mode .label { justify-content: center; }

/* ---------- Phone mockup (live card preview) ---------- */
.phone {
  width: 100%; max-width: 330px; margin: 0 auto; border-radius: 2.4rem; padding: 0.7rem; background: var(--slate-900); box-shadow: var(--shadow-xl);
}
.phone-screen { border-radius: 1.8rem; overflow: hidden; background: var(--slate-50); height: 560px; overflow-y: auto; scrollbar-width: none; position: relative; }
.phone-screen::-webkit-scrollbar { display: none; }
.phone-notch { position: absolute; top: 0.55rem; left: 50%; transform: translateX(-50%); width: 5.5rem; height: 1.4rem; border-radius: 1rem; background: var(--slate-900); z-index: 3; }
.preview-label { text-align: center; font-size: 0.8rem; color: var(--slate-500); margin: 0.9rem 0 0; }

/* Card page (shared by phone preview and card viewer) */
.cv { font-size: 0.95rem; }
.cv-banner { height: 8rem; background: linear-gradient(to right, var(--cv-a, var(--indigo-600)), var(--cv-b, var(--blue-600))); }
.cv .btn-primary { background: linear-gradient(to right, var(--cv-a, var(--indigo-600)), var(--cv-b, var(--blue-600))); color: var(--cv-fg, #fff); }
.cv .btn-primary:hover { filter: brightness(0.94); color: var(--cv-fg, #fff); }
.cv-body { padding: 0 1.25rem 1.5rem; }
.cv-avatar {
  width: 7rem; height: 7rem; border-radius: 50%; background: #fff; border: 4px solid #fff; box-shadow: var(--shadow-lg);
  margin-top: -3.5rem; margin-bottom: 1rem; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--indigo-600);
}
.cv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cv-avatar .ico { width: 3.25rem; height: 3.25rem; }
.cv-name { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--slate-900); word-break: break-word; }
.cv-title { color: var(--slate-600); margin-top: 0.3rem; }
.cv-org { color: var(--slate-500); display: flex; align-items: center; gap: 0.4rem; margin-top: 0.2rem; font-size: 0.9rem; }
.cv-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 1.25rem 0; }
.cv-quick a { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.65rem 0.25rem; border-radius: 0.75rem; background: #fff; border: 1px solid var(--slate-200); color: var(--slate-700); font-size: 0.72rem; font-weight: 600; }
.cv-quick a:hover { border-color: var(--indigo-200); background: var(--indigo-50); text-decoration: none; }
.cv-quick .ico { width: 1.15rem; height: 1.15rem; color: var(--indigo-600); }
.cv-list > * + * { margin-top: 0.6rem; }
.cv-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.85rem 1rem; background: var(--slate-50); border-radius: 0.6rem; color: var(--slate-700); word-break: break-word; border: 1px solid var(--slate-100); }
a.cv-item:hover { background: var(--slate-100); text-decoration: none; }
.cv-item .ico { width: 1.15rem; height: 1.15rem; color: var(--indigo-600); margin-top: 0.15rem; }
.cv-actions { margin-top: 1.25rem; }
.cv-actions > * + * { margin-top: 0.6rem; }
.cv-links > * + * { margin-top: 0.6rem; }
.cv-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.9rem; border-radius: 0.8rem; background: #fff; border: 1px solid var(--slate-200); color: var(--slate-800); font-weight: 600; box-shadow: var(--shadow-sm); }
.cv-link:hover { border-color: var(--indigo-300); text-decoration: none; transform: translateY(-1px); }
.cv-link .grow { flex: 1; min-width: 0; }
.cv-link small { display: block; font-weight: 400; color: var(--slate-500); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-bio { margin-top: 0.6rem; color: var(--slate-600); white-space: pre-line; }
.cv-foot { text-align: center; color: var(--slate-400); font-size: 0.75rem; padding: 1rem 0 0.5rem; }

/* Platform monogram (deliberately not the brand logos) */
.pf { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 0.65rem; display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 800; color: #fff; letter-spacing: 0.02em; background: var(--slate-700); }
.pf.lg { width: 3rem; height: 3rem; font-size: 1rem; border-radius: 0.85rem; }
.pf.sm { width: 1.7rem; height: 1.7rem; font-size: 0.65rem; border-radius: 0.5rem; }

/* ---------- Platform picker ---------- */
.pf-search { margin-bottom: 0.75rem; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 0.5rem; max-height: 300px; overflow-y: auto; padding: 0.15rem; }
.pf-opt { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 0.7rem 0.3rem; border-radius: 0.75rem; border: 2px solid var(--slate-200); background: #fff; cursor: pointer; font-size: 0.75rem; font-weight: 600; color: var(--slate-700); transition: border-color .15s, background .15s; }
.pf-opt:hover { border-color: var(--indigo-200); }
.pf-opt[aria-checked="true"] { border-color: var(--indigo-600); background: var(--indigo-50); color: var(--indigo-700); }

/* ---------- Link hub editor ---------- */
.links-ed > * + * { margin-top: 0.6rem; }
.link-row { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; padding: 0.6rem; border: 1px solid var(--slate-200); border-radius: 0.75rem; background: #fff; }
.link-row .select { height: 2.3rem; width: 8.6rem; }
.link-row .input { height: 2.3rem; }
.link-row .tools { display: flex; gap: 0.15rem; }
.link-row .tools .btn { width: 2rem; height: 2rem; padding: 0; }
@media (max-width: 520px) { .link-row { grid-template-columns: 1fr auto; } .link-row .select { width: 100%; grid-column: 1 / -1; } }

/* ---------- Swatches ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.sw { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--slate-300); cursor: pointer; padding: 0; transition: transform .12s, box-shadow .12s; }
.sw:hover { transform: scale(1.08); }
.sw[aria-checked="true"] { box-shadow: 0 0 0 2px var(--indigo-600); transform: scale(1.08); }

/* ---------- Wallet pass previews (the signature moment) ---------- */
.pass-stage { perspective: 1400px; display: flex; flex-direction: column; align-items: center; }
.pass-flip { position: relative; width: 320px; max-width: 100%; transition: transform .7s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; cursor: pointer; }
.pass-flip.is-back { transform: rotateY(180deg); }
.pass-face { -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.pass-face.back { position: absolute; inset: 0; transform: rotateY(180deg); }
.apass {
  position: relative; border-radius: 14px; padding: 14px 16px 16px; min-height: 430px; overflow: hidden;
  box-shadow: 0 30px 50px -20px rgb(15 23 42 / 0.45), 0 10px 20px -10px rgb(15 23 42 / 0.3);
  display: flex; flex-direction: column; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", var(--font);
}
.apass::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, rgb(255 255 255 / 0.16), rgb(255 255 255 / 0) 38%); }
.apass-top { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.apass-logo { height: 30px; max-width: 110px; object-fit: contain; border-radius: 6px; }
.apass-logotext { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.apass-hdr { text-align: right; }
.apass-main { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; }
.apass-main .pfield { flex: 1; min-width: 0; }
.apass-thumb { width: 78px; height: 78px; border-radius: 8px; object-fit: cover; flex: none; background: rgb(255 255 255 / 0.15); }
.pfield .pl { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.95; }
.pfield .pv { font-size: 14px; font-weight: 400; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pfield.primary .pv { font-size: 24px; font-weight: 300; line-height: 1.15; white-space: normal; word-break: break-word; }
.apass-row { display: flex; gap: 12px; margin-top: 16px; }
.apass-row .pfield { flex: 1; min-width: 0; }
.apass-row .pfield.right { text-align: right; }
.apass-code { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; align-items: center; }
.apass-code .box { background: #fff; padding: 8px; border-radius: 8px; }
.apass-code .box canvas, .apass-code .box svg { width: 128px; height: 128px; }
.apass-code .alt { font-size: 11px; margin-top: 6px; opacity: 0.85; }
.apass.backside { background: #f2f2f7 !important; color: #1c1c1e !important; padding: 0; }
.apass.backside::after { display: none; }
.apass-back-head { padding: 14px 16px; font-weight: 600; font-size: 15px; border-bottom: 1px solid #d1d1d6; background: #fff; }
.apass-back-list { padding: 4px 16px 16px; overflow-y: auto; }
.apass-back-list div { padding: 10px 0; border-bottom: 1px solid #d1d1d6; }
.apass-back-list .pl { font-size: 12px; color: #6c6c70; }
.apass-back-list .pv { font-size: 14px; color: #007aff; word-break: break-word; }
.apass-back-list .pv.plain { color: #1c1c1e; }

.gpass { width: 320px; max-width: 100%; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 50px -20px rgb(15 23 42 / 0.4); font-family: "Roboto", var(--font); }
.gpass-in { padding: 18px 18px 20px; }
.gpass-top { display: flex; align-items: center; gap: 10px; }
.gpass-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #fff; flex: none; }
.gpass-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gpass-sub { font-size: 13px; margin-top: 18px; opacity: 0.85; }
.gpass-head { font-size: 26px; line-height: 1.15; margin-top: 2px; font-weight: 400; word-break: break-word; }
.gpass-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin-top: 18px; }
.gpass-rows .gl { font-size: 11px; opacity: 0.8; }
.gpass-rows .gv { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gpass-code { display: flex; justify-content: center; margin-top: 22px; }
.gpass-code .box { background: #fff; padding: 10px; border-radius: 14px; }
.gpass-code .box canvas, .gpass-code .box svg { width: 140px; height: 140px; }
.gpass-hero { height: 70px; background-size: cover; background-position: center; }
.wallet-flip-hint { display: flex; align-items: center; gap: 0.4rem; justify-content: center; margin-top: 1rem; font-size: 0.8rem; color: var(--slate-500); }
.wallet-btns { display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; width: 100%; max-width: 420px; margin-top: 1.5rem; }
@media (max-width: 420px) { .wallet-btns { grid-template-columns: 1fr; } }
.btn-wallet { height: 3rem; border-radius: 0.75rem; background: #000; color: #fff; font-weight: 600; gap: 0.6rem; }
.btn-wallet:hover { background: #1f2937; color: #fff; }
.btn-wallet small { display: block; font-size: 0.65rem; font-weight: 500; opacity: 0.75; line-height: 1; }
.btn-wallet .two { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }

/* ---------- Callouts ---------- */
.callout { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.9rem 1rem; border-radius: 0.75rem; font-size: 0.85rem; line-height: 1.45; background: var(--indigo-50); color: var(--indigo-800); border: 1px solid var(--indigo-100); }
.callout .ico { width: 1.15rem; height: 1.15rem; margin-top: 0.1rem; flex: none; }
.callout.warn { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.callout.ok { background: var(--emerald-50); color: var(--emerald-700); border-color: #a7f3d0; }
.callout strong { font-weight: 700; }
.callout a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- QR Studio ---------- */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; }
.type-opt { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 0.75rem 0.25rem; border: 2px solid var(--slate-200); border-radius: 0.75rem; background: #fff; cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--slate-700); }
.type-opt .ico { width: 1.3rem; height: 1.3rem; color: var(--indigo-600); }
.type-opt:hover { border-color: var(--indigo-200); }
.type-opt[aria-checked="true"] { border-color: var(--indigo-600); background: var(--indigo-50); color: var(--indigo-700); }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 0.5rem; }
.style-opt { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.5rem 0.25rem; border: 2px solid var(--slate-200); border-radius: 0.6rem; background: #fff; cursor: pointer; font-size: 0.7rem; font-weight: 600; color: var(--slate-600); }
.style-opt svg { width: 34px; height: 34px; }
.style-opt[aria-checked="true"] { border-color: var(--indigo-600); background: var(--indigo-50); color: var(--indigo-700); }
.frame-wrap { display: inline-flex; flex-direction: column; align-items: center; border-radius: 1.25rem; padding: 1rem 1rem 0.85rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-md); max-width: 100%; }
.frame-wrap .inner { background: #fff; border-radius: 0.75rem; padding: 0.75rem; max-width: 100%; }
.frame-wrap .inner canvas, .frame-wrap .inner svg { width: 260px; height: auto; aspect-ratio: 1 / 1; max-width: 100%; }
.frame-wrap .cap { font-weight: 800; font-size: 1.15rem; margin-top: 0.7rem; letter-spacing: 0.02em; }
details.more { border: 1px solid var(--slate-200); border-radius: 0.75rem; background: #fff; }
details.more > summary { list-style: none; cursor: pointer; padding: 0.85rem 1rem; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .ico:last-child { margin-left: auto; transition: transform .2s; color: var(--slate-400); }
details.more[open] > summary .ico:last-child { transform: rotate(180deg); }
details.more > .body { padding: 0 1rem 1rem; }

/* ---------- NFC ---------- */
.tap-zone { position: relative; width: 180px; height: 180px; margin: 0.5rem auto 1.5rem; display: flex; align-items: center; justify-content: center; }
.tap-zone .core { width: 92px; height: 92px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 1; }
.tap-zone .core .ico { width: 2.5rem; height: 2.5rem; }
.tap-zone .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--indigo-300); opacity: 0; }
.tap-zone.is-live .ring { animation: ring 2.2s ease-out infinite; }
.tap-zone.is-live .ring:nth-child(2) { animation-delay: .7s; }
.tap-zone.is-live .ring:nth-child(3) { animation-delay: 1.4s; }
@keyframes ring { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.1); opacity: 0; } }
.cap-list > * + * { margin-top: 0.75rem; }
.cap-item .row-between { font-size: 0.85rem; margin-bottom: 0.35rem; }
.meter { height: 0.6rem; border-radius: 999px; background: var(--slate-100); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--emerald-600); transition: width .3s; }
.meter.warn > span { background: #f59e0b; }
.meter.err > span { background: var(--rose-600); }
.steps { counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; position: relative; padding-left: 2.25rem; margin-bottom: 0.85rem; font-size: 0.9rem; color: var(--slate-700); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -0.05rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--indigo-100); color: var(--indigo-700); font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.85rem; }
.kv dt { color: var(--slate-500); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- My cards ---------- */
.cards-list { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.mc { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 1.1rem; display: flex; flex-direction: column; gap: 0.85rem; }
.mc-top { display: flex; gap: 0.75rem; align-items: center; }
.mc-ava { width: 3rem; height: 3rem; border-radius: 50%; overflow: hidden; background: var(--indigo-50); color: var(--indigo-600); display: flex; align-items: center; justify-content: center; flex: none; }
.mc-ava img { width: 100%; height: 100%; object-fit: cover; }
.mc-title { font-weight: 700; line-height: 1.25; word-break: break-word; }
.mc-meta { font-size: 0.78rem; color: var(--slate-500); }
.mc-stats { display: flex; gap: 1.25rem; font-size: 0.8rem; color: var(--slate-600); }
.mc-stats b { font-size: 1.15rem; color: var(--slate-900); display: block; }
.mc-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--slate-500); }
.empty .ico { width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem; color: var(--slate-300); }
.empty h3 { color: var(--slate-800); font-size: 1.15rem; margin-bottom: 0.4rem; }

/* ---------- Status ---------- */
.check-list > * + * { border-top: 1px solid var(--slate-100); }
.check { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 0; }
.check .ico { width: 1.25rem; height: 1.25rem; margin-top: 0.1rem; }
.check .ok { color: var(--emerald-600); }
.check .no { color: var(--rose-600); }
.check .wait { color: var(--amber-700); }
.check strong { display: block; font-size: 0.92rem; }
.check span { display: block; font-size: 0.82rem; color: var(--slate-500); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgb(15 23 42 / 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .2s ease both; }
.modal-card { width: 100%; max-width: 30rem; max-height: calc(100vh - 2rem); overflow-y: auto; background: #fff; border-radius: 1.25rem; box-shadow: var(--shadow-xl); padding: 1.5rem; animation: pop .25s ease both; }
.modal-card.wide { max-width: 38rem; }
.modal-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.modal-head h3 { font-size: 1.2rem; font-weight: 700; flex: 1; }
.modal-head .ico { color: var(--indigo-600); width: 1.4rem; height: 1.4rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.crop-area { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; border-radius: 0.75rem; overflow: hidden; background: var(--slate-900); touch-action: none; cursor: grab; }
.crop-area canvas { width: 100%; height: 100%; }
.crop-area .mask { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 999px rgb(15 23 42 / 0.45); border-radius: 50%; }
.crop-area.square-mask .mask { border-radius: 0.5rem; }

/* ---------- Toasts (original used emoji titles) ---------- */
.toasts { position: fixed; z-index: 80; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; background: #fff; border: 1px solid var(--slate-200); border-radius: 0.75rem; padding: 0.9rem 1rem; box-shadow: var(--shadow-lg); animation: toast-in .25s ease both; }
.toast.err { border-color: var(--rose-200); }
.toast strong { display: block; font-size: 0.9rem; }
.toast span { display: block; font-size: 0.82rem; color: var(--slate-600); margin-top: 0.15rem; }
.toast.is-out { animation: toast-out .2s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@media (max-width: 640px) { .toasts { left: 1rem; right: 1rem; width: auto; } }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--slate-200); background: rgb(255 255 255 / 0.6); margin-top: 3rem; }
.footer-in { max-width: 80rem; margin: 0 auto; padding: 1.75rem 1rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; font-size: 0.85rem; color: var(--slate-500); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.footer-links a { color: var(--slate-600); }
.powered { font-weight: 600; color: var(--slate-700); }
.powered b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .footer, .mode-banner, .toasts { display: none !important; }
  body { background: #fff; }
}

/* ---------- Public card page (card.php, card.html, /u/) ---------- */
.viewer-main { min-height: 100vh; padding: 3rem 1rem 2rem; }
.viewer-card { max-width: 42rem; margin: 0 auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-xl); overflow: hidden; border: 1px solid var(--slate-200); animation: view-in .5s ease both; }
.viewer-card .cv-body { padding: 0 2rem 2rem; }
.viewer-card .cv-name { font-size: 1.875rem; }
.viewer-card .cv-foot { padding-bottom: 1.25rem; }
.viewer-cta { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: var(--slate-500); }
.viewer-empty { text-align: center; padding: 4rem 1.5rem; color: var(--slate-500); }
.viewer-empty .ico { margin: 0 auto 1rem; color: var(--slate-400); }
.viewer-empty h2 { font-size: 1.5rem; font-weight: 700; color: var(--slate-700); margin-bottom: 0.5rem; }
@media (max-width: 640px) {
  .viewer-main { padding: 0 0 2rem; }
  .viewer-card { border-radius: 0; border: 0; box-shadow: none; }
  .viewer-card .cv-body { padding: 0 1.25rem 1.5rem; }
  .viewer-card .cv-name { font-size: 1.6rem; }
}
