* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #1d2939;
    background: #f4f7fb;
}

a {
    color: #0f5f9c;
    text-decoration: none;
}

h1,
h2,
p {
    margin-top: 0;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    padding: 28px;
    background: linear-gradient(180deg, #0f172a 0%, #13233d 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: grid;
    gap: 6px;
}

.brand-kicker,
.eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #7dd3fc;
}

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

.nav-list a {
    padding: 12px 14px;
    border-radius: 12px;
    color: #dbe7f5;
}

.nav-list a.active,
.nav-list a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.main-panel {
    padding: 32px;
    display: grid;
    gap: 24px;
}

.page-header h1 {
    margin-bottom: 0;
}

.card-grid,
.split-grid,
.form-grid,
.filter-grid,
.choice-grid {
    display: grid;
    gap: 16px;
}

.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.split-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel,
.metric-card,
.guest-card,
.landing-card {
    background: #fff;
    border: 1px solid #d8e1eb;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.metric-card span {
    display: block;
    color: #667085;
    margin-bottom: 12px;
}

.metric-card strong {
    font-size: 30px;
}

.panel-heading,
.page-actions,
.table-actions,
.checkbox-row,
.definition-list div,
.variant-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.definition-list {
    display: grid;
    gap: 12px;
}

.definition-list dt {
    color: #667085;
}

.definition-list dd {
    margin: 0;
    font-weight: 600;
}

.field,
.stack {
    display: grid;
    gap: 8px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-span-2 {
    grid-column: span 2;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font: inherit;
    background: #fff;
}

.field textarea {
    resize: vertical;
}

.variant-card {
    gap: 18px;
}

.variant-characteristic.is-hidden {
    display: none;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    cursor: pointer;
}

.button-primary {
    background: #0f766e;
    color: #fff;
}

.button-secondary {
    background: #e2e8f0;
    color: #1e293b;
}

.button-danger {
    background: #dc2626;
    color: #fff;
}

.button-small {
    padding: 8px 12px;
    font-size: 14px;
}

.button-full {
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-muted {
    background: #e5e7eb;
    color: #475467;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.error-list {
    margin: 10px 0 0;
    padding-left: 18px;
}

.muted {
    color: #667085;
}

.align-end {
    align-self: end;
}

.guest-shell,
.landing-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top, #e0f2fe 0%, #f8fafc 42%, #eef2ff 100%);
}

.guest-card,
.landing-card {
    width: min(480px, 100%);
}

.auth-header {
    margin-bottom: 24px;
}

.field-error {
    margin: 0;
    color: #b91c1c;
}

.pagination-wrap {
    margin-top: 16px;
}

.chat-shell {
    height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #082f49 0%, #164e63 45%, #f8fafc 45%, #f8fafc 100%);
    overflow: hidden;
}

.chat-layout {
    height: 100%;
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: stretch;
}

.chat-sidebar {
    color: #eff6ff;
    padding: 18px 8px;
}

.chat-sidebar h1 {
    font-size: 40px;
    margin-bottom: 12px;
}

.chat-business-meta {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.chat-business-meta strong,
.chat-business-meta span {
    display: block;
}

.chat-card {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.chat-header h2 {
    margin-bottom: 0;
}

.chat-messages {
    min-height: 0;
    display: grid;
    gap: 14px;
    align-content: start;
    overflow-y: auto;
    padding-right: 8px;
}

.chat-bubble {
    max-width: min(80%, 560px);
    padding: 14px 16px;
    border-radius: 18px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-media-card {
    margin: 12px 0 0;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.chat-media-card img {
    display: block;
    width: 100%;
    height: auto;
}

.chat-media-caption {
    padding: 10px 12px;
    font-size: 12px;
    color: #334155;
    background: #fff;
}

.chat-bubble-user {
    justify-self: end;
    background: #0f766e;
    color: #fff;
    border-bottom-right-radius: 6px;
}

.chat-bubble-assistant {
    background: #e0f2fe;
    color: #0f172a;
    border-bottom-left-radius: 6px;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.chat-form textarea {
    width: 100%;
    resize: none;
    padding: 14px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    font: inherit;
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 18px;
    }

    .form-grid,
    .filter-grid {
        grid-template-columns: 1fr;
    }

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

    .chat-shell {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: span 1;
    }
}
