/* AEGIS — high-tech dark UI (CardWell-inspired layout) */

:root {
    --bg-base: #0b0f18;
    --bg-elevated: #111827;
    --bg-card: #151c2c;
    --bg-card-hover: #1a2235;
    --bg-sidebar: #0d111c;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.09);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #4a7df5;
    --accent-hover: #6b93ff;
    --accent-glow: rgba(74, 125, 245, 0.35);
    --accent-soft: rgba(74, 125, 245, 0.14);

    --teal: #2dd4bf;
    --purple: #a78bfa;
    --amber: #fbbf24;
    --success: #34d399;
    --danger: #f87171;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;

    --sidebar-w: 230px;
    --topbar-h: 76px;
    --font: "Inter", system-ui, -apple-system, sans-serif;

    --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.22);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

.is-hidden {
    display: none !important;
}

/* ── Auth ───────────────────────────────────────────── */

.auth-screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--bg-base);
    overflow: hidden;
    z-index: 100;
}

.auth-bg-glow {
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    pointer-events: none;
}

.auth-bg-glow--left {
    top: -120px;
    left: -80px;
    background: var(--accent);
}

.auth-bg-glow--right {
    bottom: -160px;
    right: -100px;
    background: #6366f1;
}

.auth-card {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: 0 0 48px rgba(74, 125, 245, 0.12);
}

.auth-card__shine {
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius-xl) + 1px);
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.auth-card__shine::before {
    content: "";
    position: absolute;
    inset: -50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 280deg,
        rgba(74, 125, 245, 0.15) 300deg,
        rgba(120, 160, 255, 0.95) 320deg,
        rgba(99, 102, 241, 0.7) 335deg,
        rgba(74, 125, 245, 0.15) 350deg,
        transparent 360deg
    );
    animation: auth-border-glow 5.5s linear infinite;
}

.auth-card__shine::after {
    display: none;
}

@keyframes auth-border-glow {
    to {
        transform: rotate(360deg);
    }
}

.auth-card__content {
    position: relative;
    z-index: 1;
    margin: 2px;
    padding: 38px 34px 30px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(145deg, rgba(21, 28, 44, 0.92), rgba(11, 15, 24, 0.95));
    backdrop-filter: blur(8px);
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-top: 12px;
}

.auth-brand p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(74, 125, 245, 0.25);
}

.brand-mark--eye {
    box-shadow: 0 0 20px rgba(74, 125, 245, 0.2), inset 0 0 12px rgba(74, 125, 245, 0.08);
}

.brand-mark svg {
    width: 28px;
    height: 28px;
}

.cyber-eye__pupil {
    transform-origin: 16px 16px;
    animation: cyber-eye-pulse 3s ease-in-out infinite;
}

.cyber-eye__scan {
    animation: cyber-eye-scan 2.8s ease-in-out infinite;
    transform-origin: 16px 16px;
}

.cyber-eye__iris-outer {
    animation: cyber-eye-ring 6s linear infinite;
    transform-origin: 16px 16px;
}

@keyframes cyber-eye-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.88); opacity: 0.9; }
}

@keyframes cyber-eye-scan {
    0%, 100% { opacity: 0.15; transform: scaleX(0.55); }
    50% { opacity: 0.65; transform: scaleX(1); }
}

@keyframes cyber-eye-ring {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card__shine::before,
    .brand-mark-shine::before,
    .sidebar__brand-mark-wrap .brand-mark--eye,
    .cyber-eye__pupil,
    .cyber-eye__scan,
    .cyber-eye__iris-outer {
        animation: none;
    }
}

.brand-mark--sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.brand-mark--sm svg,
.cyber-eye--sm {
    width: 18px;
    height: 18px;
}

