/* ========================================================================
   claudiia - design system
   dark · minimal · rose accent (Linear / Vercel / Framer inspired)
   ======================================================================== */

:root {
    /* surfaces */
    --bg: #09090d;
    --bg-elevated: #0d0d12;
    --surface: #111116;
    --surface-2: #16161d;
    --surface-3: #1c1c25;

    /* borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(154, 62, 108, 0.4);

    /* text */
    --text: #f5f5f7;
    --text-muted: #8b8b95;
    --text-dim: #5a5a63;

    /* accent - wine family (anchor = user's #2f1629, visible = #9a3e6c) */
    --rose: #9a3e6c;           /* visible - dots, focus, icons, text accents */
    --rose-hover: #b85488;     /* hover / bright */
    --rose-deep: #2f1629;      /* deep anchor - surfaces, shadows */
    --rose-soft: #2f1629;      /* alias pour backward compat */
    --rose-glow: rgba(154, 62, 108, 0.28);
    --rose-glow-soft: rgba(154, 62, 108, 0.1);

    /* semantic */
    --ok: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;

    /* fonts */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-rose: 0 8px 32px rgba(47, 22, 41, 0.5);

    /* radii */
    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;
    --r-full: 9999px;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.005em;
}

body {
    position: relative;
    overflow-x: hidden;
}

/* --- Background layers ---------------------------------------------------- */
.bg-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.bg-glow {
    position: fixed;
    top: -300px;
    left: 50%;
    transform: translateX(-50%);
    width: 1000px;
    height: 650px;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at center, rgba(47, 22, 41, 0.6) 0%, transparent 55%),
        radial-gradient(ellipse at center, var(--rose-glow-soft) 0%, transparent 70%);
    filter: blur(70px);
}

main, header, .container { position: relative; z-index: 1; }

/* --- Typography ----------------------------------------------------------- */
h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.03em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }

a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--rose-hover); }

code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    color: var(--text-muted);
}

::selection { background: var(--rose-glow); color: var(--text); }

/* --- Topbar --------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(9, 9, 13, 0.72);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 10px var(--rose), 0 0 20px var(--rose-glow);
}
.brand-accent { color: var(--rose); font-weight: 500; }
.brand-logo {
    height: 32px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 8px var(--rose-glow));
    transition: filter 0.2s ease, transform 0.2s ease;
}
.brand:hover .brand-logo {
    filter: drop-shadow(0 0 14px var(--rose-glow)) brightness(1.1);
    transform: scale(1.02);
}

.nav { display: flex; gap: 0.25rem; flex: 1; }
.nav-link {
    position: relative;
    padding: 0.45rem 0.85rem;
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active {
    color: var(--text);
    background: var(--surface-2);
}
.nav-link.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -10px;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--rose);
    box-shadow: 0 0 8px var(--rose-glow);
}

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.user-chip {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.3rem 0.65rem;
    border-radius: var(--r-full);
    border: 1px solid var(--border);
    background: var(--surface);
    font-variant-numeric: tabular-nums;
}

/* --- Layout --------------------------------------------------------------- */
.container {
    max-width: 1680px;
    margin: 0 auto;
    padding: 2.5rem 2rem 5rem;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.page-head > div:first-child { min-width: 0; flex: 1; }
.page-head .actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.page-head .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.35rem;
    font-family: var(--font-mono);
}

/* --- Cards ---------------------------------------------------------------- */
.card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.card > h2 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}
.card .row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.card .row-top h2 { margin-bottom: 0; }

.empty {
    text-align: center;
    padding: 4rem 1.5rem;
}
.empty p { color: var(--text-muted); margin: 0 0 1.5rem; font-size: 0.95rem; }

