:root {
    --fs-primary: #0d6efd;
    --fs-dark: #0b2545;
    --fs-accent: #13a3b5;
    --fs-bg: #f4f6f9;
    --fs-sidebar: #0b2545;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fs-bg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

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

/* Sidebar */
.sidebar {
    width: 240px; background: var(--fs-sidebar); color: #cdd9ed;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.08); color: #fff;
}
.sidebar-brand i { font-size: 1.9rem; color: var(--fs-accent); }
.brand-logo { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
.brand-title { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .78rem; opacity: .7; letter-spacing: .5px; }
.sidebar .nav { padding: .8rem .6rem; gap: .15rem; flex: 1; }
.sidebar .nav-link {
    color: #cdd9ed; border-radius: 8px; padding: .6rem .8rem; display: flex; align-items: center; gap: .65rem;
    font-size: .95rem; transition: background .15s, color .15s;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: var(--fs-primary); color: #fff; }
.sidebar-footer { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,.08); }
.powered { font-size: .72rem; opacity: .65; line-height: 1.3; }
.powered strong { color: var(--fs-accent); }

/* Main */
.main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: #fff; padding: .85rem 1.5rem; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid #e3e8ef; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 600; font-size: 1.15rem; color: var(--fs-dark); }
.content { padding: 1.5rem; flex: 1; }

/* Tarjetas KPI */
.kpi-card { border: none; border-radius: 14px; box-shadow: 0 2px 10px rgba(11,37,69,.06); }
.kpi-card .kpi-icon { font-size: 1.8rem; opacity: .85; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--fs-dark); }
.kpi-label { color: #6b7280; font-size: .85rem; }

.card { border: none; border-radius: 14px; box-shadow: 0 2px 10px rgba(11,37,69,.06); }
.card-header { background: #fff; border-bottom: 1px solid #eef1f6; font-weight: 600; border-radius: 14px 14px 0 0 !important; }

/* Login */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--fs-dark), var(--fs-accent));
}
.login-card {
    background: #fff; padding: 2.5rem; border-radius: 18px; width: 100%; max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-card .logo { text-align: center; margin-bottom: 1.2rem; }
.login-card .logo i { font-size: 3rem; color: var(--fs-primary); }
.login-powered { text-align: center; margin-top: 1.5rem; font-size: .8rem; color: #94a3b8; }
.login-powered strong { color: var(--fs-accent); }

/* Odontograma */
.odontograma-wrap { background: #fff; border-radius: 14px; padding: 1.2rem; overflow-x: auto; }
.diente { cursor: pointer; transition: opacity .15s; }
.diente:hover { opacity: .8; }
.diente .num { font-size: 11px; fill: #6b7280; font-family: monospace; text-anchor: middle; }
/* OJO: no definir `fill` acá. En SVG una propiedad CSS pisa el atributo
   fill="..." que setea el JS, y dejaría todos los dientes en blanco. */
.diente-seg { stroke: #adb5bd; stroke-width: 1; }
.leyenda { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.leyenda span { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; }
.leyenda .box { width: 16px; height: 16px; border-radius: 3px; border: 1px solid #ccc; display: inline-block; }

.saldo-positivo { color: #dc3545; font-weight: 700; }
.saldo-cero { color: #198754; font-weight: 700; }

/* Botón de menú (hamburguesa) y overlay — ocultos en escritorio */
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.6rem;
    color: var(--fs-dark); margin-right: .6rem; cursor: pointer; line-height: 1; padding: 0; }
.sidebar-overlay { display: none; }

/* ===== Responsive (celular / tablet) ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; z-index: 1050; width: 260px; }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.4); }
    .main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; align-items: center; }
    .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1040; }
    body.sidebar-open .sidebar-overlay { display: block; }
    .topbar { padding: .7rem 1rem; }
    .topbar-title { font-size: 1rem; }
    .content { padding: 1rem; }
    /* Tablas anchas: que se puedan deslizar dentro de su tarjeta */
    .card-body { overflow-x: auto; }
    /* KPIs y grillas: una columna cómoda en pantallas chicas */
    .kpi-value { font-size: 1.35rem; }
}
