/* ==========================================================================
   Design system
   Blue world taken from the company logo: deep blue (--brand) to cyan (--accent),
   both set on the Settings page via /brand.css. Neutrals are tinted navy, never grey.
   Material: frosted glass over a lit blue field. Elevation = inner highlight + soft shadow.
   ========================================================================== */

@font-face {
  font-family: 'Jakarta';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(/static/fonts/jakarta.woff2) format('woff2-variations'), url(/static/fonts/jakarta.woff2) format('woff2');
}

:root {
  --brand: #0b36c2;
  --accent: #62d9fd;
  --brand-soft: color-mix(in oklab, var(--brand) 10%, white);
  --brand-ink: #fff;

  --ink: #0c1a3d;
  --ink-2: #33466f;
  --ink-3: #52648c;
  --line: color-mix(in oklab, var(--brand) 13%, transparent);
  --line-strong: color-mix(in oklab, var(--brand) 24%, transparent);

  --ok: #0c7a52;
  --ok-soft: #dff5ea;
  --bad: #c42a32;
  --bad-soft: #fde8e9;
  --warn-ink: #7a4d00;
  --warn-soft: #fff3d6;

  --glass: rgb(255 255 255 / 0.62);
  --glass-strong: rgb(255 255 255 / 0.82);
  --glass-blur: blur(20px) saturate(165%);
  --edge: inset 0 1px 0 rgb(255 255 255 / 0.9), inset 0 0 0 1px rgb(255 255 255 / 0.45);
  --shadow-1: 0 1px 2px rgb(10 35 110 / 0.06), 0 10px 28px -14px rgb(10 35 110 / 0.28);
  --shadow-2: 0 2px 6px rgb(10 35 110 / 0.08), 0 28px 56px -24px rgb(10 35 110 / 0.42);

  --radius: 16px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-arrive: cubic-bezier(0.16, 1, 0.3, 1);

  font-family: 'Jakarta', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  accent-color: var(--brand);
  caret-color: var(--brand);
  scrollbar-color: color-mix(in oklab, var(--brand) 35%, transparent) transparent;
}

