:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: linear-gradient(180deg, #ffffff 0%, #f8fafc 54%, #f3f6fb 100%); color: var(--text); font-size: 14px; min-height: 100vh; overflow-x: hidden; }

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

.sidebar { width: var(--sidebar-width); background: var(--card); border-right: 1px solid var(--border); position: fixed; height: 100vh; overflow-y: auto; overscroll-behavior: contain; z-index: 100; display: flex; flex-direction: column; }
.sidebar-header { padding: 15px 20px; border-bottom: 1px solid var(--border); text-align: center; background: white; }
.logo-container { display: flex; justify-content: center; align-items: center; }
.sidebar-logo { max-width: 200px; width: 100%; height: auto; max-height: 70px; object-fit: contain; }
.logo-text { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.logo-text span { color: var(--primary); }

.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); text-align: center; background: #f8fafc; }
.sidebar-version { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.sidebar-version { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; background: var(--bg); padding: 2px 8px; border-radius: 10px; }

.sidebar-menu { padding: 15px 10px 26px; flex: 1 1 auto; min-height: 0; }
.menu-category { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 15px 12px 8px; letter-spacing: 0.5px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; color: var(--text-muted); text-decoration: none; transition: all 0.2s; margin-bottom: 4px; }
.menu-item:hover { background: rgba(99,102,241,0.08); color: var(--primary); }
.menu-item.active { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
.menu-item i { width: 20px; text-align: center; }

.submenu-container { position: relative; }
.submenu-toggle { cursor: pointer; justify-content: space-between; }
.submenu-toggle i.submenu-arrow { font-size: 0.7rem; transition: transform 0.3s; margin-left: auto; }
.submenu-container.open .submenu-toggle i.submenu-arrow { transform: rotate(180deg); }
.submenu { max-height: 0; overflow: hidden; transition: max-height 0.32s ease; background: rgba(99,102,241,0.05); border-radius: 0 0 10px 10px; }
.submenu-container.open .submenu { max-height: 2400px; }
.submenu .menu-item { padding-left: 48px; font-size: 0.9rem; margin: 2px 8px; }
.menu-item.inventario-active { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }

.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; background: linear-gradient(180deg, #ffffff 0%, #f8fafc 54%, #f3f6fb 100%); position: relative; overflow-x: hidden; }
.header { height: 70px; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; position: sticky; top: 0; z-index: 50; }
.header-left h2 { font-size: 1.4rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 20px; }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

.content { padding: 25px 30px; min-height: calc(100vh - 70px); }

.card { background: var(--card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 20px 25px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-title { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card-title i { color: var(--primary); }
.card-body { padding: 25px; }

.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-weight: 600; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg); }
.data-table tbody tr:hover { background: rgba(99,102,241,0.03); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; text-decoration: none; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.btn-success { background: linear-gradient(135deg, var(--success) 0%, #059669 100%); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%); color: white; }
.btn-secondary { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.btn-warning { background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%); color: white; }
.btn-info { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.btn-info:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(99,102,241,0.16); }
.btn-block { width: 100%; }

.alert { padding: 16px 20px; border-radius: 10px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #f0fdf4; color: #16a34a; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-warning { background: #fffbeb; color: #d97706; }

.form-row { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.form-group { flex: 1; min-width: 200px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; }
.form-label .required { color: var(--danger); }
.form-control { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; transition: all 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-control:read-only { background: var(--bg); }

.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-3 { margin-top: 15px; }

/* Popup */
.popup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; display: none; }
.popup-overlay.active { display: block; }
.popup-box { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; border-radius: 16px; width: 90%; max-width: 700px; max-height: 80vh; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.popup-header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.popup-close { background: rgba(255,255,255,0.2); border: none; color: white; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; }
.popup-body { padding: 20px; max-height: 50vh; overflow-y: auto; }
.popup-search { margin-bottom: 15px; }
.popup-search input { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; font-size: 1rem; }
.popup-list { display: flex; flex-direction: column; gap: 8px; }
.popup-item { padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #f8fafc; transition: all 0.2s; }
.popup-item:hover { background: #e0e7ff; border-color: var(--primary); transform: translateX(4px); }

/* Items */
.items-container { margin-top: 20px; min-height: 50px; border: 2px dashed var(--border); border-radius: 12px; padding: 15px; background: #fafafa; }
.items-container:empty::before { content: 'No hay items. Haga clic en "Agregar Item".'; color: var(--text-muted); font-style: italic; display: block; text-align: center; padding: 20px; }
.item-row { display: flex; gap: 8px; align-items: center; padding: 12px; background: white; border-radius: 10px; margin-bottom: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid var(--border); animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.item-row input, .item-row select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
.item-row .codigo { width: 90px; background: #f1f5f9; }
.item-row .descripcion { width: 180px; background: #f1f5f9; }
.item-row .cantidad { width: 70px; }
.item-row .precio { width: 90px; }
.item-row .tax { width: 60px; }
.item-row .total-linea { width: 100px; text-align: right; font-weight: 600; color: var(--primary); }
.item-row .es-serv { width: 100px; }

.search-btn { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; }

.totales-box { background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); border-radius: 12px; padding: 20px; border: 1px solid var(--border); }
.total-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #cbd5e1; }
.total-row:last-child { border-bottom: none; font-size: 1.3rem; font-weight: 700; color: var(--primary); }

.pagos-box { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-radius: 12px; padding: 20px; margin-top: 20px; border: 1px solid #bbf7d0; }
.pagos-box h4 { margin: 0 0 15px 0; color: #166534; display: flex; align-items: center; gap: 8px; }

/* Botones de pago */
.pago-botones { display: flex; gap: 10px; margin-bottom: 15px; }
.pago-btn { flex: 1; padding: 15px; border-radius: 10px; border: 2px solid var(--border); background: white; cursor: pointer; text-align: center; transition: all 0.2s; }
.pago-btn:hover { border-color: var(--primary); background: #f5f3ff; }
.pago-btn.active { border-color: var(--primary); background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
.pago-btn i { font-size: 1.5rem; margin-bottom: 5px; display: block; }
.pago-btn span { font-weight: 600; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .form-row { flex-direction: column; }
    .form-group { min-width: 100%; }
}


body.modal-open { overflow: hidden; }
.detail-modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.52); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 24px; z-index: 1600; }
.detail-modal-overlay.active { display: flex; }
.detail-modal-shell { width: min(1240px, calc(100vw - 48px)); max-height: calc(100vh - 48px); background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%); border: 1px solid rgba(99, 102, 241, 0.18); border-radius: 28px; box-shadow: 0 34px 80px rgba(15, 23, 42, 0.28); overflow: hidden; display: flex; flex-direction: column; }
.detail-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; background: linear-gradient(135deg, #4338ca 0%, #6366f1 48%, #7c3aed 100%); color: #fff; }
.detail-modal-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.16); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.detail-modal-header h3 { margin: 0; font-size: 1.08rem; font-weight: 900; }
.detail-modal-close { width: 40px; height: 40px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.24); background: rgba(255,255,255,0.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.detail-modal-close:hover { background: rgba(255,255,255,0.24); }
.detail-modal-loader { display: none; align-items: center; justify-content: center; gap: 12px; padding: 16px 18px; color: #4338ca; font-weight: 700; background: rgba(255,255,255,0.82); border-bottom: 1px solid rgba(99,102,241,0.12); }
.detail-modal-loader.active { display: flex; }
.detail-modal-spinner { width: 18px; height: 18px; border-radius: 999px; border: 2px solid rgba(99,102,241,0.18); border-top-color: #6366f1; animation: detailSpin .8s linear infinite; }
@keyframes detailSpin { to { transform: rotate(360deg); } }
.detail-modal-iframe { width: 100%; min-height: 72vh; border: 0; background: #f8fafc; opacity: 0; transition: opacity .2s ease; flex: 1 1 auto; }
.detail-modal-iframe.ready { opacity: 1; }
body.detail-modal-page { background: linear-gradient(180deg, #eef2ff 0%, #f8fafc 100%); }
body.detail-modal-page .sidebar, body.detail-modal-page .header, body.detail-modal-page .sidebar-footer { display: none !important; }
body.detail-modal-page .main-content { margin-left: 0; min-height: 100vh; }
body.detail-modal-page .content { padding: 24px; }
body.detail-modal-page .page-header { display: none; }
body.detail-modal-page .card, body.detail-modal-page .info-card, body.detail-modal-page .cat-card { box-shadow: 0 20px 40px rgba(15,23,42,0.08); border-radius: 22px; }
body.detail-modal-page .page-container, body.detail-modal-page .container-fluid, body.detail-modal-page .info-container { max-width: 1180px; margin: 0 auto; }
body.detail-modal-page .card { border: 1px solid #e7edf7; }
body.detail-modal-page .card-header { padding: 18px 20px; }
body.detail-modal-page .card-body { padding: 22px; }
@media (max-width: 768px) { .detail-modal-overlay { padding: 12px; } .detail-modal-shell { width: 100%; max-height: calc(100vh - 24px); border-radius: 20px; } .detail-modal-iframe { min-height: 78vh; } }


/* ===== Menu visual refinado v2 - AnnualPOS ===== */
body.app-shell-refined {
    --sidebar-width: 228px;
    --brand-purple: #6355e8;
    --brand-purple-dark: #4f43dd;
    --brand-purple-soft: #ede9ff;
    --brand-purple-border: #d9d2fb;
}
body.app-shell-refined .sidebar {
    background: linear-gradient(180deg, #f1eeff 0%, #faf9ff 55%, #f3f0ff 100%);
    border-right: 1px solid var(--brand-purple-border);
    box-shadow: 10px 0 28px rgba(61, 52, 139, 0.08);
    overflow: hidden;
}
body.app-shell-refined .sidebar-header {
    padding: 10px 14px;
    background: linear-gradient(180deg, #f3f0ff 0%, #ece8ff 100%);
    border-bottom: 1px solid var(--brand-purple-border);
}
body.app-shell-refined .logo-container {
    min-height: 70px;
}
body.app-shell-refined .sidebar-logo {
    max-height: 60px;
    max-width: 170px;
}
body.app-shell-refined .sidebar-menu {
    padding: 10px 9px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
}
body.app-shell-refined .sidebar-menu::-webkit-scrollbar {
    width: 8px;
}
body.app-shell-refined .sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(99, 85, 232, 0.18);
    border-radius: 999px;
}
body.app-shell-refined .menu-category {
    padding: 10px 12px 5px;
    color: #6e7288;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 800;
}
body.app-shell-refined .menu-item.simple-main {
    min-height: 40px;
    margin: 0 2px 6px;
    padding: 0 14px;
    border-radius: 12px;
    color: #546074;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(99, 85, 232, 0.08);
    font-weight: 600;
    box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset;
}
body.app-shell-refined .menu-item.simple-main i {
    color: #59657d;
}
body.app-shell-refined .menu-item.simple-main:hover {
    background: rgba(99, 85, 232, 0.10);
    border-color: rgba(99, 85, 232, 0.18);
    color: var(--brand-purple-dark);
    transform: translateX(1px);
}
body.app-shell-refined .menu-item.simple-main:hover i {
    color: var(--brand-purple-dark);
}
body.app-shell-refined .menu-item.simple-main.active {
    background: linear-gradient(135deg, var(--brand-purple-dark) 0%, var(--brand-purple) 56%, #7b6df2 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 12px 20px rgba(99, 85, 232, 0.22);
}
body.app-shell-refined .menu-item.simple-main.active i {
    color: #ffffff;
}
body.app-shell-refined .sidebar-footer {
    margin-top: 0;
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 8px 10px 10px;
    background: linear-gradient(180deg, rgba(243, 240, 255, 0.96) 0%, rgba(236, 232, 255, 0.98) 100%);
    border-top: 1px solid var(--brand-purple-border);
}
body.app-shell-refined .sidebar-version {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 10px;
    font-size: 0.70rem;
    color: var(--brand-purple-dark);
    background: rgba(99, 85, 232, 0.10);
    border: 1px solid rgba(99, 85, 232, 0.12);
    border-radius: 999px;
}
body.app-shell-refined .header {
    height: 72px;
    padding: 0 22px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}
body.app-shell-refined .main-content {
    background: linear-gradient(180deg, #ffffff 0%, #faf9ff 48%, #f5f7fb 100%);
}
body.app-shell-refined .content {
    padding: 20px 22px 26px;
}
body.app-shell-refined .section-tabs-bar {
    position: sticky;
    top: 72px;
    z-index: 45;
    padding: 0 22px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--brand-purple-border);
    backdrop-filter: blur(8px);
}
body.app-shell-refined .section-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0 11px;
    scrollbar-width: thin;
}
body.app-shell-refined .section-tabs::-webkit-scrollbar {
    height: 7px;
}
body.app-shell-refined .section-tabs::-webkit-scrollbar-thumb {
    background: rgba(99, 85, 232, 0.28);
    border-radius: 999px;
}
body.app-shell-refined .section-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--brand-purple-dark);
    background: var(--brand-purple-soft);
    border: 1px solid #d6d0fb;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.94rem;
    transition: all 0.2s ease;
}
body.app-shell-refined .section-tab i {
    font-size: 0.88rem;
}
body.app-shell-refined .section-tab:hover {
    background: #e4deff;
    border-color: #c9c0fb;
    transform: translateY(-1px);
}
body.app-shell-refined .section-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand-purple-dark) 0%, var(--brand-purple) 56%, #7b6df2 100%);
    border-color: transparent;
    box-shadow: 0 10px 18px rgba(99, 85, 232, 0.22);
}
body.app-shell-refined .section-tab.active i {
    color: #ffffff;
}
@media (max-width: 1024px) {
    body.app-shell-refined {
        --sidebar-width: 220px;
    }
    body.app-shell-refined .header,
    body.app-shell-refined .section-tabs-bar,
    body.app-shell-refined .content {
        padding-left: 16px;
        padding-right: 16px;
    }
}
@media (max-width: 900px) {
    body.app-shell-refined .sidebar {
        width: 100%;
        max-width: 260px;
    }
}


/* ===== Menu visual refinado v3 - inspirado en layout de referencia ===== */
body.app-shell-refined {
    --sidebar-width: 238px;
    --brand-purple: #6256ea;
    --brand-purple-dark: #4e45d8;
    --brand-purple-soft: #efedff;
    --brand-purple-border: #d8d3ff;
}
body.app-shell-refined .sidebar {
    background: #f7f7fb;
    border-right: 1px solid #d7dcE6;
    box-shadow: none;
    overflow-y: auto;
}
body.app-shell-refined .sidebar-header {
    padding: 10px 12px;
    background: #f7f7fb;
    border-bottom: 1px solid #d7dcE6;
}
body.app-shell-refined .logo-container {
    min-height: 66px;
}
body.app-shell-refined .sidebar-logo {
    max-width: 168px;
    max-height: 58px;
}
body.app-shell-refined .sidebar-menu {
    padding: 8px 10px 8px;
}
body.app-shell-refined .menu-category {
    padding: 11px 6px 7px;
    color: #5f6b82;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
}
body.app-shell-refined .menu-item.simple-main {
    min-height: 40px;
    margin: 0 0 6px;
    padding: 0 14px;
    border-radius: 14px;
    background: transparent;
    border: 1px solid transparent;
    color: #50627a;
    box-shadow: none;
}
body.app-shell-refined .menu-item.simple-main i {
    width: 18px;
    color: #5f6b82;
}
body.app-shell-refined .menu-item.simple-main:hover {
    background: #efedff;
    border-color: #ddd8ff;
    color: var(--brand-purple-dark);
    transform: none;
}
body.app-shell-refined .menu-item.simple-main:hover i {
    color: var(--brand-purple-dark);
}
body.app-shell-refined .menu-item.simple-main.active {
    background: linear-gradient(90deg, var(--brand-purple-dark) 0%, var(--brand-purple) 100%);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(98, 86, 234, 0.20);
}
body.app-shell-refined .menu-item.simple-main.active i {
    color: #ffffff;
}
body.app-shell-refined .sidebar-footer {
    position: static;
    margin-top: auto;
    padding: 10px 12px 14px;
    background: #f7f7fb;
    border-top: 1px solid #d7dcE6;
}
body.app-shell-refined .sidebar-version {
    min-height: 28px;
    padding: 0 12px;
    color: #64748b;
    background: #eef2f7;
    border-color: #dbe3ee;
}
body.app-shell-refined .header {
    height: 74px;
    padding: 0 18px;
    background: #ffffff;
    border-bottom: 1px solid #d7dcE6;
}
body.app-shell-refined .header-left h2 {
    font-size: 1.15rem;
}
body.app-shell-refined .content {
    padding: 12px 16px 24px;
}
body.app-shell-refined .section-shell-bar {
    margin: 0;
    background: linear-gradient(90deg, #5a4ee8 0%, #6256ea 52%, #6d61ef 100%);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.08);
}
body.app-shell-refined .section-shell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 18px;
    min-height: 80px;
}
body.app-shell-refined .section-shell-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.15rem;
    white-space: nowrap;
}
body.app-shell-refined .section-shell-title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    font-size: 0.95rem;
}
body.app-shell-refined .section-tabs-onbar {
    justify-content: flex-end;
    gap: 8px;
    padding: 0;
    margin-left: auto;
    flex: 1 1 auto;
}
body.app-shell-refined .section-tabs-onbar .section-tab {
    min-height: 36px;
    padding: 0 14px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    box-shadow: none;
}
body.app-shell-refined .section-tabs-onbar .section-tab i {
    color: #ffffff;
}
body.app-shell-refined .section-tabs-onbar .section-tab:hover {
    background: rgba(255,255,255,0.20);
    border-color: rgba(255,255,255,0.28);
    transform: none;
}
body.app-shell-refined .section-tabs-onbar .section-tab.active {
    background: #ffffff;
    color: var(--brand-purple-dark);
    border-color: transparent;
    box-shadow: 0 8px 16px rgba(61, 52, 139, 0.18);
}
body.app-shell-refined .section-tabs-onbar .section-tab.active i {
    color: var(--brand-purple-dark);
}
@media (max-width: 1200px) {
    body.app-shell-refined .section-shell-head {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    body.app-shell-refined .section-tabs-onbar {
        width: 100%;
        justify-content: flex-start;
        padding-bottom: 2px;
    }
}
@media (max-width: 900px) {
    body.app-shell-refined {
        --sidebar-width: 224px;
    }
    body.app-shell-refined .header,
    body.app-shell-refined .content,
    body.app-shell-refined .section-shell-head {
        padding-left: 14px;
        padding-right: 14px;
    }
    body.app-shell-refined .section-shell-title {
        font-size: 1rem;
    }
}

/* ===== Ajuste POS v5: compactar menu horizontal sin tocar logica ===== */
body.app-shell-refined.pos-layout-locked {
    --sidebar-width: 238px;
}
body.app-shell-refined.pos-layout-locked .main-content {
    overflow: hidden !important;
}
body.app-shell-refined.pos-layout-locked .header {
    height: 68px !important;
    padding: 0 18px !important;
}
body.app-shell-refined.pos-layout-locked .header-left h2 {
    font-size: 1.06rem !important;
}
body.app-shell-refined.pos-layout-locked .section-shell-head {
    min-height: 58px !important;
    padding: 8px 16px !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
}
body.app-shell-refined.pos-layout-locked .section-shell-title {
    font-size: 1.02rem !important;
    gap: 8px !important;
}
body.app-shell-refined.pos-layout-locked .section-shell-title i {
    width: 30px !important;
    height: 30px !important;
    border-radius: 9px !important;
    font-size: 0.86rem !important;
}
body.app-shell-refined.pos-layout-locked .section-tabs-onbar {
    gap: 7px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    padding-bottom: 0 !important;
}
body.app-shell-refined.pos-layout-locked .section-tabs-onbar .section-tab {
    min-height: 32px !important;
    padding: 0 11px !important;
    font-size: 0.80rem !important;
    border-radius: 999px !important;
    flex: 0 0 auto !important;
}
body.app-shell-refined.pos-layout-locked .section-tabs-onbar .section-tab i {
    font-size: 0.78rem !important;
}
body.app-shell-refined.pos-layout-locked .content {
    padding: 0 !important;
    min-height: calc(100vh - 126px) !important;
    overflow: hidden !important;
}

/* El POS trae estilos propios en pos/index.php; se corrigen aqui con !important
   para no modificar funciones, formularios, JS ni flujo operativo. */
body.app-shell-refined.pos-layout-locked .pos-container {
    height: calc(100vh - 126px) !important;
    max-height: calc(100vh - 126px) !important;
    overflow: hidden !important;
}
body.app-shell-refined.pos-layout-locked .pos-header {
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 16px !important;
}
body.app-shell-refined.pos-layout-locked .pos-header h2 {
    font-size: 1.32rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-header-actions {
    gap: 8px !important;
}
body.app-shell-refined.pos-layout-locked .pos-header-actions .btn {
    min-height: 36px !important;
    padding: 8px 13px !important;
    font-size: 0.86rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-totales {
    padding: 10px 14px !important;
}
body.app-shell-refined.pos-layout-locked .pos-totales-row {
    padding: 6px 0 !important;
    font-size: 0.90rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-totales-row:last-child {
    padding: 10px 12px !important;
    margin-top: 6px !important;
    font-size: 1.18rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-items-container {
    padding: 8px 10px !important;
}
body.app-shell-refined.pos-layout-locked .pos-items-table {
    font-size: 0.84rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-items-table th {
    padding: 7px 9px !important;
    font-size: 0.74rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-items-table td {
    padding: 5px 9px !important;
}
body.app-shell-refined.pos-layout-locked .pos-acciones {
    gap: 7px !important;
    padding: 8px 12px !important;
}
body.app-shell-refined.pos-layout-locked .pos-accion-btn {
    padding: 8px 6px !important;
    min-height: 54px !important;
    font-size: 0.78rem !important;
    gap: 3px !important;
}
body.app-shell-refined.pos-layout-locked .pos-accion-btn i {
    font-size: 1rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-pagar-btn {
    padding: 12px !important;
    min-height: 52px !important;
    font-size: 1.05rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-buscador {
    padding: 12px 14px !important;
}
body.app-shell-refined.pos-layout-locked .pos-buscador-input {
    padding: 10px 14px !important;
    font-size: 0.94rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-categorias,
body.app-shell-refined.pos-layout-locked .pos-productos {
    padding: 12px !important;
}
body.app-shell-refined.pos-layout-locked .pos-categorias-grid {
    grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)) !important;
    gap: 12px !important;
    padding: 12px !important;
}
body.app-shell-refined.pos-layout-locked .pos-categoria-card {
    min-height: 104px !important;
    padding: 14px 10px !important;
    gap: 8px !important;
    border-radius: 11px !important;
}
body.app-shell-refined.pos-layout-locked .pos-categoria-icono {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.15rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-categoria-card span {
    font-size: 0.79rem !important;
    line-height: 1.12 !important;
}
body.app-shell-refined.pos-layout-locked .pos-productos-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)) !important;
    gap: 10px !important;
    padding: 10px !important;
}
body.app-shell-refined.pos-layout-locked .pos-producto-card {
    min-height: 118px !important;
    padding: 12px 9px !important;
    gap: 7px !important;
}
body.app-shell-refined.pos-layout-locked .pos-producto-icono {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.05rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-producto-nombre {
    font-size: 0.78rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-producto-precio {
    font-size: 0.95rem !important;
}
@media (max-width: 1320px) {
    body.app-shell-refined.pos-layout-locked .section-shell-head {
        flex-wrap: wrap !important;
        min-height: 88px !important;
    }
    body.app-shell-refined.pos-layout-locked .section-tabs-onbar {
        width: 100% !important;
        justify-content: flex-start !important;
    }
    body.app-shell-refined.pos-layout-locked .content {
        min-height: calc(100vh - 156px) !important;
    }
    body.app-shell-refined.pos-layout-locked .pos-container {
        height: calc(100vh - 156px) !important;
        max-height: calc(100vh - 156px) !important;
    }
}

/* ===== Ajuste POS v6: recuperar boton PAGAR dentro de la pantalla =====
   No modifica funciones ni flujo operativo. Solo corrige alto/flex del layout
   para que el boton verde PAGAR quede siempre visible con el menu horizontal. */
body.app-shell-refined.pos-layout-locked .main-content {
    height: 100vh !important;
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}
body.app-shell-refined.pos-layout-locked .header {
    flex: 0 0 64px !important;
    height: 64px !important;
    min-height: 64px !important;
}
body.app-shell-refined.pos-layout-locked .section-shell-bar {
    flex: 0 0 auto !important;
}
body.app-shell-refined.pos-layout-locked .section-shell-head {
    min-height: 52px !important;
    padding: 6px 14px !important;
}
body.app-shell-refined.pos-layout-locked .section-tabs-onbar .section-tab {
    min-height: 30px !important;
    padding: 0 10px !important;
    font-size: 0.78rem !important;
}
body.app-shell-refined.pos-layout-locked .content {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}
body.app-shell-refined.pos-layout-locked .pos-header {
    flex: 0 0 50px !important;
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 14px !important;
}
body.app-shell-refined.pos-layout-locked .pos-header h2 {
    font-size: 1.24rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-header-actions .btn {
    min-height: 34px !important;
    padding: 7px 12px !important;
}
body.app-shell-refined.pos-layout-locked .pos-container {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: hidden !important;
}
body.app-shell-refined.pos-layout-locked .pos-sidebar,
body.app-shell-refined.pos-layout-locked .pos-main {
    min-height: 0 !important;
    overflow: hidden !important;
}
body.app-shell-refined.pos-layout-locked .pos-totales {
    flex: 0 0 auto !important;
    padding: 8px 12px !important;
}
body.app-shell-refined.pos-layout-locked .pos-totales-row {
    padding: 5px 0 !important;
    font-size: 0.88rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-totales-row:last-child {
    padding: 8px 10px !important;
    margin-top: 5px !important;
    font-size: 1.12rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-items-container {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 8px 10px !important;
}
body.app-shell-refined.pos-layout-locked .pos-items-table th {
    padding: 6px 8px !important;
}
body.app-shell-refined.pos-layout-locked .pos-acciones {
    flex: 0 0 auto !important;
    gap: 6px !important;
    padding: 7px 10px !important;
}
body.app-shell-refined.pos-layout-locked .pos-accion-btn {
    min-height: 48px !important;
    padding: 6px 5px !important;
    font-size: 0.76rem !important;
    gap: 3px !important;
}
body.app-shell-refined.pos-layout-locked .pos-accion-btn i {
    font-size: 0.96rem !important;
}
body.app-shell-refined.pos-layout-locked .pos-pagar-btn {
    flex: 0 0 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 12px !important;
    font-size: 1.05rem !important;
    border-radius: 0 !important;
    z-index: 3 !important;
}
body.app-shell-refined.pos-layout-locked .pos-buscador {
    flex: 0 0 auto !important;
    padding: 9px 12px !important;
}
body.app-shell-refined.pos-layout-locked .pos-buscador-input {
    padding: 9px 14px !important;
}
body.app-shell-refined.pos-layout-locked .pos-categorias,
body.app-shell-refined.pos-layout-locked .pos-productos {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 10px !important;
}
@media (max-width: 1320px) {
    body.app-shell-refined.pos-layout-locked .section-shell-head {
        min-height: 76px !important;
        padding: 6px 14px !important;
    }
    body.app-shell-refined.pos-layout-locked .content,
    body.app-shell-refined.pos-layout-locked .pos-container {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
    }
    body.app-shell-refined.pos-layout-locked .pos-accion-btn {
        min-height: 46px !important;
    }
    body.app-shell-refined.pos-layout-locked .pos-pagar-btn {
        flex-basis: 46px !important;
        height: 46px !important;
        min-height: 46px !important;
    }
}


/* ===== Sidebar ocultable V1 ===== */
body.app-shell-refined .sidebar,
body.app-shell-refined .main-content {
    transition: transform 0.24s ease, margin-left 0.24s ease, width 0.24s ease;
}
body.app-shell-refined .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
body.app-shell-refined .sidebar-toggle-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: 1px solid rgba(99, 85, 232, 0.18);
    border-radius: 12px;
    background: #ffffff;
    color: var(--brand-purple-dark, var(--primary-dark));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    transition: all 0.2s ease;
}
body.app-shell-refined .sidebar-toggle-btn:hover {
    background: var(--brand-purple-soft, #eef2ff);
    border-color: rgba(99, 85, 232, 0.32);
    transform: translateY(-1px);
}
body.app-shell-refined.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}
body.app-shell-refined.sidebar-collapsed .main-content {
    margin-left: 0;
}
body.app-shell-refined.sidebar-collapsed .section-shell-head,
body.app-shell-refined.sidebar-collapsed .header,
body.app-shell-refined.sidebar-collapsed .content {
    transition: padding 0.2s ease;
}
@media (max-width: 900px) {
    body.app-shell-refined .sidebar-toggle-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    body.app-shell-refined.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }
}

/* ===== KPI visual refresh v1 - pastel cards, symmetry and hover motion ===== */
:root {
    --kpi-hover-shadow: 0 18px 34px rgba(99, 102, 241, 0.14);
    --kpi-rest-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
    --kpi-border: rgba(148, 163, 184, 0.18);
}

.dashboard-kpis,
.admin-kpis,
.inventory-kpis,
.billing-kpis,
.invplus-grid,
.prov-grid,
.api-grid,
.price-import-summary {
    gap: 18px !important;
    align-items: stretch !important;
}

.dashboard-kpi,
.admin-kpi,
.inventory-kpi,
.billing-kpi,
.invplus-card,
.prov-card,
.api-card,
.price-import-metric {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 24px !important;
    border: 1px solid var(--kpi-border) !important;
    box-shadow: var(--kpi-rest-shadow) !important;
    transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease !important;
    isolation: isolate;
}

.dashboard-kpi::before,
.admin-kpi::before,
.inventory-kpi::before,
.billing-kpi::before,
.invplus-card::before,
.prov-card::before,
.api-card::before,
.price-import-metric::before {
    content: "";
    position: absolute;
    right: -18px;
    bottom: -18px;
    width: 112px;
    height: 112px;
    border-radius: 999px;
    background: rgba(255,255,255,0.28);
    z-index: 0;
    transition: transform .32s ease, opacity .32s ease;
}

.dashboard-kpi::after,
.admin-kpi::after,
.inventory-kpi::after,
.billing-kpi::after,
.invplus-card::after,
.prov-card::after,
.api-card::after,
.price-import-metric::after {
    content: "";
    position: absolute;
    left: -10px;
    top: -10px;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(255,255,255,0.34);
    z-index: 0;
    transition: transform .32s ease, opacity .32s ease;
}

.dashboard-kpi:hover,
.admin-kpi:hover,
.inventory-kpi:hover,
.billing-kpi:hover,
.invplus-card:hover,
.prov-card:hover,
.api-card:hover,
.price-import-metric:hover {
    transform: translateY(-6px) !important;
    box-shadow: var(--kpi-hover-shadow) !important;
    border-color: rgba(99, 102, 241, 0.18) !important;
}

.dashboard-kpi:hover::before,
.admin-kpi:hover::before,
.inventory-kpi:hover::before,
.billing-kpi:hover::before,
.invplus-card:hover::before,
.prov-card:hover::before,
.api-card:hover::before,
.price-import-metric:hover::before {
    transform: scale(1.12) translate(-4px, -6px);
}

.dashboard-kpi:hover::after,
.admin-kpi:hover::after,
.inventory-kpi:hover::after,
.billing-kpi:hover::after,
.invplus-card:hover::after,
.prov-card:hover::after,
.api-card:hover::after,
.price-import-metric:hover::after {
    transform: scale(1.08) translate(4px, 4px);
}

.dashboard-kpi > *,
.admin-kpi > *,
.inventory-kpi > *,
.billing-kpi > *,
.invplus-card > *,
.prov-card > *,
.api-card > *,
.price-import-metric > * {
    position: relative;
    z-index: 1;
}

.dashboard-kpi,
.admin-kpi,
.inventory-kpi,
.billing-kpi {
    min-height: 154px !important;
    padding: 18px 18px 20px !important;
}

.dashboard-kpi-top,
.admin-kpi-top,
.inventory-kpi-top,
.billing-kpi-top {
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
}

.dashboard-kpi-icon,
.admin-kpi-icon,
.inventory-kpi-icon,
.billing-kpi-icon {
    width: 48px !important;
    height: 48px !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 20px rgba(99,102,241,0.12) !important;
    transition: transform .24s ease, box-shadow .24s ease !important;
    flex: 0 0 48px !important;
}

.dashboard-kpi:hover .dashboard-kpi-icon,
.admin-kpi:hover .admin-kpi-icon,
.inventory-kpi:hover .inventory-kpi-icon,
.billing-kpi:hover .billing-kpi-icon {
    transform: translateY(-2px) scale(1.04) !important;
    box-shadow: 0 14px 24px rgba(99,102,241,0.16) !important;
}

.dashboard-kpi-meta,
.admin-kpi-meta,
.inventory-kpi-chip,
.billing-kpi-chip {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 30px;
    padding: 6px 10px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(99, 102, 241, 0.10) !important;
    background: rgba(255,255,255,0.46) !important;
    color: #5b6478 !important;
    font-size: .72rem !important;
    font-weight: 800 !important;
    text-transform: none !important;
    letter-spacing: .02em !important;
}

.dashboard-kpi-label,
.admin-kpi-label,
.inventory-kpi-label,
.billing-kpi-label,
.invplus-card h3,
.prov-card h3,
.api-kpi-label,
.price-import-metric .label {
    color: #5f6b82 !important;
    font-size: .82rem !important;
    font-weight: 800 !important;
    letter-spacing: .03em !important;
    text-transform: uppercase !important;
}

.dashboard-kpi-value,
.admin-kpi-value,
.inventory-kpi-value,
.billing-kpi-value,
.invplus-kpi,
.prov-kpi,
.api-kpi-value,
.price-import-metric .value {
    color: #182235 !important;
    font-weight: 900 !important;
    line-height: 1.12 !important;
    letter-spacing: -.02em;
}

.dashboard-kpi-value,
.inventory-kpi-value,
.billing-kpi-value,
.invplus-kpi,
.prov-kpi,
.price-import-metric .value {
    font-size: clamp(1.75rem, 2vw, 2.2rem) !important;
}

.admin-kpi-value,
.api-kpi-value {
    font-size: clamp(1.2rem, 1.5vw, 1.5rem) !important;
}

.dashboard-kpi-note,
.admin-kpi-note,
.inventory-kpi-note,
.billing-kpi-note,
.invplus-note,
.prov-note,
.api-kpi-note {
    color: #64748b !important;
    font-size: .92rem !important;
    line-height: 1.5 !important;
}

/* Pastel tones for dashboard/admin/inventory/billing */
.dashboard-kpi.tone-blue, .admin-kpi.tone-blue, .inventory-kpi.tone-blue, .billing-kpi.tone-blue {
    background: linear-gradient(135deg, #fdfcff 0%, #f4f0ff 50%, #eff7ff 100%) !important;
}
.dashboard-kpi.tone-green, .admin-kpi.tone-green, .inventory-kpi.tone-green, .billing-kpi.tone-green {
    background: linear-gradient(135deg, #fbfffd 0%, #eefcf5 52%, #edfdfb 100%) !important;
}
.dashboard-kpi.tone-violet, .admin-kpi.tone-violet, .inventory-kpi.tone-violet, .billing-kpi.tone-violet {
    background: linear-gradient(135deg, #fffbff 0%, #f7f0ff 52%, #f4f2ff 100%) !important;
}
.dashboard-kpi.tone-orange, .admin-kpi.tone-orange, .inventory-kpi.tone-orange, .billing-kpi.tone-orange {
    background: linear-gradient(135deg, #fffdf9 0%, #fff3e7 56%, #fff9ef 100%) !important;
}
.dashboard-kpi.tone-slate, .admin-kpi.tone-slate {
    background: linear-gradient(135deg, #ffffff 0%, #f7f9fc 55%, #f1f5f9 100%) !important;
}
.dashboard-kpi.tone-cyan, .admin-kpi.tone-cyan {
    background: linear-gradient(135deg, #fcffff 0%, #eefcff 56%, #eef8ff 100%) !important;
}
.admin-kpi.tone-rose {
    background: linear-gradient(135deg, #fffdfd 0%, #fff1f3 52%, #fff7f9 100%) !important;
}
.admin-kpi.tone-teal {
    background: linear-gradient(135deg, #fcffff 0%, #ecfbf7 52%, #f2fffd 100%) !important;
}
.admin-kpi.tone-amber {
    background: linear-gradient(135deg, #fffefa 0%, #fff7db 48%, #fffdf3 100%) !important;
}
.admin-kpi.tone-indigo {
    background: linear-gradient(135deg, #fcfdff 0%, #eef2ff 52%, #f5f7ff 100%) !important;
}

.dashboard-kpi.tone-blue .dashboard-kpi-icon, .admin-kpi.tone-blue .admin-kpi-icon, .inventory-kpi.tone-blue .inventory-kpi-icon, .billing-kpi.tone-blue .billing-kpi-icon { background: #e7e3ff !important; color: #5b46e5 !important; }
.dashboard-kpi.tone-green .dashboard-kpi-icon, .admin-kpi.tone-green .admin-kpi-icon, .inventory-kpi.tone-green .inventory-kpi-icon, .billing-kpi.tone-green .billing-kpi-icon { background: #daf6e8 !important; color: #15966b !important; }
.dashboard-kpi.tone-violet .dashboard-kpi-icon, .admin-kpi.tone-violet .admin-kpi-icon, .inventory-kpi.tone-violet .inventory-kpi-icon, .billing-kpi.tone-violet .billing-kpi-icon { background: #eee4ff !important; color: #7a3ff2 !important; }
.dashboard-kpi.tone-orange .dashboard-kpi-icon, .admin-kpi.tone-orange .admin-kpi-icon, .inventory-kpi.tone-orange .inventory-kpi-icon, .billing-kpi.tone-orange .billing-kpi-icon { background: #ffe8d1 !important; color: #dc6a12 !important; }
.dashboard-kpi.tone-slate .dashboard-kpi-icon, .admin-kpi.tone-slate .admin-kpi-icon { background: #e8eef4 !important; color: #516074 !important; }
.dashboard-kpi.tone-cyan .dashboard-kpi-icon, .admin-kpi.tone-cyan .admin-kpi-icon { background: #dff8ff !important; color: #0f8ba8 !important; }
.admin-kpi.tone-rose .admin-kpi-icon { background: #ffe1ea !important; color: #e34b74 !important; }
.admin-kpi.tone-teal .admin-kpi-icon { background: #d8f8f1 !important; color: #177f79 !important; }
.admin-kpi.tone-amber .admin-kpi-icon { background: #ffefb6 !important; color: #c37a17 !important; }
.admin-kpi.tone-indigo .admin-kpi-icon { background: #dbe2ff !important; color: #4f58d9 !important; }

/* Inventory Plus and summary cards without explicit icons */
.invplus-card,
.prov-card,
.api-card,
.price-import-metric {
    padding: 18px !important;
    min-height: 138px;
}

.invplus-card { background: linear-gradient(135deg, #fffbff 0%, #f7f2ff 55%, #f7fbff 100%) !important; }
.invplus-card:nth-child(4n+2) { background: linear-gradient(135deg, #fcfffd 0%, #eefcf5 55%, #f2fffc 100%) !important; }
.invplus-card:nth-child(4n+3) { background: linear-gradient(135deg, #fffdfa 0%, #fff3e7 55%, #fffaf1 100%) !important; }
.invplus-card:nth-child(4n+4) { background: linear-gradient(135deg, #fcfeff 0%, #edf6ff 55%, #f5fbff 100%) !important; }

.prov-card { background: linear-gradient(135deg, #fffbff 0%, #f7f2ff 55%, #f9fbff 100%) !important; }
.prov-card:nth-child(4n+2) { background: linear-gradient(135deg, #fcfffd 0%, #eefcf5 55%, #f4fffb 100%) !important; }
.prov-card:nth-child(4n+3) { background: linear-gradient(135deg, #fffdf9 0%, #fff4ea 55%, #fffaf2 100%) !important; }
.prov-card:nth-child(4n+4) { background: linear-gradient(135deg, #fcfdff 0%, #eef5ff 55%, #f5faff 100%) !important; }

.api-card { background: linear-gradient(135deg, #fffbff 0%, #f7f2ff 55%, #f6fbff 100%) !important; }
.api-card:nth-child(4n+2) { background: linear-gradient(135deg, #fcfffd 0%, #eefcf5 55%, #f2fffc 100%) !important; }
.api-card:nth-child(4n+3) { background: linear-gradient(135deg, #fffdfa 0%, #fff3e7 55%, #fffaf1 100%) !important; }
.api-card:nth-child(4n+4) { background: linear-gradient(135deg, #fcfdff 0%, #edf6ff 55%, #f7fbff 100%) !important; }

.price-import-metric { background: linear-gradient(135deg, #fffbff 0%, #f7f2ff 55%, #f9fbff 100%) !important; }
.price-import-metric:nth-child(5n+2) { background: linear-gradient(135deg, #fcfffd 0%, #eefcf5 55%, #f4fffb 100%) !important; }
.price-import-metric:nth-child(5n+3) { background: linear-gradient(135deg, #fffdfa 0%, #fff3e7 55%, #fffaf2 100%) !important; }
.price-import-metric:nth-child(5n+4) { background: linear-gradient(135deg, #fcfeff 0%, #edf6ff 55%, #f7fbff 100%) !important; }
.price-import-metric:nth-child(5n+5) { background: linear-gradient(135deg, #fffdfd 0%, #fff0f2 55%, #fff8fa 100%) !important; }

.invplus-card h3,
.prov-card h3,
.api-kpi-label,
.price-import-metric .label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px !important;
}

.invplus-card h3::before,
.prov-card h3::before,
.api-kpi-label::before,
.price-import-metric .label::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    flex: 0 0 38px;
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    font-size: .95rem;
    box-shadow: 0 10px 20px rgba(99,102,241,0.12);
}

.invplus-card h3::before {
    content: "\f201";
    background: #e8e1ff;
    color: #6d4bf1;
}
.prov-card h3::before {
    content: "\f0d6";
    background: #dff6ea;
    color: #14946b;
}
.api-kpi-label::before {
    content: "\f1eb";
    background: #ffe6d1;
    color: #da7016;
}
.price-import-metric .label::before {
    content: "\f080";
    background: #e2ecff;
    color: #4c63e8;
}

.invplus-kpi,
.prov-kpi,
.api-kpi-value,
.price-import-metric .value {
    margin-top: 2px !important;
    margin-bottom: 6px !important;
}

/* Small-screen balance */
@media (max-width: 991px) {
    .dashboard-kpi,
    .admin-kpi,
    .inventory-kpi,
    .billing-kpi,
    .invplus-card,
    .prov-card,
    .api-card,
    .price-import-metric {
        min-height: 128px;
        border-radius: 20px !important;
    }

    .dashboard-kpi::before,
    .admin-kpi::before,
    .inventory-kpi::before,
    .billing-kpi::before,
    .invplus-card::before,
    .prov-card::before,
    .api-card::before,
    .price-import-metric::before {
        width: 84px;
        height: 84px;
    }
}
