/* ==========================================================================
   App chrome: panel, auth, marketing and error pages.
   Logically separate from the invitation front-end (invite.css).
   ========================================================================== */
:root {
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --line: #e7e4df;
  --line-strong: #d6d2cb;
  --text: #1d1b19;
  --text-2: #57534e;
  --muted: #8a847c;
  --accent: #6d4bd8;
  --accent-600: #5a3bc2;
  --accent-50: #f2eefc;
  --accent-100: #e6defa;
  --success: #1f8a5b; --success-50: #e7f6ee;
  --warning: #b86e00; --warning-50: #fdf3e2;
  --danger: #c2352b; --danger-50: #fdecea;
  --info: #2563a8; --info-50: #e8f1fb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .06);
  --shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 8px 24px -12px rgba(28, 25, 23, .14);
  --shadow-lg: 0 24px 60px -20px rgba(28, 25, 23, .35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --sidebar: 264px;
  --topbar: 60px;
  --control: 40px;
  --control-sm: 32px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 1.55rem; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 1.12rem; font-weight: 620; letter-spacing: -.01em; }
h3 { font-size: .98rem; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
:where(ul, ol)[role="list"] { list-style: none; margin: 0; padding: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 26px; height: 26px; }
.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: .5rem; }
.stack-lg { display: grid; gap: 1.5rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: .08em .35em; }

/* ---- Buttons --------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--control); padding: .45rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 550; font-size: .9rem; cursor: pointer; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #c9c4bc; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 4px 12px -6px var(--accent); }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a82b22; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.04); }
.btn-sm { min-height: var(--control-sm); padding: .25rem .65rem; font-size: .82rem; }
.btn-lg { min-height: 46px; padding: .6rem 1.3rem; font-size: 1rem; }
.btn-icon { width: var(--control); padding: 0; }
.btn-icon.btn-sm { width: var(--control-sm); }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Forms ------------------------------------------------------------------ */
.field { display: grid; gap: .35rem; }
.label { font-size: .84rem; font-weight: 560; color: var(--text-2); }
.hint { font-size: .8rem; color: var(--muted); }
.input, .select, .textarea { appearance: none; -webkit-appearance: none; width: 100%; min-height: var(--control); padding: .5rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 92px; resize: vertical; }
.select { padding-right: 2.1rem; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a847c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; }
.input::-webkit-search-decoration { -webkit-appearance: none; }
.input-sm, .select-sm { min-height: var(--control-sm); padding-top: .25rem; padding-bottom: .25rem; font-size: .85rem; }
.select.select-sm { padding-right: 1.9rem; background-position: right .6rem center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.field-error { color: var(--danger); font-size: .8rem; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: flex; align-items: center; padding: 0 .7rem; border: 1px solid var(--line-strong); border-right: 0; background: var(--surface-2); border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-size: .85rem; white-space: nowrap; }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.checkbox { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; }
.checkbox input { margin-top: .2rem; }
.row > .checkbox { align-items: center; }
.row > .checkbox input { margin-top: 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch__text { display: grid; gap: .1rem; }
.switch__title { font-weight: 560; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 999px; background: #d9d5ce; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: #ece9e4; border-radius: 10px; flex-wrap: wrap; }
.segmented button, .segmented label { border: 0; background: transparent; padding: .35rem .8rem; border-radius: 8px; font-size: .85rem; font-weight: 550; color: var(--text-2); cursor: pointer; }
.segmented button[aria-pressed="true"], .segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented label input { position: absolute; opacity: 0; }
.segmented label span { display: block; }

/* ---- Cards, badges, alerts -------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head p { color: var(--muted); font-size: .85rem; }
.card-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: #efece8; color: var(--text-2); white-space: nowrap; }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-accent { background: var(--accent-50); color: var(--accent-600); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.alert { display: flex; gap: .7rem; padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; border: 1px solid; }
.alert-success { background: var(--success-50); border-color: #bfe3cf; color: #145c3c; }
.alert-danger { background: var(--danger-50); border-color: #f3c2bd; color: #8d231b; }
.alert-info { background: var(--info-50); border-color: #c4d9f1; color: #1b4a80; }
.alert-warning { background: var(--warning-50); border-color: #f1d7a8; color: #7c4a00; }
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); display: grid; justify-items: center; gap: .6rem; }
.empty .icon-lg { color: var(--line-strong); width: 40px; height: 40px; }
.empty h3 { color: var(--text); }

/* ---- Panel layout ------------------------------------------------------------ */
.app { display: grid; min-height: 100vh; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .app { grid-template-columns: var(--sidebar) 1fr; } }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #1c1a24; color: #d8d4e6; display: flex; flex-direction: column; z-index: 60; transform: translateX(-100%); transition: transform .25s ease; }
.sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
@media (min-width: 1024px) { .sidebar { position: sticky; top: 0; height: 100vh; transform: none; } }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(20, 18, 26, .45); z-index: 55; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.25rem; color: #fff; font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; letter-spacing: -.01em; text-decoration: none !important; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #9b7bff, #e58fb4); display: grid; place-items: center; color: #fff; font-size: .95rem; }
.sidebar-event { margin: .25rem .75rem 1rem; padding: .75rem; border-radius: 10px; background: rgba(255,255,255,.06); }
.sidebar-event select { width: 100%; background: transparent; border: 0; color: #fff; font-weight: 600; padding: 0; cursor: pointer; }
.sidebar-event select option { color: var(--text); }
.sidebar-event .status { margin-top: .35rem; font-size: .75rem; color: #a9a3bd; display: flex; align-items: center; gap: .35rem; }
.nav { display: grid; gap: 2px; padding: 0 .75rem; overflow-y: auto; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: #807a93; padding: 1rem .6rem .4rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: 8px; color: #cfcadd; font-weight: 500; text-decoration: none !important; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(155, 123, 255, .18); color: #fff; }
.nav a[aria-current="page"] .icon { color: #b8a2ff; }
.nav .count { margin-left: auto; font-size: .72rem; background: rgba(255,255,255,.1); padding: .05rem .45rem; border-radius: 999px; }
.sidebar-foot { margin-top: auto; padding: 1rem .75rem; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: .6rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #6d4bd8, #d46a9c); color: #fff; display: grid; place-items: center; font-size: .78rem; font-weight: 700; flex: none; }
.sidebar-foot .name { font-size: .85rem; color: #fff; font-weight: 550; line-height: 1.2; }
.sidebar-foot .email { font-size: .75rem; color: #8f89a3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.sidebar-foot form { margin-left: auto; }
.sidebar-foot button { background: none; border: 0; color: #a39db7; cursor: pointer; padding: .35rem; border-radius: 6px; }
.sidebar-foot button:hover { color: #fff; background: rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar); display: flex; align-items: center; gap: .75rem; padding: 0 1rem; background: rgba(246, 245, 243, .85); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
@media (min-width: 768px) { .topbar { padding: 0 1.75rem; } }
.topbar .menu-btn { display: inline-flex; }
@media (min-width: 1024px) { .topbar .menu-btn { display: none; } }
.topbar-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.content { padding: 1.25rem 1rem 4rem; width: 100%; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-content: start; }
@media (min-width: 768px) { .content { padding: 1.75rem 1.75rem 4rem; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: .25rem; }

/* ---- Stats & charts ------------------------------------------------------------ */
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: .2rem; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: .35rem; }
.stat-value { font-size: 1.7rem; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .78rem; color: var(--text-2); }
.progress { height: 8px; border-radius: 999px; background: #ece9e4; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; width: 0; transition: width .5s ease; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: .5rem; }
.bars span { flex: 1; background: var(--accent-100); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars span:hover { background: var(--accent); }
.legend-list { display: grid; gap: .55rem; }
.legend-item { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.stacked { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #ece9e4; }
.stacked span { height: 100%; }

/* ---- Tables & lists -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .6rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfbfa; }
.table .actions { text-align: right; white-space: nowrap; }
.person-cell { display: flex; align-items: center; gap: .65rem; min-width: 180px; }
.person-cell .avatar { width: 30px; height: 30px; font-size: .72rem; }
@media (max-width: 720px) {
  .table-cards thead { display: none; }
  .table-cards tr { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
  .table-cards td { border: 0; padding: 0; }
  .table-cards td[data-hide-mobile] { display: none; }
  .table-cards .actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
}
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .83rem; font-weight: 550; color: var(--text-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.chip .n { font-size: .74rem; opacity: .7; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1 1 220px; }
.search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 2.2rem; }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.25rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

.sortable { display: grid; gap: .6rem; }
.sortable-item { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: box-shadow .15s, border-color .15s, opacity .15s; }
.sortable-item.is-dragging { opacity: .45; }
.sortable-item.is-over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.sortable-item.is-inactive { opacity: .6; }
.drag-handle { cursor: grab; color: var(--muted); border: 0; background: none; padding: .3rem; border-radius: 6px; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.session-date { display: grid; justify-items: center; width: 58px; padding: .35rem 0; border-radius: 10px; background: var(--accent-50); color: var(--accent-600); line-height: 1.1; }
.session-date b { font-size: 1.3rem; }
.session-date span { font-size: .7rem; text-transform: uppercase; font-weight: 600; }

/* ---- Media grid ------------------------------------------------------------------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; padding: 1.25rem; }
.media-tile { position: relative; border-radius: 10px; overflow: hidden; background: #ece9e4; aspect-ratio: 1; border: 2px solid transparent; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; }
.media-tile.is-selected { border-color: var(--accent); }
.media-tile .tile-check { position: absolute; top: .45rem; left: .45rem; width: 20px; height: 20px; accent-color: var(--accent); }
.media-tile .badge { position: absolute; top: .45rem; right: .45rem; }
.media-tile .overlay { position: absolute; inset: auto 0 0 0; display: flex; gap: .3rem; justify-content: center; padding: .5rem; background: linear-gradient(transparent, rgba(0,0,0,.6)); opacity: 0; transition: opacity .15s; }
.media-tile:hover .overlay, .media-tile:focus-within .overlay { opacity: 1; }
@media (hover: none) { .media-tile .overlay { opacity: 1; } }
.media-tile .overlay .btn { background: rgba(255,255,255,.95); border: 0; }
.media-meta { position: absolute; left: .5rem; bottom: 2.6rem; color: #fff; font-size: .72rem; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ---- Modal, toast, dropdown --------------------------------------------------------- */
dialog.modal { border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: var(--shadow-lg); color: var(--text); }
dialog.modal::backdrop { background: rgba(24, 20, 30, .5); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.35rem; display: grid; gap: 1rem; overflow-y: auto; max-height: calc(100vh - 12rem); }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.35rem; border-top: 1px solid var(--line); background: var(--surface-2); }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: grid; gap: .5rem; }
.toast { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-radius: 10px; background: #1f1c27; color: #fff; box-shadow: var(--shadow-lg); font-size: .9rem; max-width: 380px; animation: modal-in .2s ease; }
.toast.is-error { background: var(--danger); }
.toast.is-success .icon { color: #7ee2b0; }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 30; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: .35rem; display: grid; }
.menu-list button, .menu-list a { display: flex; align-items: center; gap: .55rem; padding: .5rem .65rem; border: 0; background: none; border-radius: 7px; text-align: left; cursor: pointer; color: var(--text); font-size: .88rem; text-decoration: none !important; }
.menu-list button:hover, .menu-list a:hover { background: var(--surface-2); }
.menu-list .danger { color: var(--danger); }

/* ---- Wizard -------------------------------------------------------------------------- */
.stepper { display: flex; gap: .35rem; overflow-x: auto; padding: .25rem 0 .5rem; scrollbar-width: thin; }
.step { flex: none; display: flex; align-items: center; gap: .5rem; padding: .45rem .8rem .45rem .45rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .82rem; color: var(--muted); text-decoration: none !important; }
.step b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #ece9e4; color: var(--text-2); font-size: .75rem; }
.step.is-done b { background: var(--success); color: #fff; }
.step.is-current { border-color: var(--accent); color: var(--text); font-weight: 600; }
.step.is-current b { background: var(--accent); color: #fff; }
.choice-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice-card { position: relative; display: grid; gap: .4rem; justify-items: center; text-align: center; padding: 1.1rem .75rem; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; font-weight: 560; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card:hover { border-color: var(--line-strong); }
.choice-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); background: var(--accent-50); }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-card .icon { width: 26px; height: 26px; color: var(--accent); }

/* ---- Template picker & preview --------------------------------------------------------- */
.tpl-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tpl-card { position: relative; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; text-align: left; padding: 0; }
.tpl-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl-card[aria-pressed="true"], .tpl-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.tpl-thumb { aspect-ratio: 9 / 13; overflow: hidden; background: #ece9e4; position: relative; }
.tpl-thumb iframe { width: 390px; height: 564px; border: 0; transform: scale(var(--s, .55)); transform-origin: 0 0; pointer-events: none; }
.tpl-info { padding: .75rem .9rem; display: grid; gap: .3rem; }
.tpl-swatches { display: flex; gap: 4px; }
.tpl-swatches i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.1); display: block; }
.device-bar { display: flex; justify-content: center; }
.device-stage { display: grid; place-items: center; padding: 1.5rem; background: repeating-conic-gradient(#efece8 0 25%, #f6f4f1 0 50%) 0 0 / 22px 22px; border-radius: var(--radius); border: 1px solid var(--line); overflow: auto; min-height: 70vh; }
.device { background: #111; border-radius: 36px; padding: 12px; box-shadow: var(--shadow-lg); transition: width .3s ease, height .3s ease, border-radius .3s ease; }
.device iframe { width: 100%; height: 100%; border: 0; border-radius: 26px; background: #fff; display: block; }
.device[data-device="mobile"] { width: 414px; height: 860px; }
.device[data-device="tablet"] { width: 792px; height: 1060px; border-radius: 28px; }
.device[data-device="tablet"] iframe { border-radius: 18px; }
.device[data-device="desktop"] { width: 100%; max-width: 1280px; height: 800px; border-radius: 12px; padding: 28px 8px 8px; }
.device[data-device="desktop"] iframe { border-radius: 4px; }
.swatch-radio { display: inline-flex; flex-direction: column; align-items: center; gap: .35rem; cursor: pointer; font-size: .78rem; color: var(--text-2); }
.swatch-radio input { position: absolute; opacity: 0; }
.swatch-radio .sw { display: flex; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.swatch-radio .sw i { width: 18px; height: 34px; display: block; }
.swatch-radio input:checked + .sw { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.swatch-radio input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.color-input { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.share-box { display: flex; gap: .5rem; align-items: center; padding: .55rem .6rem .55rem .9rem; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.share-box code { background: none; border: 0; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-size: .85rem; }
.qr-preview { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.dropzone { display: grid; justify-items: center; gap: .4rem; padding: 1.6rem; border: 2px dashed var(--line-strong); border-radius: var(--radius); text-align: center; color: var(--muted); cursor: pointer; }
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-50); color: var(--accent-600); }
.thumb-preview { width: 100%; max-width: 320px; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* ---- Auth ------------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; }
@media (min-width: 960px) { .auth { grid-template-columns: 1.05fr 1fr; } }
.auth-aside { display: none; position: relative; overflow: hidden; background: radial-gradient(120% 90% at 20% 10%, #3a2b6b 0%, #1c1a24 55%), #1c1a24; color: #f3effc; padding: 3rem; }
@media (min-width: 960px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside::after { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(229, 143, 180, .35), transparent 65%); }
.auth-aside blockquote { margin: 0; font-family: var(--font-display); font-size: 2.1rem; line-height: 1.2; letter-spacing: -.02em; max-width: 26rem; position: relative; z-index: 1; }
.auth-aside ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; color: #cbc4e2; position: relative; z-index: 1; }
.auth-aside li { display: flex; gap: .6rem; align-items: center; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 1.4rem; }
.auth-card .brand { color: var(--text); padding: 0; }
.auth-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 1.9rem; }
.auth-foot { text-align: center; color: var(--muted); font-size: .9rem; }

/* ---- Marketing site ------------------------------------------------------------------------ */
.site-nav { display: flex; align-items: center; justify-content: space-between; padding: 1rem clamp(1rem, 4vw, 3rem); max-width: 1240px; margin: 0 auto; }
.site-nav .brand { color: var(--text); padding: 0; }
.site-hero { text-align: center; padding: clamp(3rem, 9vw, 6.5rem) 1.25rem 3rem; max-width: 900px; margin: 0 auto; display: grid; gap: 1.3rem; justify-items: center; }
.site-hero h1 { font-family: var(--font-display); font-size: clamp(2.4rem, 6.5vw, 4.4rem); font-weight: 600; line-height: 1.04; letter-spacing: -.035em; }
.site-hero h1 em { font-style: italic; color: var(--accent); }
.site-hero p { font-size: 1.12rem; color: var(--text-2); max-width: 40rem; }
.site-section { max-width: 1240px; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 3rem); display: grid; gap: 1.5rem; }
.site-section > h2 { font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 600; letter-spacing: -.02em; text-align: center; }
.features { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature { padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: .5rem; }
.feature .icon { color: var(--accent); width: 24px; height: 24px; }
.site-footer { border-top: 1px solid var(--line); padding: 2rem 1.25rem; text-align: center; color: var(--muted); font-size: .85rem; display: grid; gap: .5rem; }
.site-footer nav { display: flex; justify-content: center; gap: 1.2rem; }
.prose { max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem 4rem; display: grid; gap: 1rem; line-height: 1.7; }
.prose h1 { font-family: var(--font-display); font-size: 2.2rem; }
.prose h2 { margin-top: 1rem; }
.prose ul { margin: 0; }

/* ---- Error / state pages ------------------------------------------------------------------- */
.app-plain { background: radial-gradient(80% 60% at 50% 0%, #efe9fb, var(--bg)); }
.state-page { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.state-card { max-width: 480px; text-align: center; display: grid; gap: .8rem; justify-items: center; background: var(--surface); padding: 2.5rem 2rem; border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.state-code { font-family: var(--font-display); font-size: 3.5rem; font-weight: 600; color: var(--accent); line-height: 1; }
.state-eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); }
.state-card h1 { font-family: var(--font-display); font-weight: 600; }
.state-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.state-ref { font-size: .8rem; color: var(--muted); }
.state-debug { text-align: left; max-width: 90vw; width: 100%; }
.state-debug pre { white-space: pre-wrap; font-size: .75rem; background: #1c1a24; color: #e8e4f4; padding: 1rem; border-radius: 10px; max-height: 50vh; overflow: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
.align-start { align-items: flex-start; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.w-auto { width: auto; }
.actions .menu { display: inline-block; vertical-align: middle; }
.actions .row { justify-content: flex-end; flex-wrap: nowrap; gap: .4rem; }
.actions form { margin: 0; }
.w-sm { width: 9.5rem; }
.justify-self-start { justify-self: start; }
.card-foot .row.grow { justify-content: flex-end; }
.card-foot .row .input { flex: 1 1 12rem; min-width: 0; }

/* ---- Admin area ------------------------------------------------------------------------------ */
.sidebar-admin { background: #231417; }
.sidebar-admin .nav a[aria-current="page"] { background: rgba(229, 96, 96, .2); }
.sidebar-admin .brand .badge { font-family: var(--font); font-size: .65rem; }
.bars span.bar-h0 { height: 2%; } .bars span.bar-h1 { height: 10%; } .bars span.bar-h2 { height: 20%; } .bars span.bar-h3 { height: 30%; }
.bars span.bar-h4 { height: 40%; } .bars span.bar-h5 { height: 50%; } .bars span.bar-h6 { height: 60%; } .bars span.bar-h7 { height: 70%; }
.bars span.bar-h8 { height: 80%; } .bars span.bar-h9 { height: 90%; } .bars span.bar-h10 { height: 100%; }
.impersonation-bar { position: sticky; top: 0; z-index: 70; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: center; padding: .55rem 1rem; background: #b3261e; color: #fff; font-size: .88rem; font-weight: 550; }
.impersonation-bar form { margin: 0; }
.impersonation-bar button { background: #fff; color: #b3261e; border: 0; border-radius: 6px; padding: .3rem .8rem; font-weight: 650; cursor: pointer; }
.qr-preview svg { width: 100%; height: 100%; }

/* ─── Web installer (public/setup.php) ─── */
.setup-page { min-height: 100vh; background-repeat: no-repeat; background-color: var(--bg); }
.setup { max-width: 820px; }
.setup .brand { padding: 0; color: var(--text); }
.setup .grid-2 { align-items: start; }
.setup h1 { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; }
.setup-log { margin: 0; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem 1rem; max-height: 360px; overflow: auto; width: 100%; }
.setup-details > summary { cursor: pointer; list-style: none; }
.setup-details > summary::-webkit-details-marker { display: none; }
.setup-details:not([open]) > summary { border-bottom: 0; }
