/* DIPTY design system, shared by the couples app and the admin app.
   Loaded after Bootstrap: it re-themes the Bootstrap components both apps already use. */

:root {
    color-scheme: dark light;

    --bg: #12070e;
    --surface: #1c0c16;
    --surface-2: #28111f;
    --line: rgba(255, 180, 214, 0.12);
    --text: #fff5f8;
    --text-muted: #c9aebb;
    --primary: #c2427a;
    --primary-strong: #9d315e;
    --primary-soft: rgba(255, 180, 214, 0.12);
    --accent: #ffb4d6;
    --success: #5fd0a0;
    --warning: #ffcf6b;
    --danger: #ff7d8f;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);

    --radius-lg: 24px;
    --radius: 16px;
    --radius-sm: 12px;
    --tabbar-height: 4.25rem;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* The light palette applies when the system is light (unless dark was chosen in the app) or when light was chosen.
   The dark palette above is the default; data-theme is set by js/theme.js from the saved choice. */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #fff7fa;
        --surface: #ffffff;
        --surface-2: #fdeef4;
        --line: rgba(157, 49, 94, 0.16);
        --text: #2a1420;
        --text-muted: #7a5a69;
        --primary: #b13a6b;
        --primary-strong: #8f2a55;
        --primary-soft: rgba(177, 58, 107, 0.1);
        --accent: #9d315e;
        --success: #1f9d6b;
        --warning: #b7791f;
        --danger: #c0392b;
        --shadow: 0 10px 28px rgba(157, 49, 94, 0.14);
    }
}

:root[data-theme="light"] {
    --bg: #fff7fa;
    --surface: #ffffff;
    --surface-2: #fdeef4;
    --line: rgba(157, 49, 94, 0.16);
    --text: #2a1420;
    --text-muted: #7a5a69;
    --primary: #b13a6b;
    --primary-strong: #8f2a55;
    --primary-soft: rgba(177, 58, 107, 0.1);
    --accent: #9d315e;
    --success: #1f9d6b;
    --warning: #b7791f;
    --danger: #c0392b;
    --shadow: 0 10px 28px rgba(157, 49, 94, 0.14);
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font); letter-spacing: -0.02em; color: var(--text); }
h1, .h1 { font-size: 1.75rem; font-weight: 750; margin-bottom: 0.35rem; }
h2, .h2 { font-size: 1.3rem; font-weight: 700; }
h3, .h3, h4, .h4 { font-weight: 650; }
h5, .h5 { font-size: 1.05rem; font-weight: 650; }
p { color: var(--text); }
a, .btn-link { color: var(--accent); text-decoration: none; }
a:hover, .btn-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.text-muted, .form-text, .small.text-muted { color: var(--text-muted) !important; }
.lead { font-size: 1.1rem; color: var(--text-muted); }
hr { border-color: var(--line); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { color: var(--accent); }

/* ---- App shell ---- */

/* Phones with a notch or rounded corners: the native apps draw under the status bar (viewport-fit=cover), so the shell
   keeps its content inside the safe area. All of these insets are 0 in a normal browser. */
.app-shell {
    --page-width: 44rem; min-height: 100vh; display: flex; flex-direction: column;
    padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.app-shell.admin { --page-width: 64rem; }

.app-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    /* Header content lines up with the page column below it. */
    padding: 0.85rem max(1.1rem, calc((100% - var(--page-width)) / 2 + 1.1rem));
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); font-weight: 800; letter-spacing: 0.28em; font-size: 1.05rem; text-decoration: none; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--primary-strong)); box-shadow: 0 0 0 4px var(--primary-soft); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 0.4rem; border-radius: 50%; background: var(--bg); }

.header-action { font-size: 0.9rem; color: var(--text-muted); background: none; border: 0; padding: 0.25rem 0.5rem; border-radius: 999px; }
.header-action:hover { color: var(--text); background: var(--primary-soft); text-decoration: none; }

.app-main { flex: 1; width: 100%; max-width: var(--page-width); margin: 0 auto; padding: 1.4rem 1.1rem calc(var(--tabbar-height) + 2rem + env(safe-area-inset-bottom, 0px)); }