.brand-mark--sm.brand-mark--eye {
    box-shadow: 0 0 12px rgba(74, 125, 245, 0.18), inset 0 0 8px rgba(74, 125, 245, 0.06);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.field input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input::placeholder {
    color: var(--text-muted);
}

.auth-error {
    font-size: 13px;
    color: var(--danger);
    padding: 10px 12px;
    background: rgba(248, 113, 113, 0.1);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Buttons ────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn--primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--ghost {
    color: var(--text-secondary);
    background: transparent;
}

.btn--ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn--full {
    width: 100%;
    padding: 13px 20px;
}

.btn--cta {
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
}

.btn--cta svg {
    width: 20px;
    height: 20px;
}

.btn--icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn--icon svg {
    width: 20px;
    height: 20px;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn--danger-ghost {
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.btn--danger-ghost:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
}

/* ── App shell ──────────────────────────────────────── */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    z-index: 50;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 18px 26px;
}

.sidebar__brand-mark-wrap {
    position: relative;
    flex-shrink: 0;
    border-radius: 11px;
}

.sidebar__brand-mark-wrap .brand-mark-shine {
    display: none;
}

.sidebar__brand-mark-wrap .brand-mark--eye {
    animation: brand-mark-border-pulse 2.8s ease-in-out infinite;
}

.sidebar__brand-mark-wrap .cyber-eye__pupil,
.sidebar__brand-mark-wrap .cyber-eye__scan,
.sidebar__brand-mark-wrap .cyber-eye__iris-outer {
    animation: none;
}

@keyframes brand-mark-border-pulse {
    0%,
    100% {
        border-color: rgba(74, 125, 245, 0.28);
        box-shadow: 0 0 0 0 rgba(74, 125, 245, 0);
    }
    50% {
        border-color: rgba(74, 125, 245, 0.72);
        box-shadow: 0 0 16px 2px rgba(74, 125, 245, 0.34);
    }
}

.brand-mark-shine {
    position: absolute;
    inset: -1px;
    border-radius: 11px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.brand-mark-shine::before {
    content: "";
    position: absolute;
    inset: -50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 280deg,
        rgba(74, 125, 245, 0.12) 300deg,
        rgba(120, 160, 255, 0.85) 320deg,
        rgba(99, 102, 241, 0.55) 335deg,
        rgba(74, 125, 245, 0.12) 350deg,
        transparent 360deg
    );
    animation: auth-border-glow 5.5s linear infinite;
}

.sidebar__brand-mark-wrap .brand-mark {
    position: relative;
    z-index: 1;
    margin: 1px;
}

.sidebar__logo {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 10px;
}

.sidebar__footer {
    padding: 14px 10px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.65;
}

.nav-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item.is-active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.nav-item.is-active svg {
    opacity: 1;
}

.nav-item--muted {
    opacity: 0.45;
}

.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────── */

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 28px;
    background: rgba(11, 15, 24, 0.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    z-index: 40;
}

.search-bar {
    flex: 1;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: var(--text-primary);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.user-chip__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: #fff;
}

.user-chip__info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.user-chip__name {
    font-weight: 600;
    font-size: 13px;
}

.user-chip__role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Content ────────────────────────────────────────── */

.content {
    flex: 1;
    padding: 24px 28px 36px;
    min-width: 0;
}

/* ── Dokumentacja narzędzi ──────────────────────────── */

.docs-hero {
    margin-bottom: 28px;
    padding: 24px 26px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(74, 125, 245, 0.08), rgba(99, 102, 241, 0.04));
}

.docs-hero__eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.docs-hero__title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
}

.docs-hero__lead {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 720px;
    margin-bottom: 16px;
}

.docs-workflow {
    margin: 0;
    padding: 14px 18px 14px 32px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    max-width: 820px;
}

.docs-workflow__item {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.docs-workflow__item:last-child {
    margin-bottom: 0;
}

.docs-mount__loading,
.docs-mount__empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.docs-category {
    margin-bottom: 40px;
}

.docs-category__header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.docs-category__title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.docs-category__desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.55;
    max-width: 820px;
}

.docs-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.docs-block {
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
}

.docs-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.docs-block__header {
    margin-bottom: 18px;
}

.docs-block__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.docs-block__lead {
    font-size: 14px;
    line-height: 1.6;
    color: var(--accent);
    max-width: 820px;
}

.docs-block__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 820px;
}

.docs-block__section {
    padding-left: 14px;
    border-left: 2px solid rgba(74, 125, 245, 0.35);
}

.docs-block__heading {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.docs-block__text {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.docs-example {
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: rgba(52, 211, 153, 0.06);
    border: 1px solid rgba(52, 211, 153, 0.18);
    max-width: 820px;
}

.docs-example__title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--success);
    margin-bottom: 10px;
}

.docs-example__list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.docs-example__item {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.docs-example__item::marker {
    color: var(--success);
}

/* ── Dashboard grid ─────────────────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel-card--stretch {
    min-height: 380px;
}

.panel-card__header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.panel-card__header h4 {
    font-size: 15px;
    font-weight: 600;
}

/* ── Study list (transaction-style) ───────────────────── */

.study-list {
    list-style: none;
}

.study-list__empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.study-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.study-item:last-child {
    border-bottom: none;
}

.study-item:hover {
    background: var(--bg-card-hover);
}

.study-item__main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.study-item__icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.study-item__icon svg {
    width: 20px;
    height: 20px;
}

.study-item__name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.study-item__meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.study-item__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
}

.badge--active {
    background: rgba(52, 211, 153, 0.14);
    color: var(--success);
}

.badge--empty {
    background: rgba(248, 113, 113, 0.14);
    color: #f87171;
}

.badge--progress {
    background: rgba(251, 191, 36, 0.14);
    color: #fbbf24;
}