/* --- Program grid --------------------------------------------------------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.program-card {
    display: block;
    position: relative;
    padding: 1.25rem 1.35rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    transition: all 0.2s ease;
    overflow: hidden;
}
.program-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--r);
    padding: 1px;
    background: linear-gradient(135deg, var(--rose) 0%, transparent 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.program-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    color: var(--text);
}
.program-card:hover::before { opacity: 1; }

.program-card .card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.program-card h3 {
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.program-card .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
    font-size: 0.78rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}
.program-card .muted {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* --- Tags / status -------------------------------------------------------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.55rem;
    border-radius: var(--r-full);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    background: var(--surface-2);
    white-space: nowrap;
}
.tag.wildcard {
    color: var(--rose-hover);
    border-color: var(--border-accent);
    background: var(--rose-glow-soft);
}
.tag.domain {
    color: var(--info);
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.08);
}
.tag.mixed {
    color: #c084fc;
    border-color: rgba(192, 132, 252, 0.3);
    background: rgba(192, 132, 252, 0.08);
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: var(--r-full);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    background: var(--surface-2);
    font-family: var(--font-mono);
    text-transform: lowercase;
}
.status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}
.status-queued { color: var(--warn); border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.06); }
.status-running { color: var(--rose-hover); border-color: var(--border-accent); background: var(--rose-glow-soft); }
.status-running::before { animation: pulse 1.2s ease-in-out infinite; }
.status-done { color: var(--ok); border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.06); }
.status-failed { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.06); }
.status-idle { color: var(--text-dim); }
.status-idle::before { box-shadow: none; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* --- Forms ---------------------------------------------------------------- */
.form label,
.card label {
    display: block;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.form fieldset {
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.85rem 1rem;
}
.form fieldset legend {
    padding: 0 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    margin-top: 0.45rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.7rem 0.85rem;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:hover,
input[type="password"]:hover,
textarea:hover { border-color: var(--border-strong); }
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--rose);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px var(--rose-glow-soft);
}
textarea {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 80px;
}

.radio {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    margin: 0.5rem 0 !important;
    color: var(--text) !important;
    font-size: 0.88rem !important;
    cursor: pointer;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 400 !important;
}
.radio input {
    width: auto;
    accent-color: var(--rose);
    margin: 0;
}
.radio .muted { color: var(--text-muted); font-size: 0.82rem; font-family: var(--font-mono); }

/* --- Buttons -------------------------------------------------------------- */
.btn, button, .btn-primary, .btn-ghost, .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.15rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }

.btn-primary, button[type="submit"]:not(.btn-ghost):not(.btn-danger) {
    background: linear-gradient(180deg, var(--rose-hover) 0%, var(--rose) 100%);
    color: #fff;
    border-color: var(--rose);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 4px 14px rgba(154, 62, 108, 0.35);
}
.btn-primary:hover, button[type="submit"]:not(.btn-ghost):not(.btn-danger):hover {
    background: linear-gradient(180deg, #c9699a 0%, var(--rose-hover) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 6px 22px rgba(154, 62, 108, 0.5);
    color: #fff;
}
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
    background: var(--surface);
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.3);
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

a.btn-primary, a.btn-ghost, a.btn-danger { text-decoration: none; }
a.btn-primary:hover { text-decoration: none; }

