/* ============================================================
   Ruply Design System — 2026
   Inter font. Glass cards. Gradient accents. Mobile-first.
   Built on PicoCSS v2 base with heavy overrides.
   ============================================================ */

/* --- Tokens ----------------------------------------------- */
:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --pico-font-family: var(--font);
    --pico-font-size: 16px;

    --space-2xs: 0.125rem;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-subtle: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(168,85,247,0.08) 100%);

    --warm: #e8a43a;
    --warm-light: #f0ba5e;
    --warm-glow: rgba(232, 164, 58, 0.25);
    --warm-soft: rgba(232, 164, 58, 0.1);

    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #111118;
    --bg-raised: #18182a;
    --bg-overlay: rgba(18, 18, 38, 0.85);
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --surface-border: rgba(255, 255, 255, 0.08);
    --surface-border-hover: rgba(255, 255, 255, 0.15);
    --text: #ededf0;
    --text-secondary: #9ca3b4;
    --text-muted: #7c8599;
    --glass-bg: rgba(255, 255, 255, 0.035);
    --glass-border: rgba(255, 255, 255, 0.07);
    --nav-bg: rgba(17, 17, 24, 0.88);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-placeholder: rgba(255, 255, 255, 0.25);
    --code-bg: rgba(255, 255, 255, 0.06);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] {
    --bg: #f8f9fb;
    --bg-raised: #ffffff;
    --bg-overlay: rgba(255, 255, 255, 0.85);
    --surface: rgba(0, 0, 0, 0.025);
    --surface-hover: rgba(0, 0, 0, 0.05);
    --surface-border: rgba(0, 0, 0, 0.1);
    --surface-border-hover: rgba(0, 0, 0, 0.18);
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.08);
    --nav-bg: rgba(248, 249, 251, 0.9);
    --input-bg: rgba(0, 0, 0, 0.03);
    --input-border: rgba(0, 0, 0, 0.14);
    --input-placeholder: rgba(0, 0, 0, 0.35);
    --code-bg: rgba(0, 0, 0, 0.05);
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* --- PicoCSS Overrides ------------------------------------ */
/* Reset Pico defaults that conflict with our design system */
:root {
    --pico-border-radius: var(--radius-sm);
    --pico-block-spacing-vertical: var(--space-md);
    --pico-block-spacing-horizontal: var(--space-md);
    --pico-spacing: var(--space-md);
}

/* Override Pico's link colors globally */
a { color: var(--accent-light); }
a:hover { color: var(--accent); }

/* Override Pico's nav styling to prevent conflicts */
nav.site-nav,
nav.site-nav ul,
nav.site-nav li {
    all: unset;
}

/* --- Base ------------------------------------------------- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent);
    color: white;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Container -------------------------------------------- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    width: 100%;
    box-sizing: border-box;
}

/* Break out of container for full-width sections */
.full-bleed {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.full-bleed > .container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

main {
    flex: 1;
    padding-top: 72px; /* matches nav height (64px) + 8px breathing room */
}

/* --- Typography ------------------------------------------- */
h1, h2, h3, h4 {
    font-family: var(--font);
    font-weight: 700;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: var(--space-sm);
}

/* Type scale: Major Third (1.25) for app, Perfect Fourth (1.333) for landing */
h1 { font-size: 1.75rem; letter-spacing: -0.03em; }
h2 { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; }

@media (min-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
}

p {
    line-height: 1.6;
    color: var(--text-secondary);
}

small, .text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

code {
    font-size: 0.8em;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    background: var(--code-bg);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* --- Navigation ------------------------------------------- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    display: block;
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.nav-brand:hover {
    color: var(--text);
    text-decoration: none;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--gradient);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
}

.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    padding: 0;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle:hover {
    background: var(--surface-hover);
}

@media (min-width: 768px) {
    .nav-toggle { display: none; }
}

.nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-xs) var(--space-lg) var(--space-md);
    flex-direction: column;
    gap: 1px;
}

.nav-links.open {
    display: flex;
}

.nav-links a {
    display: block;
    padding: 0.6rem var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: var(--surface-hover);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--accent-light);
}

.nav-cta {
    background: var(--gradient) !important;
    color: white !important;
    text-align: center;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
    margin-top: var(--space-xs);
}

.nav-cta:hover {
    opacity: 0.9;
    color: white !important;
}

.nav-logout {
    opacity: 0.5;
    margin-top: var(--space-sm);
    border-top: 1px solid var(--glass-border);
    padding-top: var(--space-sm);
}

.nav-logout:hover {
    opacity: 0.8;
    color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.06) !important;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        gap: 2px;
        border: none;
        padding: 0;
        background: none;
        backdrop-filter: none;
    }

    .nav-links a {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }

    .nav-cta {
        padding: 0.35rem var(--space-md) !important;
        margin-top: 0;
        margin-left: var(--space-xs);
    }

    .nav-spacer { flex: 1; }

    .nav-logout {
        margin-top: 0;
        margin-left: var(--space-xs);
        border-top: none;
        padding-top: 0.35rem;
        border-left: 1px solid var(--glass-border);
        padding-left: var(--space-sm);
    }
}

/* --- Nav language switcher -------------------------------- */
.nav-lang {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin: 0;
    width: auto;
    line-height: 1.2;
}

.nav-lang:hover { color: var(--text); border-color: var(--accent); }
.nav-lang:focus { outline: none; box-shadow: 0 0 0 2px rgba(99,102,241,0.3); }

.nav-spacer { display: none; }

