* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --bg-2: #eef3f9;

    --sidebar: #0b1424;
    --sidebar-border: rgba(148, 163, 184, 0.10);

    --panel-light: #ffffff;
    --panel-light-2: #fbfcfe;
    --panel-light-3: #f4f7fb;
    --panel-border: #dbe6f2;
    --panel-border-strong: #c9d7e8;

    --text-dark: #122033;
    --text-mid: #4e6179;
    --text-soft: #6f829d;

    --text: #e8f0fd;
    --muted: #90a4c0;
    --heading: #f7fbff;

    --primary: #5b8cff;
    --primary-2: #7b61ff;
    --accent-warm: #f59e0b;
    --accent-warm-2: #f97316;

    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    --header-height: 96px;
    --sidebar-width: 290px;

    --success-bg: #ecfdf3;
    --success-border: #a7f3d0;
    --success-text: #166534;

    --warning-bg: #fff7ed;
    --warning-border: #fdba74;
    --warning-text: #9a3412;

    --error-bg: #fef2f2;
    --error-border: #fca5a5;
    --error-text: #b91c1c;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    color: var(--text-dark);
}

a {
    color: inherit;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.sidebar {
    width: var(--sidebar-width);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
        var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    padding: 22px 18px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
}

.app-header {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 28px;
    background:
        radial-gradient(circle at right top, rgba(123, 97, 255, 0.14), transparent 26%),
        radial-gradient(circle at left center, rgba(91, 140, 255, 0.12), transparent 24%),
        linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,251,255,0.96) 100%);
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.app-header-left {
    min-width: 0;
}

.app-header-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(91, 140, 255, 0.10);
    border: 1px solid rgba(91, 140, 255, 0.18);
    color: #3b67ab;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.app-header-left h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.05;
    color: var(--text-dark);
    letter-spacing: -0.035em;
}

.app-header-left p {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.6;
    max-width: 760px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-header-stat {
    min-height: 52px;
    padding: 10px 14px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 150px;
}

.app-header-stat-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a8ea9;
    margin-bottom: 3px;
}

.app-header-stat strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
    color: var(--text-dark);
}

.app-header-btn {
    min-height: 52px;
    padding: 0 18px;
    border-radius: 16px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 14px 32px rgba(91, 140, 255, 0.24);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.app-header-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(91, 140, 255, 0.28);
}

.page {
    padding: 26px 28px 38px;
    background: transparent;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 14px 32px rgba(91, 140, 255, 0.30);
    flex-shrink: 0;
}

.brand-copy h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
    color: #f7fbff;
    letter-spacing: -0.03em;
}

.brand-copy p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.sidebar-section {
    margin-bottom: 22px;
}

.sidebar-label {
    display: block;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #93a6c8;
    padding: 0 6px;
}

.nav-list {
    display: grid;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid transparent;
    color: #dce8ff;
    background: rgba(255,255,255,0.03);
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(148, 163, 184, 0.10);
    transform: translateY(-1px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.16), rgba(123, 97, 255, 0.14));
    border-color: rgba(91, 140, 255, 0.24);
}

.nav-link span {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.nav-pill {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.step-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 14px;
    color: #dce8ff;
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
}

.step-link + .step-link {
    margin-top: 8px;
}

.step-link.active {
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.16), rgba(123, 97, 255, 0.14));
    border-color: rgba(91, 140, 255, 0.24);
}

.step-num {
    width: 30px;
    height: 30px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.step-link.active .step-num {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.step-copy strong {
    display: block;
    font-size: 13px;
    line-height: 1.25;
    color: #edf4ff;
}

.step-copy small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.sidebar-note {
    margin-top: 18px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(148, 163, 184, 0.10);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.mobile-bar {
    display: none;
    padding: 16px 18px 0;
    background: #ffffff;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-brand h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1;
    color: var(--text-dark);
}

.mobile-brand p {
    margin: 5px 0 0;
    font-size: 12px;
    color: var(--text-soft);
}

.panel-card {
    border-radius: 24px;
    border: 1px solid var(--panel-border);
    background: linear-gradient(180deg, var(--panel-light) 0%, var(--panel-light-2) 100%);
    box-shadow: var(--shadow);
    color: var(--text-dark);
}

.hero-card {
    padding: 22px 24px;
    margin-bottom: 18px;
}

.hero-title {
    margin: 0;
    font-size: 34px;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--text-dark);
}

.hero-sub {
    margin: 10px 0 0;
    max-width: 760px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-mid);
}

.alert {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.alert-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--warning-text);
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.context-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.context-card {
    padding: 14px 16px;
}

.context-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6f85a7;
    margin-bottom: 6px;
}

.context-value {
    font-size: 16px;
    line-height: 1.4;
    color: var(--text-dark);
    word-break: break-word;
}

.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
}

.content-card,
.side-card,
.footer-card {
    padding: 22px;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #58739a;
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid var(--panel-border-strong);
    background: #ffffff;
    color: var(--text-dark);
    border-radius: 16px;
    padding: 13px 15px;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #8aa0bc;
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    border-color: rgba(91, 140, 255, 0.55);
    box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.12);
}

.field.has-error input,
.field.has-error textarea {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.10);
}

.helper {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-soft);
}

.field-error {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #dc2626;
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.btn {
    min-height: 48px;
    padding: 0 20px;
    border-radius: 16px;
    border: none;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 16px 38px rgba(91, 140, 255, 0.28);
}

.btn-secondary {
    color: var(--text-dark);
    background: #eef4fb;
    border: 1px solid var(--panel-border);
}

.side-card h3,
.footer-card h3 {
    margin: 0 0 10px;
    font-size: 20px;
    color: var(--text-dark);
}

.side-copy,
.footer-copy {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-mid);
}

.mini-stack {
    display: grid;
    gap: 10px;
}

.mini-card {
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background: var(--panel-light-3);
    padding: 14px 15px;
}

.mini-card strong {
    display: block;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.mini-card span {
    display: block;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-mid);
}

.idea-rule {
    margin-top: 16px;
    padding: 15px 16px;
    border-radius: 18px;
    border: 1px solid rgba(91, 140, 255, 0.18);
    background: #eef4ff;
    color: #294e86;
    font-size: 14px;
    line-height: 1.8;
}

@media (max-width: 980px) {
    .sidebar {
        display: none;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .mobile-bar {
        display: block;
    }

    .app-header {
        padding: 18px;
    }

    .page {
        padding: 22px 18px 32px;
    }

    .layout-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .field-grid,
    .context-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .app-header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .app-header-left h2 {
        font-size: 24px;
    }
}