/*
 * Estilos Principales - Sistema Aguas D' Guanipa
 * Tema: Glassmorphism Futurista — Mint, Cyan & Lavender
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

@viewport {
    width: device-width;
    zoom: 1.0;
}

:root {
    /* Colores de acento principales */
    --teal-dark: #0d5c63;
    --teal-mid: #0e7f8a;
    --cyan-vivid: #00c8e0;
    --cyan-soft: #7edce2;
    --magenta-soft: #d64f8e;
    --lime-green: #a8e063;
    --lavender: #c9b8f0;
    --mint: #b2f0e8;

    /* Gradiente de fondo */
    --bg-gradient: linear-gradient(135deg,
            #d0f5ef 0%,
            #c8eeff 35%,
            #ddd5f8 70%,
            #cdf5f0 100%);

    /* Colores de texto */
    --text-primary: #0d3d45;
    --text-secondary: #2b6e77;
    --text-light: #6ba8b0;
    --text-white: #ffffff;

    /* Glassmorphism tokens */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.75);
    --glass-shadow: 0 8px 32px rgba(13, 92, 99, 0.18);
    --glass-shadow-lg: 0 20px 60px rgba(13, 92, 99, 0.22);
    --glass-blur: blur(18px);

    /* Sidebar glass */
    --sidebar-bg: rgba(13, 92, 99, 0.82);
    --sidebar-glass: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(0, 200, 224, 0.22);
    --sidebar-hover: rgba(255, 255, 255, 0.1);

    /* Estado */
    --success: #2ecc87;
    --warning: #f5a623;
    --danger: #f0456a;
    --info: #00c8e0;

    /* Bordes */
    --border-radius: 14px;
    --border-radius-lg: 20px;
    --border-radius-xl: 28px;
    --border-color: rgba(255, 255, 255, 0.6);

    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background particles effect */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 20%, rgba(178, 240, 232, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse 500px 500px at 80% 10%, rgba(200, 238, 255, 0.4) 0%, transparent 60%),
        radial-gradient(ellipse 700px 400px at 60% 80%, rgba(221, 213, 248, 0.4) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Layout ───────────────────────────────────────────── */
.wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────── */
.sidebar {
    width: 265px;
    background: var(--sidebar-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    position: fixed;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.18);
    transition: var(--transition);
    z-index: 1000;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Sidebar decorative glow line */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
            transparent 0%,
            var(--cyan-vivid) 30%,
            var(--magenta-soft) 70%,
            transparent 100%);
    opacity: 0.6;
}

.sidebar-header {
    padding: 28px 22px 22px;
    background: rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    flex-shrink: 0;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--cyan-vivid), var(--magenta-soft), var(--lime-green));
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.sidebar-header p {
    font-size: 0.73rem;
    opacity: 0.65;
    margin-top: 2px;
    font-weight: 400;
}

/* Section labels */
.sidebar-section {
    padding: 18px 22px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-menu {
    list-style: none;
    padding: 8px 12px 20px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar-menu li {
    margin-bottom: 3px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.sidebar-menu a::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: var(--sidebar-hover);
    opacity: 0;
    transition: var(--transition);
}

.sidebar-menu a:hover::before,
.sidebar-menu a:hover {
    opacity: 1;
    color: white;
}

/* Solo aplicar el efecto de desplazamiento horizontal en PC con mouse */
@media (hover: hover) {
    .sidebar-menu a:hover {
        transform: translateX(6px);
    }
}

/* Efecto visual al presionar (Touch feedback) */
.sidebar-menu a:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}

.sidebar-menu a.active {
    background: var(--sidebar-active);
    color: var(--cyan-vivid);
    border: 1px solid rgba(0, 200, 224, 0.3);
    box-shadow: 0 2px 12px rgba(0, 200, 224, 0.15);
    font-weight: 600;
}

.sidebar-menu a.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--cyan-vivid);
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 10px var(--cyan-vivid);
}

.sidebar-menu .nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-menu a:hover .nav-icon,
.sidebar-menu a.active .nav-icon {
    background: rgba(0, 200, 224, 0.2);
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* ── MAIN CONTENT ─────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 265px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    min-width: 0;
    max-width: 100%;
}

/* ── TOP HEADER ───────────────────────────────────────── */
.top-header {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(13, 92, 99, 0.08);
}

.top-header h1 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--teal-dark);
    letter-spacing: -0.03em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 6px 14px 6px 6px;
    box-shadow: var(--glass-shadow);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan-vivid), var(--teal-mid));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(0, 200, 224, 0.35);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info strong {
    font-size: 0.9rem;
    color: var(--teal-dark);
    font-weight: 600;
    display: block;
    line-height: 1.2;
}

.user-info .user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin: 0;
}

.header-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── CONTENT WRAPPER ──────────────────────────────────── */
.content-wrapper {
    padding: 28px 30px;
    flex: 1;
}

/* ── GLASS CARDS ──────────────────────────────────────── */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--glass-shadow-lg);
    border-color: rgba(0, 200, 224, 0.3);
}