@media (max-width: 767px) {
    .nav-lang {
        margin: var(--space-xs) var(--space-md);
        align-self: flex-start;
    }
}

/* --- Settings rows --------------------------------------- */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--glass-border);
}

.setting-row:last-child { border-bottom: none; }

.setting-row .setting-label {
    flex: 1;
    min-width: 0;
}

.setting-row .setting-label strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.setting-row .setting-label small {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.3;
}

.setting-row .setting-control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.setting-row select,
.setting-row input[type="text"] {
    margin: 0;
    font-size: 0.85rem;
}

.setting-row select { max-width: 180px; }

.setting-inline-radios {
    display: flex;
    gap: var(--space-sm);
}

.setting-inline-radios label {
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.setting-checks {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.setting-checks label {
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

/* --- Cards ------------------------------------------------ */
article, .card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

article:last-child, .card:last-child {
    margin-bottom: 0;
}

article:hover, .card:hover {
    border-color: var(--surface-border-hover);
    box-shadow: var(--card-shadow);
}

article header {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--glass-border);
}

/* --- Buttons ---------------------------------------------- */
[role="button"],
button:not(.nav-toggle):not(.theme-toggle):not(.tag-remove),
input[type="submit"] {
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    letter-spacing: -0.01em;
    text-decoration: none;
}

/* Primary button — min 44px height (WCAG touch target) */
.btn-primary,
button[type="submit"]:not(.outline):not(.secondary):not(.btn-sm):not(.nav-toggle):not(.theme-toggle),
a[role="button"]:not(.outline):not(.secondary) {
    background: var(--gradient);
    border: none;
    color: white;
    padding: 0.7rem 1.5rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover,
button[type="submit"]:not(.outline):not(.secondary):not(.btn-sm):not(.nav-toggle):not(.theme-toggle):hover,
a[role="button"]:not(.outline):not(.secondary):hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
    color: white;
    text-decoration: none;
}

/* Outline button */
.outline, [role="button"].outline, button.outline {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
}

.outline:hover, [role="button"].outline:hover, button.outline:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.06);
    text-decoration: none;
}

/* Small button — min 36px tall, touch target padded to 44px via margin */
.btn-sm {
    padding: 0.45rem 0.9rem !important;
    font-size: 0.8rem !important;
    margin: 0;
    min-height: 36px;
}

.btn-icon {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1;
    margin: 0;
}

/* Secondary (muted) button */
.secondary, button.secondary {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
}

.secondary:hover, button.secondary:hover {
    border-color: var(--surface-border-hover);
    color: var(--text-secondary);
}

/* --- Forms ------------------------------------------------ */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    font-family: var(--font);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    padding: 0.6rem 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
}

input:not([type="checkbox"]):not([type="radio"])::placeholder,
textarea::placeholder {
    color: var(--input-placeholder);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

textarea {
    font-family: var(--font);
    resize: vertical;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
    margin-bottom: var(--space-md);
}

label > input,
label > select,
label > textarea {
    margin-top: var(--space-xs);
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
    cursor: pointer;
}

/* Inline label (checkbox/radio rows) */
label:has(input[type="checkbox"]),
label:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    margin-bottom: var(--space-sm);
}

/* --- Badges ----------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-active {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
}

.badge-error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.badge-processing {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.badge-default {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-light);
}

/* --- Tables ----------------------------------------------- */
table {
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
    padding: var(--space-sm) var(--space-md);
}

td {
    vertical-align: middle;
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

/* --- Page header ------------------------------------------ */
.page-header {
    margin-bottom: var(--space-xl);
    padding-top: var(--space-lg);
}

.page-header h1 {
    margin-bottom: var(--space-xs);
    font-size: 1.5rem;
}

@media (min-width: 768px) {
    .page-header h1 { font-size: 1.75rem; }
}

.page-header p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

/* =========================================================
   HOMEPAGE — Creative Design 2026
   Aurora bg, transformation animation, bento, warm amber
   ========================================================= */

/* --- Aurora ambient background ---------------------------- */
.aurora-wrap {
    position: relative;
    overflow: hidden;
    padding-bottom: var(--space-3xl);
}

.aurora-wrap::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -30%;
    width: 160%;
    height: 160%;
    background:
        radial-gradient(ellipse 70% 50% at 15% 45%, hsla(265, 80%, 50%, 0.18), transparent 55%),
        radial-gradient(ellipse 55% 55% at 85% 25%, hsla(35, 90%, 55%, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 70% at 50% 85%, hsla(200, 70%, 45%, 0.08), transparent 50%);
    animation: aurora-drift 14s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes aurora-drift {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(4%, -3%) scale(1.08) rotate(1.5deg); }
}

.aurora-wrap > * { position: relative; z-index: 1; }

/* --- Hero ------------------------------------------------- */
.hero {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-xl);
    max-width: 860px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(2.5rem, 7.5vw, 5.5rem);
    font-weight: 500;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: var(--space-lg);
    background: linear-gradient(180deg, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0.35) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-bottom: 0.05em;
    text-wrap: balance;
}

[data-theme="light"] .hero h1 {
    background: linear-gradient(180deg, hsl(230, 50%, 15%) 0%, hsla(230, 30%, 25%, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero h1 em {
    font-style: normal;
    -webkit-text-fill-color: var(--warm);
    position: relative;
}

.hero h1 em::after {
    content: '';
    position: absolute;
    bottom: 0.02em;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--warm);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    animation: underline-draw 0.8s 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes underline-draw {
    to { transform: scaleX(1); }
}

.hero > p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 540px;
    margin: 0 auto;
    font-weight: 400;
}

.hero-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: var(--space-xl);
    padding: 0.35rem 1.2rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.06);
}

