:root {
    --ink: #1c1915;
    --sidebar: #1e2b26;
    --sidebar-text: #d7e0db;
    --accent: #c4622d;
    --accent-dark: #9a4a1f;
    --paper: #f4f0e8;
    --card: #fffdf9;
    --line: #e6dfd3;
    --muted: #6d675f;
    --good: #1f7a4d;
    --bad: #9f2d2d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
}

h1, h2, h3, h4, .brand-name {
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
    letter-spacing: -0.02em;
}

a { color: var(--accent-dark); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 22px 16px;
    flex-shrink: 0;
}

.platform-sidebar { background: #172033; }

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    color: white;
    text-decoration: none;
    margin-bottom: 22px;
    padding: 0 8px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: white;
}

.brand small { display: block; color: #b7c4be; font-family: "Segoe UI", sans-serif; letter-spacing: 0; font-size: 12px; }

.sidebar a.nav-link {
    color: var(--sidebar-text);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 2px;
    font-size: 14.5px;
}

.sidebar a.nav-link.active, .sidebar a.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.app-main { flex: 1; min-width: 0; }

.topbar {
    height: 64px;
    background: rgba(255,253,249,0.92);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar .search { max-width: 420px; }

.content { padding: 24px; }

.card, .stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(28,25,21,0.03);
}

.stat-card { padding: 16px 18px; height: 100%; }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 28px; font-family: Georgia, serif; line-height: 1.15; margin-top: 4px; }
.stat-card a { text-decoration: none; color: inherit; }

.stat-card.risk { border-top: 3px solid var(--accent); }
.stat-card.good { border-top: 3px solid var(--good); }

.table { --bs-table-bg: transparent; }
.table thead th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.badge-stage { color: white; }

.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
}

.auth-story {
    background: var(--sidebar);
    color: white;
    padding: 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-story h1 { font-size: 48px; max-width: 520px; }
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }

.btn-accent { background: var(--accent); border-color: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); color: white; }

.timeline { border-left: 2px solid var(--line); margin-left: 8px; }
.timeline-item { position: relative; padding: 0 0 16px 18px; }
.timeline-item::before {
    content: "";
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent);
    position: absolute; left: -6px; top: 4px;
}

.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { min-width: 240px; width: 240px; background: #efeae2; border-radius: 12px; padding: 10px; }
.lead-card { background: white; border-radius: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); cursor: grab; }
.lead-card:active { cursor: grabbing; }

.filters .form-control, .filters .form-select { background: white; }

.empty {
    padding: 32px 12px;
    text-align: center;
    color: var(--muted);
}

code, .mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.doc-block { background: #221c17; color: #f6efe6; border-radius: 12px; padding: 14px 16px; position: relative; }
.doc-block pre { margin: 0; white-space: pre-wrap; color: inherit; }

.impersonation-banner {
    background: #9f2d2d;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    position: sticky;
    top: 72px;
    z-index: 15;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.impersonation-banner {
    background: #9f2d2d;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    position: sticky;
    top: 72px;
    z-index: 15;
    font-weight: 600;
    letter-spacing: 0.01em;
}

@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-story { display: none; }
    .sidebar { display: none; }
    .sidebar.show { display: block; position: fixed; inset: 0 auto 0 0; z-index: 30; }
    .content { padding: 16px; }
}
