/* Note: This file provides the base visual styling shared across public, private, and admin shells. */

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #5b6472;
    --line: #d8dfeb;
    --blue: #1d4ed8;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

.wrap {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header,
.site-footer {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.site-footer {
    border-top: 1px solid var(--line);
    border-bottom: 0;
    margin-top: 48px;
}

.header-row,
.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
}

.header-nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.eyebrow {
    color: var(--blue);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.page-shell {
    padding: 28px 0 48px;
}

.hero-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.lead {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
    max-width: 860px;
}

.grid {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

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

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

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.panel h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.metric {
    font-size: 40px;
    font-weight: 800;
    color: var(--blue);
}

.list-panels {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

@media (max-width: 900px) {
    .grid.two,
    .grid.three {
        grid-template-columns: 1fr;
    }

    .header-row,
    .footer-row {
        flex-direction: column;
        align-items: flex-start;
    }
}


.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
}

.chat-side,
.chat-main {
    min-height: 200px;
}

.chat-log {
    border: 1px solid #d8e4ff;
    background: #f8fbff;
    border-radius: 14px;
    padding: 1rem;
    min-height: 420px;
    max-height: 65vh;
    overflow-y: auto;
}

.chat-message {
    border-radius: 12px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.8rem;
}

.chat-message header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
    font-size: 0.92rem;
}

.chat-message-human {
    background: #eef5ff;
    border: 1px solid #cbdcff;
}

.chat-message-ai {
    background: #ffffff;
    border: 1px solid #d5e2ff;
}

.chat-form {
    margin-top: 1rem;
}

.chat-textarea {
    width: 100%;
    resize: vertical;
}

.chat-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
    align-items: center;
}

.chat-select {
    max-width: 240px;
}

.chat-meta-list {
    padding-left: 1.1rem;
}

.text-input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    border: 1px solid #cbdcff;
    background: #fff;
    box-sizing: border-box;
}

.form-label {
    display: block;
    font-weight: 600;
    margin: 0.9rem 0 0.35rem;
}

.button-link {
    display: inline-block;
    padding: 0.7rem 0.95rem;
    border-radius: 10px;
    text-decoration: none;
    background: #1f5fbf;
    color: white;
    border: 0;
    cursor: pointer;
}

.button-link:hover {
    background: #184f9d;
}

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

    .chat-log {
        max-height: 50vh;
    }

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

    .chat-select {
        max-width: none;
    }
}

.inline-form {
    display: inline;
    margin: 0;
}