.hero-cta {
    margin-top: var(--space-2xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.hero-cta a[role="button"] {
    padding: 0.85rem 2.8rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-cta a[role="button"]:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 0 30px var(--accent-glow), 0 0 80px rgba(99, 102, 241, 0.08);
}

.hero-note {
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .hero {
        padding: var(--space-4xl) 0 var(--space-3xl);
    }
    .hero > p {
        font-size: 1.25rem;
    }
}

/* --- Demo showcase (interactive tabbed demos) ------------- */
.demo-showcase {
    max-width: 740px;
    margin: var(--space-3xl) auto var(--space-2xl);
    padding-bottom: var(--space-xl);
}

.demo-showcase-label {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    font-weight: 500;
}

.demo-tabs {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.demo-tab {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.demo-tab:hover {
    color: var(--text);
    border-color: var(--surface-border-hover);
    background: var(--surface-hover);
}

.demo-tab.active {
    color: var(--warm);
    border-color: var(--warm);
    background: var(--warm-soft);
}

/* --- Hero transformation animation ----------------------- */
.hero-transform {
    max-width: 700px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-lg);
    align-items: center;
}

@media (max-width: 639px) {
    .hero-transform {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    .transform-arrow { transform: rotate(90deg); }
}

.email-chaos {
    padding: var(--space-lg);
    background: var(--bg-raised);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.email-chaos::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 20px 6px hsla(265, 80%, 65%, 0.2);
    animation: scan-beam 3s 0.5s ease-in-out forwards;
    opacity: 0;
}

@keyframes scan-beam {
    0%   { left: 0; opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

.email-line {
    font-size: 0.75rem;
    line-height: 1.7;
    color: var(--text-muted);
    opacity: 0;
    filter: blur(4px);
    animation: line-appear 0.5s ease forwards;
}

.email-line:nth-child(1) { animation-delay: 0.1s; }
.email-line:nth-child(2) { animation-delay: 0.25s; }
.email-line:nth-child(3) { animation-delay: 0.4s; }
.email-line:nth-child(4) { animation-delay: 0.55s; }
.email-line:nth-child(5) { animation-delay: 0.7s; }

@keyframes line-appear {
    from { opacity: 0; filter: blur(4px); transform: translateX(-8px); }
    to   { opacity: 0.55; filter: blur(0); transform: translateX(0); }
}

.email-line .hl {
    color: var(--warm);
    font-weight: 600;
    opacity: 0;
    animation: hl-glow 0.4s 2.5s ease forwards;
}

@keyframes hl-glow {
    from { opacity: 0; text-shadow: none; }
    to   { opacity: 1; text-shadow: 0 0 12px var(--warm-glow); }
}

.transform-arrow {
    color: var(--accent-light);
    font-size: 1.5rem;
    opacity: 0;
    animation: arrow-pulse 0.4s 2s ease forwards;
}

@keyframes arrow-pulse {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

.data-result {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.data-field {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-raised);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    animation: field-pop 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.data-field:nth-child(1) { animation-delay: 2.8s; }
.data-field:nth-child(2) { animation-delay: 3.1s; }
.data-field:nth-child(3) { animation-delay: 3.4s; }
.data-field:nth-child(4) { animation-delay: 3.7s; }

@keyframes field-pop {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.data-field .field-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.data-field .field-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--warm);
    font-variant-numeric: tabular-nums;
}

/* Specular highlight on top of data fields */
.data-field::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, hsla(265, 80%, 70%, 0.4), transparent);
}

.data-field { position: relative; overflow: hidden; }

/* --- Demo ------------------------------------------------- */
.demo-section {
    padding: var(--space-xl) 0 var(--space-3xl);
    display: flex;
    justify-content: center;
}

.demo-container {
    max-width: 440px;
    width: 100%;
}

.demo-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-md);
    font-weight: 600;
}

.demo-phone {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--glass-bg);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 0 120px rgba(99, 102, 241, 0.08);
    transition: box-shadow var(--transition-slow);
}

.demo-phone:hover {
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.2), 0 0 160px rgba(99, 102, 241, 0.12);
}

.demo-header {
    padding: 0.6rem var(--space-md);
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--gradient-subtle);
    color: var(--text);
}

.demo-thread-icon {
    font-size: 0.9rem;
}

.demo-msg {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.85rem;
    line-height: 1.7;
}

.demo-msg:last-child {
    border-bottom: none;
}

.demo-msg-old {
    opacity: 0.45;
}

.demo-msg-line {
    font-weight: 600;
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    color: var(--text);
}

.demo-urgency {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px; /* align with text baseline */
}

