:root {
    --bg: #f6f8fb;
    --sidebar: #111827;
    --sidebar-muted: #9ca3af;
    --text: #172033;
    --muted: #65758b;
    --line: #dbe3ef;
    --panel: #ffffff;
    --primary: #2563eb;
    --success: #16885a;
    --accent: #f59e0b;
}

* {
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border-radius: 7px;
}

.btn svg,
.nav-link svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    background: var(--sidebar);
    color: #fff;
    padding: 22px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: inherit;
    font-weight: 700;
    margin-bottom: 24px;
}

.brand:hover {
    color: inherit;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--success);
    color: #fff;
    font-size: .86rem;
}

.sidebar .nav-link {
    color: var(--sidebar-muted);
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem .75rem;
    border-radius: 7px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.main {
    min-width: 0;
}

.topbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.tenant-name {
    font-weight: 700;
}

.user-email,
.page-subtitle,
.detail-label,
.message-meta {
    color: var(--muted);
}

.content {
    padding: 28px;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 22px;
}

.page-title {
    font-size: 1.55rem;
    font-weight: 750;
    margin: 0;
}

.page-subtitle {
    margin: .25rem 0 0;
}

.panel,
.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

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

.panel-header h2 {
    font-size: 1rem;
    font-weight: 750;
    margin: 0;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric span {
    color: var(--muted);
    display: block;
    font-size: .88rem;
}

.metric strong {
    display: block;
    font-size: 1.75rem;
    margin-top: .3rem;
}

.settings-grid,
.plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.plan-limits {
    display: grid;
    gap: .65rem;
    margin: 18px 0;
}

.plan-limits div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: .55rem;
}

.plan-limits dt,
.plan-limits dd {
    margin: 0;
}

.price {
    color: var(--primary);
    font-weight: 800;
}

.detail-label {
    font-size: .82rem;
}

.detail-value {
    font-weight: 700;
}

.copy-line {
    display: block;
    white-space: normal;
    word-break: break-all;
    background: #f2f6fb;
    border-radius: 7px;
    padding: .75rem;
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(100%, 430px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 26px;
}

.auth-brand {
    color: var(--text);
}

.chat-thread {
    display: grid;
    gap: 14px;
}

.message {
    max-width: min(76ch, 82%);
}

.message.outbound {
    justify-self: end;
}

.message-bubble {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}

.message.outbound .message-bubble {
    background: #eaf2ff;
    border-color: #bfdbfe;
}

.message.system .message-bubble {
    background: #fff8e6;
    border-color: #f8d477;
}

.table {
    font-size: .94rem;
}

.form-control,
.form-select {
    border-radius: 7px;
}

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

    .sidebar {
        position: static;
    }

    .metric-grid,
    .settings-grid,
    .plan-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .content,
    .topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .page-heading,
    .topbar {
        align-items: stretch;
        flex-direction: column;
        height: auto;
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .message {
        max-width: 100%;
    }
}
