/* B2BLife Local AI Business Suite — offline-first UI (no CDN assets) */
:root {
    --bg: #f4f6fa;
    --panel: #ffffff;
    --ink: #16243a;
    --muted: #64748b;
    --line: #e2e8f0;
    --accent: #0ea5a4;
    --accent-dark: #0b8584;
    --danger: #e11d48;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(22, 36, 58, 0.08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", "SF Pro Text", -apple-system, Roboto, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
}
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 0.95rem; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Demo mode banner */
.demo-banner {
    background: linear-gradient(90deg, #78350f, #b45309);
    color: #fef3c7;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    line-height: 1.5;
}
.demo-buy-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #5eead4, #38bdf8);
    color: #0f172a;
    font-weight: 800;
    padding: 7px 16px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 12.5px;
    flex-shrink: 0;
}
.demo-buy-link:hover { opacity: 0.9; color: #0f172a; }

/* Auth screens */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0b1d2e 0%, #103a45 100%);
}
.auth-card {
    background: var(--panel);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 38px;
    width: min(430px, 92vw);
    text-align: center;
}
.auth-card h1 { font-size: 1.2rem; }
.auth-logo {
    width: 56px; height: 56px; margin: 0 auto 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #38bdf8);
    color: #fff; font-weight: 800; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
}
.auth-card form { text-align: left; margin-top: 18px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px; flex-shrink: 0;
    background: #0e2233;
    color: #dbe7f3;
    display: flex; flex-direction: column;
    padding: 18px 14px;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #38bdf8);
    color: #fff; font-weight: 800; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 14px; }
.brand-sub { font-size: 11px; color: #7b93a8; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a {
    padding: 9px 12px; border-radius: 10px; cursor: pointer;
    color: #b8cbdc; font-weight: 600; font-size: 13.5px;
    user-select: none;
}
#nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
#nav a.active { background: rgba(14,165,164,0.22); color: #7ef0e7; }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding: 10px 8px 0; }
.sidebar-foot .muted { color: #7b93a8; }

.content { flex: 1; padding: 26px 30px 60px; max-width: 1280px; }

/* Panels & grids */
.panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(22,36,58,0.04);
}
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.kpi { text-align: center; padding: 18px 10px; }
.kpi .num { font-size: 1.7rem; font-weight: 800; color: var(--accent-dark); }
.kpi .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* Forms */
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0; }
input, select, textarea {
    width: 100%; margin-top: 5px;
    padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
    font: inherit; background: #fbfdff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
.row > .fixed { flex: 0 0 auto; min-width: 0; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    padding: 9px 16px; border-radius: 10px; cursor: pointer;
    font-weight: 700; font-size: 13.5px;
}
.btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: auto; }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,0.25); color: #b8cbdc; }
.btn.small { padding: 5px 10px; font-size: 12px; }
form .btn.primary { margin-top: 14px; width: 100%; justify-content: center; }
.panel form .btn.primary { width: auto; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
tr:hover td { background: #f8fafc; }
.table-wrap { overflow-x: auto; }

/* Pipeline board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board .col {
    flex: 0 0 215px; background: #eef2f7; border-radius: 12px; padding: 10px;
}
.board .col h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.card {
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    padding: 10px; margin-bottom: 8px; font-size: 13px;
    box-shadow: 0 1px 4px rgba(22,36,58,0.06);
}
.card .val { color: var(--accent-dark); font-weight: 700; }
.card select { margin-top: 6px; font-size: 12px; padding: 4px 6px; }

/* Badges, alerts, toast */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    background: #e6fbf8; color: var(--accent-dark);
}
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.err { background: #ffe4e6; color: #be123c; }
.alert { padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-size: 13.5px; }
.alert.error { background: #ffe4e6; color: #9f1239; }
.alert.info { background: #e0f2fe; color: #075985; }
#toast {
    position: fixed; bottom: 22px; right: 22px; z-index: 50;
    display: flex; flex-direction: column; gap: 8px;
}
#toast .t {
    background: #102033; color: #fff; padding: 11px 16px; border-radius: 10px;
    font-size: 13px; box-shadow: var(--shadow); max-width: 380px;
    animation: slide-in 0.25s ease;
}
#toast .t.err { background: #9f1239; }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } }

pre.sql {
    background: #0e2233; color: #9ef0e7; padding: 12px 14px; border-radius: 10px;
    overflow-x: auto; font-size: 13px;
}
.chat-log { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-log .msg { padding: 9px 12px; border-radius: 10px; max-width: 85%; font-size: 13.5px; white-space: pre-wrap; }
.chat-log .me { background: #e0f2fe; align-self: flex-end; }
.chat-log .bot { background: #f1f5f9; align-self: flex-start; }

.widget { min-height: 200px; }
.widget h3 { display: flex; justify-content: space-between; }
.chart-box svg { width: 100%; height: auto; display: block; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

@media (max-width: 880px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
    #nav { flex-direction: row; flex-wrap: wrap; }
    .content { padding: 16px; }
}