.demo-urgency.high { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.demo-urgency.medium { background: var(--warning); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.demo-urgency.low { background: var(--success); }

.demo-msg-action {
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding-left: calc(8px + var(--space-sm)); /* align with text after dot */
}

.demo-msg-deadline {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

.demo-msg-link {
    font-size: 0.75rem;
    color: var(--accent-light);
    margin-top: var(--space-sm);
    opacity: 0.7;
}

/* --- Section titles --------------------------------------- */
.section-title {
    text-align: center;
    margin-bottom: var(--space-2xl);
    color: var(--text);
    font-size: clamp(1.3rem, 3.5vw, 1.8rem);
    font-weight: 500;
    letter-spacing: -0.03em;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 500px;
    margin: calc(var(--space-md) * -1) auto var(--space-2xl);
    line-height: 1.6;
}

.section-label {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: var(--space-md);
}

/* --- How section ------------------------------------------ */
.how-section {
    padding: var(--space-3xl) 0 var(--space-2xl);
}

/* --- Visual pipeline -------------------------------------- */
.pipeline {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    max-width: 700px;
    margin: 0 auto;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    max-width: 180px;
}

.pipeline-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    margin-bottom: var(--space-sm);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.06);
}

.pipeline-icon-warm {
    color: var(--warm);
    box-shadow: 0 0 20px rgba(232, 164, 58, 0.08);
}

.pipeline-step:hover .pipeline-icon {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

.pipeline-step:hover .pipeline-icon-warm {
    border-color: var(--warm);
    box-shadow: 0 0 30px var(--warm-glow);
}

.pipeline-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.pipeline-step h3 {
    font-size: 0.95rem;
    margin-bottom: 2px;
    color: var(--text);
}

.pipeline-step p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.pipeline-connector {
    display: flex;
    align-items: center;
    padding-top: 20px; /* align with icon center */
    flex-shrink: 0;
}

@media (max-width: 639px) {
    .pipeline {
        flex-direction: column;
        align-items: center;
        gap: var(--space-sm);
    }
    .pipeline-connector {
        padding-top: 0;
        transform: rotate(90deg);
    }
    .pipeline-step {
        max-width: none;
    }
}

/* Keep old step-grid for app pages that still use it */
.step-grid {
    display: grid;
    gap: var(--space-md);
    margin: 0;
}

@media (min-width: 768px) {
    .step-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }
}

/* Bento-style cards with mouse-following glow */
.step-card {
    --mx: 50%;
    --my: 50%;
    position: relative;
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
    background: var(--bg-raised);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: 0;
    overflow: hidden;
    transition: border-color var(--transition-base), transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        500px circle at var(--mx) var(--my),
        rgba(99, 102, 241, 0.06),
        transparent 50%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

.step-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.step-card:hover::after {
    opacity: 1;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background: var(--gradient);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.step-card h3 {
    font-size: 1.05rem;
    margin-bottom: var(--space-sm);
    color: var(--text);
    letter-spacing: -0.01em;
}

.step-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* --- Who section ------------------------------------------ */
.who-section {
    padding: var(--space-3xl) 0 var(--space-2xl);
}

.who-grid {
    display: grid;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .who-grid { grid-template-columns: repeat(3, 1fr); }
}

.who-item {
    --mx: 50%;
    --my: 50%;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: var(--bg-raised);
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.who-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.who-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        400px circle at var(--mx) var(--my),
        rgba(99, 102, 241, 0.05),
        transparent 50%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

.who-item:hover {
    border-color: rgba(99, 102, 241, 0.15);
    transform: translateY(-3px);
}

.who-item:hover::before,
.who-item:hover::after {
    opacity: 1;
}

.who-item strong {
    font-size: 0.9rem;
    color: var(--text);
    display: block;
    margin-bottom: var(--space-xs);
    position: relative;
}

.who-item p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
    position: relative;
}

/* --- Why section ------------------------------------------ */
.why-section {
    padding: var(--space-3xl) 0 var(--space-2xl);
}

.why-grid {
    display: grid;
    gap: var(--space-md);
}

@media (min-width: 640px) {
    .why-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
    .why-grid { grid-template-columns: repeat(3, 1fr); }
}

.why-item {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
    border: 1px solid var(--glass-border);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.why-item:hover {
    border-color: rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.why-icon {
    font-size: 1.15rem;
    margin-bottom: var(--space-sm);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-subtle);
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.why-item h3 {
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
    color: var(--text);
}

.why-item p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* --- Final CTA -------------------------------------------- */
.final-cta {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg) var(--space-4xl);
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.final-cta h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: var(--space-md);
    color: var(--text);
}

.final-cta p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    font-size: 1.05rem;
}

.final-cta a[role="button"] {
    padding: 0.85rem 3rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.final-cta a[role="button"]:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 0 30px var(--accent-glow), 0 0 80px rgba(99, 102, 241, 0.08);
}

/* --- Timeline use cases ----------------------------------- */
.timeline {
    max-width: 600px;
    margin: 0 auto;
    padding-left: var(--space-xl);
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--accent), var(--warm), transparent);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-xl);
    padding-left: var(--space-lg);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-xl) + 2px);
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.timeline-item.pain::before {
    background: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.timeline-item.pain .timeline-time {
    color: var(--danger);
}

.timeline-item.win::before {
    background: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.timeline-item.win .timeline-time {
    color: var(--success);
}

.timeline-item.win .timeline-text {
    color: var(--text);
}

.timeline-time {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--warm);
    letter-spacing: 0.02em;
    margin-bottom: var(--space-xs);
}

.timeline-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.timeline-text strong {
    color: var(--text);
}

/* --- Live feed (social proof) ----------------------------- */
.live-feed {
    max-width: 500px;
    margin: var(--space-xl) auto 0;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-raised);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.feed-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.feed-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50%      { opacity: 0.7; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

.feed-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0;
    animation: feed-slide 0.4s ease forwards;
}

.feed-item:nth-child(2) { animation-delay: 0.8s; }
.feed-item:nth-child(3) { animation-delay: 1.6s; }
.feed-item:nth-child(4) { animation-delay: 2.4s; }

@keyframes feed-slide {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.feed-item .feed-badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    background: var(--warm-soft);
    color: var(--warm);
    font-weight: 600;
    white-space: nowrap;
}

.feed-item .feed-time {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Bento grid ------------------------------------------- */
.bento {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-xl);
    padding: 1px;
    overflow: hidden;
}

.bento-card {
    background: var(--bg-raised);
    padding: var(--space-xl) var(--space-lg);
    position: relative;
    overflow: hidden;
    grid-column: span 3;
}

.bento-card:first-child { border-radius: var(--radius-lg) 0 0 0; }
.bento-card:nth-child(2) { border-radius: 0 var(--radius-lg) 0 0; }
.bento-card.bento-wide {
    grid-column: span 6;
}
.bento-card:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Specular highlight on top */
.bento-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, hsla(265, 80%, 70%, 0.3), transparent);
}

