:root {
    color-scheme: dark;

    /* ======================================================================
       INFOPATH 2.0 — DARK COSMIC PURPLE DESIGN SYSTEM
       ====================================================================== */
    --void-black: #080711;
    --deep-space: #100C21;
    --midnight-purple: #1A1233;
    --cosmic-panel: #151029;
    --cosmic-hover: #21183B;

    /* Accent */
    --electric-violet: #8B5CF6;
    --luminous-purple: #A78BFA;
    --cosmic-pink: #D77DFF;
    --ice-blue: #8EDCFF;

    /* Text */
    --text-main: #F7F5FF;
    --text-secondary: #B6B0CB;
    --text-muted: #89839F;

    /* Borders & Surface */
    --border-cosmic: #32284E;
    --border-subtle: rgba(167, 139, 250, 0.18);
    --border-glow: rgba(167, 139, 250, 0.42);

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-28: 112px;

    /* Shared Application Shell & Dark Research Command Center Tokens */
    --ip-bg: var(--void-black);
    --ip-sidebar: var(--deep-space);
    --ip-panel: var(--cosmic-panel);
    --ip-hover: var(--cosmic-hover);
    --ip-border: var(--border-cosmic);
    --ip-control-border: #5A4980;
    --ip-primary: var(--luminous-purple);
    --ip-link: #C4B5FD;
    --ip-secondary: var(--ice-blue);
    --ip-lavender: #261B47;
    --ip-control: #0E0B1C;
    --ip-stripe: #1A1430;
    --ip-fill: #6D44C8;
    --ip-fill-hover: #7E52DE;
    --ip-fill-active: #5B37AD;

    /* Text Tokens */
    --ip-text: var(--text-main);
    --ip-muted: var(--text-secondary);
    --ip-muted-soft: var(--text-muted);

    /* Semantic Status & Chart Differentiation Tokens (High-Contrast Dark Mode) */
    --ip-mint: #13312B;
    --ip-sky: #142A42;
    --ip-peach: #362224;
    --ip-cream: #352714;
    --ip-rose: #3D1E32;
    --ip-accent: #72D7BF;
    --ip-sky-text: #8EDCFF;
    --ip-peach-text: #F9C2B2;
    --ip-success: #6FDBAD;
    --ip-success-text: #82EAC0;
    --ip-warning: #E8B46D;
    --ip-warning-text: #FFD699;
    --ip-danger: #F08EA7;
    --ip-danger-text: #FFB3C4;

    /* Typography, Radii & Motion */
    --ip-font: "Be Vietnam Pro", Inter, system-ui, "Segoe UI", sans-serif;
    --ip-font-display: "Be Vietnam Pro", Inter, system-ui, sans-serif;
    --ip-radius: 18px;
    --ip-radius-small: 11px;
    --ip-radius-hero: 24px;
    --ip-space: 8px;
    --ip-section-gap: clamp(18px, 2.1vw, 28px);
    --ip-motion: 200ms cubic-bezier(.22, .68, .28, 1);
    --ip-shadow-hover: 0 12px 32px rgba(4, 3, 11, .45);
}

.ip-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
}

.ip-button,
.ip-shell .ip-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: var(--ip-radius-small);
    background: var(--ip-fill);
    color: #fff;
    font: 600 .875rem/1.4 var(--ip-font);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--ip-motion), color var(--ip-motion), border-color var(--ip-motion), transform var(--ip-motion), box-shadow var(--ip-motion);
}

.ip-button:hover,
.ip-shell .ip-button:hover {
    background: var(--ip-fill-hover);
    border-color: var(--luminous-purple);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(139, 92, 246, .28);
}
.ip-button:active,
.ip-shell .ip-button:active {
    background: var(--ip-fill-active);
    transform: translateY(0);
}
.ip-button .ip-icon { width: 17px; height: 17px; }

.ip-button--secondary,
.ip-shell .ip-button--secondary {
    border-color: var(--ip-control-border);
    background: var(--ip-panel);
    color: var(--ip-text);
    box-shadow: none;
}

.ip-button--secondary:hover,
.ip-shell .ip-button--secondary:hover,
.ip-shell .ip-button--secondary:active {
    border-color: var(--luminous-purple);
    background: var(--ip-hover);
    color: #fff;
    box-shadow: none;
}

.ip-button:disabled,
.ip-button[aria-disabled="true"],
.ip-button[aria-busy="true"] { opacity: .6; cursor: default; transform: none; }

.ip-button[aria-busy="true"]::before {
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    content: "";
    animation: ip-spin .8s linear infinite;
}

@keyframes ip-spin { to { transform: rotate(1turn); } }

.ip-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--ip-border);
    border-radius: 999px;
    background: var(--ip-lavender);
    color: var(--ip-link);
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.5;
}

.ip-badge--success, .ip-toast--success {
    border-color: rgba(111, 219, 173, 0.36);
    background: var(--ip-mint);
    color: var(--ip-success-text);
}
.ip-badge--warning {
    border-color: rgba(232, 180, 109, 0.36);
    background: var(--ip-cream);
    color: var(--ip-warning-text);
}
.ip-badge--danger {
    border-color: rgba(240, 142, 167, 0.36);
    background: var(--ip-rose);
    color: var(--ip-danger-text);
}

.ip-empty {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: clamp(22px, 5vw, 42px) 18px;
    border: 1px dashed var(--ip-control-border);
    border-radius: var(--ip-radius);
    color: var(--ip-muted);
    text-align: center;
}

.ip-empty > .ip-icon { width: 32px; height: 32px; padding: 6px; border-radius: 10px; background: var(--ip-lavender); color: var(--ip-link); }

.ip-loading {
    position: fixed;
    z-index: 10;
    inset-inline-end: clamp(16px, 3vw, 32px);
    inset-block-end: clamp(16px, 3vw, 28px);
    display: grid;
    align-content: start;
    gap: 9px;
    width: min(260px, calc(100% - 32px));
    padding: 15px;
    border: 1px solid var(--ip-border);
    border-radius: var(--ip-radius);
    background: var(--ip-panel);
    color: var(--ip-muted);
    font-size: .8125rem;
    box-shadow: var(--ip-shadow-hover);
}

.ip-loading[hidden] { display: none; }
.ip-skeleton { height: 9px; border-radius: 999px; background: var(--ip-lavender); animation: ip-pulse 1.15s ease-in-out infinite alternate; }
.ip-skeleton + .ip-skeleton { width: 65%; }
@keyframes ip-pulse { to { opacity: .5; } }

.ip-toast {
    padding: 11px 14px;
    border: 1px solid currentColor;
    border-radius: var(--ip-radius-small);
    font-size: .875rem;
    line-height: 1.55;
    animation: ip-appear var(--ip-motion) both;
}

@keyframes ip-appear { from { opacity: 0; transform: translateY(4px); } }

.ip-shell :focus-visible,
.ip-button:focus-visible,
.ip-skip:focus-visible { outline: 2px solid var(--ice-blue); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    .ip-button { transition: none; }
    .ip-button[aria-busy="true"]::before, .ip-skeleton, .ip-toast { animation: none; }
}