/* Bottom tab bar on phones, header-aligned tabs on larger screens. */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; justify-content: space-around; align-items: stretch;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    padding: 0.35rem calc(0.5rem + env(safe-area-inset-right, 0px)) calc(0.35rem + env(safe-area-inset-bottom, 0px)) calc(0.5rem + env(safe-area-inset-left, 0px));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
}

.tab {
    flex: 1; min-width: 0; text-align: center; line-height: 1.15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
    color: var(--text-muted); font-size: 0.7rem; font-weight: 600; text-decoration: none; border-radius: var(--radius-sm);
}
.tab svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); }
.tab.active svg { stroke-width: 2.2; }

@media (min-width: 820px) {
    .app-main { padding-bottom: 3rem; }
        .admin-tabs { max-width: 64rem; }
    .tabbar { position: sticky; top: 3.5rem; bottom: auto; height: auto; width: 100%; max-width: var(--page-width); margin: 0 auto; justify-content: flex-start; gap: 0.25rem; padding: 0.5rem 1.1rem; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 19; border-top: 0; border-bottom: 1px solid var(--line);  }
    .tab { flex: none; flex-direction: row; gap: 0.5rem; font-size: 0.9rem; padding: 0.5rem 0.9rem; }
    .tab svg { width: 1.2rem; height: 1.2rem; }
    .tab.active { background: var(--primary-soft); }
}

/* ---- Surfaces ---- */

.card, .panel {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-body { padding: 1.25rem; }
.card-footer { background: transparent; border-top: 1px solid var(--line); padding: 0.9rem 1.25rem; }
.card-title { color: var(--text); }
.panel { padding: 1.25rem; margin-bottom: 1rem; }

.hero {
    position: relative; overflow: hidden; padding: 1.6rem 1.4rem; margin-bottom: 1.1rem;
    border-radius: var(--radius-lg); border: 1px solid var(--line);
    background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--primary) 38%, transparent), transparent 60%), var(--surface);
    box-shadow: var(--shadow);
}
.hero h1 { font-size: 1.9rem; margin-bottom: 0.4rem; }
.hero p { color: var(--text-muted); margin-bottom: 1rem; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.72rem; font-weight: 700; color: var(--accent); margin-bottom: 0.35rem; }

.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.65rem; font-size: 0.78rem; font-weight: 600; border-radius: 999px; background: var(--primary-soft); color: var(--accent); border: 1px solid var(--line); }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---- Buttons and forms (Bootstrap components, re-themed) ---- */