.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* --- Alerts --------------------------------------------------------------- */
.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--r-sm);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}
.alert.error {
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--danger);
}
.alert.warn {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.25);
    color: var(--warn);
}
.alert.ok {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--ok);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: 640px;
    margin-top: 0.75rem;
}
.profile-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.profile-form .field-label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.85rem;
}
.profile-form input {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.profile-actions { margin-top: 0.25rem; }
.profile-test { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* --- Login ---------------------------------------------------------------- */
.login-wrap {
    min-height: calc(100vh - 2rem);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    position: relative;
}
.login-wrap::before {
    content: "";
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--rose-glow) 0%, transparent 60%);
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}
.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 2.25rem 2rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg), var(--shadow-rose);
    margin: 0;
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}
.login-brand {
    justify-content: center;
    margin-bottom: 0;
}
.login-brand .brand-dot {
    width: 12px;
    height: 12px;
    box-shadow: 0 0 12px var(--rose), 0 0 24px var(--rose-glow);
}
.login-logo {
    width: 220px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 4px 24px var(--rose-glow));
}
.login-brand h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.login-brand h1 .accent { color: var(--rose); font-weight: 500; }
.login-card .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 1.75rem;
}
.login-card form { margin-top: 0; }
.login-card .btn-primary { width: 100%; margin-top: 0.5rem; }
.login-card .footer-note {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

/* --- Log viewer ----------------------------------------------------------- */
.log, .scope {
    margin: 0;
    padding: 1rem 1.1rem;
    background: #05050a;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.65;
    color: #cbd5e1;
    max-height: 480px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    scroll-behavior: smooth;
}
.log::-webkit-scrollbar, .scope::-webkit-scrollbar { width: 8px; height: 8px; }
.log::-webkit-scrollbar-track, .scope::-webkit-scrollbar-track { background: transparent; }
.log::-webkit-scrollbar-thumb, .scope::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 4px;
}
.log::-webkit-scrollbar-thumb:hover, .scope::-webkit-scrollbar-thumb:hover { background: var(--rose-soft); }

/* --- Table ---------------------------------------------------------------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.table thead th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    border-bottom: 1px solid var(--border);
}
.table tbody td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--rose-hover);
    background: var(--rose-glow-soft);
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
}
.clip {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* --- Two-column layout ---------------------------------------------------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 900px) {
    .two-col { grid-template-columns: 1fr; }
    .topbar-inner { flex-wrap: wrap; gap: 0.75rem; }
    .nav { order: 3; flex-basis: 100%; }
    h1 { font-size: 1.35rem; }
    .page-head { flex-direction: column; align-items: flex-start; }
}

/* --- Markdown content ----------------------------------------------------- */
.md {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.65;
}
.md h1, .md h2, .md h3 {
    color: var(--text);
    margin: 1.25rem 0 0.6rem;
}
.md h1 { font-size: 1.15rem; }
.md h2 { font-size: 1rem; }
.md h3 { font-size: 0.92rem; color: var(--text-muted); }
.md p { margin: 0.5rem 0; color: var(--text-muted); }
.md strong { color: var(--text); font-weight: 600; }
.md table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.82rem;
}
.md th, .md td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}
.md th { background: var(--surface-2); color: var(--text-muted); font-weight: 600; }
.md code {
    background: var(--surface-2);
    color: var(--rose-hover);
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.82em;
}
.md pre {
    background: #05050a;
    border: 1px solid var(--border);
    padding: 0.85rem 1rem;
    border-radius: var(--r-sm);
    overflow-x: auto;
    margin: 0.75rem 0;
}
.md pre code { background: none; color: #cbd5e1; padding: 0; }
.md ul, .md ol { color: var(--text-muted); padding-left: 1.35rem; }
.md li { margin: 0.2rem 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* --- Small utilities ------------------------------------------------------ */
.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.mono { font-family: var(--font-mono); }

/* --- Scrollbar (global) --------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--rose-soft); }

/* --- Chat / conversation thread ------------------------------------------ */
.chat .thread {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.25rem 0.1rem 0.5rem;
    margin-bottom: 1rem;
}
.thread-empty {
    padding: 2.25rem 1rem;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--r-sm);
    font-size: 0.9rem;
}
.turn {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    scroll-margin-top: 1rem;
}
.turn-meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.78rem;
    color: var(--text-dim);
}
.turn-meta .who {
    font-weight: 600;
    color: var(--text);
    text-transform: lowercase;
    letter-spacing: 0.02em;
}
.turn-user .bubble-user {
    background: var(--rose-glow-soft);
    border: 1px solid var(--border-accent);
    border-radius: var(--r-sm);
    padding: 0.75rem 1rem;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.55;
    word-break: break-word;
    align-self: flex-start;
    max-width: 100%;
    overflow-x: auto;
}
.turn-user .bubble-user.md > *:first-child { margin-top: 0; }
.turn-user .bubble-user.md > *:last-child { margin-bottom: 0; }
.turn-user .bubble-user.md p { color: var(--text); }
.turn-user .bubble-user.md ul,
.turn-user .bubble-user.md ol { color: var(--text); }
.turn-user .bubble-user.md h1,
.turn-user .bubble-user.md h2,
.turn-user .bubble-user.md h3 {
    margin: 0.85rem 0 0.4rem;
    color: var(--text);
}
.turn-user .bubble-user.md h2 { font-size: 0.95rem; }
.turn-user .bubble-user.md h3 { font-size: 0.88rem; color: var(--text); }

