:root {
    --primary:       #4f46e5;
    --primary-dark:  #4338ca;
    --primary-light: #818cf8;
    --surface:       #f8fafc;
    --text-muted:    #94a3b8;
}

/* ── LOGIN ─────────────────────────────────────────── */
.login-body {
    margin: 0;
    background: var(--surface);
    min-height: 100vh;
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Panel izquierdo */
.login-panel-left {
    flex: 0 0 45%;
    background:
        linear-gradient(135deg, rgba(79,70,229,.82) 0%, rgba(109,40,217,.85) 100%),
        url('../img/login.jpg') center center / cover no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
    color: #fff;
}

.panel-content {
    position: relative;
    z-index: 2;
}

.brand-logo {
    width: 70px;
    height: 70px;
    background: rgba(255,255,255,.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(10px);
}

.brand-name {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: .5rem;
}

.brand-desc {
    font-size: 1rem;
    opacity: .85;
    margin-bottom: 2rem;
    max-width: 340px;
    line-height: 1.6;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .95rem;
    opacity: .9;
}

.feature-list li i {
    font-size: 1.1rem;
    color: #a5f3fc;
}

/* Patas decorativas */
.paw-decorations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.paw {
    position: absolute;
    color: rgba(255,255,255,.06);
    font-size: 5rem;
    transform: rotate(-30deg);
}

.paw-1 { top: 5%;  right: 5%;  font-size: 7rem; }
.paw-2 { bottom: 15%; left: -2%; font-size: 9rem; transform: rotate(20deg); }
.paw-3 { top: 45%; right: -3%; font-size: 6rem; transform: rotate(-10deg); }
.paw-4 { bottom: 3%; right: 15%; font-size: 4rem; }

/* Panel derecho */
.login-panel-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: #fff;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: .25rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: .9rem;
}

/* Logo mobile */
.brand-logo-sm {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

/* Inputs */
.input-group-text {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
}

.form-control {
    border-color: #e2e8f0;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 .2rem rgba(79,70,229,.15);
}

/* Botón principal */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: .65rem 1.25rem;
    border-radius: 8px;
    transition: opacity .2s, transform .1s;
}

.btn-primary-custom:hover {
    opacity: .9;
    color: #fff;
    transform: translateY(-1px);
}

.btn-primary-custom:active {
    transform: translateY(0);
}

/* Botones demo */
.demo-section {
    border-top: 1px solid #f1f5f9;
    padding-top: 1.25rem;
}

.demo-btns {
    display: flex;
    gap: .5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.demo-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .35rem .75rem;
    font-size: .8rem;
    color: #475569;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: .35rem;
}

.demo-btn:hover {
    background: #ede9fe;
    border-color: var(--primary-light);
    color: var(--primary);
}

/* ── DASHBOARD LAYOUT ───────────────────────────────── */
.dashboard-body {
    margin: 0;
    background: #f1f5f9;
    min-height: 100vh;
}

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

/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-collapsed, 68px);
    min-height: 100vh;
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width .28s cubic-bezier(.4,0,.2,1);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar:hover {
    width: 230px;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
    white-space: nowrap;
    min-height: 64px;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-light), #a78bfa);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .2s .05s, transform .2s .05s;
    letter-spacing: .02em;
}

.sidebar:hover .sidebar-brand-name {
    opacity: 1;
    transform: translateX(0);
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .75rem 0;
}

.sidebar-nav::-webkit-scrollbar { width: 0; }

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Section labels */
.sidebar-nav .nav-section-label {
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.3);
    padding: 1rem 1.1rem .3rem;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    transition: opacity .15s;
}

.sidebar:hover .nav-section-label {
    opacity: 1;
}

/* Nav items */
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .65rem 1rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    white-space: nowrap;
    border-radius: 8px;
    margin: 2px .5rem;
    transition: background .18s, color .18s;
    overflow: hidden;
}

.sidebar-nav li a i {
    font-size: 1.15rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    transition: color .18s;
}

.sidebar-nav li a span {
    font-size: .875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity .2s .04s, transform .2s .04s;
}

.sidebar:hover .sidebar-nav li a span {
    opacity: 1;
    transform: translateX(0);
}

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

.sidebar-nav li.active a {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.sidebar-nav li.active a i {
    color: #a5b4fc;
}

/* Footer de usuario */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.07);
    padding: .85rem 1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-user-info {
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .2s .05s, transform .2s .05s;
    overflow: hidden;
}