.badge--completed {
    background: rgba(52, 211, 153, 0.14);
    color: var(--success);
}

.study-item.is-selected {
    background: rgba(74, 125, 245, 0.06);
    box-shadow: inset 3px 0 0 var(--accent);
}

.study-item__main {
    cursor: pointer;
}

/* ── Right action panel ───────────────────────────────── */

.action-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-panel__summary {
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.action-panel__label {
    font-size: 12px;
    color: var(--text-muted);
}

.action-panel__name {
    font-size: 18px;
    font-weight: 700;
    margin: 6px 0 10px;
    line-height: 1.3;
    word-break: break-word;
}

.action-panel__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Modal ──────────────────────────────────────────── */

.modal {
    border: none;
    padding: 0;
    background: transparent;
    max-width: none;
    max-height: none;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal__inner {
    width: min(440px, calc(100vw - 32px));
    padding: 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal__header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal__error {
    font-size: 13px;
    color: var(--danger);
    margin-top: 12px;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ── Wizard ─────────────────────────────────────────── */

.field__optional {
    font-style: normal;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.wizard {
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}

.wizard__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.wizard__eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 4px;
}

.wizard__title {
    font-size: 22px;
    font-weight: 700;
}

.wizard__progress {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 28px;
}

.wizard__step {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    opacity: 0.72;
    transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}

.wizard__step--nav {
    cursor: pointer;
}

.wizard__step--nav:hover {
    opacity: 0.92;
}

.wizard__step--nav:focus-visible {
    outline: 2px solid rgba(74, 125, 245, 0.55);
    outline-offset: 2px;
}

.wizard__step.is-active {
    opacity: 1;
    border-color: rgba(74, 125, 245, 0.45);
    background: var(--accent-soft);
}

.wizard__step.is-complete {
    border-color: rgba(52, 211, 153, 0.5);
    animation: wizard-step-glow-ok 2.6s ease-in-out infinite;
}

.wizard__step.is-incomplete {
    border-color: rgba(248, 113, 113, 0.5);
    animation: wizard-step-glow-warn 2.6s ease-in-out infinite;
}

.wizard__step.is-active.is-complete {
    background: rgba(52, 211, 153, 0.08);
}

.wizard__step.is-active.is-incomplete {
    background: rgba(248, 113, 113, 0.08);
}

@keyframes wizard-step-glow-ok {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
    50% {
        box-shadow: 0 0 16px 2px rgba(52, 211, 153, 0.32);
    }
}

@keyframes wizard-step-glow-warn {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0);
    }
    50% {
        box-shadow: 0 0 16px 2px rgba(248, 113, 113, 0.36);
    }
}

.wizard__step-num {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 2px;
}

.wizard__step-label {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.wizard__panel {
    display: none;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    min-width: 0;
    overflow: hidden;
}

.wizard__panel--active {
    display: block;
}

.wizard__desc {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.wizard__note {
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px 12px;
    background: rgba(74, 125, 245, 0.06);
    border: 1px solid rgba(74, 125, 245, 0.12);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    line-height: 1.5;
}

.wizard__fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wizard__uploads {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.wizard__uploads--2 {
    grid-template-columns: repeat(2, 1fr);
}

.wizard__uploads--stack {
    grid-template-columns: 1fr;
}

.entity-toggle {
    margin-bottom: 20px;
}

.entity-toggle__label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.entity-toggle__buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.entity-toggle__btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.entity-toggle__btn:hover {
    color: var(--text-primary);
    border-color: rgba(74, 125, 245, 0.35);
}

.entity-toggle__btn.is-active {
    background: var(--accent-soft);
    border-color: rgba(74, 125, 245, 0.5);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(74, 125, 245, 0.2);
}

.entity-toggle__hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.wizard__uploads--months {
    grid-template-columns: repeat(3, 1fr);
}

.file-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 6px;
    min-height: 120px;
    min-width: 0;
    max-width: 100%;
    padding: 16px 20px;
    width: 100%;
    box-sizing: border-box;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    text-align: center;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
}

.file-drop.is-dragover {
    border-color: rgba(74, 125, 245, 0.75);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(74, 125, 245, 0.25);
}

.file-drop__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.92;
    transition: opacity 0.15s, transform 0.15s;
}

.file-drop__remove:hover {
    opacity: 1;
    transform: scale(1.05);
}

.file-drop:hover,
.file-drop.has-file {
    border-color: rgba(74, 125, 245, 0.45);
    background: var(--accent-soft);
}

.file-drop__input {
    display: none;
}

.file-drop__icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    font-size: 18px;
    color: var(--accent);
    align-self: center;
    flex-shrink: 0;
}

.file-drop__title {
    font-weight: 600;
    font-size: 13px;
    align-self: center;
    max-width: 100%;
}

.file-drop__hint {
    font-size: 11px;
    color: var(--text-muted);
    align-self: center;
    max-width: 100%;
}

.file-drop__name {
    font-size: 11px;
    color: var(--success);
    display: block;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    padding: 0 4px;
    box-sizing: border-box;
}

.file-drop--month {
    min-height: 110px;
    padding: 12px;
}

.file-drop__month-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
}

.people-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.people-list__item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.people-list__input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
}