* { box-sizing: border-box; }
html { overscroll-behavior-y: none; }
body { margin: 0; font-size: 15px; min-height: 100svh; background: #e9f1ff; }
::selection { background: color-mix(in oklab, var(--accent) 45%, white); color: var(--ink); }
img { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1 { font-size: 1.65rem; font-weight: 750; letter-spacing: -0.025em; line-height: 1.2; margin: 0 0 .3rem; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 .9rem; }
h3 { font-size: .9rem; font-weight: 700; margin: 0 0 .5rem; }
p { text-wrap: pretty; }
code { background: var(--brand-soft); color: var(--ink); padding: .1em .4em; border-radius: 6px; font-size: .88em; word-break: break-all; }
code.big { font-size: 1.2rem; letter-spacing: .04em; padding: .2em .5em; }
code.pre { display: block; white-space: pre-wrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
button, a, [role='button'], label.tile, label.type-tile { touch-action: manipulation; }
button, .btn, .chip, .tile span { -webkit-user-select: none; user-select: none; }

.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.req { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }

/* The lit blue field behind every admin page. Fixed layer, so it doesn't repaint on scroll. */
body:not(.card-page)::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(42rem 32rem at -5% -10%, color-mix(in oklab, var(--accent) 50%, transparent), transparent 70%),
    radial-gradient(38rem 30rem at 105% 0%, color-mix(in oklab, var(--brand) 30%, transparent), transparent 70%),
    radial-gradient(44rem 34rem at 70% 115%, color-mix(in oklab, var(--accent) 34%, transparent), transparent 70%),
    linear-gradient(180deg, #f4f8ff, #e4edff);
}

/* ---------- glass surfaces ---------- */
.panel, .topbar, .glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--edge), var(--shadow-1);
}
.panel { border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.panel.flush { padding: 0; overflow: hidden; }

/* ---------- layout ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 28px 16px 72px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 22px; }
.page-head p { margin: 0; max-width: 70ch; }
.crumbs { font-size: .85rem; margin: 0 0 .3rem !important; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.narrow-form { max-width: 760px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid-2.wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
@media (max-width: 860px) { .grid-2.wide-left, .grid-2.wide-right { grid-template-columns: 1fr; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; box-shadow: inset 0 -1px 0 var(--line), 0 6px 20px -16px rgb(10 35 110 / .4); }
.topbar-inner { max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; overflow: hidden; flex: none;
  background: linear-gradient(150deg, var(--accent), var(--brand)); color: #fff; font-weight: 750; font-size: .85rem;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 4px 10px -4px color-mix(in oklab, var(--brand) 60%, transparent);
}
.brand-mark.has-logo { background: #fff; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-mark.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.4rem; }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a { padding: 7px 13px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; transition: background-color 150ms ease, color 150ms ease; }
.nav a.active { background: color-mix(in oklab, var(--brand) 11%, white); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line); }
.nav-user { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.nav-user form { margin: 0; }
@media (hover: hover) and (pointer: fine) { .nav a:not(.active):hover { background: rgb(255 255 255 / .6); color: var(--ink); } }
@media (max-width: 720px) {
  .topbar-inner { gap: 8px; padding-top: max(10px, env(safe-area-inset-top)); }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .nav-user { margin-left: auto; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 9px 17px; border-radius: 11px; border: 0; cursor: pointer;
  font: inherit; font-weight: 650; font-size: .93rem; line-height: 1.2; text-decoration: none;
  color: var(--brand-ink);
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 82%, var(--accent)), var(--brand));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .28), 0 8px 18px -10px color-mix(in oklab, var(--brand) 75%, transparent);
  transition: transform 160ms var(--ease-out), box-shadow 160ms ease, background-color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn .icon { width: 18px; height: 18px; }
.btn-outline { background: var(--glass-strong); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgb(10 35 110 / .06); }
.btn-ghost { background: transparent; color: var(--brand); box-shadow: none; }
.btn-danger { background: rgb(255 255 255 / .7); color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad) 35%, transparent); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: .84rem; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 13px 20px; font-size: 1rem; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.btn-row.center { justify-content: center; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { box-shadow: inset 0 1px 0 rgb(255 255 255 / .28), 0 10px 22px -10px color-mix(in oklab, var(--brand) 85%, transparent); }
  .btn-outline:hover { background: #fff; }
  .btn-ghost:hover { background: color-mix(in oklab, var(--brand) 8%, transparent); }
  .btn-danger:hover { background: var(--bad-soft); }
}

/* ---------- forms ---------- */
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--ink-2); margin-bottom: 16px; }
.form label.check, label.check { flex-direction: row; align-items: flex-start; gap: 9px; font-weight: 500; color: var(--ink); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); width: 100%;
  padding: 10px 12px; border: 0; border-radius: var(--radius-sm);
  background: rgb(255 255 255 / .78);
  box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 2px rgb(10 35 110 / .05);
  transition: box-shadow 150ms ease, background-color 150ms ease;
}
input:focus, select:focus, textarea:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 1.5px var(--brand), 0 0 0 4px color-mix(in oklab, var(--accent) 30%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in oklab, var(--ink-3) 75%, white); }
input[type=checkbox], input[type=radio] { width: auto; margin-top: 3px; box-shadow: none; }
input[type=color] { padding: 3px; height: 42px; width: 64px; cursor: pointer; }
input[type=file] { padding: 7px; font-size: .88rem; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 650; color: var(--brand); border: 0; border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer;
  background: color-mix(in oklab, var(--brand) 10%, white);
}
input:disabled, textarea:disabled { opacity: .6; }
textarea { resize: vertical; }
.hint { font-weight: 450; font-size: .8rem; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); column-gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { border: 0; padding: 20px 0 0; margin: 0 0 6px; box-shadow: inset 0 1px 0 var(--line); }
.form-section:first-of-type { box-shadow: none; padding-top: 0; }
.form-section legend { font-weight: 700; font-size: .98rem; padding: 0 0 12px; float: left; width: 100%; color: var(--ink); }
.form-section legend + * { clear: both; }
.form-actions { display: flex; gap: 8px; padding-top: 6px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.colors, .color-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.color-row label { margin-bottom: 8px; }
.color-row select, .color-row input:not([type=color]) { width: auto; }
.photo-row { display: flex; gap: 18px; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; padding: 16px 0 calc(12px + env(safe-area-inset-bottom, 0px)); margin-bottom: 12px; }
.panel .sticky-actions { margin: 0 -22px -22px; padding: 18px 22px calc(18px + env(safe-area-inset-bottom, 0px)); border-radius: 0 0 var(--radius) var(--radius); background: linear-gradient(rgb(255 255 255 / 0), rgb(255 255 255 / .92) 40%); }

/* ---------- feedback ---------- */
.alert { padding: 12px 15px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: color-mix(in oklab, var(--ok-soft) 88%, transparent); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ok) 22%, transparent); }
.alert-error { background: color-mix(in oklab, var(--bad-soft) 92%, transparent); color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad) 22%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn-ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--warn-ink) 18%, transparent); }
.alert-info { background: color-mix(in oklab, var(--brand) 8%, white); color: color-mix(in oklab, var(--brand) 80%, var(--ink)); box-shadow: inset 0 0 0 1px var(--line); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: color-mix(in oklab, var(--brand) 9%, white); color: var(--ink-2); vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-ok::before, .badge-bad::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- auth ---------- */
.auth-page { display: grid; min-height: 100svh; place-items: center; }
.auth-page .container { width: 100%; }
.auth { max-width: 400px; margin: 32px auto; padding: 32px 28px; text-align: center; border-radius: 20px; box-shadow: var(--edge), var(--shadow-2); }
.auth h1 { margin-top: 14px; }
.auth .form { text-align: left; margin-top: 22px; }
.auth .brand-mark.lg { margin: 0 auto; }

/* ---------- dashboard ---------- */
.summary { font-size: 1.02rem; color: var(--ink-2); margin: 0; }
.summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.people { list-style: none; margin: 0; padding: 0; }
.people li + li { box-shadow: inset 0 1px 0 var(--line); }
.people a { display: flex; align-items: center; gap: 12px; padding: 11px 6px; color: inherit; text-decoration: none; border-radius: 10px; transition: background-color 150ms ease; }
.people .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.people .who strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .who span { color: var(--ink-3); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .when { color: var(--ink-3); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .people a:hover { background: rgb(255 255 255 / .7); } }
.empty { text-align: center; padding: 28px 12px; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }

/* ---------- avatar ---------- */
.avatar { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(150deg, color-mix(in oklab, var(--accent) 45%, white), color-mix(in oklab, var(--brand) 25%, white)); color: var(--brand); display: grid; place-items: center; overflow: hidden; font-weight: 750; font-size: .85rem; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; border-radius: 22px; font-size: 1.8rem; }

/* ---------- tables ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: middle; }
.table td { box-shadow: inset 0 1px 0 var(--line); }
.table th { font-size: .76rem; color: var(--ink-3); font-weight: 700; background: rgb(255 255 255 / .45); }
.table.compact th, .table.compact td { padding: 5px 8px; }
.row-muted td { opacity: .55; }
.cell-person { display: flex; align-items: center; gap: 11px; }
.cell-person a { color: var(--ink); text-decoration: none; font-weight: 650; }
.cell-person .muted { display: block; font-size: .82rem; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }

/* ---------- employee editor: form + live preview ---------- */
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }
.profile-layout > .form { margin-bottom: 0; }
.card-preview-col { position: sticky; top: 84px; display: grid; gap: 16px; }
.card-preview > summary { cursor: pointer; font-weight: 700; margin-bottom: 10px; list-style-position: inside; }
.card-preview > summary .hint { margin-left: 4px; }
.preview-stage { border-radius: 22px; padding: 18px 14px; max-height: calc(100vh - 150px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.preview-stage .idc a, .preview-stage .idc .btn { pointer-events: none; }
.qr-mini { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; }
.qr-mini img { width: 112px; height: 112px; border-radius: 12px; background: #fff; padding: 6px; box-shadow: var(--shadow-1); }
.qr-mini .url-box { font-size: .82rem; }
.actions-list form { margin: 0 0 8px; }
@media (max-width: 1000px) {
  .profile-layout { grid-template-columns: 1fr; }
  .card-preview-col { position: static; order: -1; max-width: 460px; width: 100%; margin: 0 auto; }
  .preview-stage { max-height: none; }
}

/* ---------- QR generator & designer ---------- */
.type-group { font-size: .74rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 16px 0 8px; }
.type-group:first-child { margin-top: 0; }
.type-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.form label.type-tile, .type-tile { position: relative; display: block; margin: 0; cursor: pointer; }
.type-tile input { position: absolute; opacity: 0; pointer-events: none; }
.type-tile span { display: flex; flex-direction: column; gap: 2px; padding: 11px 13px; border-radius: 12px; height: 100%; background: rgb(255 255 255 / .55); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 150ms ease, background-color 150ms ease; }
.type-tile strong { color: var(--ink); }
.type-tile small { color: var(--ink-3); font-weight: 450; font-size: .78rem; }
.type-tile input:checked + span { background: #fff; box-shadow: inset 0 0 0 1.5px var(--brand), 0 6px 16px -10px color-mix(in oklab, var(--brand) 70%, transparent); }
.type-tile input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.dynamic-toggle { background: color-mix(in oklab, var(--brand) 7%, white); padding: 11px 13px; border-radius: 12px; }
.dynamic-toggle.always { margin: 0; }
.link-row { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-bottom: 8px; }
.qr-list { list-style: none; margin: 0; padding: 0; }
.qr-list a { display: flex; gap: 12px; align-items: center; padding: 10px 6px; text-decoration: none; color: inherit; border-radius: 10px; }
.qr-list img { border-radius: 8px; background: #fff; flex: none; box-shadow: var(--shadow-1); }
.qr-list span { display: flex; flex-direction: column; min-width: 0; }
.qr-list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.qr-list.grid li { box-shadow: inset 0 -1px 0 var(--line); }
@media (hover: hover) and (pointer: fine) { .qr-list a:hover { background: rgb(255 255 255 / .7); } }
.qr-img { border-radius: 12px; padding: 8px; background: #fff; width: 200px; height: 200px; box-shadow: var(--shadow-1); }
.qr-img.lg { width: 280px; height: 280px; }
.url-box { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; word-break: break-all; margin: 4px 0 8px; }
.encoded { text-align: left; margin-top: 16px; }
.encoded p { margin: 8px 0 4px; }
.danger-zone { margin-top: 8px; }

.designer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.designer-preview { position: sticky; top: 84px; }
.preview-box { aspect-ratio: 1; display: grid; place-items: center; background: repeating-conic-gradient(#eef3ff 0% 25%, #fff 0% 50%) 50% / 16px 16px; border-radius: var(--radius); padding: 16px; box-shadow: var(--edge), var(--shadow-1); }
.preview-box svg, .preview-box img { width: 100%; height: 100%; object-fit: contain; }
.scan-status { font-size: .85rem; margin: 10px 0 0; min-height: 1.5em; }
.scan-status.ok { color: var(--ok); font-weight: 650; }
.scan-status.warn { color: var(--warn-ink); background: var(--warn-soft); padding: 9px 11px; border-radius: 10px; }
@media (max-width: 860px) {
  .designer-grid { grid-template-columns: 1fr; }
  .designer-preview { position: static; order: -1; max-width: 320px; margin: 0 auto; width: 100%; }
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.chip { font: inherit; font-size: .84rem; font-weight: 600; padding: 6px 13px; border-radius: 999px; border: 0; color: var(--ink-2); background: rgb(255 255 255 / .7); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: transform 140ms var(--ease-out); }
.chip:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) { .chip:hover { color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); } }
.dsec { border-radius: 12px; padding: 0 15px; margin-bottom: 8px; background: rgb(255 255 255 / .5); box-shadow: inset 0 0 0 1px var(--line); }
.dsec summary { cursor: pointer; font-weight: 650; padding: 13px 0; }
.dsec[open] { padding-bottom: 13px; }
.dsec .hint { margin: 4px 0; }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.form label.tile, .tile { position: relative; display: inline-block; margin: 0; cursor: pointer; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile span { display: inline-block; padding: 6px 12px; border-radius: 9px; font-size: .85rem; font-weight: 600; color: var(--ink-2); background: rgb(255 255 255 / .7); box-shadow: inset 0 0 0 1px var(--line); }
.tile input:checked + span { color: var(--brand); background: #fff; box-shadow: inset 0 0 0 1.5px var(--brand); }
.tile input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.shape-tune { display: flex; gap: 16px; align-items: center; margin: 8px 0; }
.mask-preview { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 10px; flex: none; box-shadow: inset 0 0 0 1px var(--line); }
.warn-text { color: var(--warn-ink); }
.custom-shape { background: rgb(255 255 255 / .6); border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; }

/* ---------- analytics ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.stats div { background: rgb(255 255 255 / .6); box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px; padding: 11px 13px; display: flex; flex-direction: column; }
.stats strong { font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stats span { color: var(--ink-3); font-size: .8rem; }
.chart { margin: 16px 0 8px; }
.chart figcaption { font-size: .85rem; font-weight: 650; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--brand); }
.chart .hit { fill: transparent; }
.chart-bar:hover .hit { fill: color-mix(in oklab, var(--brand) 8%, transparent); }
.chart-bar:hover .bar { fill: color-mix(in oklab, var(--brand) 75%, var(--ink)); }
.chart-grid { stroke: var(--line-strong); stroke-dasharray: 3 3; }
.chart-axis { stroke: var(--line-strong); }
.chart-label { font-size: 11px; fill: var(--ink-3); }
.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 12px 0; }
.breakdowns h3 { font-size: .8rem; color: var(--ink-3); margin: 0 0 6px; font-weight: 700; }
.hbar { display: grid; grid-template-columns: 1fr 70px auto; gap: 8px; align-items: center; font-size: .85rem; margin-bottom: 4px; }
.hbar-track { height: 8px; background: color-mix(in oklab, var(--brand) 8%, white); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 0 4px 4px 0; }
.hbar-value { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

/* ---------- settings ---------- */
.logo-row { display: flex; gap: 18px; align-items: center; }
.logo-preview { width: 96px; height: 96px; border-radius: 22px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; box-shadow: var(--edge), var(--shadow-1); color: var(--brand); font-weight: 750; font-size: 1.6rem; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- print sheet ---------- */
body.print-page { background: #fff; }
body.print-page::before { display: none; }
.print-toolbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 12px 16px; box-shadow: inset 0 -1px 0 var(--line); }
.print-toolbar .btn { margin-left: auto; }
.print-grid { display: grid; grid-template-columns: repeat(auto-fill, 4cm); gap: 6mm; padding: 10mm; justify-content: center; }
.print-item { margin: 0; width: 4cm; text-align: center; break-inside: avoid; }
.print-item img { width: 3cm; height: 3cm; display: block; margin: 0 auto; }
.print-item figcaption { font-size: 8pt; line-height: 1.25; display: flex; flex-direction: column; }
@media print {
  .no-print { display: none !important; }
  .print-grid { padding: 0; }
  @page { margin: 10mm; }
}

/* ==========================================================================
   The virtual ID card (public page, opened by scanning the QR)
   ========================================================================== */

.card-page {
  min-height: 100svh;
  background: #061033;
  padding: max(24px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
}
.card-page::before, .preview-stage {
  background:
    radial-gradient(30rem 26rem at 8% 4%, color-mix(in oklab, var(--accent) 62%, transparent), transparent 66%),
    radial-gradient(32rem 30rem at 100% 42%, color-mix(in oklab, var(--brand) 92%, transparent), transparent 66%),
    radial-gradient(28rem 24rem at 20% 100%, color-mix(in oklab, var(--accent) 38%, transparent), transparent 70%),
    linear-gradient(165deg, color-mix(in oklab, var(--brand) 55%, #061033), #050c28);
}
.card-page::before { content: ''; position: fixed; inset: 0; z-index: -1; }

/* The card: dark frosted glass on the lit blue field. Content is one centred column,
   then a stack of full-width tappable rows, so every edge lines up at any width. */
.idc {
  --card-top: 24px;
  --pad: clamp(16px, 5vw, 24px);
  --ink: #ffffff;
  --ink-2: rgb(222 232 255 / 0.82);
  --ink-3: rgb(205 218 255 / 0.66);
  --line: rgb(255 255 255 / 0.1);
  --row: rgb(255 255 255 / 0.07);
  --row-hi: rgb(255 255 255 / 0.12);
  --ok: #6ee7b0;
  color-scheme: dark;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 420px;
  border-radius: 28px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(180deg, rgb(16 32 86 / 0.62), rgb(5 12 40 / 0.74));
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  backdrop-filter: blur(28px) saturate(160%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.2), inset 0 0 0 1px rgb(255 255 255 / 0.08), 0 44px 90px -40px rgb(0 0 0 / 0.85), 0 14px 30px -16px rgb(0 0 0 / 0.5);
}
.idc a { color: inherit; }

/* The company logo, faint, behind the content. Soft edges so only the mark shows through. */
.idc-watermark {
  position: absolute; z-index: -1; width: 115%; max-width: none; left: -7%; top: 22%;
  opacity: .1; filter: grayscale(1) invert(1); mix-blend-mode: screen; pointer-events: none; user-select: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 25%, transparent 72%);
  mask-image: radial-gradient(closest-side, #000 25%, transparent 72%);
}
.idc-mono-mark { position: absolute; z-index: -1; right: -4%; bottom: 10%; font-size: 13rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: #fff; opacity: .04; pointer-events: none; user-select: none; }

.idc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: var(--pad) var(--pad) 0; }
.idc-org { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 650; font-size: .9rem; color: var(--ink-2); }
.idc-org > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idc-logo { width: 30px; height: 30px; border-radius: 9px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; color: var(--brand); font-size: .75rem; font-weight: 800; }
.idc-logo img { width: 100%; height: 100%; object-fit: contain; }
.idc-valid { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; color: #fff; background: rgb(255 255 255 / .1); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16); }
.idc-valid .icon { width: 13px; height: 13px; }

.idc-body { padding: 0 var(--pad) 6px; text-align: center; }
.idc-photo {
  position: relative; width: 116px; height: 116px; margin: 22px auto 16px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; color: #fff;
  background: linear-gradient(150deg, color-mix(in oklab, var(--accent) 60%, transparent), var(--brand));
  box-shadow: 0 0 0 3px rgb(255 255 255 / .9), 0 0 0 9px rgb(255 255 255 / .08), 0 0 50px -6px color-mix(in oklab, var(--accent) 70%, transparent);
}
.idc-photo img { width: 100%; height: 100%; object-fit: cover; }
.idc-name { font-size: clamp(1.45rem, 6.4vw, 1.75rem); font-weight: 750; letter-spacing: -0.025em; line-height: 1.15; margin: 0; overflow-wrap: anywhere; text-wrap: balance; }
.idc-role { margin: 6px 0 0; color: var(--ink-2); font-weight: 550; font-size: .95rem; overflow-wrap: anywhere; }
.idc-role:not(:has(span:not([hidden]))) { display: none; }
.idc-sep { color: var(--ink-3); }

.idc-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.idc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--row); box-shadow: inset 0 0 0 1px var(--line); }
.idc-chip strong { color: #fff; font-weight: 750; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.idc-chip.ok { color: var(--ok); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c58b; flex: none; animation: pulse 2.4s var(--ease-out) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(34 197 139 / .5); } 70%, 100% { box-shadow: 0 0 0 7px rgb(34 197 139 / 0); } }

.idc-bio { color: var(--ink-2); margin: 16px auto 0; max-width: 34ch; font-size: .93rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }

/* Contact rows: icon | label + detail | arrow */
.idc-rows { display: grid; gap: 8px; margin: 20px 0 0; text-align: left; }
.idc-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 16px; align-items: center; gap: 12px;
  min-height: 60px; padding: 10px 14px 10px 10px; border-radius: 16px; text-decoration: none;
  background: var(--row); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgb(255 255 255 / .05);
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
.idc-row:active { transform: scale(0.98); background: var(--row-hi); }
.idc-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(150deg, color-mix(in oklab, var(--accent) 38%, transparent), color-mix(in oklab, var(--brand) 70%, transparent)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .2); }
.idc-ico svg { width: 19px; height: 19px; }
.idc-txt { display: flex; flex-direction: column; min-width: 0; }
.idc-txt strong { font-size: .92rem; font-weight: 650; color: #fff; line-height: 1.3; }
.idc-txt span { font-size: .8rem; color: var(--ink-3); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idc-go { color: var(--ink-3); justify-self: end; transition: transform 160ms var(--ease-out), color 150ms ease; }
@media (hover: hover) and (pointer: fine) {
  .idc-row:hover { background: var(--row-hi); }
  .idc-row:hover .idc-go { color: #fff; transform: translate(2px, -2px); }
}

.idc-cta { display: grid; gap: 8px; margin: 20px 0 6px; }
.idc .idc-save { color: #071338; background: linear-gradient(180deg, #ffffff, color-mix(in oklab, var(--accent) 22%, white)); box-shadow: 0 12px 30px -12px color-mix(in oklab, var(--accent) 80%, transparent), inset 0 -1px 0 rgb(0 0 0 / .06); }
.idc .idc-share { color: #fff; background: var(--row); box-shadow: inset 0 0 0 1px var(--line); }
@media (hover: hover) and (pointer: fine) { .idc .idc-share:hover { background: var(--row-hi); } }

.idc-foot { display: flex; justify-content: space-between; align-items: center; gap: 4px 12px; flex-wrap: wrap; padding: 14px var(--pad) 16px; font-size: .74rem; color: var(--ink-3); box-shadow: inset 0 1px 0 var(--line); }
.idc-foot .live { display: inline-flex; align-items: center; gap: 7px; }
.idc-foot time { font-variant-numeric: tabular-nums; }
.idc-owner { margin: 0 0 14px; font-size: .85rem; color: rgb(255 255 255 / .85); text-align: center; }
.idc-owner a { color: #fff; font-weight: 700; }

/* Shared shell for the "not valid" and "list of links" pages */
.idc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: var(--pad) var(--pad) 0; }
.idc-top.invalid .idc-valid { color: #ffb3b8; background: rgb(255 80 90 / .16); box-shadow: inset 0 0 0 1px rgb(255 120 130 / .35); }
.idc-body.message { padding-top: 18px; padding-bottom: 28px; }
.idc-body.message p { color: var(--ink-2); max-width: 34ch; margin: 10px auto 0; }
.idc-body.message strong { color: #fff; }
.idc .link-stack .btn-outline { color: #fff; background: var(--row); box-shadow: inset 0 0 0 1px var(--line); }

/* Row titles stay on one line so every row is the same height. */
.idc-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 360px) {
  .idc-follow { display: none; }
  .idc-row { grid-template-columns: 36px minmax(0, 1fr) 14px; gap: 10px; padding-right: 12px; }
  .idc-ico { width: 36px; height: 36px; }
}

/* links page (QR "list of links") reuses the card shell */
.link-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ==========================================================================
   App shell: night theme
   The admin app lives in the same world as the scanned card: a deep navy field lit by the
   logo's cyan and blue, with frosted dark-glass panels. Things that must match print or the
   scanned card (QR images, the QR preview box, the card preview) stay on light plates.
   ========================================================================== */

[data-theme="night"] body.app {
  --ink: #eaf1ff;
  --ink-2: #bccbeb;
  --ink-3: #93a6cf;
  --line: rgb(165 195 255 / 0.13);
  --line-strong: rgb(165 195 255 / 0.24);
  --hi: color-mix(in oklab, var(--accent) 82%, white);        /* links, selection, active state */
  --hi-soft: color-mix(in oklab, var(--accent) 16%, transparent);
  --ok: #5fe0a5; --ok-soft: rgb(40 200 130 / 0.15);
  --bad: #ff8d95; --bad-soft: rgb(255 90 100 / 0.14);
  --warn-ink: #ffd27a; --warn-soft: rgb(255 190 60 / 0.13);
  --glass: rgb(255 255 255 / 0.06);
  --glass-strong: rgb(255 255 255 / 0.09);
  --glass-blur: blur(22px) saturate(150%);
  --edge: inset 0 1px 0 rgb(255 255 255 / 0.13), inset 0 0 0 1px rgb(255 255 255 / 0.06);
  --shadow-1: 0 1px 2px rgb(0 4 30 / 0.25), 0 22px 44px -26px rgb(0 4 30 / 0.85);
  --shadow-2: 0 2px 6px rgb(0 4 30 / 0.3), 0 34px 70px -30px rgb(0 4 30 / 0.95);
  color-scheme: dark;
  color: var(--ink);
  background: #061033;
  caret-color: var(--hi);
}
[data-theme="night"] body.app::before {
  background:
    radial-gradient(44rem 34rem at -6% -12%, color-mix(in oklab, var(--accent) 42%, transparent), transparent 68%),
    radial-gradient(40rem 32rem at 108% 12%, color-mix(in oklab, var(--brand) 80%, transparent), transparent 66%),
    radial-gradient(46rem 30rem at 50% 118%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(170deg, color-mix(in oklab, var(--brand) 42%, #061033), #040a24 70%);
}
[data-theme="night"] .app ::selection { background: color-mix(in oklab, var(--accent) 45%, transparent); color: #fff; }
[data-theme="night"] .app a { color: var(--hi); }
[data-theme="night"] .app :focus-visible { outline-color: var(--hi); }

/* Display type at full strength */
[data-theme="night"] .app .page-head h1 { font-size: 2.05rem; font-weight: 800; letter-spacing: -0.035em; }
[data-theme="night"] .app .summary strong { color: #fff; }

/* Glass surfaces */
[data-theme="night"] .app .panel, [data-theme="night"] .app .topbar {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.085), rgb(255 255 255 / 0.035));
}
[data-theme="night"] .app .topbar { background: rgb(6 16 51 / 0.55); box-shadow: inset 0 -1px 0 var(--line), 0 10px 30px -20px rgb(0 0 0 / 0.8); }
[data-theme="night"] .app .brand { color: #fff; }

/* Navigation: the active page glows in the accent */
[data-theme="night"] .app .nav a { color: var(--ink-2); }
[data-theme="night"] .app .nav a.active { color: #fff; background: var(--hi-soft); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 34%, transparent), 0 0 22px -6px color-mix(in oklab, var(--accent) 55%, transparent); }
@media (hover: hover) and (pointer: fine) { [data-theme="night"] .app .nav a:not(.active):hover { background: rgb(255 255 255 / 0.07); color: #fff; } }

/* Buttons */
[data-theme="night"] .app .btn {
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 62%, var(--accent)), var(--brand));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 0 0 1px color-mix(in oklab, var(--accent) 30%, transparent), 0 10px 26px -10px color-mix(in oklab, var(--accent) 55%, transparent);
}
[data-theme="night"] .app .btn-outline { background: rgb(255 255 255 / 0.06); color: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); }
[data-theme="night"] .app .btn-ghost { background: transparent; color: var(--hi); box-shadow: none; }
[data-theme="night"] .app .btn-danger { background: rgb(255 255 255 / 0.04); color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad) 40%, transparent); }
@media (hover: hover) and (pointer: fine) {
  [data-theme="night"] .app .btn:hover { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 0 0 1px color-mix(in oklab, var(--accent) 45%, transparent), 0 12px 32px -8px color-mix(in oklab, var(--accent) 70%, transparent); }
  [data-theme="night"] .app .btn-outline:hover { background: rgb(255 255 255 / 0.11); }
  [data-theme="night"] .app .btn-ghost:hover { background: var(--hi-soft); }
  [data-theme="night"] .app .btn-danger:hover { background: var(--bad-soft); }
}

/* Fields */
[data-theme="night"] .app input, [data-theme="night"] .app select, [data-theme="night"] .app textarea { background: rgb(2 8 32 / 0.45); box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 3px rgb(0 0 0 / 0.25); }
[data-theme="night"] .app input:focus, [data-theme="night"] .app select:focus, [data-theme="night"] .app textarea:focus { background: rgb(2 8 32 / 0.65); box-shadow: inset 0 0 0 1.5px var(--hi), 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent); }
[data-theme="night"] .app input::placeholder, [data-theme="night"] .app textarea::placeholder { color: color-mix(in oklab, var(--ink-3) 70%, transparent); }
[data-theme="night"] .app input[type=file]::file-selector-button { color: #fff; background: rgb(255 255 255 / 0.1); }
[data-theme="night"] .app .form label { color: var(--ink-2); }
[data-theme="night"] .app .panel .sticky-actions { background: linear-gradient(rgb(8 20 62 / 0), rgb(8 20 62 / 0.92) 42%); }

/* Feedback */
[data-theme="night"] .app .alert-success { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ok) 28%, transparent); }
[data-theme="night"] .app .alert-error { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad) 28%, transparent); }
[data-theme="night"] .app .alert-warn { background: var(--warn-soft); color: var(--warn-ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--warn-ink) 22%, transparent); }
[data-theme="night"] .app .alert-info { background: var(--hi-soft); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 26%, transparent); }
[data-theme="night"] .app .badge { background: rgb(255 255 255 / 0.08); color: var(--ink-2); }
[data-theme="night"] .app .badge-ok { background: var(--ok-soft); color: var(--ok); }
[data-theme="night"] .app .badge-bad { background: var(--bad-soft); color: var(--bad); }
[data-theme="night"] .app code { background: rgb(255 255 255 / 0.08); color: var(--ink); }

/* Lists and tables */
[data-theme="night"] .app .table th { background: rgb(255 255 255 / 0.03); }
@media (hover: hover) and (pointer: fine) {
  [data-theme="night"] .app .people a:hover, [data-theme="night"] .app .qr-list a:hover { background: rgb(255 255 255 / 0.06); }
  [data-theme="night"] .app .table tbody tr:hover td { background: rgb(255 255 255 / 0.03); }
}
[data-theme="night"] .app .cell-person a { color: #fff; }

/* QR generator and designer controls */
[data-theme="night"] .app .type-tile span, [data-theme="night"] .app .tile span, [data-theme="night"] .app .chip, [data-theme="night"] .app .dsec, [data-theme="night"] .app .stats div, [data-theme="night"] .app .custom-shape { background: rgb(255 255 255 / 0.045); }
[data-theme="night"] .app .type-tile input:checked + span, [data-theme="night"] .app .tile input:checked + span {
  background: var(--hi-soft); color: #fff;
  box-shadow: inset 0 0 0 1.5px var(--hi), 0 0 24px -8px color-mix(in oklab, var(--accent) 60%, transparent);
}
[data-theme="night"] .app .tile input:checked + span { color: #fff; }
[data-theme="night"] .app .dynamic-toggle { background: var(--hi-soft); }
@media (hover: hover) and (pointer: fine) { [data-theme="night"] .app .chip:hover { color: #fff; box-shadow: inset 0 0 0 1px var(--hi); } }

/* Analytics */
[data-theme="night"] .app .chart .bar, [data-theme="night"] .app .hbar-fill { fill: var(--hi); background: var(--hi); }
[data-theme="night"] .app .chart-bar:hover .bar { fill: #fff; }
[data-theme="night"] .app .hbar-track { background: rgb(255 255 255 / 0.07); }

/* The preview stage sits on the same night field, so give it a little separation */
[data-theme="night"] .app .preview-stage { box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1); }

/* Night theme details */
.nav a { white-space: nowrap; }
[data-theme="night"] .app .people a, [data-theme="night"] .app .qr-list a { color: var(--ink); }
[data-theme="night"] .app .sticky-actions { background: linear-gradient(rgb(6 16 51 / 0), rgb(6 16 51 / 0.88) 45%); }

/* Phone: in the card editor the form comes right after the QR and the (folded) preview;
   scans and card actions move below it. */
@media (max-width: 1000px) {
  .card-preview-col { display: contents; }
  .profile-layout > .form { order: 0; }
  .side-qr { order: -2; }
  .card-preview { order: -1; width: 100%; max-width: 460px; margin: 0 auto; }
  .side-stats { order: 1; }
  .side-actions { order: 2; }
  .profile-layout > .panel, .profile-layout > section { margin-bottom: 0; }
}

/* ---------- card v3: photo hero, round actions, about panel, rows, bottom dock ---------- */
.idc { overflow: clip; }

.idc-hero {
  position: relative; isolation: isolate; aspect-ratio: 4 / 5; max-height: 72svh; min-height: 300px;
  display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
}
/* No photo: a lit brand panel. Both it and the photo dissolve into the glass at the bottom (no seam). */
.idc-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -3;
  background:
    radial-gradient(90% 70% at 30% 20%, color-mix(in oklab, var(--accent) 55%, transparent), transparent 70%),
    linear-gradient(160deg, var(--brand), #0a1a52);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}
.idc-hero-img {
  position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%;
  -webkit-mask-image: linear-gradient(180deg, #000 52%, rgb(0 0 0 / .55) 78%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 52%, rgb(0 0 0 / .55) 78%, transparent 100%);
}
/* Scrims so the badge and the name always read, whatever the photo. */
.idc-hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgb(4 10 36 / .4) 0%, transparent 20%),
    linear-gradient(180deg, transparent 40%, rgb(5 13 42 / .5) 72%, rgb(5 13 42 / 0) 100%);
}
.idc-hero-initials { position: absolute; inset: 0 0 30%; z-index: -2; display: grid; place-items: center; font-size: clamp(5rem, 30vw, 8rem); font-weight: 200; letter-spacing: -0.04em; color: rgb(255 255 255 / .9); }
.idc-hero .idc-valid { position: absolute; top: var(--pad); right: var(--pad); background: rgb(6 14 44 / .35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.idc-hero-text { padding: 0 var(--pad) 18px; text-align: left; }
.idc-hero .idc-name {
  font-size: clamp(1.9rem, 9.5vw, 2.7rem); font-weight: 300; text-transform: uppercase; letter-spacing: .01em; line-height: 1.02;
  text-wrap: balance; overflow-wrap: anywhere; hyphens: auto; text-shadow: 0 2px 18px rgb(0 0 0 / .35);
}
.idc-hero .idc-role { margin: 10px 0 0; font-size: .98rem; font-weight: 600; color: rgb(235 242 255 / .92); }
.idc-hero .idc-org { display: flex; align-items: center; gap: 9px; margin: 12px 0 0; font-size: .86rem; font-weight: 650; color: rgb(235 242 255 / .85); min-width: 0; }
.idc-hero .idc-org > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idc-hero .idc-logo { width: 26px; height: 26px; border-radius: 8px; }

.idc-body { position: relative; isolation: isolate; padding: 4px var(--pad) 0; text-align: left; }
.idc-chips { justify-content: flex-start; margin-top: 4px; }

/* Round quick actions */
.idc-actions { display: flex; justify-content: space-between; gap: 10px; margin: 18px 0 0; }
.idc-actions a {
  flex: 1 1 0; max-width: 64px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; color: #fff; text-decoration: none;
  background: linear-gradient(180deg, rgb(255 255 255 / .14), rgb(255 255 255 / .05));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16), inset 0 1px 0 rgb(255 255 255 / .2), 0 10px 24px -14px rgb(0 0 0 / .8);
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.idc-actions a .icon { width: 22px; height: 22px; }
.idc-actions a:active { transform: scale(0.94); }
.idc-actions:not(:has(a:not([hidden]))) { display: none; }
@media (hover: hover) and (pointer: fine) { .idc-actions a:hover { background: rgb(255 255 255 / .16); } }

/* About me */
.idc-about { margin: 20px 0 0; padding: 18px 18px 20px; border-radius: 20px; text-align: center; background: var(--row); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgb(255 255 255 / .06); }
.idc-about h2 { font-size: 1.05rem; font-weight: 750; margin: 0 0 6px; color: #fff; }
.idc-about p { margin: 0 auto; max-width: 34ch; color: var(--ink-2); font-size: .93rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.idc-rows { margin-top: 16px; }

.idc-foot { margin: 18px calc(var(--pad) * -1) 0; }

/* Bottom dock: stays in reach while scrolling the card */
.idc-dock {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgb(6 14 44 / 0), rgb(6 14 44 / .82) 30%);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.idc-dock-btn {
  width: 52px; height: 52px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #fff; text-decoration: none;
  background: linear-gradient(180deg, rgb(255 255 255 / .16), rgb(255 255 255 / .06));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .18), 0 10px 24px -12px rgb(0 0 0 / .8);
  transition: transform 160ms var(--ease-out);
}
.idc-dock-btn .icon { width: 21px; height: 21px; }
.idc-dock-btn:active { transform: scale(0.94); }
.idc .idc-add {
  flex: 1; min-width: 0; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 6px 0 20px; border-radius: 999px; text-decoration: none; color: #071338; font-weight: 750; font-size: .96rem;
  background: linear-gradient(180deg, #ffffff, color-mix(in oklab, var(--accent) 20%, white));
  box-shadow: 0 14px 30px -12px color-mix(in oklab, var(--accent) 75%, transparent);
  transition: transform 160ms var(--ease-out);
}
.idc-add > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idc-add:active { transform: scale(0.98); }
.idc-add-plus { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 70%, var(--accent)), var(--brand)); }
.idc-add-plus .icon { width: 20px; height: 20px; }

/* The card's QR, full screen, so someone can scan it off this phone */
.idc-qr { border: 0; padding: 22px 22px 18px; border-radius: 26px; width: min(340px, calc(100vw - 32px)); background: #fff; color: #0c1a3d; text-align: center; box-shadow: 0 40px 90px -30px rgb(0 0 0 / .8); }
.idc-qr::backdrop { background: rgb(3 8 28 / .7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.idc-qr[open] { animation: qr-in 260ms var(--ease-out); }
.idc-qr img { display: block; width: 100%; aspect-ratio: 1; }
.idc-qr p { margin: 12px 0 0; display: flex; flex-direction: column; }
.idc-qr p span { color: #52648c; font-size: .85rem; }
.idc-qr-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: #0c1a3d; background: #eef3ff; }
@keyframes qr-in { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* Preview inside the admin editor: no sticky dock fighting the preview's own scroll */
.preview-stage .idc-dock { position: static; }
.preview-stage .idc-hero { max-height: none; }

@media (max-width: 360px) {
  .idc-actions { gap: 8px; }
  .idc-add { padding-left: 16px; font-size: .9rem; }
  .idc-dock-btn { width: 48px; height: 48px; }
}

/* ---------- opening: a clean loading screen ----------
   The page opts in from splash.js. Logo tile and company name settle in, a loading line fills
   while the photo loads, then the screen fades and the card rises into place. */
.splash { display: none; }
html.splash-on .splash {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 18px; cursor: pointer;
  background:
    radial-gradient(30rem 26rem at 50% 38%, color-mix(in oklab, var(--accent) 26%, transparent), transparent 70%),
    linear-gradient(170deg, color-mix(in oklab, var(--brand) 45%, #061033), #040a24);
  transition: opacity 380ms ease, visibility 0s linear 380ms;
}
html.splash-out .splash { opacity: 0; visibility: hidden; }
.splash-tile {
  width: 104px; height: 104px; border-radius: 28px; display: grid; place-items: center; overflow: hidden;
  background: #fff; color: var(--brand); font-size: 2.1rem; font-weight: 800; letter-spacing: -0.04em;
  box-shadow: 0 0 0 1px rgb(255 255 255 / .5), 0 0 60px -10px color-mix(in oklab, var(--accent) 70%, transparent), 0 24px 50px -24px rgb(0 0 0 / .8);
  animation: s-tile 620ms var(--ease-arrive) both;
}
.splash-tile img { width: 80%; height: 80%; object-fit: contain; }
.splash-name { margin: 0; font-size: .95rem; font-weight: 650; letter-spacing: .02em; color: rgb(235 242 255 / .85); animation: s-fade 500ms ease 180ms both; }
.splash-bar { width: 120px; height: 3px; border-radius: 3px; overflow: hidden; background: rgb(255 255 255 / .12); animation: s-fade 400ms ease 260ms both; }
.splash-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #fff); transform-origin: left; animation: s-load 1100ms cubic-bezier(.4, 0, .2, 1) 300ms both; }
html.splash-out .splash-bar i { animation: none; transform: scaleX(1); transition: transform 200ms ease; }

html.splash-on .card-page .idc { opacity: 0; transform: translateY(22px) scale(.985); }
html.splash-out .card-page .idc { opacity: 1; transform: none; transition: opacity 520ms ease 120ms, transform 700ms var(--ease-arrive) 120ms; }

@keyframes s-tile { from { opacity: 0; transform: scale(.92); } }
@keyframes s-fade { from { opacity: 0; } }
@keyframes s-load { from { transform: scaleX(0); } to { transform: scaleX(.85); } }

@media (prefers-reduced-motion: reduce) {
  .splash-tile, .splash-name, .splash-bar, .splash-bar i { animation: none; }
  .splash-bar i { transform: scaleX(.85); }
  html.splash-on .card-page .idc, html.splash-out .card-page .idc { transform: none; }
}

/* ==========================================================================
   Theme: Soft daylight
   The palette's 45° lavender (#F2DCF9) to cream (#FDF5E8) gradient as the field, light frosted glass,
   navy ink, and the company blue for actions. The admin app uses the light glass system above.
   ========================================================================== */
[data-theme="day"] {
  --lav: #f2dcf9;
  --cream: #fdf5e8;
  --field:
    radial-gradient(38rem 30rem at 0% 0%, rgb(226 196 245 / .75), transparent 70%),
    radial-gradient(34rem 28rem at 100% 100%, rgb(255 226 196 / .6), transparent 70%),
    linear-gradient(45deg, var(--lav), var(--cream));
}
[data-theme="day"] body { background: var(--cream); }
[data-theme="day"] body:not(.card-page)::before { background: var(--field); }
[data-theme="day"] .topbar { background: rgb(255 255 255 / .55); }

/* Settings: theme picker */
.theme-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 8px; }
.form label.theme-pick, .theme-pick { position: relative; display: flex; flex-direction: row; align-items: center; gap: 12px; margin: 0; padding: 12px; border-radius: 14px; cursor: pointer; background: rgb(255 255 255 / .05); box-shadow: inset 0 0 0 1px var(--line); }
.theme-pick input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pick:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--hi, var(--brand)); }
.theme-pick:has(input:focus-visible) { outline: 2px solid var(--hi, var(--brand)); outline-offset: 2px; }
.theme-pick strong { display: block; color: var(--ink); }
.theme-pick small { color: var(--ink-3); font-weight: 450; }
.theme-swatch { width: 64px; height: 44px; flex: none; border-radius: 10px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); }
.theme-swatch.theme-night { background: radial-gradient(60% 80% at 20% 10%, var(--accent), transparent 70%), linear-gradient(160deg, var(--brand), #050c28); }
.theme-swatch.theme-day { background: linear-gradient(45deg, #f2dcf9, #fdf5e8); }
.theme-swatch i { position: absolute; left: 10px; right: 10px; height: 6px; border-radius: 3px; }
.theme-swatch i:nth-child(1) { top: 9px; right: 30px; }
.theme-swatch i:nth-child(2) { top: 19px; }
.theme-swatch i:nth-child(3) { top: 29px; right: 22px; }
.theme-night i { background: rgb(255 255 255 / .35); }
.theme-day i { background: rgb(255 255 255 / .85); box-shadow: 0 1px 2px rgb(60 40 90 / .15); }
.theme-day i:nth-child(3) { background: var(--brand); }

/* ---------- the virtual card in daylight ---------- */
[data-theme="day"] .card-page { background: var(--cream); }
[data-theme="day"] .card-page::before,
[data-theme="day"] .preview-stage { background: var(--field); }
[data-theme="day"] .idc {
  --ink: #14193b;
  --ink-2: #3c4466;
  --ink-3: #5d6483;
  --line: rgb(60 50 110 / .12);
  --row: rgb(255 255 255 / .6);
  --row-hi: rgb(255 255 255 / .85);
  --ok: #0c7a52;
  color-scheme: light;
  background: linear-gradient(180deg, rgb(255 255 255 / .6), rgb(255 255 255 / .42));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .9), inset 0 0 0 1px rgb(255 255 255 / .6), 0 40px 80px -40px rgb(70 40 110 / .45), 0 12px 28px -16px rgb(70 40 110 / .25);
}
[data-theme="day"] .idc-watermark { filter: none; mix-blend-mode: multiply; opacity: .09; }
[data-theme="day"] .idc-mono-mark { color: var(--brand); opacity: .05; }

[data-theme="day"] .idc-hero::before { background: radial-gradient(90% 70% at 30% 20%, rgb(255 255 255 / .9), transparent 70%), linear-gradient(160deg, #e9d3f6, #f9eadf); }
[data-theme="day"] .idc-hero-initials { color: var(--brand); font-weight: 300; }
[data-theme="day"] .idc-hero::after {
  background:
    linear-gradient(180deg, rgb(20 20 50 / .25) 0%, transparent 20%),
    linear-gradient(180deg, transparent 42%, rgb(250 240 246 / .78) 74%, rgb(250 240 246 / 0) 100%);
}
[data-theme="day"] .idc-hero .idc-name { color: var(--ink); text-shadow: 0 1px 14px rgb(255 255 255 / .6); }
[data-theme="day"] .idc-hero .idc-role { color: var(--ink-2); }
[data-theme="day"] .idc-hero .idc-org { color: var(--ink-2); }
[data-theme="day"] .idc-hero .idc-logo { box-shadow: 0 2px 6px rgb(60 40 90 / .2); }

[data-theme="day"] .idc-txt strong, [data-theme="day"] .idc-about h2, [data-theme="day"] .idc-chip strong { color: var(--ink); }
[data-theme="day"] .idc-row { box-shadow: inset 0 0 0 1px var(--line), 0 6px 16px -12px rgb(60 40 90 / .35); }
[data-theme="day"] .idc-ico { color: #fff; background: linear-gradient(150deg, color-mix(in oklab, var(--brand) 55%, var(--accent)), var(--brand)); }
[data-theme="day"] .idc-actions a {
  color: var(--brand);
  background: linear-gradient(180deg, rgb(255 255 255 / .9), rgb(255 255 255 / .6));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .9), 0 10px 22px -14px rgb(60 40 90 / .5);
}
[data-theme="day"] .idc-about { box-shadow: inset 0 0 0 1px var(--line), 0 8px 20px -16px rgb(60 40 90 / .4); }
[data-theme="day"] .idc-chip.ok { background: rgb(12 122 82 / .1); box-shadow: none; }

[data-theme="day"] .idc-dock { background: linear-gradient(180deg, rgb(250 240 246 / 0), rgb(250 240 246 / .86) 30%); }
[data-theme="day"] .idc-dock-btn { color: var(--brand); background: rgb(255 255 255 / .85); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .9), 0 10px 22px -12px rgb(60 40 90 / .45); }
[data-theme="day"] .idc .idc-add { color: #fff; background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 78%, var(--accent)), var(--brand)); box-shadow: 0 14px 28px -12px color-mix(in oklab, var(--brand) 60%, transparent); }
[data-theme="day"] .idc-add-plus { color: var(--brand); background: #fff; }
[data-theme="day"] .idc-foot { color: var(--ink-3); }

/* Opening screen in daylight */
[data-theme="day"].splash-on .splash { background: var(--field); }
[data-theme="day"] .splash-name { color: var(--ink-2, #3c4466); }
[data-theme="day"] .splash-bar { background: rgb(60 50 110 / .12); }
[data-theme="day"] .splash-bar i { background: linear-gradient(90deg, var(--accent), var(--brand)); }
[data-theme="day"] .splash-tile { box-shadow: 0 0 0 1px rgb(255 255 255 / .9), 0 24px 50px -24px rgb(70 40 110 / .5); }

/* "Not valid" and links pages */
[data-theme="day"] .idc-body.message strong { color: var(--ink); }
[data-theme="day"] .idc-top.invalid .idc-valid { color: #b42330; background: rgb(196 42 50 / .1); }
[data-theme="day"] .idc .idc-valid { color: var(--ink); background: rgb(255 255 255 / .6); box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="day"] .idc-hero .idc-valid { color: #fff; background: rgb(20 20 50 / .3); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .3); }
[data-theme="day"] .idc .link-stack .btn-outline { color: var(--brand); background: var(--row); }

/* ==========================================================================
   QR generator: compact studio layout
   One row of types, then content + design on the left and a panel that stays in view
   on the right with the live preview and the Create button.
   ========================================================================== */
.page-head.compact { margin-bottom: 16px; }
.qr-studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "types types" "main side"; gap: 16px 20px; align-items: start; margin-bottom: 20px; }
.qr-studio > .panel { margin-bottom: 0; }

/* Type row */
.qr-types { grid-area: types; display: flex; gap: 6px; padding: 8px; overflow-x: auto; scrollbar-width: none; }
.qr-types.expanded { flex-wrap: wrap; overflow: visible; }
.form label.type-tab, .type-tab { position: relative; display: block; flex: 1 0 auto; min-width: 128px; margin: 0; cursor: pointer; }
.qr-types.expanded .type-tab { flex: 1 0 150px; }
.type-tab input { position: absolute; opacity: 0; pointer-events: none; }
.type-tab > span { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 8px; border-radius: 12px; font-weight: 650; font-size: .9rem; color: var(--ink-2); white-space: nowrap; transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease; }
.type-ico { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--brand); background: color-mix(in oklab, var(--brand) 9%, white); box-shadow: inset 0 0 0 1px var(--line); }
.type-ico .icon { width: 19px; height: 19px; }
.type-tab input:checked + span { color: var(--brand); background: color-mix(in oklab, var(--brand) 9%, white); box-shadow: inset 0 0 0 1.5px var(--brand); }
.type-tab input:checked + span .type-ico { color: #fff; background: var(--brand); box-shadow: none; }
.type-tab input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.qr-types:not(.expanded) .type-tab.extra:not(:has(input:checked)) { display: none; }
.type-more { flex: none; display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 14px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 650; font-size: .9rem; color: var(--ink-2); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.type-more .icon { width: 18px; height: 18px; transition: transform 200ms var(--ease-out); }
.type-more[aria-expanded="true"] .icon { transform: rotate(180deg); }
@media (hover: hover) and (pointer: fine) {
  .type-tab:not(:has(input:checked)) > span:hover { background: rgb(255 255 255 / .6); color: var(--ink); }
  .type-more:hover { color: var(--ink); }
}

/* Steps */
.qr-main { grid-area: main; padding: 0; }
.qr-step { padding: 22px; }
.qr-step + .qr-step { box-shadow: inset 0 1px 0 var(--line); }
.qr-step > h2, .qr-side > h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: 16px; }
.step-no { width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center; font-size: .82rem; font-weight: 800; color: #fff; background: var(--brand); }
.qr-step .type-fields { max-width: 640px; }

/* Side: preview + create */
.qr-side { grid-area: side; position: sticky; top: 84px; padding: 20px; }
.qr-side .preview-box { margin-bottom: 4px; }
.qr-side .btn-block { margin-top: 14px; }
.qr-side .hint { margin: 10px 0 0; }

/* Design tabs (the designer partial; also used on the QR edit page and the ID card QR style page) */
.designer-grid.single { grid-template-columns: 1fr; }
.dtabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 12px; background: color-mix(in oklab, var(--brand) 5%, transparent); box-shadow: inset 0 0 0 1px var(--line); }
.dtab { flex: 1 0 auto; border: 0; border-radius: 9px; padding: 8px 12px; cursor: pointer; font: inherit; font-size: .86rem; font-weight: 650; color: var(--ink-2); background: transparent; transition: background-color 150ms ease, color 150ms ease; }
.dtab[aria-selected="true"] { color: var(--brand); background: #fff; box-shadow: 0 1px 3px rgb(10 35 110 / .12), inset 0 0 0 1px var(--line); }
.dtab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dpanel { padding: 0 0 6px; }
.dpanel + .dpanel { margin-top: 16px; }
.designer.tabbed .dpanel + .dpanel { margin-top: 0; }
.designer.tabbed .dpanel-title { display: none; }
.dpanel-title { font-size: .9rem; margin: 0 0 8px; }
.dpanel > .hint:first-of-type { margin-top: 0; }
@media (hover: hover) and (pointer: fine) { .dtab:not([aria-selected="true"]):hover { color: var(--ink); } }

/* Night theme versions */
[data-theme="night"] .app .type-ico { color: var(--hi); background: rgb(255 255 255 / .06); }
[data-theme="night"] .app .type-tab input:checked + span { color: #fff; background: var(--hi-soft); box-shadow: inset 0 0 0 1.5px var(--hi), 0 0 24px -8px color-mix(in oklab, var(--accent) 60%, transparent); }
[data-theme="night"] .app .type-tab input:checked + span .type-ico { color: #071338; background: var(--hi); }
[data-theme="night"] .app .step-no { color: #071338; background: var(--hi); }
[data-theme="night"] .app .dtabs { background: rgb(255 255 255 / .04); }
[data-theme="night"] .app .dtab[aria-selected="true"] { color: #fff; background: var(--hi-soft); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 40%, transparent); }
@media (hover: hover) and (pointer: fine) { [data-theme="night"] .app .type-tab:not(:has(input:checked)) > span:hover { background: rgb(255 255 255 / .06); color: #fff; } }

/* Tablet / phone: one column; preview + Create come after the design so the flow reads top to bottom */
@media (max-width: 960px) {
  .qr-studio { grid-template-columns: 1fr; grid-template-areas: "types" "main" "side"; }
  .qr-side { position: static; }
  .qr-side .preview-box { max-width: 300px; margin: 0 auto 4px; }
}
@media (max-width: 560px) {
  .qr-step { padding: 18px 16px; }
  .type-tab { min-width: 0; }
  .form label.type-tab, .type-tab { flex: 0 0 auto; }
}

/* QR edit page: same studio, with downloads, facts and scans in the side column */
.qr-studio.edit { grid-template-areas: "main side"; }
.qr-side-stack { grid-area: side; display: grid; gap: 16px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; border-radius: var(--radius); }
.qr-side-stack .panel { margin: 0; }
.qr-side-stack .qr-side { position: static; }
.dl-menu { margin-top: 8px; }
.dl-menu > summary { list-style: none; cursor: pointer; }
.dl-menu > summary::-webkit-details-marker { display: none; }
.dl-menu > summary .icon { width: 18px; height: 18px; transition: transform 200ms var(--ease-out); }
.dl-menu[open] > summary .icon { transform: rotate(180deg); }
.dl-list { display: grid; margin-top: 6px; padding: 6px; border-radius: 12px; background: rgb(255 255 255 / .7); box-shadow: inset 0 0 0 1px var(--line); }
.dl-list a { padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }
@media (hover: hover) and (pointer: fine) { .dl-list a:hover { background: color-mix(in oklab, var(--brand) 8%, transparent); } }
.qr-facts dl { margin: 0; }
.qr-facts dt { font-size: .78rem; font-weight: 650; color: var(--ink-3); margin-top: 10px; }
.qr-facts dt:first-child { margin-top: 0; }
.qr-facts dd { margin: 4px 0 0; font-size: .88rem; overflow-wrap: anywhere; }
[data-theme="night"] .app .dl-list { background: rgb(255 255 255 / .05); }
[data-theme="night"] .app .dl-list a:hover { background: rgb(255 255 255 / .07); }
@media (max-width: 960px) {
  .qr-studio.edit { grid-template-areas: "main" "side"; }
  .qr-side-stack { position: static; max-height: none; overflow: visible; }
}
.qr-side-stack > * { grid-area: auto; }
[data-theme="night"] .app .dl-list a { color: var(--ink); }

/* ==========================================================================
   One-screen layouts (all looks)
   On laptops and desktops every admin page fits the window: long content is split into tabs
   and pages instead of scrolling. Phones keep normal scrolling for the admin forms.
   ========================================================================== */
@font-face { font-family: 'Display'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/display.woff2) format('woff2'); }

.page-head .muted .badge { margin-right: 6px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-list { display: grid; gap: 12px; }

/* Segmented tabs (card editor) and step tabs (QR pages) */
.seg, .steps-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: color-mix(in oklab, var(--brand) 6%, transparent); box-shadow: inset 0 0 0 1px var(--line); width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button, .steps-tabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 9px 18px; cursor: pointer; font: inherit; font-size: .9rem; font-weight: 650; white-space: nowrap; color: var(--ink-2); background: transparent; transition: background-color 150ms ease, color 150ms ease; }
.seg button[aria-selected="true"], .steps-tabs button[aria-selected="true"] { color: #fff; background: var(--brand); }
.seg button[aria-selected="true"] .step-no, .steps-tabs button[aria-selected="true"] .step-no { color: var(--brand); background: #fff; }
.seg button:focus-visible, .steps-tabs button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tab-pane { min-width: 0; }
.step-next { display: flex; justify-content: flex-end; margin-top: 16px; }
.tabbed .step-next { display: flex; }
.step-next { display: none; }

/* Dropdown menus (details/summary) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary .icon, .dl-menu > summary .icon { width: 16px; height: 16px; transition: transform 200ms var(--ease-out); }
.menu[open] > summary .icon { transform: rotate(180deg); }
.menu-list { position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; min-width: 230px; display: grid; padding: 8px; border-radius: 16px; background: var(--menu-bg, #fff); box-shadow: 0 0 0 1px var(--line), 0 18px 40px -16px rgb(0 0 0 / .35); }
.menu-list.right { left: auto; right: 0; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 10px; cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600; color: var(--menu-ink, #0c1a3d); text-decoration: none; background: transparent; }
.menu-list .danger { color: #c42a32; }
.menu-qr { padding: 8px 8px 10px; }
.menu-qr img { display: block; width: 132px; height: 132px; margin: 0 auto; }
@media (hover: hover) and (pointer: fine) { .menu-list a:hover, .menu-list button:hover { background: rgb(0 0 0 / .05); } }

/* Pager */
.pager { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: .88rem; color: var(--ink-2); }
.pager.standalone { justify-content: center; margin: 20px 0 0; }
.btn.is-disabled { opacity: .35; pointer-events: none; }

/* My QR codes tiles */
.qr-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.qr-tiles a { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius); text-decoration: none; color: inherit; background: var(--glass); box-shadow: var(--edge), var(--shadow-1); }
.qr-tiles img { flex: none; border-radius: 10px; background: #fff; padding: 4px; }
.qr-tiles span { display: flex; flex-direction: column; min-width: 0; }
.qr-tiles strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Card editor: tabbed form + live preview */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.editor-form { margin: 0; display: flex; flex-direction: column; gap: 20px; }
.editor-panes { min-height: 0; }
.editor-form .form-actions { padding: 0; }
.editor-preview { display: flex; flex-direction: column; gap: 10px; }
.editor-preview .preview-stage { height: 640px; max-height: none; overflow: hidden; padding: 14px; display: flex; justify-content: center; }
.editor-preview .preview-stage .idc { height: 100%; }
.editor-preview .hint { margin: 0; }

/* QR pages */
.qr-main .steps-tabs { margin: 22px 22px 0; }
.details-pane .qr-facts { margin-bottom: 18px; }
.details-pane h3 { margin-top: 4px; }
.qr-side-stack .dl-menu { position: relative; }
.qr-side-stack .dl-list { position: absolute; z-index: 30; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--menu-bg, #fff); box-shadow: 0 0 0 1px var(--line), 0 18px 40px -16px rgb(0 0 0 / .35); }
.qr-side-stack .dl-list a { color: var(--menu-ink, #0c1a3d); }
.qr-side-stack { overflow: visible; max-height: none; }

/* Settings: two columns */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings-grid > .panel { margin: 0; }
.settings-save { grid-column: 1 / -1; padding: 0; }
.settings-grid .theme-picks { grid-template-columns: 1fr; }

/* ---------- desktop: pages fit the window ---------- */
@media (min-width: 1024px) and (min-height: 600px) {
  body.app:not(.auth-page) { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  body.app:not(.auth-page) > .container { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; padding-top: 24px; padding-bottom: 24px; }
  body.app:not(.auth-page) > .container > * { flex: none; }
  .editor, .qr-studio, .list-shell, .settings-grid { flex: 1 1 auto !important; min-height: 0; }
  .editor { align-items: stretch; }
  .editor-form { min-height: 0; }
  .editor-panes { flex: 1; }
  .editor-preview { min-height: 0; }
  .editor-preview .preview-stage { flex: 1; height: auto; min-height: 0; }
  .qr-studio { grid-template-rows: auto minmax(0, 1fr); }
  .qr-studio.edit { grid-template-rows: minmax(0, 1fr); }
  .qr-main, .qr-side, .qr-side-stack { min-height: 0; }
  .qr-side { align-self: start; }
  .qr-side .preview-box { max-height: calc(100dvh - 430px); min-height: 160px; aspect-ratio: 1; margin-inline: auto; }
  .list-shell { display: flex; flex-direction: column; }
  .list-shell .table-wrap { flex: none; }
}
@media (max-width: 1023px) {
  .editor { grid-template-columns: 1fr; }
  .editor-preview { order: -1; }
  .editor-preview .preview-stage { height: 620px; max-width: 420px; width: 100%; margin: 0 auto; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .form-grid.two { grid-template-columns: 1fr; }
  .seg, .steps-tabs { width: 100%; }
}

/* ==========================================================================
   Virtual card: one screen, no scrolling (all looks)
   ========================================================================== */
.card-page { height: 100dvh; min-height: 0; overflow: hidden; padding: 16px; justify-content: center; }
.card-page .idc { height: min(100%, 860px); }
.idc { display: flex; flex-direction: column; }
.idc-hero { flex: 1 1 auto; aspect-ratio: auto; min-height: 110px; max-height: none; }
.idc-hero-initials { inset: 0; }
.idc-body { flex: none; padding: 14px var(--pad) 4px; }
.idc-ident { min-width: 0; }
.idc .idc-name { font-size: clamp(1.4rem, 6vw, 1.75rem); font-weight: 750; line-height: 1.1; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.idc .idc-role { margin: 4px 0 0; font-size: .92rem; font-weight: 600; color: var(--ink-2); }
.idc .idc-org { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: .84rem; font-weight: 650; color: var(--ink-2); min-width: 0; }
.idc .idc-org > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idc .idc-logo { width: 22px; height: 22px; border-radius: 6px; }
.idc-web { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; max-width: 100%; font-size: .82rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.idc-web .icon { width: 14px; height: 14px; flex: none; }
.idc-web span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idc-chips { margin-top: 12px; }
.idc-bio { margin: 10px 0 0; max-width: none; text-align: left; font-size: .88rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.idc .idc-actions { display: flex; justify-content: flex-start; gap: 10px; margin: 14px 0 0; }
.idc .idc-actions a { flex: 1 1 0; max-width: 72px; aspect-ratio: auto; border-radius: 0; background: none; box-shadow: none; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .72rem; font-weight: 650; color: var(--ink-2); }
.idc .idc-actions a .icon { width: 48px; height: 48px; padding: 13px; border-radius: 50%; box-sizing: border-box; color: #fff; background: linear-gradient(180deg, rgb(255 255 255 / .16), rgb(255 255 255 / .06)); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .18); }
.idc .idc-socials { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.idc .idc-socials a { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--row); box-shadow: inset 0 0 0 1px var(--line); }
.idc .idc-socials svg { width: 17px; height: 17px; }
.idc-dock { position: static; flex: none; margin-top: auto; padding-top: 14px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (max-width: 480px) {
  .card-page { padding: 0; }
  .card-page .idc { height: 100dvh; max-width: none; border-radius: 0; }
}
@media (max-height: 640px) {
  .idc-bio { -webkit-line-clamp: 1; }
  .idc .idc-actions a .icon { width: 42px; height: 42px; padding: 11px; }
  .idc .idc-actions a { font-size: 0; gap: 0; }
}
.preview-stage .idc-dock { position: static; }

/* ==========================================================================
   Theme: Monochrome
   Black on white after SHOP.CO: heavy uppercase display type, pill buttons, soft grey surfaces,
   hairline borders instead of shadows, generous white space. Colour only for status.
   ========================================================================== */
html[data-theme="mono"] {
  --brand: #000;
  --accent: #000;
  --ink: #000;
  --ink-2: #404040;
  --ink-3: #666;
  --line: rgb(0 0 0 / .1);
  --line-strong: rgb(0 0 0 / .18);
  --grey: #f0f0f0;
  --glass: #fff;
  --glass-strong: #fff;
  --glass-blur: none;
  --edge: inset 0 0 0 1px rgb(0 0 0 / .1);
  --shadow-1: 0 0 0 0 transparent;
  --shadow-2: 0 0 0 0 transparent;
  --radius: 20px;
  --menu-bg: #fff;
  --menu-ink: #000;
  --display: 'Display', 'Archivo Black', 'Arial Black', sans-serif;
  accent-color: #000;
  caret-color: #000;
}
[data-theme="mono"] body { background: #fff; color: #000; font-size: 15px; }
[data-theme="mono"] body::before, [data-theme="mono"] .card-page::before { display: none; }
[data-theme="mono"] ::selection { background: #000; color: #fff; }
[data-theme="mono"] a { color: #000; }
[data-theme="mono"] :focus-visible { outline: 2px solid #000; outline-offset: 2px; }

/* Type: one display face (uppercase headings) + one text face */
[data-theme="mono"] h1, [data-theme="mono"] .page-head h1 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: clamp(1.75rem, 2.6vw, 2.25rem); letter-spacing: 0; line-height: 1.05; }
[data-theme="mono"] h2 { font-size: 1.05rem; font-weight: 750; letter-spacing: -0.01em; }
[data-theme="mono"] .page-head { margin-bottom: 28px; gap: 20px; }
[data-theme="mono"] .page-head p { margin-top: 8px; color: var(--ink-3); }
[data-theme="mono"] .crumbs a { color: var(--ink-3); }
[data-theme="mono"] .muted, [data-theme="mono"] .hint { color: var(--ink-3); }

/* Surfaces: flat white with hairlines, grey for inset areas */
[data-theme="mono"] .panel, [data-theme="mono"] .topbar, [data-theme="mono"] .glass, [data-theme="mono"] .qr-tiles a { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .panel { padding: 28px; }
[data-theme="mono"] .panel.flush { padding: 0; }
[data-theme="mono"] .topbar { box-shadow: inset 0 -1px 0 var(--line); }
[data-theme="mono"] .topbar-inner { padding-top: 14px; padding-bottom: 14px; gap: 32px; }
[data-theme="mono"] .brand { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 1.15rem; letter-spacing: 0; }
[data-theme="mono"] .brand-mark { background: #000; box-shadow: none; }
[data-theme="mono"] .brand-mark.has-logo { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .nav a { color: #000; font-weight: 500; padding: 8px 12px; border-radius: 0; background: none; box-shadow: none; }
[data-theme="mono"] .nav a.active { font-weight: 700; background: none; box-shadow: inset 0 -2px 0 #000; }
@media (hover: hover) and (pointer: fine) { [data-theme="mono"] .nav a:not(.active):hover { background: none; text-decoration: underline; text-underline-offset: 6px; } }

/* Buttons: black pill, outlined pill, text */
[data-theme="mono"] .btn { min-height: 46px; padding: 12px 24px; border-radius: 999px; font-weight: 600; color: #fff; background: #000; box-shadow: none; }
[data-theme="mono"] .btn-lg { min-height: 52px; padding: 14px 32px; font-size: 1rem; }
[data-theme="mono"] .btn-sm { min-height: 36px; padding: 7px 16px; font-size: .85rem; }
[data-theme="mono"] .btn-outline { color: #000; background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); }
[data-theme="mono"] .btn-ghost { color: #000; background: transparent; box-shadow: none; }
[data-theme="mono"] .btn-danger { color: #c42a32; background: #fff; box-shadow: inset 0 0 0 1px rgb(196 42 50 / .35); }
@media (hover: hover) and (pointer: fine) {
  [data-theme="mono"] .btn:hover { background: #262626; box-shadow: none; }
  [data-theme="mono"] .btn-outline:hover { background: var(--grey); }
  [data-theme="mono"] .btn-ghost:hover { background: var(--grey); }
  [data-theme="mono"] .btn-danger:hover { background: #fdeceb; }
}

/* Fields: soft grey, no border, black focus ring */
[data-theme="mono"] input, [data-theme="mono"] select, [data-theme="mono"] textarea { background: var(--grey); box-shadow: none; border-radius: 12px; padding: 12px 14px; color: #000; }
[data-theme="mono"] input:focus, [data-theme="mono"] select:focus, [data-theme="mono"] textarea:focus { background: #fff; box-shadow: inset 0 0 0 1.5px #000; }
[data-theme="mono"] input[type=search] { border-radius: 999px; padding-left: 20px; }
[data-theme="mono"] input[type=file]::file-selector-button { color: #fff; background: #000; border-radius: 999px; padding: 7px 14px; }
[data-theme="mono"] input[type=checkbox], [data-theme="mono"] input[type=radio] { background: none; }
[data-theme="mono"] .form label { color: #000; font-weight: 600; margin-bottom: 18px; }
[data-theme="mono"] .form-grid { column-gap: 20px; }
[data-theme="mono"] .form-section { box-shadow: inset 0 1px 0 var(--line); padding-top: 24px; }
[data-theme="mono"] .form-section:first-of-type { box-shadow: none; padding-top: 0; }

/* Feedback */
[data-theme="mono"] .alert { background: var(--grey); color: #000; box-shadow: none; border-radius: 14px; }
[data-theme="mono"] .alert-success { background: #e9f6ef; color: #0b6b47; }
[data-theme="mono"] .alert-error { background: #fdeceb; color: #b42330; }
[data-theme="mono"] .alert-warn { background: #fff4dc; color: #6b4500; }
[data-theme="mono"] .badge { background: var(--grey); color: #000; }
[data-theme="mono"] .badge-ok { background: #e9f6ef; color: #0b6b47; }
[data-theme="mono"] .badge-bad { background: #fdeceb; color: #b42330; }
[data-theme="mono"] code { background: var(--grey); color: #000; }

/* Lists */
[data-theme="mono"] .table th { background: #fff; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; }
[data-theme="mono"] .table th, [data-theme="mono"] .table td { padding: 14px 18px; }
[data-theme="mono"] .cell-person a { color: #000; }
[data-theme="mono"] .avatar { background: var(--grey); color: #000; border-radius: 50%; }
[data-theme="mono"] .avatar.lg { border-radius: 50%; }
[data-theme="mono"] .people a { color: #000; }
@media (hover: hover) and (pointer: fine) { [data-theme="mono"] .people a:hover, [data-theme="mono"] .qr-list a:hover, [data-theme="mono"] .table tbody tr:hover td { background: #fafafa; } }
[data-theme="mono"] .stats div { background: var(--grey); box-shadow: none; }
[data-theme="mono"] .chart .bar, [data-theme="mono"] .hbar-fill { fill: #000; background: #000; }
[data-theme="mono"] .chart-bar:hover .bar { fill: #555; }
[data-theme="mono"] .hbar-track { background: var(--grey); }

/* Tabs, chips, tiles: grey track, black selection */
[data-theme="mono"] .seg, [data-theme="mono"] .steps-tabs, [data-theme="mono"] .dtabs { background: var(--grey); box-shadow: none; border-radius: 999px; }
[data-theme="mono"] .dtab { border-radius: 999px; color: #000; font-weight: 600; }
[data-theme="mono"] .dtab[aria-selected="true"], [data-theme="mono"] .seg button[aria-selected="true"], [data-theme="mono"] .steps-tabs button[aria-selected="true"] { color: #fff; background: #000; box-shadow: none; }
[data-theme="mono"] .seg button, [data-theme="mono"] .steps-tabs button { color: #000; font-weight: 600; }
[data-theme="mono"] .step-no { color: #fff; background: #000; border-radius: 50%; }
[data-theme="mono"] .chip, [data-theme="mono"] .tile span { border-radius: 999px; color: #000; background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); font-weight: 500; }
[data-theme="mono"] .tile input:checked + span { color: #fff; background: #000; box-shadow: none; }
[data-theme="mono"] .qr-types { padding: 6px; gap: 4px; }
[data-theme="mono"] .type-tab > span { border-radius: 999px; color: #000; font-weight: 600; height: 48px; }
[data-theme="mono"] .type-ico { background: var(--grey); color: #000; box-shadow: none; border-radius: 50%; width: 34px; height: 34px; }
[data-theme="mono"] .type-tab input:checked + span { color: #fff; background: #000; box-shadow: none; }
[data-theme="mono"] .type-tab input:checked + span .type-ico { color: #000; background: #fff; }
[data-theme="mono"] .type-more { border-radius: 999px; color: #000; box-shadow: inset 0 0 0 1px var(--line-strong); height: 48px; }
@media (hover: hover) and (pointer: fine) { [data-theme="mono"] .type-tab:not(:has(input:checked)) > span:hover { background: var(--grey); } }
[data-theme="mono"] .dynamic-toggle { background: var(--grey); border-radius: 14px; }
[data-theme="mono"] .dsec, [data-theme="mono"] .custom-shape { background: var(--grey); box-shadow: none; }
[data-theme="mono"] .preview-box { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .scan-status.ok { color: #0b6b47; }
[data-theme="mono"] .theme-pick { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .theme-pick:has(input:checked) { box-shadow: inset 0 0 0 2px #000; }
.theme-swatch.theme-mono { background: #fff; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }
.theme-mono i { background: #f0f0f0; }
.theme-mono i:nth-child(3) { background: #000; }
[data-theme="mono"] .logo-preview { box-shadow: inset 0 0 0 1px var(--line); border-radius: 20px; }
[data-theme="mono"] .dl-list { background: #fff; }
[data-theme="mono"] .menu-list { box-shadow: 0 0 0 1px var(--line), 0 20px 40px -20px rgb(0 0 0 / .25); }
[data-theme="mono"] .auth { box-shadow: inset 0 0 0 1px var(--line); padding: 40px 36px; }

/* ---------- the virtual card in monochrome ---------- */
[data-theme="mono"] .card-page { background: #f2f0f1; }
[data-theme="mono"] .preview-stage { background: #f2f0f1; box-shadow: none; }
[data-theme="mono"] .idc {
  --ink: #000;
  --ink-2: #404040;
  --ink-3: #666;
  --line: rgb(0 0 0 / .1);
  --row: #f0f0f0;
  --row-hi: #e6e6e6;
  --ok: #0b6b47;
  color-scheme: light;
  color: #000;
  background: #fff;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 0 0 1px rgb(0 0 0 / .08), 0 30px 60px -40px rgb(0 0 0 / .45);
}
[data-theme="mono"] .idc-hero::before { background: #e9e7e8; -webkit-mask-image: none; mask-image: none; }
[data-theme="mono"] .idc-hero-img { filter: grayscale(1) contrast(1.05); -webkit-mask-image: none; mask-image: none; }
[data-theme="mono"] .idc-hero::after { background: linear-gradient(180deg, rgb(0 0 0 / .28) 0%, transparent 22%); }
[data-theme="mono"] .idc-hero-initials { color: #000; font-family: var(--display); font-weight: 400; }
[data-theme="mono"] .idc-hero .idc-valid { color: #fff; background: rgb(0 0 0 / .45); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .25); }
[data-theme="mono"] .idc .idc-name { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: 0; font-size: clamp(1.45rem, 6.6vw, 1.9rem); line-height: 1.02; }
[data-theme="mono"] .idc .idc-logo { box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .idc-web { color: #000; }
[data-theme="mono"] .idc-chip { background: #fff; color: #000; box-shadow: inset 0 0 0 1px var(--line-strong, rgb(0 0 0 / .18)); }
[data-theme="mono"] .idc-chip strong { color: #000; }
[data-theme="mono"] .idc-chip.ok { color: #0b6b47; background: #e9f6ef; box-shadow: none; }
[data-theme="mono"] .idc-bio { color: #404040; }
[data-theme="mono"] .idc .idc-actions a { color: #000; }
[data-theme="mono"] .idc .idc-actions a .icon { color: #fff; background: #000; box-shadow: none; }
[data-theme="mono"] .idc .idc-socials a { color: #000; background: #fff; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .18); }
[data-theme="mono"] .idc-watermark { filter: grayscale(1); mix-blend-mode: multiply; opacity: .05; }
[data-theme="mono"] .idc-dock-btn { color: #000; background: #fff; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .18); }
[data-theme="mono"] .idc .idc-add { color: #fff; background: #000; box-shadow: none; }
[data-theme="mono"] .idc-add-plus { color: #000; background: #fff; }
[data-theme="mono"] .idc-qr { box-shadow: 0 0 0 1px rgb(0 0 0 / .1), 0 40px 80px -40px rgb(0 0 0 / .5); }
[data-theme="mono"] .idc-qr-close { background: #f0f0f0; color: #000; }

/* Opening screen in monochrome */
[data-theme="mono"].splash-on .splash { background: #fff; }
[data-theme="mono"] .splash-tile { box-shadow: 0 0 0 1px rgb(0 0 0 / .1); }
[data-theme="mono"] .splash-name { font-family: var(--display); text-transform: uppercase; color: #000; letter-spacing: 0; font-size: 1.05rem; }
[data-theme="mono"] .splash-bar { background: #f0f0f0; }
[data-theme="mono"] .splash-bar i { background: #000; }

/* "Not valid" and links pages */
[data-theme="mono"] .idc .idc-valid { color: #000; background: #f0f0f0; box-shadow: none; }
[data-theme="mono"] .idc-top.invalid .idc-valid { color: #b42330; background: #fdeceb; }
[data-theme="mono"] .idc-body.message strong { color: #000; }
[data-theme="mono"] .idc .link-stack .btn-outline { color: #000; background: #fff; }

/* ---------- fit fixes (measured at 1280×640, 1366×657, 1440×800, 1920×960) ---------- */
.idc-body { overflow: clip; }
.idc-watermark { top: 0; }
.presets { margin: 0; }
.presets .chip { margin: 0; }
.dpanel.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.designer.tabbed .dpanel.presets { display: flex; }

/* QR content: main field beside the title; bigger field sets span the row */
.qr-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; align-content: start; }
.qr-content > * { grid-column: 1 / -1; }
.qr-content > .type-fields:not(:has(.form-grid, .link-row, textarea)) { grid-column: 1; }
.qr-content > .type-fields:not(:has(.form-grid, .link-row, textarea)) ~ label:not(.check) { grid-column: 2; }
.qr-content > .type-fields:not(:has(.form-grid, .link-row, textarea)) ~ label:not(.check) .hint { display: none; }
.qr-content > .type-fields:not(:has(.form-grid, .link-row, textarea)) > .hint { display: none; }
.qr-content .type-fields .form-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.qr-content .link-row { margin-bottom: 6px; }
.qr-content .dynamic-toggle { margin: 0; }
.qr-content .step-next { margin-top: 12px; }
.qr-content textarea { min-height: 0; }

/* Compact scan stats inside tabs */
.editor .breakdowns, .editor details.small, .details-pane .breakdowns, .details-pane details.small { display: none; }
.editor .chart svg, .details-pane .chart svg { max-height: 130px; }

@media (min-width: 1024px) and (min-height: 600px) {
  .editor { grid-template-rows: minmax(0, 1fr); }
  .editor-form { overflow: hidden; }
  .editor-preview .preview-stage { max-height: 100%; }
  .qr-studio { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "types side" "main side"; }
  .qr-studio.edit { grid-template-areas: "main side"; }
  .qr-side { align-self: stretch; display: flex; flex-direction: column; gap: 12px; }
  .qr-side .preview-box { flex: 1 1 auto; max-height: none; min-height: 0; width: 100%; aspect-ratio: auto; }
  .qr-side .btn-block { margin-top: 0; }
  .qr-side .scan-status { margin: 0; min-height: 0; }
  .qr-side-stack { align-self: stretch; }
  .qr-side-stack .qr-side { height: 100%; }
  .qr-main { overflow: hidden; }
  .card-design { flex: 1 1 auto; min-height: 0; display: flex; }
  .card-design > .panel { flex: 1; margin: 0; min-height: 0; }
  .card-design .designer-preview .preview-box { aspect-ratio: auto; height: min(320px, calc(100dvh - 330px)); }
  .settings-grid .theme-picks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-grid .theme-pick { flex-direction: column; align-items: flex-start; }
  .settings-grid .theme-swatch { width: 100%; height: 48px; }
  .settings-grid { align-items: stretch; }
}

/* Monochrome: tighter vertical rhythm on short windows so everything fits */
@media (min-width: 1024px) and (max-height: 820px) {
  [data-theme="mono"] .page-head { margin-bottom: 18px; }
  [data-theme="mono"] .page-head p { margin-top: 4px; }
  [data-theme="mono"] .panel { padding: 22px; }
  [data-theme="mono"] .form label { margin-bottom: 12px; gap: 5px; }
  [data-theme="mono"] input, [data-theme="mono"] select { padding-top: 10px; padding-bottom: 10px; }
  [data-theme="mono"] .topbar-inner { padding-top: 10px; padding-bottom: 10px; }
  body.app:not(.auth-page) > .container { padding-top: 18px !important; padding-bottom: 18px !important; }
  .qr-step { padding: 18px 22px; }
  .qr-main .steps-tabs { margin: 18px 22px 0; }
  .editor-form { gap: 14px; }
  .photo-row { gap: 14px; }
  .photo-row .avatar.lg { width: 64px; height: 64px; }
}

/* ---------- fit fixes, round 2 ---------- */
[data-theme="mono"] .panel.qr-types { padding: 6px; }
.qr-types { align-self: start; }
.type-tab > span { gap: 8px; padding: 0 14px 0 6px; font-size: .88rem; }
.form label.type-tab, .type-tab { min-width: 0; }
.type-ico { width: 32px; height: 32px; }
[data-theme="mono"] .type-ico { width: 32px; height: 32px; }

/* Page titles stay on one line; actions keep their place */
.page-head { flex-wrap: nowrap; }
.page-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.page-head > div:first-child h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head > .btn-row, .page-head > .btn, .page-head > a.btn { flex: none; margin-top: 0; }
@media (max-width: 820px) { .page-head { flex-wrap: wrap; } .page-head > div:first-child h1 { white-space: normal; } }

/* Editor preview: the card at phone size (390 × 780), scaled to fit the frame */
.editor-preview .preview-stage { position: relative; display: block; padding: 0; }
.editor-preview .preview-stage .idc {
  position: absolute; top: 12px; left: 50%; width: 390px; max-width: none; height: 780px;
  transform: translateX(-50%) scale(var(--fit, .6)); transform-origin: top center;
}

/* ---------- fit fixes, round 3 ---------- */
.qr-name { margin: 0 !important; }
.content-foot { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.content-foot .dynamic-toggle { flex: 1; margin: 0; }
.content-foot .step-next { margin: 0; }
.qr-content > .type-fields { grid-column: 1 / -1 !important; }
.qr-content .type-fields .link-row { margin-bottom: 8px; }
.qr-content .type-fields > .hint { margin: 0 0 8px; }
/* Corners / Logo: labels beside their options */
[data-tab-panel="corners"], [data-tab-panel="logo"] { display: grid; grid-template-columns: 92px minmax(0, 1fr); column-gap: 12px; align-items: center; }
[data-tab-panel="corners"] > *, [data-tab-panel="logo"] > * { grid-column: 1 / -1; }
[data-tab-panel="corners"] > .hint { grid-column: 1; margin: 0 0 8px !important; }
[data-tab-panel="corners"] > .tiles { grid-column: 2; }
[data-tab-panel="logo"] > label:first-of-type { grid-column: 1 / -1; }
[data-tab-panel="logo"] { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
[data-tab-panel="logo"] > label { grid-column: auto; }
[data-tab-panel="logo"] > .hint { grid-column: 1 / -1; order: 3; }
.designer.tabbed .dpanel-title { display: none; }
.settings-grid .logo-preview { width: 72px; height: 72px; border-radius: 16px; }
.settings-grid .form-section { margin-bottom: 0; }
@media (max-height: 680px) {
  .card-page .idc-hero, .idc-hero { min-height: 84px; }
  .card-page .idc .idc-name { font-size: 1.3rem; }
  .card-page .idc-chips { margin-top: 8px; }
  .card-page .idc .idc-actions { margin-top: 10px; }
  .card-page .idc .idc-socials { margin-top: 8px; }
  .card-page .idc .idc-socials a { width: 34px; height: 34px; }
  .card-page .idc-dock { padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- short laptop windows (under 700px tall): tighter vertical rhythm ---------- */
@media (min-width: 1024px) and (max-height: 700px) {
  .page-head.compact > div > p.muted:not(:has(.badge)) { display: none; }
  .page-head.compact { margin-bottom: 14px !important; }
  .type-tab > span, [data-theme="mono"] .type-tab > span, .type-more, [data-theme="mono"] .type-more { height: 42px; }
  .type-ico, [data-theme="mono"] .type-ico { width: 30px; height: 30px; }
  .qr-content .type-fields > .hint, .qr-content .type-fields > p.hint { display: none; }
  .form label, [data-theme="mono"] .form label { margin-bottom: 10px; }
  input, select, [data-theme="mono"] input, [data-theme="mono"] select { padding-top: 8px; padding-bottom: 8px; }
  .qr-main .steps-tabs { margin: 14px 22px 0 !important; }
  .qr-step { padding: 14px 22px !important; }
  .seg button, .steps-tabs button { padding-top: 7px; padding-bottom: 7px; }
  .dtabs { margin-bottom: 10px; }
  .dtab { padding: 6px 10px; }
  .settings-grid .form-section { padding-top: 14px; }
  .editor .chart svg, .details-pane .chart svg { max-height: 100px; }
}
[data-theme="mono"] input:focus-visible, [data-theme="mono"] select:focus-visible, [data-theme="mono"] textarea:focus-visible { outline: none; }

/* Monochrome card: the photo dissolves into the white details panel instead of a hard edge,
   and the name block rides up onto the faded part so the two read as one surface. */
[data-theme="mono"] .idc-hero-img,
[data-theme="mono"] .idc-hero::before {
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 58%, rgb(0 0 0 / .55) 78%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 58%, rgb(0 0 0 / .55) 78%, transparent 100%);
}
[data-theme="mono"] .idc-body { margin-top: -56px; position: relative; z-index: 1; background: linear-gradient(180deg, rgb(255 255 255 / 0) 0, #fff 56px); }

/* ==========================================================================
   Top-bar panels and dropdowns: smooth open / quicker close
   ========================================================================== */
.topbar-inner { position: relative; }
.nav-trigger { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer; font: inherit; padding: 7px 13px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.nav-trigger .icon { width: 16px; height: 16px; transition: transform 200ms var(--ease-out); }
.nav-trigger[aria-expanded="true"] .icon { transform: rotate(180deg); }
.nav-trigger.active { color: var(--brand); }
[data-theme="mono"] .nav-trigger { color: #000; font-weight: 500; padding: 8px 12px; border-radius: 999px; }
[data-theme="mono"] .nav-trigger.active { font-weight: 700; box-shadow: inset 0 -2px 0 #000; border-radius: 0; }
[data-theme="mono"] .nav-trigger[aria-expanded="true"] { background: #f0f0f0; border-radius: 999px; box-shadow: none; }
[data-theme="night"] .app .nav-trigger { color: var(--ink-2); }
[data-theme="night"] .app .nav-trigger.active, [data-theme="night"] .app .nav-trigger[aria-expanded="true"] { color: #fff; background: rgb(255 255 255 / .08); }

.mega {
  position: absolute; z-index: 40; top: calc(100% + 10px); left: 16px; width: min(760px, calc(100vw - 32px));
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 12px; border-radius: 20px;
  background: var(--menu-bg, #fff); box-shadow: 0 0 0 1px var(--line), 0 24px 60px -20px rgb(0 0 0 / .3);
  opacity: 0; transform: translateY(-8px) scale(.985); transform-origin: top left;
  transition: opacity 140ms ease-out, transform 140ms var(--ease-out);
}
.mega.is-open { opacity: 1; transform: none; transition-duration: 200ms, 220ms; }
.mega-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; border-radius: 14px; text-decoration: none; color: var(--menu-ink, #0c1a3d); transition: background-color 120ms ease; }
.mega-item strong { display: block; font-size: .93rem; font-weight: 700; }
.mega-item span span { display: block; font-size: .84rem; color: var(--ink-3); margin-top: 2px; }
.mega-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--brand); box-shadow: inset 0 0 0 1px var(--line); background: var(--menu-bg, #fff); }
.mega-ico .icon { width: 20px; height: 20px; }
.mega-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .mega-item:hover { background: rgb(0 0 0 / .04); } }
[data-theme="night"] .mega { --menu-bg: #0e1d52; --menu-ink: #fff; }
[data-theme="night"] .mega-ico { color: var(--hi, #9fe9ff); }
[data-theme="night"] .mega-item:hover { background: rgb(255 255 255 / .06); }
[data-theme="mono"] .mega-ico { color: #000; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }

/* The page behind dims while a top-bar panel is open */
.nav-scrim { position: fixed; inset: 0; z-index: 15; background: rgb(10 12 20 / .22); opacity: 0; pointer-events: none; transition: opacity 140ms ease-out; }
.nav-scrim.is-open { opacity: 1; pointer-events: auto; transition-duration: 200ms; }

/* Dropdowns (Download QR, More, Download menu on QR pages) use the same motion */
html.js .menu > .menu-list, html.js .dl-menu > .dl-list {
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top left;
  transition: opacity 140ms ease-out, transform 140ms var(--ease-out);
}
html.js .menu-list.right { transform-origin: top right; }
html.js .qr-side-stack .dl-menu > .dl-list { transform: translateY(6px) scale(.98); transform-origin: bottom center; }
html.js .menu.is-open > .menu-list, html.js .dl-menu.is-open > .dl-list { opacity: 1; transform: none; transition-duration: 200ms, 220ms; }

@media (max-width: 720px) {
  .mega { left: 8px; right: 8px; width: auto; grid-template-columns: 1fr; top: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .mega, html.js .menu > .menu-list, html.js .dl-menu > .dl-list { transform: none !important; }
  .nav-trigger .icon { transition: none; }
}

/* ==========================================================================
   Wider layout: the top bar spans the window (logo top-left, Sign out top-right)
   and the content lines up with it.
   ========================================================================== */
:root { --gutter: clamp(16px, 3vw, 48px); }
.topbar-inner { max-width: none; padding-left: var(--gutter); padding-right: var(--gutter); }
.container { max-width: none; padding-left: var(--gutter); padding-right: var(--gutter); }
.nav { flex: 0 1 auto; }
.nav-user { margin-left: auto; }
.mega { left: var(--gutter); }
@media (min-width: 1700px) {
  .editor { grid-template-columns: minmax(0, 1fr) 420px; }
  .qr-studio { grid-template-columns: minmax(0, 1fr) 380px; }
}

/* ==========================================================================
   QR studio: one framed, centred composition (after QRFY)
   Grey frame → white type bar → white content card + grey preview column with the QR on a white tile.
   ========================================================================== */
.qr-studio {
  --studio-frame: rgb(0 0 0 / .035);
  width: 100%; max-width: 1280px; margin: 0 auto; padding: 10px; border-radius: 28px; background: var(--studio-frame);
  grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "types types" "main side"; gap: 10px;
}
.qr-studio.edit { grid-template-areas: "main side"; }
[data-theme="night"] .qr-studio { --studio-frame: rgb(255 255 255 / .04); }
.qr-studio > .panel, .qr-studio > aside > .panel { box-shadow: none; border-radius: 20px; }
[data-theme="mono"] .qr-studio > .panel, [data-theme="mono"] .qr-studio > aside > .panel { box-shadow: none; }

/* Type bar: tabs sized to their labels, More at the end */
.qr-studio .qr-types { padding: 8px !important; gap: 4px; flex-wrap: nowrap; }
.qr-studio .type-tab, .qr-studio .form label.type-tab { flex: 0 0 auto; min-width: 0; }
.qr-studio .qr-types.expanded { flex-wrap: wrap; }
.qr-studio .qr-types.expanded .type-tab { flex: 0 0 auto; }
.qr-studio .type-more { margin-left: auto; }

/* Content card */
.qr-studio .qr-main { padding: 0; }
.qr-studio .qr-step .type-fields, .qr-studio .qr-content > * { max-width: 760px; }
.qr-studio .content-foot { max-width: 760px; }

/* Preview column */
.qr-studio .qr-side { background: var(--grey, rgb(0 0 0 / .04)); align-items: center; justify-content: center; padding: 28px 24px; gap: 14px; }
[data-theme="night"] .qr-studio .qr-side { background: rgb(255 255 255 / .04); }
.qr-studio .qr-side .preview-box {
  flex: none; width: clamp(150px, calc(100dvh - 470px), 280px); aspect-ratio: 1; height: auto; max-height: none; margin: 0;
  padding: 16px; border-radius: 18px; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 14px 32px -14px rgb(0 0 0 / .28);
}
.qr-studio .qr-side .scan-status { align-self: center; text-align: center; }
.qr-studio .qr-side .qr-name, .qr-studio .qr-side > .btn-block, .qr-studio .qr-side .dl-menu { width: 100%; }
.qr-studio .qr-side-stack { display: block; }
.qr-studio .qr-side-stack .qr-side { height: 100%; }
@media (max-width: 960px) {
  .qr-studio { grid-template-columns: 1fr; grid-template-areas: "types" "main" "side"; padding: 8px; border-radius: 22px; }
  .qr-studio.edit { grid-template-areas: "main" "side"; }
  .qr-studio .qr-side .preview-box { width: min(260px, 70vw); }
}

/* ==========================================================================
   Monochrome · professional refinement
   One typeface (Geist), a 14px interface scale, compact 36px controls with 8px corners,
   hairline borders, quiet segmented tabs. Overrides the earlier Monochrome rules.
   Type scale: 12 · 13 · 14 · 16 · 20 · 24 px.  Spacing: 4 · 8 · 12 · 16 · 24 · 32 px.
   ========================================================================== */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/static/fonts/geist.woff2) format('woff2-variations'), url(/static/fonts/geist.woff2) format('woff2'); }

html[data-theme="mono"] {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: var(--font);
  --ink: #0a0a0a;
  --ink-2: #525252;
  --ink-3: #6b6b6b;
  --line: #e7e7e7;
  --line-strong: #d4d4d4;
  --grey: #f5f5f5;
  --radius: 12px;
  --ctl: 36px;
  font-family: var(--font);
  font-feature-settings: 'ss01' 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[data-theme="mono"] body { font-size: 14px; line-height: 1.5; color: var(--ink); letter-spacing: -0.006em; }
[data-theme="mono"] button, [data-theme="mono"] input, [data-theme="mono"] select, [data-theme="mono"] textarea { font-family: var(--font); letter-spacing: inherit; }

/* Headings: sentence case, semibold, tight tracking */
[data-theme="mono"] h1, [data-theme="mono"] .page-head h1 { font-family: var(--font); font-weight: 600; text-transform: none; font-size: 24px; line-height: 1.25; letter-spacing: -0.025em; }
[data-theme="mono"] h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 12px; }
[data-theme="mono"] h3 { font-size: 13px; font-weight: 600; }
[data-theme="mono"] .page-head { margin-bottom: 24px; align-items: center; }
[data-theme="mono"] .page-head p { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
[data-theme="mono"] .crumbs { font-size: 13px; }
[data-theme="mono"] .hint, [data-theme="mono"] .muted.small, [data-theme="mono"] small { font-size: 12.5px; }

/* Top bar: 56px, brand in the text face */
[data-theme="mono"] .topbar-inner { padding-top: 0; padding-bottom: 0; height: 56px; gap: 28px; }
[data-theme="mono"] .brand { font-family: var(--font); font-weight: 600; font-size: 15px; text-transform: none; letter-spacing: -0.015em; gap: 10px; }
[data-theme="mono"] .brand-mark { width: 26px; height: 26px; border-radius: 7px; }
[data-theme="mono"] .nav { gap: 2px; align-self: stretch; align-items: stretch; }
[data-theme="mono"] .nav a, [data-theme="mono"] .nav-trigger {
  display: inline-flex; align-items: center; height: 100%; padding: 0 12px; border-radius: 0; background: none;
  font-size: 14px; font-weight: 500; color: var(--ink-2); box-shadow: none; text-decoration: none;
}
[data-theme="mono"] .nav a.active, [data-theme="mono"] .nav-trigger.active { color: var(--ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
[data-theme="mono"] .nav-trigger[aria-expanded="true"] { color: var(--ink); background: none; box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
@media (hover: hover) and (pointer: fine) { [data-theme="mono"] .nav a:not(.active):hover, [data-theme="mono"] .nav-trigger:hover { color: var(--ink); text-decoration: none; } }
[data-theme="mono"] .nav-user .btn { font-size: 14px; font-weight: 500; color: var(--ink-2); }

/* Surfaces */
[data-theme="mono"] .panel { padding: 20px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .panel.flush { padding: 0; }
[data-theme="mono"] body.app:not(.auth-page) > .container { padding-top: 28px; padding-bottom: 28px; }

/* Buttons: 36px, 8px corners */
[data-theme="mono"] .btn { min-height: var(--ctl); height: var(--ctl); padding: 0 14px; border-radius: 8px; font-size: 14px; font-weight: 500; gap: 6px; color: #fff; background: var(--ink); box-shadow: none; }
[data-theme="mono"] .btn-lg { min-height: 40px; height: 40px; padding: 0 18px; font-size: 14px; }
[data-theme="mono"] .btn-sm { min-height: 30px; height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
[data-theme="mono"] .btn-outline { color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); }
[data-theme="mono"] .btn-ghost { color: var(--ink-2); background: transparent; box-shadow: none; }
[data-theme="mono"] .btn-danger { color: #b42318; background: #fff; box-shadow: inset 0 0 0 1px #f1c4c0; }
[data-theme="mono"] .btn .icon { width: 16px; height: 16px; }
@media (hover: hover) and (pointer: fine) {
  [data-theme="mono"] .btn:hover { background: #262626; }
  [data-theme="mono"] .btn-outline:hover, [data-theme="mono"] .btn-ghost:hover { background: var(--grey); color: var(--ink); }
}

/* Fields: outlined, 36px */
[data-theme="mono"] input, [data-theme="mono"] select, [data-theme="mono"] textarea {
  height: var(--ctl); padding: 0 11px; border-radius: 8px; font-size: 14px; color: var(--ink);
  background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong);
}
[data-theme="mono"] textarea { height: auto; padding: 8px 11px; line-height: 1.45; }
[data-theme="mono"] input[type=checkbox], [data-theme="mono"] input[type=radio] { height: auto; padding: 0; box-shadow: none; width: 15px; height: 15px; margin-top: 2px; }
[data-theme="mono"] input[type=color] { height: var(--ctl); width: 52px; padding: 3px; }
[data-theme="mono"] input[type=file] { height: auto; padding: 6px; font-size: 13px; }
[data-theme="mono"] input[type=file]::file-selector-button { height: 26px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink); background: var(--grey); box-shadow: inset 0 0 0 1px var(--line-strong); }
[data-theme="mono"] input[type=search] { border-radius: 8px; padding-left: 11px; }
[data-theme="mono"] input:focus, [data-theme="mono"] select:focus, [data-theme="mono"] textarea:focus { background: #fff; box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 3px rgb(0 0 0 / .07); }
[data-theme="mono"] input::placeholder, [data-theme="mono"] textarea::placeholder { color: #a3a3a3; }
[data-theme="mono"] .form label { font-size: 13px; font-weight: 500; color: var(--ink); gap: 6px; margin-bottom: 14px; }
[data-theme="mono"] .form label.check, [data-theme="mono"] label.check { font-size: 13.5px; font-weight: 400; gap: 8px; }
[data-theme="mono"] .form-grid { column-gap: 16px; }
[data-theme="mono"] .form-section legend { font-size: 13px; font-weight: 600; padding-bottom: 12px; }

/* Segmented tabs: grey track, white sliding chip */
[data-theme="mono"] .seg, [data-theme="mono"] .steps-tabs, [data-theme="mono"] .dtabs { gap: 2px; padding: 3px; border-radius: 9px; background: var(--grey); box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .seg button, [data-theme="mono"] .steps-tabs button, [data-theme="mono"] .dtab {
  height: 28px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: transparent; box-shadow: none; gap: 6px;
}
[data-theme="mono"] .seg button[aria-selected="true"], [data-theme="mono"] .steps-tabs button[aria-selected="true"], [data-theme="mono"] .dtab[aria-selected="true"] {
  color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .08), inset 0 0 0 1px var(--line);
}
[data-theme="mono"] .step-no { width: 18px; height: 18px; font-size: 11px; font-weight: 600; color: var(--ink-2); background: #e5e5e5; border-radius: 50%; }
[data-theme="mono"] .steps-tabs button[aria-selected="true"] .step-no { color: #fff; background: var(--ink); }

/* Chips and option tiles */
[data-theme="mono"] .chip, [data-theme="mono"] .tile span { height: 30px; display: inline-flex; align-items: center; padding: 0 11px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); }
[data-theme="mono"] .tile input:checked + span { color: #fff; background: var(--ink); box-shadow: none; }
@media (hover: hover) and (pointer: fine) { [data-theme="mono"] .chip:hover { box-shadow: inset 0 0 0 1px var(--ink); color: var(--ink); } }

/* Feedback */
[data-theme="mono"] .alert { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 450; box-shadow: inset 0 0 0 1px var(--line); background: #fafafa; }
[data-theme="mono"] .alert-success { background: #f0faf4; color: #0b6b47; box-shadow: inset 0 0 0 1px #cdebd9; }
[data-theme="mono"] .alert-error { background: #fef3f2; color: #b42318; box-shadow: inset 0 0 0 1px #fbd5d1; }
[data-theme="mono"] .alert-warn { background: #fffaeb; color: #93370d; box-shadow: inset 0 0 0 1px #fde7b5; }
[data-theme="mono"] .badge { height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; }

/* Lists */
[data-theme="mono"] .table th { font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3); background: #fafafa; }
[data-theme="mono"] .table th, [data-theme="mono"] .table td { padding: 12px 16px; }
[data-theme="mono"] .table td { font-size: 14px; }
[data-theme="mono"] .avatar { width: 32px; height: 32px; font-size: 12px; }
[data-theme="mono"] .cell-person { gap: 10px; }
[data-theme="mono"] .cell-person a { font-weight: 500; }
[data-theme="mono"] .people a { padding: 10px 8px; }
[data-theme="mono"] .people .who strong { font-weight: 500; }
[data-theme="mono"] .stats div { background: #fff; box-shadow: inset 0 0 0 1px var(--line); border-radius: 10px; padding: 12px 14px; }
[data-theme="mono"] .stats strong { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
[data-theme="mono"] .summary { font-size: 14px; color: var(--ink-3); }
[data-theme="mono"] .summary strong { font-weight: 600; color: var(--ink); }
[data-theme="mono"] .empty { font-size: 13.5px; padding: 24px 12px; }
[data-theme="mono"] .empty strong { font-size: 14px; font-weight: 500; }

/* Top-bar panels */
[data-theme="mono"] .mega { top: calc(100% + 6px); width: min(640px, calc(100vw - 32px)); padding: 8px; gap: 2px; border-radius: 14px; box-shadow: 0 0 0 1px var(--line), 0 16px 40px -16px rgb(0 0 0 / .22); }
[data-theme="mono"] .mega-item { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 10px; border-radius: 10px; }
[data-theme="mono"] .mega-item strong { font-size: 14px; font-weight: 500; }
[data-theme="mono"] .mega-item span span { font-size: 12.5px; }
[data-theme="mono"] .mega-ico { width: 36px; height: 36px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .mega-ico .icon { width: 17px; height: 17px; }
[data-theme="mono"] .nav-scrim { background: rgb(0 0 0 / .12); }
[data-theme="mono"] .menu-list { border-radius: 12px; padding: 6px; min-width: 210px; }
[data-theme="mono"] .menu-list a, [data-theme="mono"] .menu-list button { padding: 8px 10px; border-radius: 7px; font-size: 13.5px; font-weight: 500; }

/* QR studio */
[data-theme="mono"] .qr-studio { --studio-frame: #fafafa; padding: 8px; gap: 8px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .qr-studio > .panel, [data-theme="mono"] .qr-studio > aside > .panel { border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .qr-studio .qr-types { padding: 6px !important; gap: 2px; }
[data-theme="mono"] .type-tab > span { height: 34px; padding: 0 12px 0 10px; gap: 8px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
[data-theme="mono"] .type-ico { width: auto; height: auto; background: none; border-radius: 0; color: inherit; }
[data-theme="mono"] .type-ico .icon { width: 16px; height: 16px; }
[data-theme="mono"] .type-tab input:checked + span { color: #fff; background: var(--ink); }
[data-theme="mono"] .type-tab input:checked + span .type-ico { color: #fff; background: none; }
[data-theme="mono"] .type-more { height: 34px; padding: 0 10px 0 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
@media (hover: hover) and (pointer: fine) { [data-theme="mono"] .type-tab:not(:has(input:checked)) > span:hover { background: var(--grey); color: var(--ink); } }
[data-theme="mono"] .qr-main .steps-tabs { margin: 16px 20px 0; }
[data-theme="mono"] .qr-step { padding: 16px 20px 20px; }
[data-theme="mono"] .dynamic-toggle { padding: 9px 12px; border-radius: 8px; background: #fafafa; box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; }
[data-theme="mono"] .qr-studio .qr-side { background: #fafafa; padding: 24px 20px; gap: 12px; }
[data-theme="mono"] .qr-studio .qr-side .preview-box { border-radius: 12px; padding: 14px; box-shadow: 0 0 0 1px var(--line), 0 8px 24px -14px rgb(0 0 0 / .22); }
[data-theme="mono"] .scan-status { font-size: 12.5px; }
[data-theme="mono"] .dl-list { border-radius: 10px; padding: 6px; }
[data-theme="mono"] .dl-list a { padding: 8px 10px; font-size: 13.5px; font-weight: 500; }

/* Card editor */
[data-theme="mono"] .editor-form { gap: 16px; }
[data-theme="mono"] .photo-row .avatar.lg { width: 56px; height: 56px; font-size: 18px; }
[data-theme="mono"] .preview-stage { background: #fafafa; box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px; }

/* Settings + login */
[data-theme="mono"] .theme-pick { padding: 10px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .theme-pick:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--ink); }
[data-theme="mono"] .theme-pick strong { font-size: 13.5px; font-weight: 500; }
[data-theme="mono"] .logo-preview { border-radius: 12px; }
[data-theme="mono"] .auth { max-width: 360px; padding: 32px 28px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
[data-theme="mono"] .auth h1 { font-size: 20px; margin-top: 12px; }
[data-theme="mono"] .auth .brand-mark.lg { width: 44px; height: 44px; border-radius: 10px; }

/* Virtual card: same face, no uppercase display type */
[data-theme="mono"] .idc .idc-name { font-family: var(--font); font-weight: 650; text-transform: none; font-size: clamp(1.45rem, 6.2vw, 1.75rem); letter-spacing: -0.03em; line-height: 1.12; }
[data-theme="mono"] .idc .idc-role { font-size: 14.5px; font-weight: 500; color: #404040; }
[data-theme="mono"] .idc .idc-org, [data-theme="mono"] .idc-web { font-size: 13.5px; }
[data-theme="mono"] .idc-bio { font-size: 14px; }
[data-theme="mono"] .idc .idc-actions a { font-size: 11.5px; font-weight: 500; }
[data-theme="mono"] .idc .idc-actions a .icon { width: 46px; height: 46px; padding: 13px; }
[data-theme="mono"] .idc-dock-btn { width: 46px; height: 46px; }
[data-theme="mono"] .idc .idc-add { height: 46px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
[data-theme="mono"] .idc-add-plus { width: 36px; height: 36px; }
[data-theme="mono"] .idc-hero-initials { font-family: var(--font); font-weight: 300; letter-spacing: -0.05em; }
[data-theme="mono"] .splash-name { font-family: var(--font); text-transform: none; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

/* ---------- composition on large screens ---------- */
/* Content sits in one centred column; the top bar stays full width (logo left, Sign out right). */
body.app > .container { max-width: 1440px; margin-left: auto; margin-right: auto; }
.qr-studio { max-width: none; }
/* Type tabs size to their labels */
.qr-studio .qr-types label.type-tab, .qr-studio .qr-types .type-tab { flex: 0 0 auto; }
/* Panels take the height their content needs instead of stretching to the window */
@media (min-width: 1024px) and (min-height: 600px) {
  .qr-studio { flex: 0 1 auto !important; }
  .qr-studio.edit { grid-template-rows: auto; }
  .editor { align-items: start; flex: 0 1 auto !important; }
  .editor-form { align-self: start; }
  .editor-preview { height: min(calc(100dvh - 210px), 780px); }
  .card-design { flex: 0 1 auto !important; }
  .settings-grid { flex: 0 1 auto !important; align-items: start; }
}

/* Tooltips for icon-only buttons on the card (borrowed from the "label on hover" idea):
   fade + lift in 150 ms on hover or keyboard focus; hidden on touch-only devices. */
.idc-dock-btn[aria-label], .idc-socials a[aria-label] { position: relative; }
.idc-dock-btn[aria-label]::after, .idc-socials a[aria-label]::after {
  content: attr(aria-label); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 5;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  font: 500 12px/1.4 var(--font, inherit); letter-spacing: 0; color: #fff; background: #0a0a0a;
  opacity: 0; transform: translate(-50%, 4px); transition: opacity 120ms ease-out, transform 150ms var(--ease-out);
}
.idc-dock-btn[aria-label]:focus-visible::after, .idc-socials a[aria-label]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
@media (hover: hover) and (pointer: fine) {
  .idc-dock-btn[aria-label]:hover::after, .idc-socials a[aria-label]:hover::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 150ms; }
}
.preview-stage .idc-dock-btn::after, .preview-stage .idc-socials a::after { display: none; }
@media (prefers-reduced-motion: reduce) { .idc-dock-btn::after, .idc-socials a::after { transform: translate(-50%, 0) !important; } }
.qr-studio > .qr-main, .qr-studio > .qr-side, .qr-studio > .qr-side-stack { align-self: stretch; }

/* ---------- opening loader (after Uiverse "TamaniPhiri", rebuilt without Tailwind) ----------
   A 112px ring (8px light track, one coloured arc) spins once a second; the company logo in the
   centre turns with it and pings: swells to 2x while fading out, on repeat. */
html.splash-on .splash { gap: 0; }
.loader {
  width: 112px; height: 112px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 8px solid #d1d5db; border-top-color: var(--company, #60a5fa);
  animation: loader-spin 1s linear infinite;
}
.loader-mark {
  width: 40px; height: 40px; object-fit: contain; display: grid; place-items: center;
  font: 700 18px/1 var(--font, inherit); color: var(--company, #60a5fa);
  animation: loader-ping 1s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-ping { 75%, 100% { transform: scale(2); opacity: 0; } }
[data-theme="night"] .loader { border-color: rgb(255 255 255 / .18); border-top-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .loader, .loader-mark { animation: none; }
}

/* ---------- Design: every option in one panel, two balanced columns ---------- */
.design-sheet { columns: 2; column-gap: 32px; }
.design-sheet > .dpanel { break-inside: avoid; margin: 0 0 16px !important; padding: 0; display: block !important; background: none; box-shadow: none; }
.design-sheet > .dpanel[hidden] { display: block !important; }
.design-sheet .dpanel-title { display: block !important; margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); text-transform: none; }
.design-sheet .tiles, .design-sheet .presets { margin: 0; gap: 6px; }
.design-sheet .dpanel.presets { display: flex !important; flex-wrap: wrap; gap: 6px; }
.design-sheet .dpanel.presets .dpanel-title { flex-basis: 100%; margin-bottom: 2px; }
.design-sheet .hint { margin: 6px 0 0; }
.design-sheet .color-row { gap: 10px; }
.design-sheet .color-row label { margin-bottom: 0; }
.design-sheet .check { margin: 8px 0 0 !important; }
/* Corners: frame and centre as two labelled rows */
.design-sheet [data-tab-panel="corners"] > .hint { display: block; margin: 8px 0 6px !important; font-size: 12px; }
.design-sheet [data-tab-panel="corners"] > .hint:first-of-type { margin-top: 0 !important; }
.design-sheet [data-tab-panel="corners"] > input[type=color] { margin-top: 8px; }
/* Logo / photo: file field and size side by side */
.design-sheet [data-tab-panel="logo"] { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; align-items: end; }
.design-sheet [data-tab-panel="logo"] > .dpanel-title, .design-sheet [data-tab-panel="logo"] > .hint, .design-sheet [data-tab-panel="logo"] > button { grid-column: 1 / -1; }
.design-sheet [data-tab-panel="logo"] > label { margin: 0; }
.design-sheet [data-tab-panel="photo-qr"] > label, .design-sheet [data-tab-panel="frame"] > .color-row { margin-top: 0; }
.design-sheet [data-tab-panel="frame"] > .tiles { margin-bottom: 8px; }
.design-sheet input[type=file] { max-width: 100%; }
.design-sheet input[type=range] { padding: 0; height: 24px; box-shadow: none; background: none; }
.design-sheet .btn-ghost.btn-sm { margin-top: 6px; padding-left: 0; }
@media (max-width: 760px) { .design-sheet { columns: 1; } }
/* Short windows: drop helper hints and tighten tiles so the whole sheet still fits */
@media (min-width: 1024px) and (max-height: 760px) {
  .design-sheet > .dpanel { margin-bottom: 10px !important; }
  .design-sheet > .dpanel > .hint:not([data-tab-panel="corners"] .hint), .design-sheet [data-tab-panel="logo"] > .hint, .design-sheet [data-tab-panel="photo-qr"] > .hint, .design-sheet [data-tab-panel="colours"] > .hint { display: none; }
  .design-sheet .dpanel-title { margin-bottom: 5px; }
  [data-theme="mono"] .design-sheet .chip, [data-theme="mono"] .design-sheet .tile span { height: 27px; padding: 0 9px; font-size: 12.5px; }
}

/* ---------- Design sheet, compact: one labelled row per group ---------- */
.design-sheet > .dpanel { display: grid !important; grid-template-columns: 64px minmax(0, 1fr); column-gap: 12px; align-items: start; margin: 0 0 12px !important; }
.design-sheet > .dpanel > * { grid-column: 2; }
.design-sheet > .dpanel > .dpanel-title { grid-column: 1; grid-row: 1 / span 6; margin: 0 !important; line-height: 30px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.design-sheet .dpanel.presets { display: grid !important; }
.design-sheet .dpanel.presets > .dpanel-title { grid-row: 1 / span 9; }
.design-sheet .dpanel.presets > .chip { grid-column: auto; }
.design-sheet .dpanel.presets { grid-template-columns: 64px repeat(auto-fill, minmax(0, max-content)); gap: 6px; column-gap: 6px; }
.design-sheet .dpanel.presets > .dpanel-title { margin-right: 6px !important; }
.design-sheet .hint.sub { margin: 0 0 4px !important; font-size: 11.5px; line-height: 1.2; }
.design-sheet .tiles + .hint.sub { margin-top: 6px !important; }
/* Logo: the group label says it all; upload + size side by side */
.design-sheet [data-tab-panel="logo"] { grid-template-columns: 64px minmax(0, 1fr) 140px !important; }
.design-sheet [data-tab-panel="logo"] > label:first-of-type { grid-column: 2; font-size: 0; gap: 0; margin: 0; }
.design-sheet [data-tab-panel="logo"] > label:nth-of-type(2) { grid-column: 3; font-size: 11.5px; color: var(--ink-3); margin: 0; gap: 2px; }
.design-sheet [data-tab-panel="logo"] > .hint, .design-sheet [data-tab-panel="logo"] > button { grid-column: 2 / -1; }
.design-sheet [data-tab-panel="photo-qr"] > label:first-of-type { font-size: 0; gap: 0; margin: 0; }
.design-sheet [data-tab-panel="colours"] .color-row label { font-size: 11.5px; color: var(--ink-3); gap: 3px; }
.design-sheet [data-tab-panel="frame"] .color-row label { font-size: 11.5px; color: var(--ink-3); gap: 3px; }
.design-sheet [data-tab-panel="frame"] .color-row input:not([type=color]) { width: 160px; }
.design-sheet .custom-shape { margin-top: 8px; }
@media (min-width: 1024px) and (max-height: 760px) {
  .design-sheet > .dpanel { margin-bottom: 8px !important; }
  .design-sheet > .dpanel > .dpanel-title { line-height: 27px; }
  .design-sheet .color-row input[type=color], .design-sheet .color-row select, .design-sheet .color-row input { height: 32px; }
  .design-sheet [data-tab-panel="corners"] .check { margin-top: 4px !important; }
}
/* Short laptop windows: three narrow columns, group label above its row */
@media (min-width: 1200px) and (max-height: 760px) {
  .design-sheet { columns: 3; column-gap: 24px; }
  .design-sheet > .dpanel, .design-sheet .dpanel.presets { grid-template-columns: minmax(0, 1fr) !important; }
  .design-sheet .dpanel.presets { grid-template-columns: repeat(auto-fill, minmax(0, max-content)) !important; }
  .design-sheet [data-tab-panel="logo"] { grid-template-columns: minmax(0, 1fr) 110px !important; }
  .design-sheet > .dpanel > * { grid-column: 1; }
  .design-sheet .dpanel.presets > .chip { grid-column: auto; }
  .design-sheet [data-tab-panel="logo"] > label:first-of-type { grid-column: 1; }
  .design-sheet [data-tab-panel="logo"] > label:nth-of-type(2) { grid-column: 2; }
  .design-sheet [data-tab-panel="logo"] > .hint, .design-sheet [data-tab-panel="logo"] > button { grid-column: 1 / -1; }
  .design-sheet > .dpanel > .dpanel-title, .design-sheet .dpanel.presets > .dpanel-title { grid-column: 1 / -1; grid-row: auto; line-height: 1.2; margin: 0 0 6px !important; }
  .design-sheet [data-tab-panel="frame"] .color-row input:not([type=color]) { width: 100%; }
}
/* Design sheet: tight wraps, colour pickers on one line */
.design-sheet .dpanel.presets { display: flex !important; flex-wrap: wrap; gap: 6px; align-items: center; }
.design-sheet .dpanel.presets > .dpanel-title { flex: 0 0 100%; margin: 0 0 2px !important; line-height: 1.2; }
.design-sheet .tiles { gap: 6px !important; row-gap: 6px !important; align-content: flex-start; margin-bottom: 0; }
.design-sheet .tiles > * { margin: 0 !important; }
.design-sheet .color-row { display: flex !important; flex-wrap: nowrap; gap: 8px; align-items: flex-end; margin: 0; }
.design-sheet .color-row label { margin: 0; min-width: 0; }
.design-sheet .color-row input[type=color] { width: 40px; height: 30px; padding: 2px; }
.design-sheet .color-row select { height: 30px; min-width: 0; width: 100%; }
.design-sheet .color-row label:has(select), .design-sheet [data-tab-panel="frame"] .color-row label:first-child { flex: 1 1 auto; }
.design-sheet [data-tab-panel="frame"] .color-row input:not([type=color]) { width: 100% !important; height: 30px; }
.design-sheet .check { margin: 6px 0 0 !important; font-size: 12.5px; }
.design-sheet [data-tab-panel="frame"] .tiles { margin-bottom: 8px; }

/* ---------- Design sheet: icon tiles (after Uiverse "icon-box" by barisdogansutcu) ---------- */
.itile { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.itile input { position: absolute; opacity: 0; pointer-events: none; }
.ibox { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: #fff; color: var(--ink); box-shadow: rgb(99 99 99 / .2) 0 2px 8px 0;
  transition: transform .2s ease, box-shadow .2s ease, background-color .15s ease, color .15s ease; }
button.ibox { border: 0; padding: 0; position: relative; cursor: pointer; }
.ibox svg { width: 22px; height: 22px; display: block; }
.itile input:checked + .ibox { background: var(--ink); color: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .18); }
.itile input:focus-visible + .ibox, button.ibox:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.itile:active .ibox, button.ibox:active { transform: scale(.95); }
.itile .tip { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translate(-50%, 4px); white-space: nowrap; font-size: 11.5px; font-weight: 500; line-height: 1; padding: 5px 7px; border-radius: 5px; background: var(--ink); color: #fff; opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease; z-index: 6; }
.itile input:focus-visible ~ .tip, button.itile:focus-visible .tip { opacity: 1; transform: translate(-50%, 0); }
@media (hover: hover) {
  .itile:hover .ibox, button.ibox:hover { transform: translateY(-2px); box-shadow: rgb(99 99 99 / .28) 0 6px 14px 0; }
  .itile input:checked + .ibox:hover { box-shadow: 0 6px 14px rgb(0 0 0 / .25); }
  .itile:hover .tip { opacity: 1; transform: translate(-50%, 0); transition-delay: 120ms; }
}
@media (prefers-reduced-motion: reduce) { .ibox, .itile .tip { transition: none; } .itile:hover .ibox, button.ibox:hover { transform: none; } }

/* Roomier sheet now that options are icons */
.design-sheet, .design-sheet:is(*) { columns: 2 !important; column-gap: 56px !important; }
.design-sheet > .dpanel { margin: 0 0 22px !important; }
.design-sheet > .dpanel > .dpanel-title { line-height: 40px; }
.design-sheet .tiles { gap: 8px !important; }
.design-sheet .tiles + .tiles { margin-top: 8px; }
.design-sheet .tiles[data-sub]::before { content: attr(data-sub); width: 40px; align-self: center; font-size: 11.5px; color: var(--ink-3); }
.design-sheet .dpanel.presets { display: grid !important; grid-template-columns: 64px minmax(0, 1fr) !important; }
.design-sheet .dpanel.presets > .dpanel-title { flex: none; margin: 0 !important; line-height: 40px; }
.design-sheet .dpanel.presets > .tiles { grid-column: 2; }
@media (min-width: 1024px) and (max-height: 760px) {
  .design-sheet > .dpanel { margin-bottom: 14px !important; }
  .design-sheet > .dpanel > .dpanel-title, .design-sheet .dpanel.presets > .dpanel-title { grid-column: 1; grid-row: 1 / span 6; line-height: 36px; margin: 0 !important; }
  .design-sheet > .dpanel, .design-sheet .dpanel.presets { grid-template-columns: 64px minmax(0, 1fr) !important; }
  .design-sheet > .dpanel > * { grid-column: 2; }
  .design-sheet [data-tab-panel="logo"] { grid-template-columns: 64px minmax(0, 1fr) 120px !important; }
  .design-sheet [data-tab-panel="logo"] > label:first-of-type { grid-column: 2; }
  .design-sheet [data-tab-panel="logo"] > label:nth-of-type(2) { grid-column: 3; }
  .design-sheet [data-tab-panel="logo"] > button { grid-column: 2 / -1; }
  .ibox { width: 36px; height: 36px; }
  .ibox svg { width: 20px; height: 20px; }
}
@media (max-width: 760px) { .design-sheet, .design-sheet:is(*) { columns: 1 !important; } }
.design-sheet .dpanel.presets { gap: 0 !important; column-gap: 0 !important; }
.design-sheet .dpanel.presets > .dpanel-title { grid-row: 1 !important; grid-column: 1 !important; }
.design-sheet .dpanel.presets > .tiles { grid-row: 1; }
/* Group labels: one line, centred on their first row of tiles at every size */
.design-sheet .dpanel-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 40px; line-height: 40px !important; align-self: start; }
@media (min-width: 1024px) and (max-height: 760px) { .design-sheet .dpanel-title { height: 36px; line-height: 36px !important; } }
.design-sheet .tiles[data-sub]::before { line-height: 1; }
.design-sheet [data-tab-panel="colours"] > .dpanel-title { margin-top: 16px !important; }
@media (min-width: 1024px) and (max-height: 760px) { .design-sheet [data-tab-panel="colours"] > .dpanel-title { margin-top: 17px !important; } }

/* ---------- Settings: theme cards stack (preview on top, words below) ---------- */
.settings-grid .theme-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 12px; }
.settings-grid label.theme-pick { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; padding: 10px !important; min-width: 0; }
.settings-grid label.theme-pick .theme-swatch { width: 100% !important; height: 56px !important; }
.settings-grid label.theme-pick > span:last-child { display: block; min-width: 0; padding: 0 2px 2px; }
.settings-grid label.theme-pick strong { font-size: 13.5px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-grid label.theme-pick small { display: block; font-size: 12px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .settings-grid .theme-picks { grid-template-columns: 1fr !important; } .settings-grid label.theme-pick { flex-direction: row !important; align-items: center !important; } .settings-grid label.theme-pick .theme-swatch { width: 72px !important; height: 44px !important; } }

/* ---------- Password fields: show / hide eye ---------- */
.pw-field { position: relative; display: block; }
.pw-field input { width: 100%; padding-right: 44px !important; }
.pw-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); cursor: pointer; transition: color .15s ease, background-color .15s ease; }
.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle:hover { color: var(--ink); background: rgb(0 0 0 / .05); }
.pw-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
.pw-toggle .eye-slash { display: none; }
.pw-toggle[aria-pressed="true"] .eye-slash { display: inline; }
[data-theme="night"] .pw-toggle:hover { background: rgb(255 255 255 / .08); }
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }

/* ---------- Low-poly background: full on sign-in, a faint wash behind the app ---------- */
:root { --poly: url('../img/poly-bg.jpg'); --poly: image-set(url('../img/poly-bg.webp') type('image/webp'), url('../img/poly-bg.jpg') type('image/jpeg')); }
:is([data-theme="mono"], [data-theme="day"]) body.app::before {
  content: ""; display: block !important; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(rgb(250 250 250 / .84), rgb(250 250 250 / .84)), var(--poly) center / cover no-repeat;
}
:is([data-theme="mono"], [data-theme="day"]) body.app { background: #f6f6f7; }
:is([data-theme="mono"], [data-theme="day"]) body.app.auth-page::before { background: var(--poly) center / cover no-repeat; }
:is([data-theme="mono"], [data-theme="day"]) body.app.auth-page { background: #b9b9bb; }
/* Panels and the top bar float on the wash */
[data-theme="mono"] body.app:not(.auth-page) .panel { box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / .03); }
[data-theme="mono"] body.app .topbar { background: rgb(255 255 255 / .82); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); }
/* Sign-in card: solid white, soft lift, gentle entrance */
:is([data-theme="mono"], [data-theme="day"]) .auth-page .auth {
  background: rgb(255 255 255 / .96); border-radius: 16px;
  box-shadow: 0 1px 0 rgb(255 255 255 / .6) inset, 0 24px 60px -12px rgb(0 0 0 / .28), 0 4px 14px rgb(0 0 0 / .08);
  animation: auth-in .5s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .auth-page .auth { animation: none !important; } }
