:root {
    --sidebar: #111827;
    --sidebar-muted: #94a3b8;
    --page: #f3f6fa;
    --card: #ffffff;
    --text: #182230;
    --muted: #667085;
    --border: #e4e9f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --cyan: #0891b2;
    --green: #16845b;
    --violet: #7c3aed;
    --radius: 14px;
    --shadow: 0 6px 22px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 8px; background: var(--primary); color: white; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .15s; }
button:hover, .button:hover { background: var(--primary-dark); }
button.secondary, .button.secondary { background: #e8eef7; color: #344054; }
button.small, .button.small { padding: 6px 11px; font-size: 12px; }
.layout { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; width: 252px; height: 100vh; padding: 26px 18px 20px; background: var(--sidebar); color: white; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 12px; color: white; margin: 0 8px 34px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--primary); font-weight: 800; letter-spacing: -.5px; }
.brand-text { font-size: 17px; font-weight: 700; line-height: 1.15; }
.brand-text small { display: block; margin-top: 4px; color: var(--sidebar-muted); font-size: 11px; font-weight: 500; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 8px; color: #cbd5e1; font-weight: 550; transition: background .15s, color .15s; }
.nav-link:hover { background: #1f2937; color: white; }
.nav-icon { color: #60a5fa; font-size: 11px; font-weight: 700; }
.sidebar-note { margin-top: auto; padding: 16px 12px 4px; border-top: 1px solid #293548; color: var(--sidebar-muted); font-size: 12px; }
.workspace { min-width: 0; flex: 1; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 92px; padding: 20px 34px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 2px 0 0; font-size: 24px; letter-spacing: -.5px; }
.eyebrow { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.user-chip { padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; background: #f8fafc; color: var(--muted); }
.content { max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; }
.card { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 0 0 22px; box-shadow: var(--shadow); }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px; background: linear-gradient(120deg, #fff 30%, #edf5ff); }
.hero h2 { margin: 5px 0 8px; font-size: 26px; letter-spacing: -.6px; }
.hero p { margin: 0; color: var(--muted); max-width: 680px; }
.system-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #b9e5ce; border-radius: 999px; background: #effcf5; color: #166b48; font-size: 12px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #1aab73; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.metric-card::before { position: absolute; content: ""; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.metric-card strong { display: block; margin: 7px 0 3px; font-size: 30px; line-height: 1; letter-spacing: -.5px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-note { color: var(--muted); font-size: 11px; }
.accent-violet::before { background: var(--violet); }
.accent-cyan::before { background: var(--cyan); }
.accent-green::before { background: var(--green); }
.dashboard-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-heading h3 { margin: 0; font-size: 16px; }
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-item { display: block; padding: 13px 14px; border: 1px solid var(--border); border-radius: 9px; transition: border-color .15s, background .15s; }
.action-item:hover { border-color: #a9c5f8; background: #f5f9ff; }
.action-item b { display: block; margin-bottom: 3px; color: #243b63; }
.action-item span { color: var(--muted); font-size: 12px; }
.details-list { margin: 0; }
.details-list div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.details-list div:last-child { border-bottom: 0; }
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; text-align: right; font-weight: 550; }
label { display: block; margin: 14px 0 7px; color: #344054; font-weight: 600; }
input, textarea, select { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus { border-color: #79a9f5; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; line-height: 1.55; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #f7f9fc; color: #475467; font-size: 12px; font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; }
.status.approved { background: #dcf7e8; color: #16714a; }
.status.draft { background: #fff2cc; color: #8a5b00; }
.status.archived { background: #e8edf2; color: #586474; }
.alert { padding: 13px 16px; border-radius: 9px; margin-bottom: 18px; }
.alert.error { border: 1px solid #f2b8b5; background: #fff0f0; color: #a92d2d; }
.chat-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 22px; align-items: start; }
.chat { max-height: 68vh; overflow-y: auto; padding-right: 4px; }
.message { max-width: 88%; margin: 12px 0; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; white-space: pre-wrap; }
.message small { display: inline-block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.message.user { margin-left: auto; border-color: #c5dcff; background: #eaf2ff; }
.message.assistant { background: white; }
.message-meta { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.muted { color: var(--muted); }
.nav-toggle, .nav-button { display: none; }
@media (max-width: 1050px) {
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .chat-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .layout { display: block; }
    .sidebar { position: fixed; z-index: 10; left: 0; width: 252px; transform: translateX(-100%); transition: transform .2s; }
    .nav-toggle:checked ~ .layout .sidebar { transform: translateX(0); }
    .nav-button { position: fixed; z-index: 20; top: 14px; left: 14px; display: inline-flex; }
    .topbar { padding: 16px 18px 16px 92px; min-height: 82px; }
    .topbar h1 { font-size: 20px; }
    .topbar-actions { gap: 6px; }
    .user-chip { display: none; }
    .content { padding: 20px 14px 34px; }
    .hero { display: block; padding: 20px; }
    .system-pill { display: inline-flex; margin-top: 16px; }
    .card { padding: 17px; }
    th, td { padding: 11px 12px; }
    .message { max-width: 96%; }
}
@media (max-width: 460px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .hero h2 { font-size: 22px; }
}

.auth-body .sidebar, .auth-body .topbar, .auth-body .nav-button { display: none; }
.auth-body .workspace { display: grid; place-items: center; min-height: 100vh; }
.auth-body .content { width: min(460px, 100%); padding: 28px 18px; }
.auth-card { width: 100%; padding: 28px; }
.auth-heading { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.auth-heading h2 { margin: 3px 0 4px; font-size: 24px; }
.auth-heading p { margin: 0; }
.code-card { max-width: 100%; overflow-x: hidden; background: #111827; color: #d7e5f5; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.knowledge-section h3 { margin-top: 0; color: #29466d; }
.knowledge-section pre { margin-bottom: 0; color: #475467; }
