:root {
    --bg: #f5f7fb;
    --bg-accent: radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.12), transparent 45%),
        radial-gradient(circle at 80% 0%, rgba(59, 130, 246, 0.1), transparent 35%);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.95);
    --border: rgba(15, 23, 42, 0.08);
    --primary: #4f46e5;
    --primary-alt: #2563eb;
    --bubble-in: #ffffff;
    --bubble-out: #cfe1ff;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: auto;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--bg-accent);
    z-index: -1;
    opacity: 0.9;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.page-shell {
    padding: calc(2rem + 60px) clamp(1rem, 3vw, 3rem) 4rem;
}

.page-container {
    max-width: 1100px;
    margin: 0 auto;
}

body.chat-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.chat-page > main {
    flex: 1;
    display: flex;
}

body.chat-page .page-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem clamp(0.5rem, 3vw, 2rem) 1.25rem;
}

body.chat-page .page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin: 0;
}

.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero.hero-light {
    text-align: left;
    background: rgba(255, 255, 255, 0.8);
    padding: 1.5rem;
    border-radius: 1.2rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.hero-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    align-items: center;
}

.hero h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.hero p {
    color: var(--text-muted);
    margin: 0;
}

.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.cta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.cta-card {
    border-radius: 1.4rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(79, 70, 229, 0.2);
    box-shadow: 0 20px 35px rgba(15, 23, 42, 0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cta-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 45px rgba(59, 130, 246, 0.15);
}

.cta-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.cta-link {
    margin-top: auto;
    color: var(--primary);
    font-weight: 600;
}

.auth-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.auth-info {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 1.2rem;
    padding: 1.5rem;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.07);
}

.auth-info ul {
    margin: 0.75rem 0 1rem;
    padding-left: 1.1rem;
    color: var(--text-muted);
}

.tip-box {
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    color: #312e81;
}

.auth-card {
    max-width: 520px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1.5rem;
    padding: 2rem;
    border: 1px solid rgba(79, 70, 229, 0.15);
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.08);
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.35rem;
    display: block;
    color: var(--text-main);
}

.form-group input {
    width: 100%;
    padding: 0.85rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(249, 250, 255, 0.9);
}

.form-group small {
    display: block;
    color: var(--text-muted);
}