.scope-md { font-size: 0.85rem; }
.scope-md pre { max-height: 320px; }
/* Log flows inline - page handles scrolling, no nested scrollbar. */
.turn-claude .turn-log { max-height: none; overflow: visible; }

.chat-input {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.chat-input textarea {
    width: 100%;
    resize: vertical;
    min-height: 70px;
}
.chat-input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.btn-primary.small,
.btn-ghost.small,
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.78rem; }

/* --- Program stats bar ---------------------------------------------------- */
.program-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
    margin: 0 0 1rem;
}
.program-stats .stat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.55rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.program-stats .stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}
.program-stats .stat-val {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.program-stats .stat.active {
    border-color: var(--border-accent);
    background: var(--rose-glow-soft);
}
.program-stats .stat.active .stat-val { color: var(--rose-hover); }
.program-stats .stat.loop-on {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.07);
}
.program-stats .stat.loop-on .stat-val { color: var(--ok); }
.program-stats .stat.warn {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.06);
}
.program-stats .stat.warn .stat-val { color: var(--warn); }

/* --- Tabs ----------------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin: 0 0 1rem;
    padding: 0.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}
.tabs .tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.55rem 0.85rem;
    border-radius: calc(var(--r-sm) - 2px);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.tabs .tab:hover { color: var(--text); background: var(--surface-3); }
.tabs .tab.active {
    background: var(--bg-elevated);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.tabs .tab.active .tab-icon { color: var(--rose-hover); }
.tabs .tab.warn { color: var(--warn); }
.tabs .tab .tab-icon { font-size: 0.95rem; }
.tabs .tab .tab-badge {
    background: var(--surface-3);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
}
.tabs .tab.active .tab-badge { background: var(--rose-glow-soft); color: var(--rose-hover); }
.tabs .tab .tab-badge.warn {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warn);
}
.tabs .tab .tab-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-dim);
}
.tabs .tab .tab-dot.on {
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.tab-panel { animation: fadein 0.2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* --- /loop card ----------------------------------------------------------- */
.loop-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    margin-left: 0.5rem;
}
.loop-status.on { color: var(--ok); }
.loop-status.off { color: var(--text-dim); }