.bento-card h3 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

.bento-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.bento-icon {
    font-size: 1.3rem;
    margin-bottom: var(--space-md);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-subtle);
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

@media (max-width: 767px) {
    .bento {
        grid-template-columns: 1fr;
    }
    .bento-card,
    .bento-card.bento-wide {
        grid-column: span 1;
    }
    .bento-card:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .bento-card:nth-child(2) { border-radius: 0; }
    .bento-card:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}

/* =========================================================
   APP PAGES
   ========================================================= */

/* --- Stat bar (dashboard) --------------------------------- */
.stat-bar {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    background: var(--gradient-subtle);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    justify-content: center;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 60px;
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-num.stat-success { color: var(--success); }
.stat-num.stat-danger { color: var(--danger); }

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

/* --- Status cards (dashboard) ----------------------------- */
.status-grid {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .status-grid { grid-template-columns: repeat(3, 1fr); }
}

.status-card {
    padding: var(--space-lg);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.status-card:hover {
    border-color: var(--surface-border-hover);
    box-shadow: var(--card-shadow);
}

.status-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 600;
}

.status-card .status-value {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text);
}

.status-card .status-left {
    flex: 1;
}

.status-card a[role="button"] {
    flex-shrink: 0;
}

/* --- Settings section title ------------------------------- */
.settings-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--glass-border);
}

/* --- Config card ------------------------------------------ */
.config-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.config-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    color: var(--text);
}

.config-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* --- Account row ------------------------------------------ */
.account-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.account-row strong {
    color: var(--text);
}

.account-actions {
    display: flex;
    gap: var(--space-sm);
}

/* --- Setup step ------------------------------------------- */
.setup-step {
    position: relative;
}

.setup-step h3 {
    font-size: 1rem;
    color: var(--text);
}

/* --- QR section ------------------------------------------- */
.qr-section {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xl);
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

.qr-box {
    background: white;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    display: inline-block;
}

/* --- Auth pages ------------------------------------------- */
.auth-card {
    max-width: 400px;
    margin: var(--space-3xl) auto 0;
    padding: var(--space-2xl) var(--space-xl) var(--space-xl);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.auth-card:hover {
    /* Disable hover lift on auth cards */
    box-shadow: none;
    border-color: var(--glass-border);
}

.auth-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--text);
}

.auth-card label {
    color: var(--text-secondary);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-light);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* --- Empty state ------------------------------------------ */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-muted);
    border: 1px dashed var(--surface-border);
    border-radius: var(--radius-md);
    background: none;
}

.empty-state:hover {
    border-color: var(--surface-border);
    box-shadow: none;
}

.empty-state p {
    font-size: 0.9rem;
    margin: 0;
    color: var(--text-muted);
}

/* --- Legal pages ------------------------------------------ */
.legal-page {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-2xl) 0;
    background: none;
    border: none;
}

.legal-page:hover {
    box-shadow: none;
    border-color: transparent;
}

.legal-page h1 {
    margin-bottom: var(--space-xs);
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 500;
    letter-spacing: -0.03em;
}

.legal-page h2 {
    font-size: 1.1rem;
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-sm);
    color: var(--text);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

.legal-page h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

.legal-page p,
.legal-page li {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.legal-page a {
    color: var(--accent-light);
}

.legal-page ul {
    padding-left: var(--space-lg);
}

.legal-page li {
    margin-bottom: var(--space-xs);
}

.legal-page table {
    margin: var(--space-md) 0;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.legal-page th {
    background: var(--surface);
}

.legal-page code {
    font-size: 0.8rem;
}

/* --- Footer ----------------------------------------------- */
.site-footer {
    margin-top: auto; /* push to bottom on short pages */
    padding: var(--space-xl) 0 var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

.site-footer .container {
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
    padding: 0;
    list-style: none;
}

.footer-links a {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-light);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
}

.footer-bottom small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    background: none;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    padding: 0;
    margin: 0;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.06);
}

