:root {
    --bg: #070b12;
    --panel: #0e1522;
    --panel-soft: #111b2c;
    --border: rgba(148, 163, 184, 0.16);
    --text: #f8fafc;
    --muted: #94a3b8;
    --blue: #2f80ff;
    --blue-2: #66a6ff;
    --danger: #ef4444;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(47, 128, 255, 0.16), transparent 34rem),
        linear-gradient(180deg, #080d16 0%, var(--bg) 52%, #05070c 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--blue-2);
    text-decoration: none;
}

a:hover {
    color: #9bc2ff;
}

.app-nav {
    background: rgba(7, 11, 18, 0.82);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.brand-dot {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    margin-right: 0.55rem;
    border-radius: 999px;
    background: var(--blue);
    box-shadow: 0 0 24px rgba(47, 128, 255, 0.9);
}

.app-card,
.hero-panel {
    background: linear-gradient(180deg, rgba(17, 27, 44, 0.96), rgba(12, 18, 30, 0.96));
    border: 1px solid var(--border);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
}

.hero-panel {
    position: relative;
    overflow: hidden;
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: auto 2rem -5rem auto;
    width: 16rem;
    height: 16rem;
    border: 1px solid rgba(102, 166, 255, 0.18);
    border-radius: 999px;
}

.eyebrow {
    color: var(--blue-2);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.text-secondary {
    color: var(--muted) !important;
}

.btn {
    border-radius: 0.85rem;
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue), #1f67d8);
    border-color: rgba(102, 166, 255, 0.35);
    box-shadow: 0 12px 34px rgba(47, 128, 255, 0.26);
}

.btn-outline-light {
    border-color: rgba(226, 232, 240, 0.22);
    color: #e2e8f0;
}

.form-control {
    background: rgba(3, 7, 18, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0.9rem;
    color: var(--text);
}

.form-control:focus {
    background: rgba(3, 7, 18, 0.76);
    border-color: var(--blue-2);
    box-shadow: 0 0 0 0.2rem rgba(47, 128, 255, 0.18);
    color: var(--text);
}

.form-control::placeholder {
    color: #64748b;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 8rem);
    place-items: center;
}

.auth-card {
    width: min(100%, 30rem);
    animation: rise 360ms ease both;
}

.page-heading {
    margin-bottom: 1.25rem;
}

.bot-list-item,
.empty-state {
    padding: 1.25rem;
    background: rgba(3, 7, 18, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 1.25rem;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.check-row:last-child {
    border-bottom: 0;
}

.check-row span {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}

.check-row.done span {
    background: var(--blue);
    border-color: var(--blue);
    box-shadow: 0 0 20px rgba(47, 128, 255, 0.46);
}

.knowledge-form {
    top: 5.25rem;
}

.knowledge-list {
    display: grid;
    gap: 1rem;
}

.knowledge-item {
    animation: rise 260ms ease both;
}

.knowledge-item .question {
    color: #e2e8f0;
    font-weight: 800;
}

.knowledge-item .answer {
    line-height: 1.65;
}

.chat-shell {
    height: calc(100vh - 8.5rem);
    min-height: 36rem;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.chat-messages {
    height: calc(100% - 9.2rem);
    overflow-y: auto;
    padding: 1.25rem;
    scroll-behavior: smooth;
}

.chat-empty {
    max-width: 32rem;
    margin: 10vh auto 0;
    padding: 1.5rem;
    text-align: center;
    background: rgba(3, 7, 18, 0.28);
    border: 1px dashed rgba(148, 163, 184, 0.24);
    border-radius: 1.25rem;
}

.message-row {
    display: flex;
    margin-bottom: 1rem;
    animation: rise 180ms ease both;
}

.message-row.from-user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(42rem, 86%);
    padding: 0.9rem 1rem;
    border-radius: 1.1rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.from-user .message-bubble {
    background: linear-gradient(135deg, var(--blue), #1f67d8);
    color: white;
    border-bottom-right-radius: 0.3rem;
}

.from-ai .message-bubble {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-bottom-left-radius: 0.3rem;
}

.typing .message-bubble {
    color: var(--muted);
}

.typing-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.typing-dots span {
    width: 0.42rem;
    height: 0.42rem;
    background: var(--blue-2);
    border-radius: 999px;
    animation: pulse 900ms ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 120ms;
}

.typing-dots span:nth-child(3) {
    animation-delay: 240ms;
}

.chat-input {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
    background: rgba(7, 11, 18, 0.7);
}

.chat-input textarea {
    max-height: 8rem;
    resize: none;
}

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

@keyframes pulse {
    0%, 80%, 100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@media (max-width: 767.98px) {
    main {
        padding-top: 1rem !important;
    }

    .chat-shell {
        height: calc(100vh - 6.7rem);
        min-height: 32rem;
        border-radius: 0.9rem;
    }

    .chat-header,
    .chat-input {
        padding-inline: 0.9rem;
    }

    .chat-input {
        align-items: stretch;
    }

    .message-bubble {
        max-width: 92%;
    }
}