.header-button {
    background: transparent;
    border: 0;
    color: var(--blue);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.narrow-card {
    max-width: 640px;
    margin: 0 auto;
}

.stack-form {
    display: grid;
    gap: 0.2rem;
}

.notice {
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    margin: 1rem 0;
}

.notice-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.button-secondary {
    background: #e5ecfb;
    color: #184f9d;
    margin-left: 0.5rem;
}

.top-gap { margin-top: 24px; }
.compact-grid { margin-top: 0; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.button-link.secondary { background: #e9efff; color: #1749a3; border: 1px solid #bdd0ff; }
.button-link.secondary:hover { background: #dce8ff; }
.brand-hero { position: relative; overflow: hidden; }
.platform-hero { background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%); }
.tenant-hero { background: linear-gradient(135deg, #ffffff 0%, #f3f9ff 100%); }
.feature-panel { border-color: #cfe0ff; }
.info-strip { border-top: 6px solid #1d4ed8; }
.meta-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 18px; color: var(--muted); }
.wrap-meta span { background: #eff6ff; border: 1px solid #dbeafe; padding: 10px 12px; border-radius: 999px; }
.bullet-list { margin-top: 14px; color: var(--muted); line-height: 1.7; }
@media (max-width: 900px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .wrap-meta span { width: 100%; }
}


.chat-badges { display:flex; flex-wrap:wrap; gap:0.45rem; margin:0.7rem 0 0.2rem; }
.chat-badge { display:inline-flex; align-items:center; border:1px solid #dbeafe; background:#f8fbff; color:#1e3a8a; border-radius:999px; padding:0.22rem 0.6rem; font-size:0.78rem; }
.chat-badge-backend { background:#eef2ff; color:#4338ca; border-color:#c7d2fe; }
.chat-rich-card { margin-top:0.8rem; padding:0.85rem 0.95rem; border:1px solid #dbeafe; border-radius:12px; background:#fff; }
.chat-rich-title { margin:0 0 0.65rem; font-size:0.92rem; color:#1e3a8a; }
.chat-summary-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:0.7rem; }
.chat-summary-item { border:1px solid #e2e8f0; border-radius:10px; padding:0.65rem 0.7rem; background:#f8fafc; }
.chat-summary-label { display:block; font-size:0.75rem; color:#64748b; margin-bottom:0.25rem; text-transform:uppercase; letter-spacing:0.04em; }
.chat-summary-value { display:block; font-size:0.95rem; color:#0f172a; }
.chat-message-text { white-space:pre-wrap; }

.status-badge { display:inline-flex; align-items:center; border-radius:999px; padding:0.18rem 0.55rem; font-size:0.74rem; font-weight:600; border:1px solid transparent; }
.status-healthy { background:#ecfdf3; color:#166534; border-color:#bbf7d0; }
.status-warning { background:#fff7ed; color:#9a3412; border-color:#fed7aa; }
.status-error { background:#fff1f2; color:#9f1239; border-color:#fecdd3; }
.chat-badge-status { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.chat-badge-status.status-healthy { background:#ecfdf3; color:#166534; border-color:#bbf7d0; }
.chat-badge-status.status-warning { background:#fff7ed; color:#9a3412; border-color:#fed7aa; }
.chat-badge-status.status-error { background:#fff1f2; color:#9f1239; border-color:#fecdd3; }

.chat-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.chat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #d1dcf7;
    background: #f5f8ff;
    font-size: 0.78rem;
    color: #23426a;
}

.chat-badge-backend {
    background: #eef4ff;
}

.chat-source-card {
    margin-top: 0.85rem;
    border: 1px solid #dce6ff;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-radius: 14px;
    padding: 0.9rem 1rem;
}

.chat-source-card h4,
.chat-rich-title {
    margin: 0 0 0.6rem;
    font-size: 0.98rem;
}

.chat-source-grid,
.chat-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
}

.chat-source-item,
.chat-summary-item {
    background: #ffffff;
    border: 1px solid #e2e9fb;
    border-radius: 12px;
    padding: 0.55rem 0.7rem;
}

.chat-source-label,
.chat-summary-label {
    display: block;
    font-size: 0.72rem;
    color: #5a7396;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chat-source-value,
.chat-summary-value {
    display: block;
    margin-top: 0.2rem;
    color: #173459;
    font-weight: 700;
    word-break: break-word;
}

.chat-rich-card {
    margin-top: 0.85rem;
    border: 1px solid #dde6fa;
    background: #fdfefe;
    border-radius: 14px;
    padding: 0.85rem 0.95rem;
}

.chat-rich-notices {
    background: #fffaf0;
}

.compact-list {
    margin: 0;
    padding-left: 1rem;
}

.diagnostics-actions a {
    display: inline-flex;
    align-items: center;
    padding: 0.32rem 0.55rem;
    border-radius: 999px;
    background: #f5f8ff;
    border: 1px solid #d1dcf7;
    text-decoration: none;
}


.chat-badge-pilot { background:#fff7ed; color:#9a3412; border-color:#fed7aa; }
.chat-source-header { display:flex; align-items:center; justify-content:space-between; gap:0.6rem; margin-bottom:0.6rem; }
.chat-citation-item { background:#fbfdff; }
.chat-citation-snippet { display:block; margin-top:0.35rem; color:#5a7396; font-size:0.82rem; line-height:1.45; }


.chat-badge-calendar {
    border: 1px solid rgba(15, 118, 110, 0.35);
    background: rgba(15, 118, 110, 0.08);
}

.cutover-dashboard-link {
    display: inline-block;
    margin-top: 0.5rem;
}


.status-safe { background:#eff6ff; color:#1d4ed8; border-color:#bfdbfe; }
.status-pilot { background:#f5f3ff; color:#6d28d9; border-color:#ddd6fe; }
.status-neutral { background:#f8fafc; color:#475569; border-color:#cbd5e1; }
.banner-panel { border-width: 1px; }
.banner-warning { background:#fff7ed; border-color:#fed7aa; }
.banner-error { background:#fff1f2; border-color:#fecdd3; }