/* --- Cookie banner ---------------------------------------- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    z-index: 200;
}

.cookie-banner p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.cookie-banner a {
    color: var(--accent-light);
}

@media (max-width: 767px) {
    .cookie-banner {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
}

/* --- Utilities -------------------------------------------- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.gap-sm { gap: var(--space-sm); }

.grid-2 {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* --- Animations ------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.35s ease-out;
}

.animate-in {
    animation: fadeInUp 0.5s ease-out both;
}

/* Staggered entrance */
.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.06s; }
.animate-in:nth-child(3) { animation-delay: 0.12s; }
.animate-in:nth-child(4) { animation-delay: 0.18s; }
.animate-in:nth-child(5) { animation-delay: 0.24s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

/* Scroll-triggered reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered reveal children */
.reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal:nth-child(4) { transition-delay: 0.24s; }
.reveal:nth-child(5) { transition-delay: 0.32s; }
.reveal:nth-child(6) { transition-delay: 0.4s; }

/* Mouse-following glow for cards */
.glow-card {
    --mx: 50%;
    --my: 50%;
    position: relative;
    overflow: hidden;
}

.glow-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        500px circle at var(--mx) var(--my),
        rgba(99, 102, 241, 0.06),
        transparent 50%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

.glow-card:hover::after {
    opacity: 1;
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Disable hover effects on touch devices --------------- */
@media (hover: none) {
    article:hover, .card:hover,
    .step-card:hover, .why-item:hover,
    .status-card:hover {
        border-color: var(--glass-border);
        box-shadow: none;
    }

    .btn-primary:hover,
    button[type="submit"]:not(.outline):not(.secondary):not(.btn-sm):not(.nav-toggle):not(.theme-toggle):hover,
    a[role="button"]:not(.outline):not(.secondary):hover {
        transform: none;
        box-shadow: none;
    }
}

/* --- Table responsive ------------------------------------- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Tag list (settings) ---------------------------------- */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    min-height: 1.5rem;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tag-remove {
    cursor: pointer;
    opacity: 0.5;
    border: none;
    background: none;
    padding: 0 2px;
    font-size: 1rem;
    color: inherit;
    transition: opacity var(--transition-fast), color var(--transition-fast);
    line-height: 1;
}

.tag-remove:hover {
    opacity: 1;
    color: var(--danger);
}

/* --- Details/summary -------------------------------------- */
details {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--glass-bg);
    margin-bottom: var(--space-md);
}

details:hover {
    box-shadow: none;
}

details summary {
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::after {
    content: '+';
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

details[open] summary::after {
    content: '−';
}

details summary:hover {
    color: var(--text);
}

details[open] summary {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--glass-border);
}

/* --- Loading spinner -------------------------------------- */
[aria-busy="true"] {
    opacity: 0.6;
}

/* --- Activity rows --------------------------------------- */
.activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem var(--space-md);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    gap: var(--space-md);
}

.activity-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
}

.activity-sender {
    font-size: 0.85rem;
    font-weight: 550;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

.activity-subject {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.activity-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

@media (max-width: 639px) {
    .activity-main {
        flex-direction: column;
        gap: 1px;
    }
    .activity-subject {
        white-space: normal;
        font-size: 0.75rem;
    }
}

/* --- Inline flex helper ----------------------------------- */
.inline-flex {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

/* =========================================================
   ENHANCED COMPONENTS (UI/UX Polish)
   ========================================================= */

/* --- Toast notifications ---------------------------------- */
.toast-container {
    position: fixed;
    top: 76px;
    right: var(--space-lg);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - var(--space-lg) * 2);
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 0.85rem;
    color: var(--text);
    animation: toastIn 0.3s ease-out;
    transition: all 0.3s ease-out;
}

.toast.toast-exit {
    opacity: 0;
    transform: translateX(100%);
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1.4;
}

.toast-body {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.toast-close:hover {
    opacity: 1;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warning); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media (max-width: 639px) {
    .toast-container {
        right: var(--space-sm);
        left: var(--space-sm);
        max-width: none;
        width: auto;
    }
}

/* --- Loading skeleton ------------------------------------- */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface) 25%,
        var(--surface-hover) 50%,
        var(--surface) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-line {
    height: 0.85rem;
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-sm);
}

.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.short { width: 60%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Tabs ------------------------------------------------- */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    padding: 0.6rem var(--space-md);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease-out; }

/* --- Pipe flow visual ------------------------------------- */
.pipe-flow {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--gradient-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    margin-bottom: var(--space-md);
    overflow-x: auto;
    flex-wrap: wrap;
}

.pipe-flow-step {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.pipe-flow-step .pipe-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.pipe-flow-arrow {
    color: var(--accent-light);
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* --- Use case cards (homepage) ---------------------------- */
.use-case-grid {
    display: grid;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .use-case-grid { grid-template-columns: repeat(2, 1fr); }
}

.use-case-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.use-case-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.use-case-card:hover {
    border-color: var(--surface-border-hover);
    box-shadow: var(--card-shadow);
}

.use-case-card:hover::before {
    opacity: 1;
}

.use-case-card .use-case-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.use-case-card .use-case-before {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: var(--space-sm);
}

.use-case-card .use-case-after {
    font-size: 0.8rem;
    color: var(--success);
    line-height: 1.6;
    font-weight: 500;
    margin: 0;
}

.use-case-title svg {
    flex-shrink: 0;
}

/* --- Comparison section (homepage) ------------------------ */
.comparison-grid {
    display: grid;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .comparison-grid { grid-template-columns: repeat(3, 1fr); }
}

.comparison-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    text-align: center;
}

.comparison-card .comparison-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    opacity: 0.5;
}

.comparison-card h3 {
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.comparison-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* --- Number highlight (homepage) -------------------------- */
.number-highlight {
    color: var(--accent-light);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* --- Responsive table wrapper ----------------------------- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--space-lg) * -1);
    padding: 0 var(--space-lg);
}

/* --- Improved empty state --------------------------------- */
.empty-state-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

/* --- Processor/Output card improvements ------------------- */
.config-card-body {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--glass-border);
}