.loop-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    margin: 0.5rem 0 0.75rem;
    flex-wrap: wrap;
}
.loop-hero.on {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.06);
}
.loop-hero-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex: 0 0 auto;
}
.loop-hero.on .loop-hero-icon { animation: spin 4s linear infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.loop-hero-text {
    flex: 1 1 280px;
    min-width: 0;
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.55;
}
.loop-hero-text strong { color: var(--text); }

.inline-field {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.inline-field select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.35rem 0.5rem;
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.loop-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.loop-history { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.75rem; }
.loop-history h3 { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.loop-history ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.25rem; max-height: 240px; overflow-y: auto; }
.loop-history li { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.5rem; border-radius: var(--r-sm); font-size: 0.82rem; }
.loop-history li:hover { background: var(--surface-2); }
.loop-history a { color: var(--text); text-decoration: none; }
.loop-history a:hover { color: var(--rose-hover); }

.turn-loop { border-left: 2px solid rgba(52, 211, 153, 0.4); padding-left: 0.75rem; }
.loop-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ok);
    background: rgba(52, 211, 153, 0.12);
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
}
.loop-card .loop-preview {
    margin: 0.4rem 0 0.85rem;
}
.loop-card .loop-preview summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.25rem 0;
    list-style: none;
}
.loop-card .loop-preview summary::-webkit-details-marker { display: none; }
.loop-card .loop-preview summary::before {
    content: "▸ ";
    color: var(--rose-hover);
}
.loop-card .loop-preview[open] summary::before { content: "▾ "; }
.loop-prompt-preview {
    margin: 0.5rem 0 0;
    padding: 0.75rem 0.9rem;
    background: #05050a;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #cbd5e1;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow-y: auto;
}
.loop-form {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.loop-form button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.loop-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.loop-counter strong {
    color: var(--rose-hover);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* --- Alert card (e.g. blockers) ------------------------------------------ */
.alert-card {
    border-color: rgba(251, 191, 36, 0.35);
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.06), var(--surface-1));
}
.alert-card > .row-top h2 { color: var(--warn); }
.tag.warn {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warn);
    border: 1px solid rgba(251, 191, 36, 0.35);
    padding: 0.08rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    margin-left: 0.35rem;
    font-family: var(--font-mono);
}

/* --- Checkbox row (program_new) ------------------------------------------ */
label.check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}
label.check input[type="checkbox"] {
    accent-color: var(--rose);
    width: 1rem;
    height: 1rem;
}