.people-list__input:focus {
    border-color: var(--accent);
}

.wizard__error {
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 12px;
}

.wizard__footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* ── Pipeline generowania ───────────────────────────── */

.pipeline {
    max-width: 820px;
    margin: 0 auto;
}

.pipeline__top {
    margin-bottom: 12px;
}

.pipeline__eyebrow,
.study-workspace__eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 4px;
}

.pipeline__title,
.study-workspace__title {
    font-size: 22px;
    font-weight: 700;
}

.pipeline__lead {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.pipeline__steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.pipeline-step {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.pipeline-step--running {
    border-color: rgba(74, 125, 245, 0.45);
    background: var(--accent-soft);
}

.pipeline-step--success {
    border-color: rgba(52, 211, 153, 0.4);
}

.pipeline-step--error {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.06);
}

.pipeline-step--skipped {
    opacity: 0.72;
}

.pipeline-step__row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pipeline-step__label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.pipeline-step__icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
}

.pipeline-step__icon--spin {
    border: 2px solid rgba(74, 125, 245, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pipeline-spin 0.8s linear infinite;
}

.pipeline-step__icon--ok {
    color: var(--success);
}

.pipeline-step__icon--err {
    color: var(--danger);
}

.pipeline-step__icon--skip,
.pipeline-step__icon--pending {
    color: var(--text-muted);
}

.pipeline-step__details-btn {
    font-size: 12px;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

.pipeline-step__error-detail {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    color: #fecaca;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-x: auto;
}

.pipeline__error {
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 12px;
}

.pipeline__footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@keyframes pipeline-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Pliki badania ─────────────────────────────────── */

.study-workspace {
    max-width: 900px;
    margin: 0 auto;
}

.study-workspace__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.study-workspace__section {
    margin-bottom: 28px;
}

.study-workspace__heading {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.study-files {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.study-files--muted .study-files__name {
    color: var(--text-secondary);
}

.study-files__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.study-files__meta {
    min-width: 0;
    flex: 1;
}

.study-files__name {
    display: block;
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.study-files__slot {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.study-files__empty {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Asystent AI (badanie wstępne) ─────────────────── */

.ai-assist {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(74, 125, 245, 0.3);
    background: var(--accent-soft);
}

.ai-assist__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.ai-assist__heading {
    margin-bottom: 6px;
}

.ai-assist__badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(74, 125, 245, 0.14);
    border: 1px solid rgba(74, 125, 245, 0.35);
    border-radius: 999px;
    padding: 3px 10px;
}

.ai-assist__lead {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 16px;
    max-width: 720px;
}

.ai-assist__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.ai-assist__status {
    margin-top: 12px;
    font-size: 12px;
    color: var(--success);
}

.ai-assist__status--error {
    color: var(--danger);
}

@media (max-width: 768px) {
    .wizard__progress {
        grid-template-columns: repeat(2, 1fr);
    }

    .wizard__uploads--2,
    .wizard__uploads--months {
        grid-template-columns: 1fr;
    }
}

/* ── Tabele wiodące fix ─────────────────────────────── */

.leader-fix {
    max-width: 900px;
    margin: 0 auto;
}

.leader-fix__eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 4px;
}

.leader-fix__title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.leader-fix__lead {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    max-width: 760px;
    margin-bottom: 24px;
}

.leader-fix__grid {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.leader-fix__field {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.leader-fix__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.leader-fix__note {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.leader-fix .entity-toggle {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.leader-fix .entity-toggle--sub {
    margin-top: 4px;
}

.leader-fix__actions {
    margin-top: 26px;
}

.leader-fix__result {
    margin-top: 22px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.leader-fix__result--error {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.06);
    color: #fecaca;
}

.leader-fix__done-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 12px;
}

.leader-fix__stats {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.leader-fix__stat {
    font-size: 13px;
    color: var(--text-secondary);
}

.leader-fix__stat b {
    color: var(--text-primary);
}

.leader-fix__stat--ok {
    color: var(--success);
}

.leader-fix__stat--warn {
    color: #fbbf24;
}

.leader-fix__spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 6px;
    border: 2px solid rgba(74, 125, 245, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pipeline-spin 0.8s linear infinite;
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .action-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-area {
        margin-left: 0;
    }

    .content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .search-bar {
        display: none;
    }

    .user-chip__info {
        display: none;
    }
}