.config-meta {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.config-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* --- Prompt editor ---------------------------------------- */
.prompt-editor {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    tab-size: 2;
    min-height: 120px;
    background: var(--bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    resize: vertical;
}

.prompt-editor:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

/* --- Variable chips --------------------------------------- */
.var-chips {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
    margin-top: var(--space-xs);
}

.var-chip {
    font-size: 0.7rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--accent-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.var-chip:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
}

/* --- Section divider -------------------------------------- */
.section-divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: var(--space-2xl) 0;
}

/* --- Hero improvements ------------------------------------ */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

.hero-stat {
    text-align: center;
}

.hero-stat-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-light);
    display: block;
    line-height: 1.2;
}

.hero-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}


/* ===========================================================
   APP LAYOUT — Authenticated pages only
   Scoped under .app-layout so landing page is untouched.
   Linear-style: flat, dense, monochrome + accent.
   =========================================================== */

/* --- App tokens (dark) --- */
.app-layout {
    --app-bg: #09090b;
    --app-surface: #141416;
    --app-surface-hover: #1c1c20;
    --app-border: #27272a;
    --app-border-hover: #3f3f46;
    --app-text: #fafafa;
    --app-text-secondary: #a1a1aa;
    --app-text-muted: #71717a;
    --app-accent: #6366f1;
    --app-accent-hover: #818cf8;
    --app-accent-subtle: rgba(99, 102, 241, 0.10);
    --app-success: #22c55e;
    --app-danger: #ef4444;
    --app-warning: #eab308;
    --app-info: #3b82f6;
    --app-radius: 6px;
    --app-radius-sm: 4px;
}

/* --- App tokens (light) --- */
[data-theme="light"] .app-layout {
    --app-bg: #fafafa;
    --app-surface: #ffffff;
    --app-surface-hover: #f4f4f5;
    --app-border: #e4e4e7;
    --app-border-hover: #d4d4d8;
    --app-text: #09090b;
    --app-text-secondary: #52525b;
    --app-text-muted: #a1a1aa;
    --app-accent-subtle: rgba(99, 102, 241, 0.08);
}

/* --- Base reset (no Pico dependency) --- */
.app-layout,
.app-layout *,
.app-layout *::before,
.app-layout *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.app-layout {
    display: flex;
    min-height: 100dvh;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-layout h1, .app-layout h2, .app-layout h3, .app-layout h4 {
    font-weight: 600;
    color: var(--app-text);
    line-height: 1.3;
}

.app-layout a {
    text-decoration: none;
    color: inherit;
}

.app-layout p {
    line-height: 1.5;
}

.app-layout ul, .app-layout ol {
    list-style: none;
}

.app-layout img, .app-layout svg {
    display: block;
    max-width: 100%;
}

.app-layout button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

.app-layout select {
    font-family: inherit;
    cursor: pointer;
}

.app-layout details {
    border: none;
}

.app-layout details summary {
    cursor: pointer;
    list-style: none;
}

.app-layout details summary::-webkit-details-marker {
    display: none;
}

.app-layout article {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
}

.app-layout strong {
    font-weight: 600;
}

.app-layout *,
.app-layout *::before,
.app-layout *::after {
    border-color: var(--app-border);
}

/* --- Sidebar --- */
.app-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--app-surface);
    border-right: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.app-sidebar-brand {
    padding: 16px 16px 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--app-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.app-sidebar-brand .logo-mark {
    width: 24px;
    height: 24px;
    background: var(--app-accent);
    color: #fff;
    border-radius: var(--app-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.app-sidebar-nav {
    flex: 1;
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.app-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin: 0;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 450;
    line-height: 1.2;
    transition: all 0.12s ease;
}

.app-sidebar-nav a:hover {
    background: var(--app-surface-hover);
    color: var(--app-text);
}

.app-sidebar-nav a.active {
    background: var(--app-accent-subtle);
    color: var(--app-accent-hover);
    font-weight: 500;
}

.app-sidebar-nav a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

.app-sidebar-nav a.active svg {
    opacity: 1;
}

.app-sidebar-divider {
    height: 1px;
    background: var(--app-border);
    margin: 8px 10px 4px;
}

.app-sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-text-muted);
    padding: 4px 10px 6px;
}

.app-sidebar-bottom {
    padding: 8px;
    border-top: 1px solid var(--app-border);
}

.app-sidebar-bottom a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin: 0;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-muted);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.2;
    transition: all 0.12s ease;
}

.app-sidebar-bottom a:hover {
    background: var(--app-surface-hover);
    color: var(--app-text-secondary);
}

.app-sidebar-bottom a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* --- Main content area --- */
.app-main {
    flex: 1;
    margin-left: 220px;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: 52px;
    border-bottom: 1px solid var(--app-border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--app-bg);
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-topbar-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--app-text);
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-content {
    flex: 1;
    padding: 24px;
    max-width: 960px;
    width: 100%;
}

/* --- Mobile sidebar --- */
.app-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--app-text);
    padding: 8px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .app-mobile-toggle {
        display: flex;
    }
    .app-content {
        padding: 16px;
    }
    .app-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .app-sidebar.open + .app-sidebar-overlay {
        display: block;
    }
}

/* --- Page header --- */
.app-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.app-page-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--app-text);
    letter-spacing: -0.02em;
}

.app-page-header p {
    font-size: 13px;
    color: var(--app-text-muted);
    margin: 2px 0 0;
}

.app-page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* --- Card --- */
.app-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.app-card-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted);
    border-bottom: 1px solid var(--app-border);
}

.app-card-body {
    padding: 16px;
}

.app-card--clickable {
    cursor: pointer;
    transition: border-color 0.12s ease;
}

.app-card--clickable:hover {
    border-color: var(--app-border-hover);
}

/* --- Row (list item) --- */
.app-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--app-border);
    font-size: 13px;
}