/* --- Report page --------------------------------------------------------- */
.sev-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.sev-cell {
    padding: 1rem 1rem 0.85rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.sev-cell.empty { opacity: 0.4; }
.sev-num {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
    color: var(--text);
}
.sev-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.sev-cell.sev-critical { border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.08); }
.sev-cell.sev-critical .sev-num { color: #fca5a5; }
.sev-cell.sev-high     { border-color: rgba(251, 146, 60, 0.4); background: rgba(251, 146, 60, 0.07); }
.sev-cell.sev-high .sev-num { color: #fdba74; }
.sev-cell.sev-medium   { border-color: rgba(232, 133, 126, 0.4); background: rgba(232, 133, 126, 0.07); }
.sev-cell.sev-medium .sev-num { color: #f4a9a2; }
.sev-cell.sev-low      { border-color: rgba(184, 132, 156, 0.38); background: rgba(184, 132, 156, 0.06); }
.sev-cell.sev-low .sev-num { color: #d4a3b8; }
.sev-cell.sev-info     { border-color: var(--border-strong); background: var(--surface-2); }
.sev-cell.sev-info .sev-num { color: var(--text-muted); }

.sev-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.22rem 0.6rem;
    border-radius: var(--r-full);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-muted);
    white-space: nowrap;
}
.sev-pill.sev-critical { color: #fca5a5; border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.1); }
.sev-pill.sev-high     { color: #fdba74; border-color: rgba(251, 146, 60, 0.4);  background: rgba(251, 146, 60, 0.1); }
.sev-pill.sev-medium   { color: #f4a9a2; border-color: rgba(232, 133, 126, 0.45); background: rgba(232, 133, 126, 0.1); }
.sev-pill.sev-low      { color: #d4a3b8; border-color: rgba(184, 132, 156, 0.4);  background: rgba(184, 132, 156, 0.1); }
.sev-pill.sev-info     { color: var(--text-muted); }

.toc-findings {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.toc-findings li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    flex-wrap: wrap;
}
.toc-findings a {
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
}
.toc-findings a:hover { color: var(--rose-hover); }

.finding {
    scroll-margin-top: 1rem;
    border-left: 3px solid var(--border-strong);
}
.finding-critical { border-left-color: #f87171; }
.finding-high     { border-left-color: #fb923c; }
.finding-medium   { border-left-color: #e8857e; }
.finding-low      { border-left-color: #b8849c; }
.finding-info     { border-left-color: var(--border-strong); }
.finding-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.md-source {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.copy-finding {
    flex-shrink: 0;
}
.finding-head h2 {
    margin: 0;
    font-size: 1.1rem;
    flex: 1;
    min-width: 0;
}
.finding-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.35rem 1rem;
    margin: 0.75rem 0 1rem;
    padding: 0.65rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 0.82rem;
}
.finding-meta > div { display: flex; gap: 0.4rem; align-items: baseline; }
.finding-meta dt {
    margin: 0;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: lowercase;
    font-size: 0.78rem;
    min-width: fit-content;
}
.finding-meta dd { margin: 0; color: var(--text); }

.finding-section { margin-top: 0.9rem; }
.finding-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--rose-hover);
    margin: 0 0 0.4rem;
    font-weight: 600;
}

@media print {
    .topbar, .page-head .actions { display: none; }
    body, main { background: white; color: black; }
    .card { break-inside: avoid; }
}

/* --- Overview / global dashboard ---------------------------------------- */
.ov-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.ov-hero-cell {
    position: relative;
    padding: 1.3rem 1.4rem 1.2rem;
    background: linear-gradient(145deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
}
.ov-hero-cell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top right, var(--rose-glow-soft) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0.6;
}
.ov-hero-cell.primary {
    border-color: var(--border-accent);
    background: linear-gradient(145deg, var(--rose-deep) 0%, var(--surface-2) 80%);
    box-shadow: var(--shadow-rose);
}
.ov-hero-cell.primary::before {
    background: radial-gradient(ellipse at top right, var(--rose-glow) 0%, transparent 55%);
    opacity: 1;
}
.ov-hero-cell.crit {
    border-color: rgba(248, 113, 113, 0.3);
}
.ov-hero-cell.crit::before {
    background: radial-gradient(ellipse at top right, rgba(248, 113, 113, 0.18) 0%, transparent 60%);
    opacity: 1;
}
.ov-hero-cell.crit .ov-hero-num { color: #fca5a5; }
.ov-hero-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
    position: relative;
}
.ov-hero-num {
    font-family: var(--font-mono);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    position: relative;
}
.ov-hero-cell.primary .ov-hero-num { color: var(--rose-hover); }
.ov-hero-foot { position: relative; }

.ov-sev-grid .sev-cell {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-bottom: 1rem;
}
.sev-bar-wrap {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--r-full);
    overflow: hidden;
    margin-top: 0.3rem;
}
.sev-bar {
    height: 100%;
    border-radius: var(--r-full);
    transition: width 0.4s ease;
}
.sev-bar.sev-critical { background: linear-gradient(90deg, #f87171, #fca5a5); }
.sev-bar.sev-high     { background: linear-gradient(90deg, #fb923c, #fdba74); }
.sev-bar.sev-medium   { background: linear-gradient(90deg, #e8857e, #f4a9a2); }
.sev-bar.sev-low      { background: linear-gradient(90deg, #b8849c, #d4a3b8); }
.sev-bar.sev-info     { background: linear-gradient(90deg, #5a5a63, #8b8b95); }
.sev-pct { align-self: flex-end; }

.ov-prog-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ov-prog-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 2fr auto;
    gap: 1.25rem;
    align-items: center;
    padding: 0.85rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.ov-prog-row:hover {
    border-color: var(--border-accent);
    background: var(--surface-3);
    transform: translateX(2px);
}
.ov-prog-left { min-width: 0; }
.ov-prog-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}
.ov-prog-name {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ov-loop-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 8px var(--ok);
    animation: ov-pulse 1.8s ease-in-out infinite;
}
@keyframes ov-pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.15); }
}
.ov-prog-sub {
    font-size: 0.72rem;
}

.ov-prog-bar-wrap {
    width: 100%;
}
.ov-prog-bar {
    display: flex;
    height: 28px;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}
.ov-prog-bar.empty {
    justify-content: center;
    align-items: center;
    background: transparent;
    border-style: dashed;
}
.ov-prog-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--bg);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: filter 0.15s ease;
}
.ov-prog-seg:hover { filter: brightness(1.15); }
.ov-prog-seg.sev-critical { background: linear-gradient(180deg, #fca5a5, #f87171); }
.ov-prog-seg.sev-high     { background: linear-gradient(180deg, #fdba74, #fb923c); }
.ov-prog-seg.sev-medium   { background: linear-gradient(180deg, #f4a9a2, #e8857e); }
.ov-prog-seg.sev-low      { background: linear-gradient(180deg, #d4a3b8, #b8849c); }
.ov-prog-seg.sev-info     { background: linear-gradient(180deg, #8b8b95, #5a5a63); color: var(--text); }

.ov-prog-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    min-width: 64px;
}
.ov-prog-num {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

.ov-top-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    counter-reset: topf;
}
.ov-top-list li {
    counter-increment: topf;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    flex-wrap: wrap;
}
.ov-top-list li::before {
    content: counter(topf, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    min-width: 1.5rem;
}
.ov-top-title {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    flex: 1;
    min-width: 200px;
}
.ov-top-title:hover { color: var(--rose-hover); }

@media (max-width: 900px) {
    .ov-prog-row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    .ov-prog-total { align-items: flex-start; }
}

/* --- Luma (Mario Galaxy) decorations -------------------------------------- */
.luma {
    display: inline-block;
    pointer-events: none;
    overflow: visible;
    transform-origin: center;
    transform: rotate(var(--luma-rot, 0deg));
    will-change: transform;
}
.luma img { pointer-events: none; }

/* Floating decoration container: absolute-positioned lumas, fixed to their
   parent, won't interact with anything. */
.luma-scatter {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 0;
}
.luma-scatter > .luma-pos {
    position: absolute;
    pointer-events: none;
}

/* Drifts: combined with the parent's rotation via CSS var so the luma still
   bobs even if rotated. */
.luma-drift-float {
    animation: luma-float 7s ease-in-out infinite;
}
.luma-drift-bob {
    animation: luma-bob 4.5s ease-in-out infinite;
}
.luma-drift-spin {
    animation: luma-spin 14s linear infinite;
}
.luma-drift-none { animation: none; }

@keyframes luma-float {
    0%   { transform: rotate(var(--luma-rot, 0deg)) translateY(0)     translateX(0); }
    25%  { transform: rotate(var(--luma-rot, 0deg)) translateY(-10px) translateX(4px); }
    50%  { transform: rotate(var(--luma-rot, 0deg)) translateY(-4px)  translateX(-6px); }
    75%  { transform: rotate(var(--luma-rot, 0deg)) translateY(-12px) translateX(2px); }
    100% { transform: rotate(var(--luma-rot, 0deg)) translateY(0)     translateX(0); }
}
@keyframes luma-bob {
    0%, 100% { transform: rotate(var(--luma-rot, 0deg)) translateY(0) scale(1); }
    50%      { transform: rotate(var(--luma-rot, 0deg)) translateY(-8px) scale(1.04); }
}
@keyframes luma-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login page: let lumas float behind the card */
.login-wrap { overflow: hidden; }
.login-wrap .luma-scatter { z-index: 0; }
.login-wrap .login-card { z-index: 2; }

/* Overview hero: lumas peeking from corners */
.ov-hero { position: relative; }

/* Topbar mascot: tiny luma next to the logo */
.brand-mascot {
    margin-left: -6px;
    display: inline-flex;
    align-items: center;
}

@media (prefers-reduced-motion: reduce) {
    .luma-drift-float, .luma-drift-bob, .luma-drift-spin, .luma .luma-face {
        animation: none !important;
    }
}