.card-header {
    background: linear-gradient(135deg,
            rgba(13, 92, 99, 0.9) 0%,
            rgba(14, 127, 138, 0.85) 100%);
    color: white;
    padding: 18px 24px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header .card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.card-body {
    padding: 24px;
}

/* ── STATS GRID ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--glass-border);
    padding: 24px 22px;
    box-shadow: var(--glass-shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.08;
    transition: var(--transition);
}

.stat-card.cyan-card::before {
    background: var(--cyan-vivid);
}

.stat-card.teal-card::before {
    background: var(--teal-mid);
}

.stat-card.magenta-card::before {
    background: var(--magenta-soft);
}

.stat-card.lime-card::before {
    background: var(--lime-green);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--glass-shadow-lg);
}

.stat-card:hover::before {
    opacity: 0.15;
    transform: scale(1.3);
}

.stat-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.stat-icon.cyan {
    background: linear-gradient(135deg, #00c8e0, #0e7f8a);
    box-shadow: 0 6px 20px rgba(0, 200, 224, 0.4);
}

.stat-icon.teal {
    background: linear-gradient(135deg, #0e7f8a, #0d5c63);
    box-shadow: 0 6px 20px rgba(13, 92, 99, 0.4);
}

.stat-icon.magenta {
    background: linear-gradient(135deg, #d64f8e, #a8216b);
    box-shadow: 0 6px 20px rgba(214, 79, 142, 0.4);
}

.stat-icon.lime {
    background: linear-gradient(135deg, #a8e063, #79c247);
    box-shadow: 0 6px 20px rgba(168, 224, 99, 0.4);
}

/* Alias for backward compat */
.stat-icon.purple {
    background: linear-gradient(135deg, #9b7fd4, #7a5fb8);
    box-shadow: 0 6px 20px rgba(155, 127, 212, 0.4);
}

.stat-icon.blue {
    background: linear-gradient(135deg, #63b3ed, #4299e1);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
}

.stat-icon.green {
    background: linear-gradient(135deg, #68d391, #48bb78);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f6ad55, #ed8936);
    box-shadow: 0 6px 20px rgba(237, 137, 54, 0.4);
}

.stat-content {
    position: relative;
    z-index: 1;
}

.stat-content h3 {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--teal-dark);
    margin-bottom: 4px;
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-trend {
    font-size: 0.73rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 4px;
    display: inline-block;
}

.stat-trend.up {
    background: rgba(46, 204, 135, 0.15);
    color: var(--success);
}

.stat-trend.down {
    background: rgba(240, 69, 106, 0.15);
    color: var(--danger);
}

/* Progress bar on stat cards */
.stat-progress {
    height: 3px;
    background: rgba(13, 92, 99, 0.08);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.stat-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cyan-vivid) 0%, var(--teal-mid) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(0, 200, 224, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 200, 224, 0.45);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc87, #25a970);
    color: white;
    box-shadow: 0 4px 14px rgba(46, 204, 135, 0.35);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(46, 204, 135, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, #f0456a, #c73050);
    color: white;
    box-shadow: 0 4px 14px rgba(240, 69, 106, 0.35);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 69, 106, 0.45);
}

.btn-warning {
    background: linear-gradient(135deg, #f5a623, #e08a00);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 166, 35, 0.35);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 166, 35, 0.45);
}

.btn-secondary {
    background: var(--glass-bg-strong);
    color: var(--teal-dark);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: white;
}

.btn-outline {
    background: transparent;
    color: var(--cyan-vivid);
    border: 1.5px solid var(--cyan-vivid);
}

.btn-outline:hover {
    background: var(--cyan-vivid);
    color: white;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.78rem;
}

/* btn-info: usado en botón Categorías, Ver Kardex, badges de módulos */
.btn-info {
    background: linear-gradient(135deg, #29b6d8, #1a8fa8);
    color: white;
    box-shadow: 0 4px 14px rgba(41, 182, 216, 0.35);
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(41, 182, 216, 0.45);
    color: white;
}

/* btn-block: ancho completo */
.btn-block {
    width: 100%;
    justify-content: center;
}

/* ── FORMS ────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--teal-dark);
    font-weight: 600;
    font-size: 0.88rem;
}

.form-control,
.form-select {
    width: 100%;
    padding: 11px 15px;
    border: 1.5px solid rgba(13, 92, 99, 0.15);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--glass-bg-strong);
    color: var(--text-primary);
    backdrop-filter: blur(8px);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--cyan-vivid);
    box-shadow: 0 0 0 3px rgba(0, 200, 224, 0.15);
    background: rgba(255, 255, 255, 0.9);
}

.form-select {
    cursor: pointer;
}

.input-group {
    position: relative;
}

.input-group .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--teal-mid);
    font-size: 1rem;
    pointer-events: none;
}

.input-group .form-control {
    padding-left: 42px;
}

/* ── TABLES ───────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
    scrollbar-width: thin;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

thead {
    background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal-mid) 100%);
    color: white;
}

thead th {
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

thead th:first-child {
    border-radius: 10px 0 0 0;
}

thead th:last-child {
    border-radius: 0 10px 0 0;
}

tbody tr {
    border-bottom: 1px solid rgba(13, 92, 99, 0.07);
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(0, 200, 224, 0.05);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 13px 16px;
    font-size: 0.88rem;
    color: var(--text-primary);
    vertical-align: middle;
}

/* ── BADGES ───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    gap: 4px;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-success {
    background: rgba(46, 204, 135, 0.15);
    color: #16a368;
}

.badge-warning {
    background: rgba(245, 166, 35, 0.15);
    color: #c47f00;
}

.badge-danger {
    background: rgba(240, 69, 106, 0.15);
    color: #c0234a;
}

.badge-info {
    background: rgba(0, 200, 224, 0.15);
    color: #0391a3;
}

.badge-primary {
    background: rgba(13, 92, 99, 0.12);
    color: var(--teal-dark);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.12);
    color: #4b5563;
}

/* ── ALERTS ───────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
}

.alert-success {
    background: rgba(46, 204, 135, 0.12);
    color: #15845a;
    border: 1px solid rgba(46, 204, 135, 0.3);
}

.alert-danger {
    background: rgba(240, 69, 106, 0.1);
    color: #b02040;
    border: 1px solid rgba(240, 69, 106, 0.3);
}

.alert-warning {
    background: rgba(245, 166, 35, 0.1);
    color: #9a6500;
    border: 1px solid rgba(245, 166, 35, 0.3);
}

.alert-info {
    background: rgba(0, 200, 224, 0.1);
    color: #0a7080;
    border: 1px solid rgba(0, 200, 224, 0.3);
}

/* ── MODAL ────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(13, 60, 70, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    margin: 6% auto;
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--glass-shadow-lg);
    animation: modalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-40px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--teal-dark), var(--teal-mid));
    color: white;
    padding: 20px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1.05rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.modal-body {
    padding: 26px;
}

.modal-footer {
    padding: 16px 26px;
    background: rgba(13, 92, 99, 0.04);
    border-top: 1px solid rgba(13, 92, 99, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── PAGE TITLE ───────────────────────────────────────── */
.page-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title-bar h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--teal-dark);
    letter-spacing: -0.03em;
}

.page-title-bar .breadcrumb {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* ── TOOLBAR ──────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 380px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1.5px solid rgba(13, 92, 99, 0.15);
    border-radius: 10px;
    font-size: 0.87rem;
    background: var(--glass-bg-strong);
    transition: var(--transition);
    font-family: inherit;
    color: var(--text-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--cyan-vivid);
    box-shadow: 0 0 0 3px rgba(0, 200, 224, 0.12);
}

.search-box .search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--teal-mid);
    font-size: 0.95rem;
    pointer-events: none;
}

/* ── PROGRESS BARS ────────────────────────────────────── */
.progress {
    height: 8px;
    background: rgba(13, 92, 99, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 1s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(100%);
    }
}

.progress-bar.cyan {
    background: linear-gradient(90deg, var(--teal-mid), var(--cyan-vivid));
}

.progress-bar.magenta {
    background: linear-gradient(90deg, #a8216b, var(--magenta-soft));
}

.progress-bar.lime {
    background: linear-gradient(90deg, #79c247, var(--lime-green));
}

.progress-bar.teal {
    background: linear-gradient(90deg, var(--teal-dark), var(--teal-mid));
}

/* ── FLOATING 3D ELEMENTS (dashboard decorations) ─────── */
.floating-orb {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: relative;
    animation: float 4s ease-in-out infinite;
    flex-shrink: 0;
}

.floating-orb.orb-cyan {
    background: radial-gradient(circle at 35% 35%,
            #7efeff 0%,
            var(--cyan-vivid) 45%,
            #005f6b 100%);
    box-shadow:
        0 8px 32px rgba(0, 200, 224, 0.5),
        inset 0 -4px 12px rgba(0, 0, 0, 0.2),
        inset 0 4px 12px rgba(255, 255, 255, 0.4);
}

.floating-orb.orb-magenta {
    background: radial-gradient(circle at 35% 35%,
            #ff9fd2 0%,
            var(--magenta-soft) 45%,
            #7a1046 100%);
    box-shadow:
        0 8px 32px rgba(214, 79, 142, 0.5),
        inset 0 -4px 12px rgba(0, 0, 0, 0.2),
        inset 0 4px 12px rgba(255, 255, 255, 0.4);
    animation-delay: -1.5s;
}

.floating-orb.orb-lime {
    background: radial-gradient(circle at 35% 35%,
            #e8ffa4 0%,
            var(--lime-green) 45%,
            #4a7a20 100%);
    box-shadow:
        0 8px 32px rgba(168, 224, 99, 0.5),
        inset 0 -4px 12px rgba(0, 0, 0, 0.2),
        inset 0 4px 12px rgba(255, 255, 255, 0.4);
    animation-delay: -3s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

/* ── QUICK ACTION TILES ───────────────────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.quick-action-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 18px 14px;
    text-align: center;
    text-decoration: none;
    color: var(--teal-dark);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.85rem;
}

.quick-action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 200, 224, 0.2);
    border-color: rgba(0, 200, 224, 0.4);
    background: rgba(255, 255, 255, 0.8);
}

.quick-action-btn .qa-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* ── RATE DISPLAY ─────────────────────────────────────── */
.rate-display {
    background: linear-gradient(135deg, var(--teal-dark), var(--teal-mid));
    border-radius: var(--border-radius);
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.rate-display::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
}

.rate-display .rate-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--cyan-soft);
}

.rate-display .rate-label {
    font-size: 0.82rem;
    opacity: 0.75;
    margin-top: 4px;
}

/* ── UTILITIES ────────────────────────────────────────── */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.d-flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.gap-3 {
    gap: 24px;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.w-100 {
    width: 100%;
}

.text-cyan {
    color: var(--cyan-vivid);
}

.text-teal {
    color: var(--teal-dark);
}

.text-magenta {
    color: var(--magenta-soft);
}

.text-lime {
    color: var(--lime-green);
}

.text-muted {
    color: var(--text-secondary);
}

/* ── SIDEBAR LOGOUT ──────────────────────────────────── */
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    background: rgba(240, 69, 106, 0.12);
    border: 1px solid rgba(240, 69, 106, 0.22);
    width: 100%;
}

.sidebar-logout:hover {
    background: rgba(240, 69, 106, 0.28);
    color: white;
    transform: translateX(3px);
}

.sidebar-logout .nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(240, 69, 106, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ── SIDEBAR SECTION ITEMS ───────────────────────────── */
.sidebar-section-item {
    list-style: none;
}

/* ── HAMBURGER BUTTON ─────────────────────────────────── */
.hamburger-btn {
    display: none;
    /* Oculto en desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    padding: 8px;
    transition: var(--transition);
    flex-shrink: 0;
    z-index: 1001;
    position: relative;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 16px rgba(0, 200, 224, 0.2);
}

.ham-line {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--teal-dark);
    transition: var(--transition);
    transform-origin: center;
}

/* Animación X cuando está abierto */
.hamburger-btn.open .ham-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.open .ham-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.open .ham-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── SIDEBAR OVERLAY (para cerrar al tocar fuera) ─────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13, 60, 70, 0.42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999;
    /* justo debajo del sidebar (z-index: 1000) */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ── RESPONSIVE ───────────────────────────────────────── */

/* ── ROW-CARDS: Layout de tarjetas en 2 col (colapsa a 1 en móvil) ── */
.row-cards {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* Columna angosta: ~1/3 del ancho */
.col-card-narrow {
    flex: 1 1 280px;
    min-width: 0;
}

/* ── SALES GRID CARDS ─────────────────────────────────── */
.sales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.date-separator {
    grid-column: 1 / -1;
    margin-top: 15px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.date-separator span {
    background: rgba(13, 92, 99, 0.08);
    color: var(--teal-dark);
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
}

.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(13, 92, 99, 0.1);
}

.sale-card {
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    border-left: 5px solid transparent;
}

.sale-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow-lg);
    border-color: rgba(0, 200, 224, 0.35);
}

.sale-card.status-paid { border-left-color: var(--success-color); }
.sale-card.status-pending { border-left-color: var(--warning-color); }
.sale-card.status-cancelled { border-left-color: var(--danger-color); opacity: 0.8; }

.sale-card-header {
    padding: 15px 18px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sale-info {
    display: flex;
    flex-direction: column;
}

.sale-number {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--teal-dark);
}

.sale-time {
    font-size: 0.72rem;
    color: var(--text-light);
}

.sale-actions {
    display: flex;
    gap: 8px;
}

.action-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-decoration: none;
    transition: var(--transition);
    background: white;
    border: 1px solid var(--border-color);
}

.action-icon:hover { transform: scale(1.1); }
.action-icon.info { color: var(--cyan-vivid); }
.action-icon.print { color: var(--teal-dark); }

.sale-card-body {
    padding: 18px;
    flex: 1;
}

.client-name {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 700;
}

.products-summary {
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.amounts-row {
    display: flex;
    gap: 15px;
    background: rgba(13, 92, 99, 0.04);
    padding: 12px;
    border-radius: 10px;
}

.amount-item {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.amount-item .label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 700;
}

.amount-item .value {
    font-weight: 800;
    font-size: 1rem;
}

.amount-item .value.bs { color: var(--teal-dark); }
.amount-item .value.usd { color: var(--cyan-vivid); }

.sale-card-footer {
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.status-indicator {
    margin-left: auto;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

@media (max-width: 480px) {
    .sales-grid {
        grid-template-columns: 1fr;
    }
    
    .sale-card-header { padding: 12px 15px; }
    .sale-card-body { padding: 15px; }
}
.col-card-wide {
    flex: 2 1 340px;
    min-width: 0;
}

/* Columna genérica (cuando no se especifica variante) */
.col-card {
    flex: 1 1 300px;
    min-width: 0;
}

/* ═══════════════════════════════════════════════════════════
   BREAKPOINT: TABLETS & SMALL LAPTOPS (≤ 1024px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════
   BREAKPOINT: MOBILE (≤ 768px)
   La mayor parte de la responsividad se concentra aquí.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── SIDEBAR MOBILE ──────────────────────────────────── */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        max-width: 85vw;
        z-index: 1000;
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100vh;
        height: 100dvh;
    }

    .sidebar-footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 6px 0 40px rgba(0, 0, 0, 0.25);
    }

    .hamburger-btn {
        display: flex !important;
    }

    .main-content {
        margin-left: 0;
    }

    /* ── TOP HEADER MOBILE ───────────────────────────────── */
    .top-header {
        padding: 10px 14px;
        gap: 10px;
    }

    .top-header h1 {
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50vw;
    }

    .header-time {
        display: none;
    }

    .header-badge {
        padding: 4px 10px 4px 4px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .user-info strong {
        font-size: 0.82rem;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-info .user-role {
        font-size: 0.7rem;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* ── CONTENT WRAPPER MOBILE ──────────────────────────── */
    .content-wrapper {
        padding: 16px 12px;
    }

    /* ── PAGE TITLE BAR ──────────────────────────────────── */
    .page-title-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ── STATS GRID → 1 columna ────────────────────────── */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .stat-card {
        padding: 18px 16px;
        gap: 14px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
        border-radius: 12px;
    }

    .stat-content h3 {
        font-size: 1.5rem;
    }

    .stat-content p {
        font-size: 0.82rem;
    }

    /* ── DASH GRID → 1 columna ──────────────────────────── */
    .dash-grid {
        grid-template-columns: 1fr;
    }

    .dash-grid .col-full,
    .dash-grid .col-left,
    .dash-grid .col-right {
        grid-column: 1 !important;
    }

    /* ── QUICK ACTIONS → 2 col ──────────────────────────── */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .quick-action-btn {
        padding: 14px 10px;
        font-size: 0.8rem;
    }

    .quick-action-btn .qa-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    /* ── CARDS ────────────────────────────────────────────── */
    .card {
        border-radius: var(--border-radius);
        margin-bottom: 16px;
    }

    .card-header {
        padding: 14px 16px;
        font-size: 0.9rem;
        gap: 8px;
    }

    .card-header .card-icon {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    .card-body {
        padding: 16px;
    }

    .card .card-body p {
        font-size: 0.88rem;
        line-height: 1.65;
    }

    /* Card header con botones inline */
    .card-header.d-flex.justify-between {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    .card-header .btn {
        font-size: 0.76rem;
        padding: 5px 10px;
    }

    /* ── BARRA DE TÍTULO + BOTONES DE ACCIÓN ──────────── */
    .d-flex.justify-between.align-center,
    .d-flex.justify-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    .d-flex.justify-between > div,
    .d-flex.justify-between.align-center > div {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .d-flex.justify-between .btn,
    .d-flex.justify-between.align-center .btn {
        flex: 1 1 auto;
        text-align: center;
        justify-content: center;
        min-width: 100px;
        font-size: 0.82rem;
        padding: 10px 12px;
        /* Touch‑friendly min tap area */
        min-height: 44px;
    }

    /* ── INLINE GRIDS → 1 columna ────────────────────── */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* ── FLEX WRAPS → columna ────────────────────────── */
    [style*="display: flex"][style*="flex-wrap: wrap"] > *,
    [style*="display:flex"][style*="flex-wrap:wrap"] > * {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }

    /* ── ROW-CARDS → stack ────────────────────────────── */
    .row-cards {
        flex-direction: column;
    }

    .row-cards > *,
    .col-card-narrow,
    .col-card-wide,
    .col-card {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    /* ── FLEX GAP GROUPS → columna ────────────────────── */
    .d-flex.gap-1,
    .d-flex.gap-2,
    .d-flex.gap-3,
    .d-flex[style*="flex-wrap"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .d-flex.gap-1 > *,
    .d-flex.gap-2 > *,
    .d-flex.gap-3 > *,
    .d-flex[style*="flex-wrap"] > * {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        width: 100% !important;
        margin: 0 !important;
    }

    /* ── INLINE FLEX‑BASIS CHILDREN → full width ─────── */
    [class*="col-md-"][style*="flex"],
    div[style*="flex: 1"],
    div[style*="flex:1"],
    div[style*="flex: 2"],
    div[style*="flex:2"],
    div[style*="flex: 3"],
    div[style*="flex:3"] {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Forzar que los contenedores con display: grid inline se colapsen */
    [style*="display: grid"],
    [style*="display:grid"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* ── TABLES ───────────────────────────────────────── */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto !important;
        width: 100% !important;
        display: block !important;
        border-radius: var(--border-radius);
        margin-bottom: 1rem;
    }

    table {
        min-width: 650px !important;
        width: 100% !important;
    }

    thead th {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    tbody td {
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    /* ── FORMS ────────────────────────────────────────── */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 14px;
        min-height: 44px; /* Touch‑friendly */
    }

    .form-label {
        font-size: 0.84rem;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .input-group .form-control {
        padding-left: 42px;
    }

    textarea.form-control {
        font-size: 16px;
    }

    /* ── BUTTONS – minimum tap area for mobile ─────── */
    .btn {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .btn-sm {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .btn-xs {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 0.76rem;
    }

    /* ── TOOLBAR ─────────────────────────────────────── */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
        min-width: 100%;
    }

    /* ── MODALS ───────────────────────────────────────── */
    .modal-content {
        margin: 3% auto;
        width: 96%;
        border-radius: var(--border-radius-lg);
    }

    .modal-header {
        padding: 16px 18px;
        font-size: 1rem;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-footer {
        padding: 14px 18px;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
    }

    /* ── HEADINGS ─────────────────────────────────────── */
    h2 {
        font-size: 1.15rem;
        word-break: break-word;
    }

    /* ── BADGES ───────────────────────────────────────── */
    .badge {
        white-space: nowrap;
        font-size: 0.72rem;
        padding: 3px 10px;
    }

    /* ── NUEVA VENTA — producto-item grid → stack ───── */
    .producto-item {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        padding: 14px !important;
    }

    /* Producto item header row rendered by JS */
    .producto-item + .producto-item,
    div[style*="grid-template-columns: 2fr 1fr 1fr 1fr 1fr 80px"] {
        grid-template-columns: 1fr !important;
    }

    /* Resumen-venta panel: drop sticky on mobile */
    .resumen-venta {
        position: relative !important;
        top: auto !important;
    }

    /* ── RATE DISPLAY ─────────────────────────────────── */
    .rate-display {
        padding: 16px;
    }

    .rate-display .rate-value {
        font-size: 1.6rem;
    }

    /* ── FLOATING ORBS — smaller on mobile ────────────── */
    .levitate-platform {
        gap: 16px;
        padding: 20px 0;
    }

    .floating-orb {
        width: 44px !important;
        height: 44px !important;
    }

    /* ── CHART CONTAINERS — reduce height on mobile ──── */
    .chart-area {
        height: 150px;
    }

    div[style*="height: 250px"],
    div[style*="height: 300px"],
    div[style*="height:250px"],
    div[style*="height:300px"] {
        height: 220px !important;
    }

    /* ── ALERTS ───────────────────────────────────────── */
    .alert {
        padding: 12px 14px;
        font-size: 0.85rem;
    }

    /* ── PROGRESS BARS ───────────────────────────────── */
    .progress {
        height: 6px;
    }

    /* ── SCROLL HINT: shadow on table-responsive ───── */
    .table-responsive {
        position: relative;
    }

    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 30px;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8));
        pointer-events: none;
        opacity: 0.7;
    }

    /* ── KPI RING (dashboard) ────────────────────────── */
    .kpi-ring-wrap {
        gap: 10px;
    }

    .kpi-ring {
        width: 42px;
        height: 42px;
    }
}

/* ═══════════════════════════════════════════════════════════
   BREAKPOINT: SMALL PHONES (≤ 480px)
   Refina los estilos móviles para pantallas muy estrechas.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    /* ── Padding y espaciado ultra-compactos ───────── */
    .content-wrapper {
        padding: 12px 10px;
    }

    /* ── Botones de acción → full width ───────────── */
    .d-flex.justify-between .btn,
    .d-flex.justify-between.align-center .btn {
        width: 100%;
        flex: 1 1 100%;
    }

    /* ── Cards ────────────────────────────────────── */
    .card-body {
        padding: 14px 12px;
    }

    .card-header {
        padding: 12px 14px;
        font-size: 0.88rem;
    }

    .card {
        border-radius: 12px;
        margin-bottom: 12px;
    }

    /* ── Tables — aún más compactos ─────────────── */
    tbody td,
    thead th {
        font-size: 0.76rem;
        padding: 8px 8px;
    }

    table {
        min-width: 400px;
    }

    /* ── Headings ─────────────────────────────────── */
    h2 {
        font-size: 1.02rem;
    }

    .top-header h1 {
        font-size: 0.95rem;
        max-width: 42vw;
    }

    /* ── Header badge ────────────────────────────── */
    .header-badge {
        padding: 4px 8px 4px 4px;
    }

    .user-info strong {
        max-width: 65px;
        font-size: 0.78rem;
    }

    .user-info .user-role {
        display: none;
    }

    /* ── Stats ────────────────────────────────────── */
    .stat-card {
        padding: 14px 12px;
        gap: 12px;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .stat-content h3 {
        font-size: 1.3rem;
    }

    /* ── Quick actions → 2 col más compacto ─────── */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .quick-action-btn {
        padding: 12px 8px;
        font-size: 0.76rem;
        gap: 8px;
    }

    .quick-action-btn .qa-icon {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    /* ── Modals → casi full screen ──────────────── */
    .modal-content {
        margin: 2% auto;
        width: 98%;
        border-radius: var(--border-radius);
    }

    .modal-body {
        padding: 14px;
    }

    /* ── Charts — height even smaller ────────────── */
    div[style*="height: 250px"],
    div[style*="height: 300px"],
    div[style*="height:250px"],
    div[style*="height:300px"] {
        height: 180px !important;
    }

    /* ── Rate display ──────────────────────────── */
    .rate-display .rate-value {
        font-size: 1.4rem;
    }

    /* ── Levitate platform: even smaller ────────── */
    .levitate-platform {
        gap: 12px;
        padding: 14px 0;
    }

    .floating-orb {
        width: 36px !important;
        height: 36px !important;
    }

    .platform-label {
        font-size: 0.68rem;
    }
}

/* ═══════════════════════════════════════════════════════════
   BREAKPOINT: ULTRA-SMALL PHONES (≤ 360px, e.g. Galaxy S5)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 360px) {

    .content-wrapper {
        padding: 10px 8px;
    }

    .top-header {
        padding: 8px 10px;
    }

    .top-header h1 {
        font-size: 0.88rem;
        max-width: 38vw;
    }

    .sidebar {
        width: 260px;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 16px 12px;
    }

    .stat-icon {
        margin: 0 auto;
    }

    .stat-content h3 {
        font-size: 1.2rem;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .quick-action-btn {
        padding: 10px 6px;
        font-size: 0.72rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .d-flex.justify-between .btn,
    .d-flex.justify-between.align-center .btn {
        min-width: 80px;
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    /* Hide user info entirely, just show avatar */
    .user-info strong,
    .user-info .user-role {
        display: none;
    }
}

/* ── PRINT ────────────────────────────────────────────── */
@media print {

    .sidebar,
    .top-header,
    .toolbar,
    .hamburger-btn,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    body {
        background: white !important;
    }
}

/* ══════════════════════════════════════════════════════════
   MÓDULOS — RESPONSIVE ADICIONAL
   Cubre grillas y layouts inline de todos los módulos.
   ══════════════════════════════════════════════════════════ */

/* ── NUEVA VENTA: layout 2fr 1fr → 1 columna ──────────── */
@media (max-width: 768px) {

    /* Columna principal + resumen → stack */
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns:2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Formularios con 2 columnas inline */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Grilla 3 columnas → 1 */
    div[style*="grid-template-columns: 1fr 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr 1fr"],
    div[style*="grid-template-columns: repeat(3"],
    div[style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    /* ── NOMINA: filtro de período → columna ────────── */
    form.d-flex.align-center[style*="flex-wrap"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    form.d-flex.align-center[style*="flex-wrap"] select,
    form.d-flex.align-center[style*="flex-wrap"] input[type="date"] {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* ── ASISTENCIA / tablas con acciones → wrap ─────── */
    td > form[style*="display:inline"],
    td > form[style*="display: inline"] {
        display: block !important;
        margin-bottom: 4px;
        margin-left: 0 !important;
    }

    /* ── VER VENTA: sección estado entrega → columna ── */
    .entrega-form-grid,
    div[style*="display: grid"][style*="gap"] {
        grid-template-columns: 1fr !important;
    }

    /* ── PRODUCCIÓN: panel de fórmula → columna ─────── */
    .formula-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── INVENTARIO: tabla con stock → scroll ─────── */
    .table-responsive table {
        min-width: 480px;
    }

    /* Estilo de formularios con columna-span inline */
    [style*="grid-column: 1 / -1"],
    [style*="grid-column:1/-1"] {
        grid-column: 1 !important;
    }

    /* ── Paneles de 2 col con display:flex en módulos ── */
    .panel-2col,
    .info-2col {
        flex-direction: column !important;
        gap: 16px !important;
    }

    /* ── RESUMEN VENTA sticky → normal ─────────────── */
    [style*="position: sticky"],
    [style*="position:sticky"] {
        position: relative !important;
        top: auto !important;
    }

    /* ── NUEVA VENTA: cabecera del carrito de productos → columna */
    div[style*="grid-template-columns: 2fr 1fr 1fr 1fr 1fr 80px"] {
        display: none !important; /* ocultamos el encabezado de la grilla */
    }

    /* ── REPORTES: layout imprimir → bien en móvil ─── */
    .reporte-header {
        flex-direction: column !important;
        text-align: center !important;
    }

    /* ── INDICADORES FINANCIEROS: grillas internas ──── */
    .fin-grid-2,
    .fin-grid-3 {
        grid-template-columns: 1fr !important;
    }

    /* ── CARDS con inline style display:grid ─────────── */
    .card-body > div[style*="display: grid"],
    .card-body > div[style*="display:grid"] {
        grid-template-columns: 1fr !important;
    }

    /* ── BOTONES DE ACCIÓN en td → touch-friendly ─── */
    td .btn {
        min-height: 38px !important;
        padding: 6px 10px !important;
        font-size: 0.79rem !important;
        touch-action: manipulation;
    }

    /* ── TABLA NOMINA: acciones con 2 buttons → wrap ─ */
    td > form + form {
        margin-left: 0 !important;
        margin-top: 4px;
    }

    /* ── CONFIG PAGE: grupos de config → apilados ─── */
    .config-row,
    .setting-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* ── DASHBOARD: tarjetas de bienvenida → columna ─ */
    .welcome-actions {
        flex-direction: column !important;
    }

    /* ── INLINE DISPLAY FLEX con gap pero sin flex-wrap ─ */
    div[style*="display:flex"][style*="gap"],
    div[style*="display: flex"][style*="gap"] {
        flex-wrap: wrap !important;
    }

    /* ── VER_TRABAJADOR: cards lado a lado → apiladas ─ */
    .row-cards.mt-3 {
        flex-direction: column !important;
    }

    /* Que los badges dentro de td no rompan */
    td .badge {
        white-space: nowrap;
    }

    /* ── MODAL con formularios de 2 col → 1 col ─────── */
    .modal-body div[style*="grid-template-columns"],
    .modal-body div[style*="display: grid"],
    .modal-body div[style*="display:grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Asegurar que las tarjetas de resumen y dashboards internos no desborden */
    .card-body > div[style*="display: flex"],
    .card-body > div[style*="display:flex"] {
        flex-direction: column !important;
    }

    /* ── IMPRIMIR VENTA → no afecta en pantalla ─────── */
    .no-print-mobile {
        display: none !important;
    }

    /* ── COMPRAS: formulario de nueva compra ─────────── */
    .compra-form .productos-header {
        display: none !important;
    }

    /* ── CLIENTES: datos personales en 2 columnas → 1 ─ */
    .cliente-info-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── DASHBOARD GRID INLINE — Fix agresivo ── */
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns:2fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    div[style*="display: grid"],
    div[style*="display:grid"] {
        grid-template-columns: 1fr !important;
        width: 100% !important;
    }

    /* ── RESUMEN VENTA FIX ── */
    .resumen-venta {
        position: static !important;
        margin-top: 20px;
        width: 100% !important;
    }
}

/* ── BREAKPOINT: tablets (769px–1024px) refinos ────────── */
@media (min-width: 769px) and (max-width: 1024px) {

    .content-wrapper {
        padding: 20px 18px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tabla en tablet: un poco más compacta */
    thead th,
    tbody td {
        padding: 10px 12px;
    }

    /* Evitar que el menú sea tan sensible al simple roce */
    .sidebar-menu a {
        padding: 14px 18px; /* Área táctil más grande */
        -webkit-tap-highlight-color: transparent; /* Quitar el recuadro gris default */
        transition: background 0.2s ease, transform 0.15s ease;
    }

    /* Solo mostrar hover si el dispositivo realmente lo soporta (mouse) */
    @media (hover: none) {
        .sidebar-menu a:hover {
            transform: none !important;
            background: transparent !important;
        }
        .sidebar-menu a:active {
            background: rgba(255, 255, 255, 0.15) !important;
        }
    }
    .main-content {
        margin-left: 240px;
    }

    .sidebar {
        width: 240px;
    }
}

/* ── SMALL PHONES (≤ 480px) adicionales de módulos ─────── */
@media (max-width: 480px) {

    /* Ocultar columnas no esenciales en tablas largas */
    .table-col-hide-sm {
        display: none !important;
    }

    /* Formularios grid → 1 col garantizado */
    div[style*="display: grid"],
    div[style*="display:grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Nueva venta: resumen compacto */
    .resumen-venta h3 {
        font-size: 1.1rem !important;
    }

    .resumen-venta {
        padding: 16px !important;
    }

    .resumen-total {
        font-size: 1.1rem !important;
        margin-top: 12px !important;
        padding-top: 12px !important;
    }

    /* Stats en finanzas */
    .stat-content h3[style*="font-size:1.8rem"],
    .stat-content h3[style*="font-size: 1.8rem"],
    .stat-content h3[style*="font-size:2.2rem"],
    .stat-content h3[style*="font-size: 2.2rem"] {
        font-size: 1.4rem !important;
    }

    /* Badge de período en nómina */
    .badge[style*="font-size:0.9rem"],
    .badge[style*="font-size: 0.9rem"] {
        font-size: 0.76rem !important;
        padding: 3px 8px !important;
        word-break: break-word;
        white-space: normal !important;
    }

    /* Totales de nómina */
    td[colspan][style*="text-align:right"] {
        text-align: left !important;
        font-size: 0.82rem !important;
    }
}

/* ── TOUCH DEVICE OPTIMIZATIONS ───────────────────────── */
@media (hover: none) and (pointer: coarse) {
    /* Desactivar animaciones conflictivas en hover en pantallas táctiles */
    .sale-card:hover, .card:hover, .stat-card:hover, .action-icon:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
    
    .btn:hover, .quick-action-btn:hover {
        transform: none !important;
    }
    
    /* Configurar acción táctil para evitar sensibilidades raras y fastclick nativo */
    a, button, .btn, .action-icon, input, select, textarea {
        touch-action: manipulation;
    }
}