.app-row:last-child {
    border-bottom: none;
}

.app-row-main {
    flex: 1;
    min-width: 0;
}

.app-row-meta {
    color: var(--app-text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.app-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* --- Badge --- */
.app-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.app-badge--default {
    background: var(--app-surface-hover);
    color: var(--app-text-secondary);
}

.app-badge--success {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
}

.app-badge--danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}

.app-badge--warning {
    background: rgba(234, 179, 8, 0.12);
    color: #facc15;
}

.app-badge--info {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
}

.app-badge--accent {
    background: var(--app-accent-subtle);
    color: var(--app-accent-hover);
}

[data-theme="light"] .app-badge--success { color: #16a34a; }
[data-theme="light"] .app-badge--danger { color: #dc2626; }
[data-theme="light"] .app-badge--warning { color: #ca8a04; }
[data-theme="light"] .app-badge--info { color: #2563eb; }
[data-theme="light"] .app-badge--accent { color: var(--app-accent); }

/* --- Button --- */
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--app-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
    border: 1px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}

.app-btn {
    background: var(--app-accent);
    color: #fff;
}

.app-btn:hover {
    background: var(--app-accent-hover);
}

.app-btn--ghost {
    background: transparent;
    color: var(--app-text-secondary);
    border-color: var(--app-border);
}

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

.app-btn--danger {
    background: transparent;
    color: var(--app-danger);
    border-color: rgba(239, 68, 68, 0.25);
}

.app-btn--danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.app-btn--sm {
    padding: 3px 10px;
    font-size: 12px;
}

.app-btn--icon {
    padding: 4px 6px;
    font-size: 14px;
    line-height: 1;
}

.app-btn[disabled],
.app-btn[aria-busy="true"] {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Dot indicator --- */
.app-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.app-dot--danger { background: var(--app-danger); }
.app-dot--warning { background: var(--app-warning); }
.app-dot--success { background: var(--app-success); }
.app-dot--info { background: var(--app-info); }
.app-dot--muted { background: var(--app-text-muted); }

/* --- Empty state --- */
.app-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--app-text-muted);
    font-size: 13px;
}

.app-empty p {
    margin: 0 0 12px;
}

/* --- Forms --- */
.app-layout input[type="text"],
.app-layout input[type="email"],
.app-layout input[type="password"],
.app-layout input[type="url"],
.app-layout input[type="number"],
.app-layout input[type="search"],
.app-layout select,
.app-layout textarea {
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    color: var(--app-text);
    font-size: 13px;
    padding: 8px 12px;
    font-family: inherit;
    transition: border-color 0.12s ease;
    width: 100%;
    line-height: 1.5;
    -webkit-appearance: none;
    appearance: none;
}

.app-layout input[type="checkbox"],
.app-layout input[type="radio"] {
    width: auto;
    accent-color: var(--app-accent);
    cursor: pointer;
}

.app-layout input:focus,
.app-layout select:focus,
.app-layout textarea:focus {
    border-color: var(--app-accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--app-accent-subtle);
}

.app-layout input::placeholder,
.app-layout textarea::placeholder {
    color: var(--app-text-muted);
}

.app-layout label {
    font-size: 13px;
    font-weight: 500;
    color: var(--app-text-secondary);
    display: block;
    margin-bottom: 4px;
}

.app-form-group {
    margin-bottom: 16px;
}

.app-form-hint {
    font-size: 12px;
    color: var(--app-text-muted);
    margin-top: 4px;
}

.app-form-row {
    display: flex;
    gap: 12px;
}

.app-form-row > * {
    flex: 1;
}

/* --- Section divider --- */
.app-section {
    margin-bottom: 24px;
}

.app-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-text-muted);
    margin: 0 0 8px;
    padding: 0;
}

/* --- Inline action row (for dashboard) --- */
.app-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
}

.app-action-row .task-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-action-row .task-meta {
    color: var(--app-text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.app-action-row .task-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* --- Project card (dashboard specific) --- */
.app-project {
    padding: 14px 16px;
}

.app-project-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.app-project-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-project-sub {
    font-size: 12px;
    color: var(--app-text-muted);
    margin-top: 2px;
}

.app-project-actions {
    padding: 4px 0 0 24px;
}

/* --- Timeline --- */
.app-timeline-item {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
    border-left: 2px solid var(--app-border);
    padding-left: 12px;
    margin-left: 4px;
}

.app-timeline-date {
    color: var(--app-text-muted);
    font-size: 12px;
    white-space: nowrap;
    min-width: 48px;
}

.app-timeline-content {
    flex: 1;
    min-width: 0;
}

.app-timeline-content strong {
    font-weight: 600;
}

.app-timeline-summary {
    color: var(--app-text-muted);
    font-size: 12px;
    margin-top: 1px;
}

/* --- Auth page (login/register) --- */
.app-auth {
    max-width: 360px;
    margin: 80px auto;
    padding: 0 20px;
}

.app-auth h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.app-auth p {
    font-size: 13px;
    color: var(--app-text-muted);
    margin: 0 0 24px;
}

.app-auth .app-card-body {
    padding: 20px;
}

/* --- Scrollbar --- */
.app-layout ::-webkit-scrollbar {
    width: 6px;
}

.app-layout ::-webkit-scrollbar-track {
    background: transparent;
}

.app-layout ::-webkit-scrollbar-thumb {
    background: var(--app-border);
    border-radius: 3px;
}

.app-layout ::-webkit-scrollbar-thumb:hover {
    background: var(--app-border-hover);
}
