/* =========================================================
   Tema "Odoo-like" — variables de marca
   ========================================================= */
:root {
    --brand: #714B67;
    --brand-dark: #5b3b53;
    --brand-light: #8f6482;
    --brand-tint: #f3edf1;
    --ink: #2b2530;
    --muted: #7c7887;
    --border: #e8e6ea;
    --bg: #f6f5f8;
    --sidebar-bg: #2b2430;
    --sidebar-bg-active: #714B67;
    --sidebar-text: #c7c1cc;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 7px;
}

* { box-sizing: border-box; }

html, body {
    background-color: var(--bg);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ink);
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 700; }

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* =========================================================
   Layout general: sidebar + topbar + contenido
   ========================================================= */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1040;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.1rem;
}

.sidebar-company {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 18px 4px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: #e7e2eb;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}

.sidebar-heading {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.35);
    margin: 18px 10px 8px;
    font-weight: 700;
}

.sidebar-link, .sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    background: transparent;
    border: none;
    margin-bottom: 2px;
    text-align: left;
}

.sidebar-link i, .sidebar-toggle i { font-size: 1.05rem; width: 20px; text-align: center; }

.sidebar-link:hover, .sidebar-toggle:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-bg-active);
    color: #fff;
    box-shadow: 0 2px 8px rgba(113,75,103,0.45);
}

.sidebar-toggle .chevron {
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}

.sidebar-toggle[aria-expanded="true"] .chevron,
.sidebar-toggle.active .chevron { transform: rotate(180deg); }

.sidebar-submenu {
    padding-left: 8px;
    margin-bottom: 4px;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 30px;
    font-size: 0.86rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
}

.sidebar-sublink:hover { background: rgba(255,255,255,0.08); color: #fff; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,15,20,0.5);
    z-index: 1030;
}

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

.app-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 22px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-burger {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: var(--ink);
}

.topbar-spacer { flex: 1; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--brand-tint);
    color: var(--brand-dark);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 500;
}

.topbar-pill:hover { background: #ebe0e6; }

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 12px 5px 5px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.app-content {
    padding: 24px 28px 40px;
    flex: 1;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 0 0 24px rgba(0,0,0,0.25);
    }
    .app-sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop.is-visible { display: block; }
    .app-content { padding: 18px 16px 32px; }
    .app-topbar { padding: 12px 16px; }
}

/* =========================================================
   Login
   ========================================================= */
.login-body {
    min-height: 100vh;
    background: radial-gradient(circle at top left, var(--brand-light), var(--brand) 45%, var(--ink) 100%);
    font-family: 'Roboto', sans-serif;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(30, 15, 30, 0.35);
}

.login-card .brand-mark {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
    border-radius: 16px;
    margin: 0 auto;
}

/* =========================================================
   Componentes generales (cards, botones, tablas, badges)
   ========================================================= */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(20,10,20,0.04);
}

.card-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    border-bottom: 1px solid var(--border);
    background: #fff;
    font-weight: 600;
}

.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.stat-icon {
    position: absolute;
    right: 14px;
    bottom: 10px;
    font-size: 2.2rem;
    opacity: 0.12;
}

.stat-icon-chip {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--brand-dark) !important;
    border-color: var(--brand-dark) !important;
}

.btn-outline-primary {
    color: var(--brand);
    border-color: var(--brand);
}

.btn-outline-primary:hover {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-check:checked + .btn-outline-primary,
.btn-outline-primary.active {
    background-color: var(--brand);
    border-color: var(--brand);
}

.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }

.form-control:focus, .form-select:focus {
    border-color: var(--brand-light);
    box-shadow: 0 0 0 0.2rem rgba(113,75,103,0.15);
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
}

.nav-tabs .nav-link.active {
    color: var(--brand);
    border-bottom: 2px solid var(--brand);
    font-weight: 600;
}

.table {
    --bs-table-hover-bg: var(--brand-tint);
}

.table thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    background: #fafafb;
}

.badge { font-weight: 500; border-radius: 999px; padding: 5px 10px; }

.list-group-item { border-color: var(--border); }

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(20,10,20,0.12);
    padding: 6px;
}

.dropdown-item { border-radius: var(--radius-sm); padding: 8px 12px; }
.dropdown-item.active, .dropdown-item:active { background-color: var(--brand); }
.dropdown-item:hover { background-color: var(--brand-tint); }

/* ===== Kanban (Pipeline) — estilo Odoo ===== */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.kanban-column {
    background: #edecf1;
    border-radius: var(--radius-md);
    min-width: 290px;
    max-width: 290px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    box-shadow: 0 1px 0 var(--border);
}

.kanban-column-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 80px;
}

.kanban-card {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(20,10,20,0.06);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.kanban-card:hover {
    box-shadow: 0 6px 16px rgba(20,10,20,0.14);
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.5;
}

.kanban-card-ganado {
    background: #f1faf4;
    border: 1px solid #b7e4c4;
    border-left: 3px solid #2f9e57;
}

.kanban-card-perdido {
    background: #f8f8f9;
    border-left: 3px solid #c8c5cd;
    opacity: 0.65;
}

.kanban-card-perdido .fw-semibold {
    text-decoration: line-through;
    text-decoration-color: #adb5bd;
}

.kanban-column-body.drag-over {
    background: #e3d9e0;
    border-radius: 8px;
}

.kanban-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand-dark);
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