.sidebar:hover .sidebar-user-info {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-user-name {
    font-size: .8rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.sidebar-user-rol {
    font-size: .7rem;
    color: rgba(255,255,255,.45);
    text-transform: capitalize;
}

/* Avatares */
.avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    color: #fff;
    flex-shrink: 0;
}

.avatar-md {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    color: #fff;
    flex-shrink: 0;
}

/* ── MAIN WRAPPER ───────────────────────────────────── */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar */
.topbar {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left .topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
}

.topbar-left .topbar-date {
    font-size: .75rem;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.topbar-avatar-btn {
    border: none;
    background: none;
}

/* Main content */
.main-content {
    padding: 1.5rem;
    flex: 1;
}

/* Badge rol */
.badge-rol {
    background: #ede9fe;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 20px;
}

/* Stat cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow .2s;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.stat-label {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

/* Soft backgrounds */
.bg-primary-soft  { background: #ede9fe; }
.bg-success-soft  { background: #dcfce7; }
.bg-warning-soft  { background: #fef9c3; }
.bg-info-soft     { background: #e0f2fe; }
.bg-danger-soft   { background: #fee2e2; }

/* Badge soft en tabla */
.badge.bg-success-soft  { background: #dcfce7 !important; }
.badge.bg-warning-soft  { background: #fef9c3 !important; }
.badge.bg-danger-soft   { background: #fee2e2 !important; }

/* Badge de categoría en almacén */
.categoria-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: .72rem;
    font-weight: 600;
    padding: .25rem .6rem;
    border-radius: 20px;
}

/* Botón de acción en tabla */
.btn-accion {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
}

/* ── INGRESOS — líneas de productos en modal ──────────── */
.linea-header {
    display: grid;
    grid-template-columns: 1fr 120px 130px 100px 40px;
    gap: .5rem;
    padding: .4rem .6rem;
    background: #f8fafc;
    border-radius: 8px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    margin-bottom: .35rem;
}

.linea-row {
    display: grid;
    grid-template-columns: 1fr 120px 130px 100px 40px;
    gap: .5rem;
    align-items: center;
    padding: .4rem .2rem;
    border-bottom: 1px solid #f1f5f9;
}

.linea-row:last-child { border-bottom: none; }

.linea-col { min-width: 0; }

.linea-lbl {
    font-size: .7rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: .2rem;
}

.linea-subtotal {
    font-weight: 700;
    font-size: .9rem;
    color: #1e293b;
    text-align: right;
    padding-right: .25rem;
}

.linea-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 2rem 1rem;
    color: #cbd5e1;
    font-size: .875rem;
}

.linea-empty i { font-size: 2rem; }

.linea-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .75rem;
    padding: .65rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-weight: 600;
    font-size: .875rem;
    color: #15803d;
}

.linea-total-valor {
    font-size: 1.1rem;
    font-weight: 800;
}

/* ── AUTOCOMPLETE DE PRODUCTOS ──────────────────────── */
.prod-ac {
    position: relative;
}

.prod-ac-input {
    padding-right: 2rem;
}

.prod-ac-list {
    display: none;
    position: fixed;
    z-index: 1080;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 220px;
    overflow-y: auto;
}

.prod-ac-list::-webkit-scrollbar { width: 4px; }
.prod-ac-list::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 4px; }

.prod-ac-item {
    padding: .5rem .75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8fafc;
    transition: background .12s;
}

.prod-ac-item:last-child { border-bottom: none; }

.prod-ac-item:hover,
.prod-ac-item.ac-hover {
    background: #ede9fe;
}

.prod-ac-sin-stock {
    opacity: .5;
    cursor: not-allowed;
    background: #f8fafc !important;
}

.prod-ac-nombre {
    font-size: .85rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.prod-ac-code {
    font-size: .72rem;
    font-weight: 400;
    color: #94a3b8;
    background: #f1f5f9;
    border-radius: 4px;
    padding: .1rem .35rem;
}

.prod-ac-meta {
    display: flex;
    justify-content: space-between;
    margin-top: .15rem;
    font-size: .72rem;
}

.prod-ac-stock      { color: #16a34a; }
.prod-ac-stock.sin-stock { color: #dc2626; }
.prod-ac-precio     { color: #64748b; }

.prod-ac-empty {
    padding: .75rem;
    text-align: center;
    color: #94a3b8;
    font-size: .82rem;
}

/* ── PÉRDIDAS — banner de motivo ────────────────────── */
.motivo-banner {
    display: flex;
    align-items: center;
    padding: .6rem 1rem;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
}

.motivo-perdida     { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.motivo-vencimiento { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }
.motivo-bodega      { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.motivo-propietario { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* Total en rojo para pérdidas */
.linea-total-danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

/* Scroll en el listado de líneas del modal */
.lineas-scroll {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}

.lineas-scroll::-webkit-scrollbar {
    width: 4px;
}

.lineas-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.lineas-scroll::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 4px;
}

/* Responsive: mobile stack */
@media (max-width: 767px) {
    .linea-header { display: none; }
    .linea-row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "prod  prod"
            "cant  precio"
            "sub   del";
        padding: .75rem .25rem;
        gap: .4rem;
    }
    .linea-col-producto { grid-area: prod; }
    .linea-col-cant     { grid-area: cant; }
    .linea-col-precio   { grid-area: precio; }
    .linea-col-sub      { grid-area: sub; }
    .linea-col-del      { grid-area: del; justify-self: end; }
    .linea-subtotal     { text-align: left; }
}

/* ── INGRESOS — tabla e íconos ──────────────────────── */
.ingreso-icon-prod {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    font-size: .95rem;
    flex-shrink: 0;
}

.ingreso-resumen {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: .75rem 1rem;
    font-size: .875rem;
    color: #15803d;
}

/* Fila bloqueada en tabla de productos */
.fila-bloqueada {
    background: #f8fafc !important;
    opacity: .7;
}

.fila-bloqueada:hover {
    background: #f1f5f9 !important;
}

/* Avatar pequeño en tabla de clientes */
.cliente-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Badge sin mascotas */
.bg-secondary-soft { background: #f1f5f9; }

/* Modal detalle cliente */
.detalle-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.detalle-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detalle-grid {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.detalle-fila {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: .45rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: .875rem;
}

.detalle-fila:last-child { border-bottom: none; }

.detalle-label {
    color: #64748b;
    white-space: nowrap;
    font-weight: 500;
}

.detalle-valor {
    text-align: right;
    color: #1e293b;
    font-weight: 500;
    word-break: break-word;
}
