/* Bidadari Card — application UI. Design tokens follow the Bidadari family (List, Check-In, Seal):
   violet accent, system fonts, light/dark via data-theme (theme.js, shared cookie across *.bidadari.app). */
:root {
  --bg: #faf9ff;
  --surface: #ffffff;
  --surface-2: #f4f2fc;
  --text: #1d1830;
  --muted: #5f5a75;
  --border: #e3defa;
  --brand: #6d4fd8;
  --brand-strong: #5a3dc2;
  --brand-soft: #f0ecff;
  --on-brand: #ffffff;
  --accent-grad: linear-gradient(135deg, #7c5ce6, #6240d0);
  --glow: radial-gradient(60rem 30rem at 50% -10%, rgb(167 139 250 / 18%), transparent 70%);
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #12703f;
  --success-soft: #e7f6ee;
  --warn: #8a5a00;
  --warn-soft: #fff4dd;
  --focus-color: #3b2fb8;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgb(29 24 48 / 6%), 0 12px 32px rgb(109 79 216 / 10%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --width: 780px;
  --focus: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent);
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09070f; --surface: #14111f; --surface-2: #1b1730; --text: #f1eefc; --muted: #aaa4c4; --border: #2b2542;
  --brand: #b79cff; --brand-strong: #cbb8ff; --brand-soft: #231c3d; --on-brand: #14102a;
  --accent-grad: linear-gradient(135deg, #c4b5fd, #a78bfa);
  --glow: radial-gradient(60rem 30rem at 50% -10%, rgb(167 139 250 / 22%), transparent 70%);
  --danger: #ff8a7a; --danger-soft: #3a1a17; --success: #6fd6a0; --success-soft: #11291d; --warn: #f0b94d; --warn-soft: #3a2d10;
  --focus-color: #c4b5fd; --shadow: 0 1px 2px rgb(0 0 0 / 50%), 0 12px 32px rgb(0 0 0 / 45%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--glow) no-repeat top center, var(--bg); background-color: var(--bg); color: var(--text); font: 1rem/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 5vw, 2rem); overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-underline-offset: 2px; }
img, svg { max-width: 100%; }
img { display: block; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; word-break: break-all; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--on-brand); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; border-radius: 6px; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

/* Layout (same structure as the other Bidadari apps) */
.site-header, .site-footer { width: 100%; max-width: var(--width); margin: 0 auto; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-header { flex-wrap: nowrap; }
body.wide .site-header, body.wide .site-footer, body.wide .wrap { max-width: 1080px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 44px; font-weight: 650; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand .wordmark { height: 15px; width: auto; color: var(--text); flex: none; }
.brand-sub { font-size: .72rem; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: var(--brand); padding-left: 10px; border-left: 1.5px solid var(--border); line-height: 1; margin-left: 2px; }
.nav, .site-footer nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nav { margin-left: auto; }
.nav a, .nav button, .site-footer nav a, .site-footer nav button { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; background: none; border: 0; font: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover, .site-footer nav a:hover, .site-footer nav button:hover { color: var(--text); background: var(--brand-soft); }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 650; }
.nav form { margin: 0; }
.wrap { width: 100%; max-width: var(--width); margin: 0 auto; padding: 8px 16px 40px; flex: 1; }
.site-footer { margin-top: auto; padding-top: 32px; padding-bottom: 32px; border-top: 1px solid var(--border); font-size: .9rem; color: var(--muted); }
.site-footer p { margin: 0; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.theme-btn { width: 44px; height: 44px; padding: 0 !important; justify-content: center; }
.theme-btn .icon { width: 22px; height: 22px; display: none; }
:root:not([data-theme="dark"]) .theme-btn .t-light, :root[data-theme="dark"] .theme-btn .t-dark { display: block; }
@media (max-width: 560px) {
  .site-header { flex-wrap: wrap; row-gap: 2px; padding-bottom: 8px; }
  .nav { margin-left: -8px; width: 100%; justify-content: flex-start; gap: 2px; }
  .nav a, .nav button { padding: 8px 10px; min-height: 40px; font-size: .92rem; }
  .brand img { width: 32px; height: 32px; }
  .brand .wordmark { height: 13px; }
  .brand-sub { font-size: .66rem; letter-spacing: .24em; padding-left: 8px; }
  .site-footer { flex-direction: column; align-items: flex-start; }
  .site-footer nav { margin-left: -8px; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: 12px 22px; border: 1.5px solid transparent; border-radius: 12px; background: var(--accent-grad); color: var(--on-brand); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; transition: background .15s, transform .1s; }
.btn:hover { background: var(--brand-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.outline { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger.outline:hover { background: var(--danger-soft); }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: .9rem; border-radius: 10px; }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: .8rem 1.6rem; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 0; width: 44px; }
.btn.sm.icon-only { width: 40px; }

/* Forms */
.field { margin-bottom: 16px; }
.field label, .label, legend { display: block; font-weight: 600; margin-bottom: .35rem; }
.hint { color: var(--muted); font-size: .9rem; margin-top: .35rem; }
.err { color: var(--danger); font-size: .92rem; margin-top: .35rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; font: inherit; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1.5 1.75 7 7.25l5.5-5.5' stroke='%237a7498' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 14px 9px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--danger); }
input[type=color] { width: 48px; height: 48px; padding: 3px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--bg); cursor: pointer; }
input[type=file] { font: inherit; max-width: 100%; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; font-weight: 400; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
@media (max-width: 560px) { .panel { padding: 18px; } }
.panel + .panel { margin-top: 16px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel.flat { box-shadow: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: .92rem; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--success-soft); color: var(--success); }
.banner { background: var(--warn-soft); color: var(--warn); }
.banner-inner { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .92rem; }
.banner a { color: inherit; font-weight: 600; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } .stats.six { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .stats.six { grid-template-columns: repeat(6, 1fr); } }
.stat { box-shadow: var(--shadow); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .num { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .cap { color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* Dashboard */
.dash-grid { display: grid; gap: 24px; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list li { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.card-list li:first-child { border-top: 0; }
.card-list .grow { flex: 1; min-width: 180px; }
.card-list .name { font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.empty { text-align: center; padding: 48px 20px; }
.empty .icon-wrap { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; margin: 0 auto 16px; }
.empty .icon-wrap .icon { width: 26px; height: 26px; }
.preview-frame { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--border); max-height: 560px; }
.preview-frame::after { content: ""; position: absolute; inset: auto 0 0 0; height: 90px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }

/* Segmented control */
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented a, .segmented button { padding: 8px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font: inherit; font-size: .9rem; font-weight: 600; border: 0; background: none; cursor: pointer; min-height: 40px; }
.segmented [aria-current="true"], .segmented [aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Chart */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--brand); }
.chart .bar:hover { fill: var(--brand-strong); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.actions-list { list-style: none; margin: 0; padding: 0; }
.actions-list li { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; padding: 8px 0; }
.actions-list svg { width: 100%; height: 10px; display: block; }
.actions-list .count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Toasts + dialog */
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: .92rem; box-shadow: 0 8px 28px rgba(0,0,0,.25); animation: toast-in .25s ease; }
.toast.error { background: var(--danger); color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
dialog { border: 1px solid var(--border); border-radius: 18px; padding: 24px; max-width: min(92vw, 420px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 8, 20, .55); }
dialog h2 { margin-top: 0; }
dialog .row { justify-content: flex-end; margin-top: 20px; }

/* Home / hero (as on List) */
.hero { text-align: center; padding: 24px 0 20px; }
.hero-mark { display: block; margin: 0 auto; border-radius: 18px; }
.hero h1 { font-size: clamp(1.7rem, 6.4vw, 2.8rem); line-height: 1.15; margin: 12px 0; letter-spacing: -.02em; text-wrap: balance; }
.lede { color: var(--muted); font-size: 1.1rem; max-width: 56ch; margin: 0 auto 8px; }
.hero-cta { margin-top: 20px; display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.how { margin-top: 32px; }
.how h2 { font-size: 1.3rem; margin: 0 0 12px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.step-icon { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.steps strong { font-size: 1.05rem; }
.steps span { color: var(--muted); font-size: .92rem; }
@media (max-width: 480px) { .steps { grid-template-columns: 1fr; } }
.features { margin: 32px 0 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature .icon-wrap { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 10px; }
.feature h3 { margin-bottom: 4px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.band { margin-top: 28px; }
.prose { padding-top: 16px; }
.prose h1 { font-size: 2rem; margin: 0 0 8px; }
.prose h2 { margin-top: 32px; font-size: 1.3rem; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 8px 0; }
.iphone-mockup { width: min(100%, 390px); margin: 32px auto 0; padding: 9px; border: 1px solid #34323c; border-radius: 48px; background: linear-gradient(145deg, #36343e, #17161b 55%, #3d3b44); box-shadow: 0 28px 70px rgba(31, 24, 48, .24), inset 0 0 0 1px rgba(255,255,255,.18); }
.iphone-screen { position: relative; height: min(740px, 78vh); min-height: 520px; overflow: hidden; border-radius: 39px; background: var(--page-bg); }
.iphone-status { height: 38px; position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; color: #17151f; font-size: 11px; font-weight: 700; }
.iphone-island { position: absolute; left: 50%; top: 8px; width: 92px; height: 22px; transform: translateX(-50%); border-radius: 99px; background: #17161b; }
.mini-card { max-width: none; height: calc(100% - 38px); margin: 0; }
.mini-card .pc-stage.is-embedded { height: 100%; max-height: none; overflow-y: auto; padding: 14px 12px 28px; border: 0; border-radius: 0; scrollbar-width: none; }
.mini-card .pc-stage.is-embedded::-webkit-scrollbar { display: none; }
.iphone-home-indicator { position: absolute; z-index: 2; bottom: 7px; left: 50%; width: 112px; height: 4px; transform: translateX(-50%); border-radius: 99px; background: #17161b; }

/* Card builder */
.builder { display: grid; gap: 24px; }
@media (min-width: 960px) { .builder { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; } .builder .preview-col { position: sticky; top: 84px; } .view-toggle { display: none !important; } }
@media (max-width: 959px) {
  .builder[data-view="edit"] .preview-col { display: none; }
  .builder[data-view="preview"] .editor-col { display: none; }
}
.builder-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.builder-head h1 { margin: 0; font-size: 1.5rem; }
.builder-head .tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.view-toggle { margin-bottom: 16px; }
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.section-sub { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.photo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.photo-thumb { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font-weight: 700; font-size: 1.4rem; overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.items { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.item-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.item-row.dragging { opacity: .5; }
.item-row.drop-before { box-shadow: 0 -3px 0 var(--brand); }
.item-row.is-hidden .item-fields { opacity: .55; }
.item-handle { cursor: grab; color: var(--muted); display: grid; place-items: center; width: 28px; height: 44px; }
.item-fields { display: grid; gap: 8px; min-width: 0; }
.item-type { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item-btns { display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 560px) { .item-fields.two { grid-template-columns: 1fr 1.4fr; } .item-btns { flex-direction: row; } }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .themes { grid-template-columns: repeat(6, 1fr); } }
.theme-opt { position: relative; }
.theme-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.theme-opt .swatch { display: grid; gap: 6px; justify-items: center; padding: 10px 6px; border: 2px solid var(--border); border-radius: 12px; font-size: .8rem; font-weight: 600; }
.theme-opt .chip { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); position: relative; }
.theme-opt .chip i { position: absolute; left: 20%; right: 20%; bottom: 18%; height: 18%; border-radius: 99px; }
.theme-opt input:checked + .swatch { border-color: var(--brand); box-shadow: var(--focus); }
.theme-opt input:focus-visible + .swatch { box-shadow: var(--focus); }
.savebar { position: static; margin: 24px 0 0; padding: 12px 0 0; background: transparent; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.savebar .grow { flex: 1; color: var(--muted); font-size: .88rem; }
.savebar .dirty-dot { display: none; }
body.is-dirty .savebar .dirty-dot { display: inline; color: var(--warn); font-weight: 600; }
.pc-stage.is-embedded { border-radius: 24px; border: 1px solid var(--border); overflow: hidden; max-height: 78vh; overflow-y: auto; }

/* QR page */
.qr-box { background: #fff; padding: 16px; border-radius: 16px; border: 1px solid var(--border); width: min(100%, 320px); margin: 0 auto; }
.qr-box svg, .qr-box .qr-svg { width: 100%; height: auto; display: block; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Utilities (no inline styles: the CSP forbids them) */
.m0 { margin: 0; } .mt-4 { margin-top: 4px; } .mt-12 { margin-top: 12px; }
.mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.mx-auto { margin-left: auto; margin-right: auto; } .maxw-520 { max-width: 520px; }
.center { text-align: center; } .center-row { justify-content: center; }
.grow-input { flex: 1; min-width: 200px; width: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0 0 20px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.vis-toggle { cursor: pointer; position: relative; }
.vis-toggle .off, .vis-toggle input:not(:checked) ~ .on { display: none; }
.vis-toggle input:not(:checked) ~ .off { display: inline-flex; }
.vis-toggle:focus-within { box-shadow: var(--focus); }
.theme-opt .chip { background: var(--page-bg); }
.theme-opt .chip i { background: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { padding: 0; }
.field .row { flex-wrap: nowrap; }
.field .row input[type=text] { flex: 1; min-width: 0; }
.preview-col .label { margin: 0 0 8px; }
.segmented .check { min-height: 40px; padding: 0 12px; border-radius: 9px; }
.segmented .check:has(input:checked) { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.segmented .check input { position: absolute; opacity: 0; }
.segmented .check:has(input:focus-visible) { box-shadow: var(--focus); }
.panel.flat { margin-top: 24px; }
.builder-head .badge { align-self: center; }

/* Builder refinements */
.item-fields.two { grid-template-columns: 1fr; }
.item-row { grid-template-columns: auto minmax(0, 1fr); }
.item-btns { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 8px; }
.theme-opt .swatch { border: 2px solid #d9d6e6; background: var(--surface); color: var(--text); }
.theme-opt input:checked + .swatch { border-color: var(--brand); }
.segmented .check { color: var(--muted); font-weight: 600; font-size: .9rem; cursor: pointer; }
.segmented .check:has(input:checked) { color: var(--text); }

.guest-foot { margin-top: 16px; text-align: center; color: var(--muted); font-size: .92rem; }
.guest-foot form { display: inline; }

.badge .icon { width: 14px; height: 14px; }
.badge { border: 1px solid var(--border); }
.badge.ok { border-color: transparent; }

/* ===== Maturity pass: consistent page header, settings layout, tables, charts ===== */
.page-head { margin: 8px 0 24px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600; min-height: 36px; margin-left: -2px; }
.crumb:hover { color: var(--text); }
.crumb .icon { width: 16px; height: 16px; }
.page-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.page-head-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions form { margin: 0; }
.lede-sm { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 650; background: var(--surface-2); color: var(--muted); line-height: 1.6; white-space: nowrap; vertical-align: middle; }
.badge.accent { background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

.panel h2 { font-size: 1.05rem; margin-bottom: .25rem; }
.panel-sub { color: var(--muted); font-size: .92rem; margin: 0 0 18px; }
.panel + .panel { margin-top: 18px; }

/* Settings rows: description left, controls right */
.setting { display: grid; gap: 18px 40px; }
@media (min-width: 820px) { .setting { grid-template-columns: 230px minmax(0, 1fr); } }
.setting h2 { margin: 0 0 4px; }
.setting .panel-sub { margin: 0; }
.setting-body > .field:last-child { margin-bottom: 0; }
.identity { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-grad); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; font-size: 1.35rem; flex: none; overflow: hidden; }
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.identity .meta { min-width: 0; }
.identity .meta strong { display: block; font-size: 1.1rem; }
.link-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Stats */
.stat { display: flex; flex-direction: column-reverse; gap: 2px; }
.stat .cap { font-weight: 600; font-size: .8rem; letter-spacing: .02em; color: var(--muted); }
.stat .num { font-size: 1.9rem; }
.stats.six .stat .num { font-size: 1.6rem; }

/* Tables */
.table-wrap { margin: 0 -8px; }
.table th { padding-top: 6px; }
.table td, .table th { padding: 13px 12px; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; font-weight: 650; }
.table a:hover { text-decoration: underline; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border: 1.5px solid var(--border); border-radius: 999px; background: transparent; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600; }
.chip:hover { background: var(--brand-soft); color: var(--text); }
.chip[aria-current="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.search-row { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.search-row input { flex: 1; min-width: 0; }

/* Dashboard card rows */
.card-list li { gap: 14px; padding: 16px 0; }
.card-thumb { width: 48px; height: 48px; border-radius: 50%; background: var(--accent-grad); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-list .name { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 1.02rem; }
.card-list .url { font-size: .85rem; color: var(--muted); text-decoration: none; word-break: break-all; }
.card-list .url:hover { color: var(--brand); text-decoration: underline; }

/* Analytics */
.chart .bar { fill: var(--brand); opacity: .9; transition: opacity .15s; }
.chart .bar:hover { opacity: 1; fill: var(--brand-strong); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis-line { stroke: var(--border); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-total { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.actions-list .bar-track { fill: var(--surface-2); }
.actions-list .bar-fill { fill: var(--brand); }
.actions-list li { grid-template-columns: 96px 1fr 36px; }
.grid.equal { align-items: stretch; }
.grid.equal > .panel { margin-top: 0; }
.panel .empty-note { color: var(--muted); padding: 24px 0; text-align: center; }

/* File pickers */
.file-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }
.file-pick label.btn { margin: 0; cursor: pointer; }
.file-pick:focus-within label.btn { box-shadow: var(--focus); }
.file-name { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }

/* Builder: compact link rows */
.items { container-type: inline-size; }
@container (min-width: 520px) {
  .item-fields.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
  .item-fields.two .item-type, .item-fields.two .err { grid-column: 1 / -1; }
}
.item-row { background: var(--surface-2); }
.item-row textarea { min-height: 72px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.section-head .icon-chip { width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.section-head .icon-chip .icon { width: 18px; height: 18px; }
.section-head h2 { margin: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); box-shadow: none; }

/* QR */
.qr-layout { display: grid; gap: 24px; }
@media (min-width: 760px) { .qr-layout { grid-template-columns: 340px minmax(0, 1fr); align-items: start; } }
.qr-box { width: 100%; max-width: 340px; margin: 0; }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tips li { display: flex; gap: 10px; color: var(--muted); font-size: .92rem; }
.tips .icon { color: var(--brand); margin-top: 2px; }
.copy-row { margin-top: 6px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }

/* ===== UX polish: form controls inside .field, section dividers, floating save bar ===== */
.field label, .label, legend { display: block; }
.field label.check, .field label.btn, .field .theme-opt, .field .segmented label { display: flex; margin: 0; font-weight: 400; }
.field label.btn { display: inline-flex; font-weight: 600; }
.file-pick label.btn { gap: 8px; }
.file-pick label.btn .icon { width: 18px; height: 18px; }
.field .segmented { padding: 3px; }
.field .segmented label.check { min-height: 40px; padding: 0 16px; align-items: center; font-weight: 600; color: var(--muted); border-radius: 9px; }
.field .segmented label.check:has(input:checked) { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.field label.check { gap: 10px; align-items: center; min-height: 44px; }
.field .row { gap: 14px; }
.field .row input[type=color] { flex: none; }

.section-head { padding-bottom: 14px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.section-head h2 { font-size: 1.05rem; }
.panel .section-head + .section-sub { margin-top: -6px; }
.editor-col .panel { padding: 24px 24px 22px; }
.editor-col .field > .label, .editor-col .field > legend { margin-bottom: .5rem; }
.editor-col fieldset.field { padding-bottom: 4px; }
.editor-col .field + .field { margin-top: 4px; }
.editor-col .panel .field:last-child { margin-bottom: 0; }
.editor-col hr.sep { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.danger-zone .section-head { border-bottom-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }

.savebar { background: transparent; border: 0; backdrop-filter: none; padding: 0 0 calc(14px + env(safe-area-inset-bottom)); margin: 20px 0 0; bottom: 0; justify-content: flex-end; pointer-events: none; }
.savebar > * { pointer-events: auto; }
.savebar .btn { box-shadow: 0 8px 24px rgb(80 50 190 / 28%); }
.savebar .grow { flex: none; }
.savebar .dirty-dot { background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 8px 14px; box-shadow: var(--shadow); font-size: .85rem; }
body.is-dirty .savebar .dirty-dot { display: inline-block; }

/* Share page */
.share-layout { display: grid; gap: 18px; align-items: start; }
@media (min-width: 900px) { .share-layout { grid-template-columns: minmax(0, 1fr) 340px; } }
.stack-col > .panel + .panel { margin-top: 18px; }
.share-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.share-wa { background: #1faa5b; color: #fff; }
.share-wa:hover { background: #178a49; }
:root[data-theme="dark"] .share-wa { background: #2dd47a; color: #052d17; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.inline-form { display: inline; margin-left: 10px; }
.mt-16 { margin-top: 16px; }
.link-preview { margin: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); max-width: 460px; box-shadow: var(--shadow); }
.link-preview img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--surface-2); }
.link-preview figcaption { display: grid; gap: 2px; padding: 12px 14px 14px; background: var(--surface-2); }
.link-preview figcaption strong { font-size: .98rem; }
.link-preview figcaption span { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-preview figcaption small { color: var(--muted); font-size: .78rem; }
.share-layout .qr-box { max-width: 100%; }