.auth-hint {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.auth-hint a {
    color: var(--primary);
    font-weight: 600;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.admin-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1.5rem;
    padding: 1.8rem;
    border: 1px solid rgba(79, 70, 229, 0.15);
    box-shadow: 0 30px 50px rgba(15, 23, 42, 0.08);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.status-pill {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-weight: 600;
}

.status-pill.ok {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.status-pill.warn {
    background: rgba(248, 113, 113, 0.15);
    color: #b91c1c;
}

.admin-form .form-group,
.admin-form .form-row {
    margin-bottom: 1rem;
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.admin-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.side-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1.2rem;
    padding: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 35px rgba(15, 23, 42, 0.06);
}

.admin-actions button {
    width: 100%;
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-actions form {
    width: 100%;
}

.welcome-preview {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.welcome-preview img {
    max-width: 220px;
    border-radius: 0.8rem;
    border: 1px solid rgba(15, 23, 42, 0.1);
}
.info-list {
    margin: 0;
    padding-left: 1rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .panel-header {
        flex-direction: column;
    }
}

.card {
    background: var(--card-bg);
    padding: 1.75rem;
    border-radius: 1.2rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="url"],
textarea {
    width: 100%;
    padding: 0.85rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-main);
    margin-bottom: 1.2rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

button,
.button {
    background: linear-gradient(120deg, var(--primary), var(--primary-alt));
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(79, 70, 229, 0.25);
}

button:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.3);
    outline-offset: 3px;
}

.inline-form button {
    padding: 0.5rem 1rem;
}


.chat-wrapper {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.chat-window {
    background: #f8fbff;
    border-radius: 1.5rem;
    padding: 1rem;
    min-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 15px rgba(15, 23, 42, 0.05);
    scroll-behavior: smooth;
    scroll-padding-bottom: 90px;
}

.message-row {
    display: flex;
    gap: 0.4rem;
}

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

.message-row.system {
    justify-content: center;
}

.bubble {
    max-width: 78%;
    padding: 0.9rem 1.1rem;
    border-radius: 1.4rem;
    background: var(--bubble-in);
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    position: relative;
}

.message-row.outgoing .bubble {
    background: var(--bubble-out);
    border-color: rgba(79, 70, 229, 0.25);
}

.message-row.system .bubble {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    box-shadow: none;
}

.bubble .meta {
    font-size: 0.72rem;
    color: rgba(15, 23, 42, 0.45);
    display: block;
    margin-top: 0.4rem;
    text-align: right;
}

.bubble .text,
.system-text {
    margin: 0;
    line-height: 1.5;
    white-space: pre-line;
}

.composer {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 0.6rem 0.85rem 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 12px 20px rgba(15, 23, 42, 0.08);
    position: sticky;
    bottom: 0.5rem;
    z-index: 5;
    margin-top: auto;
}

#chat-form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.composer textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    font-size: 1rem;
    min-height: 60px;
    color: var(--text-main);
}

.composer textarea:focus {
    outline: none;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.2rem;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.attach-btn {
    cursor: pointer;
    font-size: 0.95rem;
    margin-right: 0.15rem;
    color: var(--primary);
    transition: transform 0.2s;
}

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

.attachment-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.attachment-image {
    display: inline-block;
    padding: 0;
    border: none;
    background: none;
    margin-top: 0.5rem;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    cursor: pointer;
}

.attachment-image img {
    display: block;
    width: 100%;
    max-width: 320px;
    max-height: 320px;
    object-fit: cover;
}

.system-attachment {
    border: none;
    background: none;
    display: block;
    width: 100%;
    padding: 0.3rem 0;
}

.system-attachment img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
}

.composer button {
    padding: 0.5rem 1.05rem;
    min-width: 95px;
}

.alert {
    padding: 0.85rem 1.2rem;
    background: rgba(251, 191, 36, 0.18);
    border: 1px solid rgba(251, 191, 36, 0.45);
    border-radius: 0.9rem;
    color: #92400e;
}

.alert-danger {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #b91c1c;
}

.hash-box {
    font-size: 1rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.85rem;
    background: #fff;
    border-radius: 0.9rem;
    border: 1px dashed rgba(99, 102, 241, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    word-break: break-all;
}

.copy-btn {
    border: none;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    font-weight: 600;
    border-radius: 999px;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.copy-btn:hover {
    background: rgba(79, 70, 229, 0.2);
}

.inline-form {
    display: inline-flex;
    margin-left: 0.75rem;
}

.user-pill {
    margin-right: 0.5rem;
    color: var(--text-muted);
}

.lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lightbox.hidden {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.lightbox-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.lightbox-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    border: none;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    font-size: 1.35rem;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        gap: 0.4rem;
        text-align: center;
    }

    .page-shell {
        padding: 1.25rem 1rem 3rem;
    }

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

    .hero-split {
        grid-template-columns: 1fr;
    }

    .chat-wrapper {
        width: 100%;
        max-width: none;
        padding: 0 0.5rem;
        gap: 0.7rem;
        flex: 1;
        min-height: 0;
    }

    .chat-window {
        padding: 0.85rem;
        border-radius: 1.2rem;
        flex: 1;
        min-height: 0;
        max-height: none;
    }

    .bubble {
        max-width: 90%;
    }

    .composer {
        margin-top: 0.35rem;
        padding: 0.55rem 0.7rem 0.7rem;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 0.75rem 1rem;
    }

    .hero {
        margin-bottom: 1.5rem;
    }

    .chat-wrapper {
        gap: 0.6rem;
    }

    .chat-window {
        padding: 0.75rem;
        max-height: none;
    }

    .bubble {
        max-width: 100%;
        padding: 0.7rem 0.8rem;
    }

    .attachment-image img {
        width: 100%;
        max-height: 160px;
    }

    .composer textarea {
        min-height: 55px;
        font-size: 0.92rem;
    }

    .composer-actions {
        gap: 0.3rem;
    }

    .attach-btn {
        font-size: 0.9rem;
    }

    .composer button {
        width: 100%;
        min-width: 0;
        padding: 0.5rem 0.85rem;
    }
}

.alert {
    padding: 0.75rem 1rem;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 0.75rem;
}

.hash-box {
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.6);
    display: inline-block;
    margin: 1rem 0;
}

.inline-form {
    display: inline-block;
    margin-left: 1rem;
}

.user-pill {
    margin-right: 0.5rem;
    color: #475569;
}

.ban-wrapper {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ban-card {
    max-width: 520px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.12);
    text-align: center;
}

.ban-wrapper-alert {
    min-height: 80vh;
}

.ban-card-alert {
    background: #fee2e2;
    border: 3px solid #ef4444;
    box-shadow: 0 30px 60px rgba(190, 18, 60, 0.35);
}

.ban-headline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ban-icon {
    font-size: 3rem;
}

.ban-icon-alert {
    font-size: 4.5rem;
}

.ban-title-alert {
    font-size: 2.5rem;
    color: #b91c1c;
    letter-spacing: 0.15em;
    margin: 0;
}

.ban-reason-alert {
    color: #7f1d1d;
    margin-top: 1rem;
}
.hero-copy .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--primary);
    font-weight: 600;
}

.hero-copy .lead {
    font-size: 1.05rem;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.ghost-button {
    border: 1px solid rgba(79, 70, 229, 0.4);
    color: var(--primary);
    border-radius: 999px;
    padding: 0.75rem 1.6rem;
    font-weight: 600;
}

.hero-list {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
    color: var(--text-muted);
}

.hero-list li {
    margin-bottom: 0.35rem;
}

.hero-visual .chat-preview {
    border-radius: 1.5rem;
    padding: 1.2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(59, 130, 246, 0.15));
    box-shadow: 0 30px 45px rgba(15, 23, 42, 0.1);
    display: grid;
    gap: 0.85rem;
}

.bubble-sample {
    padding: 0.75rem 1rem;
    border-radius: 1.2rem;
    background: #fff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.bubble-sample.operator {
    align-self: flex-start;
}

.bubble-sample.user {
    align-self: flex-end;
    background: #cfe1ff;
}

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