.btn { white-space: nowrap; border-radius: 999px; font-weight: 650; padding: 0.6rem 1.2rem; border-width: 1px; transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-sm { padding: 0.3rem 0.85rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1.05rem; }
.btn:disabled, .btn.disabled { opacity: 0.5; }
.btn-primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 40%, transparent); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { color: #fff; border-color: transparent; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 88%, white), var(--primary)); }
.btn-outline-primary { color: var(--accent); border-color: var(--line); background: transparent; }
.btn-outline-primary:hover, .btn-outline-primary:active { color: var(--text); background: var(--primary-soft); border-color: var(--accent); }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--line); background: transparent; }
.btn-outline-secondary:hover, .btn-outline-secondary:active { color: var(--text); background: var(--primary-soft); border-color: var(--line); }
.btn-outline-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn-outline-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-success { color: #06281b; background: var(--success); border-color: transparent; }
.btn-success:hover { color: #06281b; background: color-mix(in srgb, var(--success) 88%, white); }
.btn-warning { color: #3a2500; background: var(--warning); border-color: transparent; }
.btn-link { padding: 0.25rem 0.5rem; }

.form-label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.form-control, .form-select {
    background-color: var(--surface-2); color: var(--text); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 0.65rem 0.9rem;
}
.form-control::placeholder { color: var(--text-muted); opacity: 0.7; }
.form-control:focus, .form-select:focus { background-color: var(--surface-2); color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-control:disabled, .form-select:disabled { background-color: var(--surface); color: var(--text-muted); opacity: 0.7; }
.form-select { padding-right: 2.4rem; min-width: 5.5rem; background-position: right 0.8rem center; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c9aebb' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.form-check-input { background-color: var(--surface-2); border-color: var(--line); width: 1.25rem; height: 1.25rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--primary-soft); border-color: var(--accent); }
.input-group .btn { border-radius: 0 999px 999px 0; }
.input-group .form-control { border-radius: 999px 0 0 999px; }
fieldset { border-color: var(--line) !important; border-radius: var(--radius); }
legend { color: var(--accent); }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: 0.85rem; }

.alert { border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.alert-danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.alert-success { border-color: color-mix(in srgb, var(--success) 50%, transparent); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.alert-warning { border-color: color-mix(in srgb, var(--warning) 50%, transparent); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.badge { border-radius: 999px; font-weight: 600; }
.text-bg-secondary { background: var(--primary-soft) !important; color: var(--accent) !important; }

.list-group { border-radius: var(--radius); }
.list-group-item { background: var(--surface); color: var(--text); border-color: var(--line); padding: 0.9rem 1.1rem; }
.table { color: var(--text); --bs-table-bg: transparent; --bs-table-striped-bg: var(--primary-soft); border-color: var(--line); }
.table > :not(caption) > * > * { background-color: transparent; color: var(--text); border-bottom-color: var(--line); }
.table thead th { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

/* ---- Checklists and numbered steps ---- */

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.steps > li { counter-increment: step; display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.85rem 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.steps > li::before { content: counter(step); flex: none; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; border-radius: 50%; background: var(--primary-soft); color: var(--accent); }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.check-item { display: flex; align-items: flex-start; gap: 0.8rem; width: 100%; text-align: left; padding: 0.85rem 1rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.check-item:hover { border-color: var(--accent); }
.check-item .box { flex: none; width: 1.55rem; height: 1.55rem; display: grid; place-items: center; border-radius: 8px; border: 2px solid var(--line); color: transparent; font-weight: 800; transition: all 0.15s ease; }
.check-item.done .box { background: var(--success); border-color: var(--success); color: #06281b; }
.check-item.done .text { color: var(--text-muted); text-decoration: line-through; }
.who { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); background: var(--primary-soft); border-radius: 999px; padding: 0.1rem 0.5rem; margin-left: 0.4rem; white-space: nowrap; }

.progress-line { height: 6px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; }
.progress-line > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.25s ease; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 1.6rem 0 0.7rem; }
.section-title h2 { margin: 0; font-size: 1.1rem; }

/* ---- Swipe card ---- */

.swipe-card {
    position: relative; overflow: hidden; min-height: 21rem; display: flex; flex-direction: column; justify-content: flex-end;
    padding: 1.6rem; border-radius: 28px; color: #fff; box-shadow: var(--shadow);
    background: linear-gradient(160deg, #d4528a 0%, #7a2750 100%);
}
.swipe-card { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; overflow-anchor: none; }
.swipe-card[data-swipe-dir="like"] { outline: 3px solid rgba(80, 200, 120, 0.8); }
.swipe-card[data-swipe-dir="skip"] { outline: 3px solid rgba(255, 255, 255, 0.5); }
.round-btn[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }
.swipe-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 60% at 100% 0%, rgba(255, 255, 255, 0.22), transparent 60%); pointer-events: none; }
.swipe-card.pillar-1 { background: linear-gradient(160deg, #e0685f 0%, #8f2f4f 100%); }
.swipe-card.pillar-2 { background: linear-gradient(160deg, #7e57c2 0%, #3b2a6e 100%); }
.swipe-card.pillar-3 { background: linear-gradient(160deg, #c2185b 0%, #4a0f2a 100%); }
.swipe-card h2 { color: #fff; font-size: 1.7rem; line-height: 1.15; margin: 0.5rem 0; }
.swipe-card p { color: rgba(255, 255, 255, 0.9); margin: 0 0 1rem; }
.swipe-card .chip { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.swipe-actions { display: flex; justify-content: center; align-items: center; gap: 1.6rem; margin: 1.3rem 0 0.4rem; }
.round-btn { width: 4.2rem; height: 4.2rem; display: grid; place-items: center; border-radius: 50%; font-size: 1.7rem; border: 1px solid var(--line); background: var(--surface); color: var(--text-muted); box-shadow: var(--shadow); transition: transform 0.1s ease; }
.round-btn:active:not(:disabled) { transform: scale(0.92); }
.round-btn.like { width: 5rem; height: 5rem; font-size: 2rem; color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); }
.round-btn:disabled { opacity: 0.5; }

.stars { display: inline-flex; gap: 0.25rem; }
.star { font-size: 2.2rem; line-height: 1; background: none; border: 0; padding: 0.1rem; color: var(--line); }
.star.on { color: var(--warning); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty .emoji { font-size: 2.4rem; display: block; margin-bottom: 0.5rem; }

/* ---- Authentication ---- */

.auth { max-width: 26rem; margin: 1.5rem auto 0; }
.auth .brand { justify-content: center; width: 100%; margin-bottom: 1.2rem; }

/* ---- Blazor chrome ---- */

h1:focus { outline: none; }
#blazor-error-ui { background: var(--danger); color: #fff; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.3); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
#blazor-error-ui a { color: #fff; text-decoration: underline; }
.blazor-error-boundary { background: var(--danger); padding: 1rem; color: #fff; border-radius: var(--radius); }
.loading-progress circle { stroke: var(--primary-soft) !important; }
.loading-progress circle:last-child { stroke: var(--primary) !important; }
.loading-progress-text { color: var(--text-muted) !important; }

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

/* ---- Admin: editable numbered steps ---- */


/* ---- Filter chips (toggle buttons) ---- */

.filter-chip { padding: 0.3rem 0.85rem; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; }
.filter-chip:hover { color: var(--text); border-color: var(--accent); }
.filter-chip.on { color: var(--text); background: var(--primary-soft); border-color: var(--accent); }

/* ---- Sortable table headings ---- */

.th-sort { white-space: nowrap; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; background: none; border: 0; }
.th-sort:hover, .th-sort.on { color: var(--accent); }

/* ---- Locked live reveals ---- */

.steps > li.locked { background: transparent; border-style: dashed; color: var(--text-muted); }
.steps > li.locked::before { background: transparent; color: var(--text-muted); }

/* ---- Calendar: day pills and hour chips ---- */

.week-nav { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.week-label { flex: 1; text-align: center; font-weight: 600; font-size: 0.9rem; }
.day-pills { display: flex; gap: 0.3rem; overflow-x: auto; padding: 0.2rem 0 0.8rem; margin-bottom: 0.4rem; scrollbar-width: thin; }
.day-pill { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.45rem 0.15rem; color: var(--text-muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.day-pill .dow { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.day-pill .num { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.day-pill .dot { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: transparent; }
.day-pill .dot.has { background: var(--accent); }
.day-pill.on { color: var(--accent); border-color: var(--accent); background: var(--primary-soft); }

.hour-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
@media (min-width: 560px) { .hour-grid { grid-template-columns: repeat(6, 1fr); } }
.hour-chip { padding: 0.55rem 0; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.hour-chip:hover { border-color: var(--accent); color: var(--text); }
.hour-chip.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); }

/* ---- Range slider (spice limit) ---- */

.form-range { height: 1.6rem; background: transparent; accent-color: var(--primary); }
.form-range::-webkit-slider-runnable-track { height: 0.5rem; background: var(--primary-soft); border: 1px solid var(--line); border-radius: 999px; }
.form-range::-moz-range-track { height: 0.5rem; background: var(--primary-soft); border: 1px solid var(--line); border-radius: 999px; }
.form-range::-webkit-slider-thumb { margin-top: -0.55rem; width: 1.5rem; height: 1.5rem; background: linear-gradient(135deg, var(--accent), var(--primary)); border: 2px solid var(--bg); box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 50%, transparent); }
.form-range::-moz-range-thumb { width: 1.5rem; height: 1.5rem; background: linear-gradient(135deg, var(--accent), var(--primary)); border: 2px solid var(--bg); }
.form-range:focus { box-shadow: none; }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--primary-soft); }

/* ---- Group headings inside tables ---- */

.table tr.group-row > td { padding-top: 1.1rem; background: transparent; color: var(--text); border-bottom: 1px solid var(--accent); }

/* ---- Disabled buttons keep the theme (Bootstrap would show its own blue) ---- */

.btn-primary:disabled, .btn-primary.disabled { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); box-shadow: none; }
.btn-outline-primary:disabled, .btn-outline-primary.disabled { color: var(--accent); border-color: var(--line); background: transparent; }
.btn-outline-secondary:disabled, .btn-outline-secondary.disabled { color: var(--text-muted); border-color: var(--line); background: transparent; }
.btn-outline-danger:disabled, .btn-outline-danger.disabled { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }

.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.1rem; font-size: 0.82rem; }
.legal-links a { color: var(--text-muted); }
.app-footer { padding: 1.2rem 0 5.5rem; }

.update-banner { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: 5.2rem; width: calc(100% - 2rem); max-width: 28rem; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.7rem 0.9rem; font-size: 0.9rem; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25); }
@media (min-width: 720px) { .update-banner { bottom: 1.5rem; } }

.start-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.start-step { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 0.6rem 0.8rem 0.6rem 2.4rem; background: var(--surface); }
.start-step::before { content: ""; position: absolute; left: 0.8rem; top: 0.85rem; width: 1.05rem; height: 1.05rem; border: 2px solid var(--line); border-radius: 50%; }
.start-step.done::before { background: var(--accent); border-color: var(--accent); }
.start-step.done .start-head { color: var(--text-muted); }
.start-head { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.start-head.static { cursor: default; font-weight: 500; }
.start-note { margin-top: 0.15rem; }
.start-body { margin-top: 0.7rem; }
.start-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.start-list li { position: relative; padding-left: 1.7rem; }
.start-list li::before { content: ""; position: absolute; left: 0; top: 0.25rem; width: 1.05rem; height: 1.05rem; border: 2px solid var(--line); border-radius: 50%; }
.start-list li.done::before { background: var(--accent); border-color: var(--accent); }
.start-list li.done a { color: var(--text-muted); text-decoration: line-through; }

.rhythm-note { font-size: 0.9rem; color: var(--text-muted); margin: 0.2rem 0 0.8rem; }
.rhythm-note.overdue { color: var(--warning, var(--accent)); }

.track-tabs { display: flex; gap: 0.4rem; padding: 0.25rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.track-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.55rem 0.8rem; font-weight: 600; color: var(--text-muted); background: transparent; border: 0; border-radius: 999px; }
.track-tab.on { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); }
.track-tab .dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }

.status-page { text-align: center; padding: 3rem 0 2rem; }
.status-code { font-size: 4.5rem; font-weight: 800; line-height: 1; letter-spacing: 0.04em; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 0.6rem; }

.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1.4rem 0 0.4rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--accent); }
.chip.warn { color: var(--warning, #f5c26b); border-color: currentColor; }

.bar-row { display: grid; grid-template-columns: 7.5rem 1fr 6.5rem; align-items: center; gap: 0.6rem; margin: 0.35rem 0; font-size: 0.9rem; }
.bar-track { height: 0.7rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }
.bar-value { text-align: right; white-space: nowrap; }
.spark { margin-bottom: 1rem; }
.spark-bars { display: flex; align-items: flex-end; gap: 0.3rem; height: 3.2rem; margin-top: 0.3rem; }
.spark-bar { flex: 1; min-height: 2px; background: linear-gradient(180deg, var(--accent), var(--primary)); border-radius: 3px 3px 0 0; }
.kv { display: grid; grid-template-columns: minmax(11rem, 1.4fr) 1.6fr; gap: 0.35rem 0.8rem; margin: 0; font-size: 0.92rem; }
.kv dt { color: var(--text-muted); font-weight: 500; }
.kv dd { margin: 0; }
.ranking { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; }
.ranking li span { display: block; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 5.5rem 1fr 5rem; } .kv { grid-template-columns: 1fr; } }

a.track-tab { text-decoration: none; }
.sub-nav { overflow-x: auto; }
.sub-nav .track-tab { white-space: nowrap; padding-inline: 0.9rem; }

.icon { vertical-align: -0.18em; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: 8px; }
.icon-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--line); background: var(--surface-2); }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger); }
.icon-btn:disabled { opacity: 0.45; }
.row-icons { display: inline-flex; gap: 0.35rem; align-items: center; color: var(--text-muted); }
.row-icons .icon { opacity: 0.9; }
.status-published { color: var(--success, #5fd3a1); }
.status-draft { color: var(--warning, #f5c26b); }
.status-archived { color: var(--text-muted); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.7rem; margin-top: 0.1rem; }
.row-meta > span { display: inline-flex; align-items: center; gap: 0.25rem; }

/* ---- Info tip: an "i" that explains a number or a heading ---- */
.info-tip { position: relative; display: inline-block; vertical-align: middle; margin-left: 0.3rem; }
.info-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.15rem; border: 0; border-radius: 999px; background: none; color: var(--text-muted); line-height: 1; cursor: help; }
.info-btn:hover, .info-btn:focus-visible { color: var(--accent); }
.info-bubble {
    position: absolute; z-index: 40; left: 50%; top: calc(100% + 0.35rem); transform: translateX(-30%);
    width: max-content; max-width: min(18rem, 80vw); padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow);
    font-size: 0.82rem; font-weight: 400; line-height: 1.4; letter-spacing: 0; text-transform: none; text-align: left;
    visibility: hidden; opacity: 0; transition: opacity 0.12s;
}
.info-tip:hover .info-bubble, .info-tip:focus-within .info-bubble { visibility: visible; opacity: 1; }

.chip.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.health-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.health-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }

/* ---- Breadcrumbs ---- */
.breadcrumbs { margin: 0 0 0.6rem; font-size: 0.85rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.15rem 0.4rem; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-muted); max-width: 100%; }
.breadcrumbs li + li::before { content: "›"; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; padding: 0.15rem 0; }
.breadcrumbs a:hover { color: var(--text); text-decoration: underline; }
.breadcrumbs li span { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }

/* ---- Steps editor: one list of steps, one text per language ---- */
.steps-editor { list-style: none; margin: 0 0 0.7rem; padding: 0; display: grid; gap: 0.6rem; }
.step-card { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 0.6rem 0.7rem; display: grid; gap: 0.5rem; }
.step-card.dragging { opacity: 0.45; }
.step-card.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.step-card.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.step-handle { display: inline-flex; padding: 0.2rem 0.1rem; color: var(--text-muted); cursor: grab; user-select: none; touch-action: none; }
.step-handle:active { cursor: grabbing; }
.step-number { min-width: 1.2rem; font-weight: 700; color: var(--accent); }
.step-who { flex: 1 1 9rem; width: auto; min-width: 0; max-width: 16rem; }
.step-tools { margin-left: auto; display: inline-flex; gap: 0.1rem; }
.step-texts { display: grid; gap: 0.5rem; }
.step-text-cell { display: grid; gap: 0.2rem; min-width: 0; }
.step-text-cell textarea { resize: vertical; min-height: 3.2rem; }
.step-lang { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.step-lang.missing { color: var(--danger); }
.lang-bar { position: sticky; top: 0; z-index: 12; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.55rem 0.8rem; margin: 0.8rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.lang-bar-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.lang-bar .filter-chip .dot { display: inline-block; width: 0.45rem; height: 0.45rem; margin-left: 0.35rem; border-radius: 50%; background: var(--danger); }
.lang-manage { flex-basis: 100%; font-size: 0.9rem; }
.lang-manage summary { cursor: pointer; color: var(--text-muted); }
.lang-field { display: grid; gap: 0.5rem; }
.lang-field .input-group-text { min-width: 2.8rem; justify-content: center; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; }

/* ---- Edit forms: the buttons stay in reach ---- */
.form-actions {
    position: sticky; bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px)); z-index: 25; margin: 1.2rem -0.4rem 0; padding: 0.7rem 0.4rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.form-actions .ms-auto { margin-left: auto; }
.saved-note { color: var(--success); font-size: 0.9rem; }
@media (min-width: 820px) { .form-actions { bottom: 0; } }

/* ---- Ideas as a table (admin) ---- */
.table-controls .filter-chip { white-space: nowrap; }
.bulk-bar { padding: 0.5rem 0.7rem; border: 1px dashed var(--accent); border-radius: 12px; }
.idea-table-wrap { overflow: auto; max-height: calc(100vh - 19rem); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.idea-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.idea-table th { position: sticky; top: 0; z-index: 3; padding: 0.5rem; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); text-align: left; white-space: nowrap; }
.idea-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.idea-table .col-select { width: 2rem; position: sticky; left: 0; z-index: 2; background: var(--surface); }
.idea-table th.col-select { z-index: 4; }
.idea-table .col-title { min-width: 20rem; max-width: 26rem; position: sticky; left: 2rem; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.idea-table th.col-title { z-index: 4; }
.row-changed td.col-title { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.row-problem td.col-title { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.idea-table .col-title .input-group + .input-group { margin-top: 0.25rem; }
.idea-table .col-open { width: 2.4rem; }
.idea-table select, .idea-table input.form-control { min-width: 5.5rem; }
.idea-table input.narrow { width: 4.5rem; min-width: 0; }
.idea-table input.months { width: 7rem; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; }
.th-sort:hover { color: var(--text); }
.cell-changed { box-shadow: 0 0 0 2px var(--accent); }
.row-changed td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.row-changed td.col-select { box-shadow: inset 3px 0 0 var(--accent); }
.row-problem td { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.row-expanded td { background: var(--surface-2, var(--surface)); }
.expanded-grid { display: grid; gap: 1.2rem; padding: 0.4rem 0 0.8rem; position: sticky; left: 2.6rem; width: min(120rem, calc(100vw - 7rem)); }
/* Description, preparation and the course of the event one below the other, each as wide as the table: the languages sit
   side by side, and each step is one wide row (who does it on the left, the texts on the right). */
.expanded-grid { grid-template-columns: minmax(0, 1fr); }
.lang-columns { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); }
/* The steps as a table: a row per step, the languages as columns. */
.steps-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.steps-row { display: grid; grid-template-columns: var(--cols); gap: 0.4rem; align-items: start; padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--line); }
.steps-row:last-child { border-bottom: 0; }
.steps-row.steps-head { background: var(--surface-2, var(--surface)); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding-top: 0.3rem; padding-bottom: 0.3rem; align-items: center; }
.steps-row.dragging { opacity: 0.45; }
.steps-row.drop-before { box-shadow: inset 0 3px 0 0 var(--accent); }
.steps-row.drop-after { box-shadow: inset 0 -3px 0 0 var(--accent); }
.steps-row .step-handle { padding-top: 0.45rem; }
.steps-row .step-number { padding-top: 0.35rem; }
.steps-row textarea.form-control { min-height: 2rem; padding: 0.25rem 0.5rem; line-height: 1.35; resize: vertical; field-sizing: content; }
.steps-row .step-who { padding-top: 0.2rem; padding-bottom: 0.2rem; }
.steps-row .step-tools { display: flex; gap: 0; justify-content: flex-end; }
.expanded-grid .step-card { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 0.4rem 1rem; align-items: start; }
.expanded-grid .step-head { flex-wrap: wrap; align-content: start; }
.expanded-grid .step-who { flex-basis: 100%; }
.expanded-grid .step-texts { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.expanded-grid .steps-editor { gap: 0.5rem; }
.expanded-grid .step-card { padding: 0.4rem 0.6rem; }
.expanded-grid .step-text-cell textarea { min-height: 2.4rem; }
.expanded-grid .step-head .step-tools { margin-left: auto; }
.steps-preview { max-height: 14rem; overflow: auto; padding-left: 1.2rem; }
.steps-preview .step-partner::marker { color: var(--accent); }
.steps-preview .step-both::marker { color: var(--accent-2, var(--accent)); }
.steps-preview .step-reveal { font-style: italic; }
.spice-cell { display: flex; align-items: center; gap: 0.4rem; }
.spice-cell input { width: 4.2rem; min-width: 0; }
.spice-chip { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; font-size: 0.8rem; font-weight: 700; color: #fff; }
.spice-low { background: #6f8f7a; }
.spice-mid { background: #c9a227; }
.spice-high { background: #d9742b; }
.spice-top { background: #c0392b; }
.status-draft { border-color: #c9a227; }
.status-archived { opacity: 0.7; }

/* ---- Packages: what a package offers ---- */
.package-facts { list-style: none; margin: 0 0 0.8rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.9rem; color: var(--text-muted); }
.package-facts li { position: relative; }
.package-facts li + li::before { content: ""; position: absolute; left: -0.55rem; top: 0.45em; width: 3px; height: 3px; border-radius: 50%; background: var(--line); }
.package-samples ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.package-samples li { font-style: italic; }
.package-hint { margin-top: 1.4rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }

/* A page that needs the whole width (the idea table) lifts the width limit of the content column. */
.app-main:has(.wide-page) { max-width: none; }
.app-main:has(.wide-page) .idea-table-wrap { max-height: calc(100vh - 17rem); }

/* The row of an idea stays under the column headings while its (long) steps scroll by; the next idea pushes it away. */
.idea-table { --thead-h: 2.5rem; }
.idea-table tbody.idea-body > tr:first-child > td { position: sticky; top: var(--thead-h); z-index: 2; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.idea-table tbody.idea-body > tr:first-child > td.col-select { z-index: 3; }
.idea-table tbody.idea-body > tr:first-child > td.col-title { z-index: 3; }
.idea-table tbody.idea-body > tr.row-changed:first-child > td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.idea-table tbody.idea-body > tr.row-problem:first-child > td { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

/* The description sits in the idea's own row (next to the title), so it stays in view with it. */
.idea-table .col-description { min-width: 24rem; max-width: 40rem; width: 32rem; }
.idea-table textarea.desc-input { min-height: 2.2rem; max-height: 4.6rem; resize: vertical; line-height: 1.3; }
.idea-table textarea.desc-input + textarea.desc-input { margin-top: 0.25rem; }

/* ---- Ideas as cards (admin) ---- */
.idea-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: 1rem; align-items: start; }
.idea-card .idea-desc { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.idea-card .steps-preview { margin: 0.4rem 0 0; max-height: 16rem; overflow: auto; }
.idea-card.row-changed { box-shadow: 0 0 0 2px var(--accent); }
.min-w-0 { min-width: 0; }
.view-switch .track-tab { padding: 0.2rem 0.9rem; font-size: 0.85rem; }

/* ---- The idea editor: wide, compact, the details and the preview beside the main column ---- */
.app-main:has(.edit-layout) { max-width: none; }
.edit-layout .panel { padding: 0.8rem 1rem; margin-bottom: 0.8rem !important; }
.edit-layout .panel h2.h5 { font-size: 1rem; margin-bottom: 0.5rem; }
.edit-layout .form-label { margin-bottom: 0.15rem; font-size: 0.85rem; }
.edit-layout .row.g-3 { --bs-gutter-y: 0.6rem; --bs-gutter-x: 0.8rem; }
.edit-layout .lang-field { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.edit-layout .form-text, .edit-layout p.text-muted.small { margin-bottom: 0.4rem; }
@media (min-width: 1300px) {
    .edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 34rem; gap: 1.2rem; align-items: start; }
    .edit-side { position: sticky; top: 4.6rem; max-height: calc(100vh - 8rem); overflow: auto; }
}
/* The step table on a narrow screen: who and the buttons in one line, every text below, full width. */
@media (max-width: 899px) {
    .steps-row { grid-template-columns: 1.2rem 1.6rem minmax(0, 1fr) auto; }
    .steps-row > * { order: 1; }
    .steps-row textarea.form-control { order: 2; grid-column: 1 / -1; }
    .steps-row.steps-head { display: none; }
}

/* ---- System notices: a message from the operator that has to be confirmed ---- */
.notice-backdrop { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 1rem; background: rgba(18, 7, 14, 0.72); backdrop-filter: blur(3px); }
.notice-dialog { width: min(34rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.4rem; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.notice-card { border-left: 5px solid var(--accent); padding-left: 1rem; }
.notice-card.notice-important { border-left-color: #c9a227; }
.notice-card.notice-security { border-left-color: var(--danger); }
.notice-card.notice-security .eyebrow { color: var(--danger); }
.notice-message { white-space: pre-wrap; overflow-wrap: anywhere; }
.confirm-code { font: 700 2rem/1 ui-monospace, monospace; letter-spacing: 0.35em; margin: 0.5rem 0; user-select: all; }
.confirm-input { text-transform: uppercase; letter-spacing: 0.2em; max-width: 12rem; }

/* The title box is as tall as the selects and numbers next to it, and the checkbox sits at the height of the first line. */
.idea-table .col-title .form-control { min-height: 2.4rem; }
.idea-table .col-select .form-check-input { margin-top: 0.7rem; }

/* "BETA" next to the name on a beta server, so nobody mistakes it for the real one. */
.channel-badge { margin-left: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; align-self: center; }

/* The tabs around swiping (Stack, My choices, Our ideas, Packages) must fit a phone: smaller on narrow screens, and if a language
   needs more room the row scrolls sideways instead of cutting the last tab off. */
.track-tabs { overflow-x: auto; scrollbar-width: none; }
.track-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 480px) {
  .sub-nav .track-tab { flex: 1 1 auto; padding-inline: 0.55rem; font-size: 0.88rem; }
}
