:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --accent-color: #FFD700;
    --button-bg: #00E5FF;
    --button-text: #000000;
    --error-color: #ff5252;
    --logo-width: 350px;
    --sidebar-bg: #161616;
    --sidebar-hover: #232323;
    --sidebar-active: #2a2a2a;
    --sidebar-border: #2c2c2c;
    --sidebar-width: 300px;
    --input-bg: #2c2c2c;
    --border-color: #444;
    --success-color: #4CAF50;
    --table-even: #1e1e1e;
    --table-hover: #333;
    --shadow-color: rgba(0,0,0,0.5);
    --shadow-strong: rgba(0,0,0,0.8);

    --grad-primary: linear-gradient(135deg, #00E5FF 0%, #0091EA 100%);
    --grad-success: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    --grad-danger:  linear-gradient(135deg, #ff5252 0%, #c62828 100%);
    --grad-warning: linear-gradient(135deg, #FFB300 0%, #EF6C00 100%);
    --grad-purple:  linear-gradient(135deg, #9C27B0 0%, #6A1B9A 100%);
    --grad-blue:    linear-gradient(135deg, #2196F3 0%, #0D47A1 100%);
    --grad-excel:   linear-gradient(135deg, #43A047 0%, #1B5E20 100%);
}

/* ═══════════════════════════════════════════════════════════
   MODO CLARO — Base (para páginas públicas como index.php y procesar.php)
   ═══════════════════════════════════════════════════════════ */
html[data-theme="light"] {
    --bg-color: #eef2f7;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent-color: #b8860b;
    --button-bg: #0284c7;
    --button-text: #ffffff;
    --error-color: #dc2626;
    --success-color: #16a34a;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f1f5f9;
    --sidebar-active: #e0f2fe;
    --sidebar-border: #e2e8f0;
    --table-even: #f8fafc;
    --table-hover: #f1f5f9;
    --shadow-color: rgba(15,23,42,0.08);
    --shadow-strong: rgba(15,23,42,0.18);

    --grad-primary: linear-gradient(135deg, #00B8D4 0%, #0277BD 100%);
    --grad-success: linear-gradient(135deg, #43A047 0%, #1B5E20 100%);
    --grad-danger:  linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
    --grad-warning: linear-gradient(135deg, #FFB300 0%, #E65100 100%);
    --grad-purple:  linear-gradient(135deg, #8E24AA 0%, #4A148C 100%);
    --grad-blue:    linear-gradient(135deg, #1E88E5 0%, #0D47A1 100%);
    --grad-excel:   linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
}

/* ═══════════════════════════════════════════════════════════
   MODO CLARO + ADMIN (body.has-sidebar) — Tema Windows XP (Luna)
   Se aplica solo en Dashboard, Configuración y Detalles.
   ═══════════════════════════════════════════════════════════ */
html[data-theme="light"] body.has-sidebar {
    --bg-color: #ECE9D8;
    --card-bg: #FFFFFF;
    --text-main: #000000;
    --text-muted: #4A4A4A;
    --accent-color: #003C74;
    --button-bg: #316AC5;
    --button-text: #FFFFFF;
    --error-color: #CC0000;
    --success-color: #3C8D2F;
    --border-color: #919B9C;
    --input-bg: #FFFFFF;
    --sidebar-bg: #D4D0C8;
    --sidebar-hover: #BFBCB1;
    --sidebar-active: #316AC5;
    --sidebar-border: #808080;
    --table-even: #F5F4EC;
    --table-hover: #FFFACD;
    --shadow-color: rgba(0,0,0,0.18);
    --shadow-strong: rgba(0,0,0,0.35);

    --grad-primary: linear-gradient(180deg, #4A9EFF 0%, #0054E3 100%);
    --grad-success: linear-gradient(180deg, #77B255 0%, #3C8D2F 100%);
    --grad-danger:  linear-gradient(180deg, #FF7A5C 0%, #D8402A 100%);
    --grad-warning: linear-gradient(180deg, #FFB800 0%, #FF8C00 100%);
    --grad-purple:  linear-gradient(180deg, #A855F7 0%, #7C3AED 100%);
    --grad-blue:    linear-gradient(180deg, #4A9EFF 0%, #0054E3 100%);
    --grad-excel:   linear-gradient(180deg, #5CB85C 0%, #3C8D2F 100%);
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
    transition: padding-left .35s cubic-bezier(.4,0,.2,1),
                background-color .25s ease,
                color .25s ease;
}

/* Tipografía XP clásica solo en admin + modo claro */
html[data-theme="light"] body.has-sidebar {
    font-family: Tahoma, 'Segoe UI', Verdana, Geneva, sans-serif;
}

.container, .sidebar, .modal-content, .section-box,
.detail-box, .coupon-box, .dynamic-text, .highlight, .filters,
.page-link, .date-input-wrap, .section-title, .contador-registros,
.sidebar-link, .sidebar-header, .sidebar-footer, .sidebar-user-info,
.theme-toggle, .window-header {
    transition: background-color .25s ease, color .25s ease,
                border-color .25s ease, box-shadow .25s ease;
}

.container {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 4px 15px var(--shadow-color);
    width: 95%;
    max-width: 600px;
    text-align: center;
    box-sizing: border-box;
    margin: auto;
    position: relative;
}

/* Marco tipo ventana XP para el contenedor administrativo */
html[data-theme="light"] body.has-sidebar .container {
    border: 1px solid #7F9DB9;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.22), inset 0 1px 0 #FFFFFF;
    background: linear-gradient(180deg, #FFFFFF 0%, #F5F4EC 100%);
}

body > .container { padding-top: 30px; }
body.has-sidebar > .container { padding-top: 55px; }

.dynamic-text { text-align: left; word-break: break-word; overflow-wrap: break-word; }
.dynamic-text p { margin: 0 0 10px 0; }
.dynamic-text:last-child p { margin-bottom: 0; }
.dynamic-text img { max-width: 100%; height: auto; display: inline-block; }
.dynamic-text ul, .dynamic-text ol { padding-left: 20px; margin: 10px 0; }

.logo-global { width: var(--logo-width); max-width: 100%; height: auto; display: block; margin: 0 auto 20px auto; }

.btn-sm { padding: 8px 14px !important; font-size: 13px !important; width: auto !important; min-width: 0 !important; flex: none !important; border-radius: 8px; }
.modal-botones-flex { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 15px; }
.detalles-registro p { margin: 4px 0; line-height: 1.4; font-size: 15px; }

h1 { color: var(--accent-color); font-size: 24px; margin-bottom: 10px; }
p { font-size: 16px; line-height: 1.5; margin-bottom: 20px; }
.highlight { color: var(--accent-color); font-weight: bold; font-size: 18px; margin: 30px 0; }

.form-group { text-align: left; margin-bottom: 20px; width: 100%; box-sizing: border-box; }
label { display: block; margin-bottom: 8px; font-weight: bold; }

input[type="text"], input[type="password"], input[type="number"], input[type="tel"], input[type="file"], input[type="date"], select, textarea {
    width: 100%; max-width: 100%; padding: 12px; box-sizing: border-box;
    background-color: var(--input-bg); color: var(--text-main);
    border: 1px solid var(--border-color); border-radius: 8px; font-size: 16px;
    font-family: inherit;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus,
input[type="tel"]:focus, input[type="date"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--button-bg);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.15);
}

/* Inputs estilo XP en admin + modo claro */
html[data-theme="light"] body.has-sidebar input[type="text"],
html[data-theme="light"] body.has-sidebar input[type="password"],
html[data-theme="light"] body.has-sidebar input[type="number"],
html[data-theme="light"] body.has-sidebar input[type="tel"],
html[data-theme="light"] body.has-sidebar input[type="file"],
html[data-theme="light"] body.has-sidebar input[type="date"],
html[data-theme="light"] body.has-sidebar select,
html[data-theme="light"] body.has-sidebar textarea {
    border: 1px solid #7F9DB9;
    border-radius: 3px;
    background-color: #FFFFFF;
    color: #000000;
}
html[data-theme="light"] body.has-sidebar input:focus,
html[data-theme="light"] body.has-sidebar select:focus,
html[data-theme="light"] body.has-sidebar textarea:focus {
    border-color: #316AC5;
    box-shadow: 0 0 0 2px rgba(49,106,197,0.28);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: .8; }

.btn-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 120px;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1),
                box-shadow .25s ease,
                filter .25s ease;
    will-change: transform;
}
.btn::before {
    content: '';
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    transition: left .6s ease;
    pointer-events: none;
}
.btn:hover::before { left: 130%; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Botones tipo XP en admin + modo claro */
html[data-theme="light"] body.has-sidebar .btn {
    border: 1px solid #003C74;
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 1px 2px rgba(0,0,0,0.18);
    font-weight: 700;
    letter-spacing: 0.2px;
}
html[data-theme="light"] body.has-sidebar .btn::before { display: none; }
html[data-theme="light"] body.has-sidebar .btn:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65), 0 2px 5px rgba(0,0,0,0.28);
}

.btn-fit {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 220px;
    max-width: 100%;
}

.btn-submit { background: var(--grad-primary); color: var(--button-text); box-shadow: 0 4px 15px rgba(0,229,255,.35); }
.btn-submit:hover { box-shadow: 0 8px 25px rgba(0,229,255,.55); filter: brightness(1.05); }
.btn-success { background: var(--grad-success); color: #fff; box-shadow: 0 4px 15px rgba(76,175,80,.35); }
.btn-success:hover { box-shadow: 0 8px 25px rgba(76,175,80,.55); }
.btn-danger { background: var(--grad-danger); color: #fff; box-shadow: 0 4px 15px rgba(255,82,82,.35); }
.btn-danger:hover { box-shadow: 0 8px 25px rgba(255,82,82,.55); }
.btn-warning { background: var(--grad-warning); color: #fff; box-shadow: 0 4px 15px rgba(255,179,0,.35); }
.btn-warning:hover { box-shadow: 0 8px 25px rgba(255,179,0,.55); }
.btn-purple { background: var(--grad-purple); color: #fff; box-shadow: 0 4px 15px rgba(156,39,176,.35); }
.btn-purple:hover { box-shadow: 0 8px 25px rgba(156,39,176,.55); }
.btn-blue { background: var(--grad-blue); color: #fff; box-shadow: 0 4px 15px rgba(33,150,243,.35); }
.btn-blue:hover { box-shadow: 0 8px 25px rgba(33,150,243,.55); }
.btn-excel { background: var(--grad-excel); color: #fff; box-shadow: 0 4px 15px rgba(67,160,71,.35); }
.btn-excel:hover { box-shadow: 0 8px 25px rgba(67,160,71,.55); }

.btn-cancel { background: transparent; color: var(--text-main); border: 2px solid var(--border-color); }
.btn-cancel:hover { background: var(--input-bg); border-color: var(--accent-color); color: var(--accent-color); box-shadow: 0 8px 20px rgba(255,215,0,.2); }

/* Botón cancelar estilo XP */
html[data-theme="light"] body.has-sidebar .btn-cancel {
    background: linear-gradient(180deg, #FFFFFF 0%, #ECE9D8 100%);
    color: #000000;
    border: 1px solid #003C74;
}
html[data-theme="light"] body.has-sidebar .btn-cancel:hover {
    background: linear-gradient(180deg, #FFFFFF 0%, #D6DFF7 100%);
    color: #003C74;
    border-color: #0054E3;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.22);
}

.top-bar { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 20px; align-items: center; }
.btn-small { padding: 7px 12px; font-size: 13px; flex: unset; width: auto; font-weight: 600; border-radius: 8px; min-width: unset; }

.coupon-box { background-color: #000; border: 2px dashed var(--accent-color); padding: 20px; font-size: 32px; letter-spacing: 5px; color: var(--accent-color); margin: 20px 0; font-weight: bold; width: 100%; box-sizing: border-box; word-break: break-all; overflow-wrap: break-word; border-radius: 12px; }
footer a { color: var(--button-bg); text-decoration: none; font-size: 14px; }

.table-responsive { width: 100%; overflow-x: auto; margin-top: 20px; display: block; }
.nowrap { white-space: nowrap; }

/* Tablas estilo XP en admin + modo claro */
html[data-theme="light"] body.has-sidebar table {
    border: 1px solid #7F9DB9;
    border-collapse: collapse;
}
html[data-theme="light"] body.has-sidebar th {
    background: linear-gradient(180deg, #FFFFFF 0%, #D6DFF7 100%);
    color: #003C74;
    border: 1px solid #7F9DB9;
    font-weight: 700;
}
html[data-theme="light"] body.has-sidebar td {
    border: 1px solid #D6DFF7;
}
html[data-theme="light"] body.has-sidebar tr:nth-child(even) {
    background-color: #F5F4EC;
}
html[data-theme="light"] body.has-sidebar tr:hover {
    background-color: #FFFACD;
}

.modal { position: fixed !important; z-index: 9999; left: 0; top: 0; width: 100vw; height: 100vh; background-color: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; padding: 15px; box-sizing: border-box; }
.modal-content { background-color: var(--card-bg); padding: 30px; border: 1px solid var(--border-color); width: 90%; max-width: 400px; border-radius: 14px; text-align: center; box-shadow: 0 10px 40px var(--shadow-strong); box-sizing: border-box; color: var(--text-main); }

/* Modal estilo ventana XP */
html[data-theme="light"] body.has-sidebar .modal-content {
    border: 2px solid #0054E3;
    border-radius: 8px 8px 4px 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    background: linear-gradient(180deg, #FFFFFF 0%, #ECE9D8 100%);
}

.pagination { margin-top: 20px; display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; }
.page-link { padding: 8px 12px; background: var(--input-bg); color: var(--text-main); text-decoration: none; border-radius: 8px; border: 1px solid var(--border-color); font-size: 13px; transition: all .2s; }
.page-link:hover { border-color: var(--accent-color); }
.page-link.active { background: var(--grad-primary); color: var(--button-text); font-weight: bold; border-color: transparent; }

html[data-theme="light"] body.has-sidebar .page-link {
    border-radius: 3px;
    border: 1px solid #7F9DB9;
}

.window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}
.window-header h1 {
    margin: 0;
    flex: 1;
    font-size: 22px;
    color: var(--accent-color);
    text-align: left;
}
.btn-close-window {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--grad-danger);
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(255,82,82,.4);
    transition: all .3s cubic-bezier(.34,1.56,.64,1);
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-close-window:hover {
    transform: scale(1.12) rotate(90deg);
    box-shadow: 0 6px 22px rgba(255,82,82,.65);
}
.btn-close-window:active { transform: scale(.95) rotate(90deg); }

html[data-theme="light"] body.has-sidebar .btn-close-window {
    border-radius: 4px;
    background: linear-gradient(180deg, #FF7A5C 0%, #D8402A 100%);
    border: 1px solid #7A1F0F;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 1px 3px rgba(0,0,0,0.28);
}
html[data-theme="light"] body.has-sidebar .btn-close-window:hover {
    transform: none;
    filter: brightness(1.1);
}

.textarea-notas { width: 100%; max-width: 100%; background-color: var(--input-bg); color: var(--text-main); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px; margin-top: 5px; resize: vertical; box-sizing: border-box; font-family: inherit; transition: border-color .2s ease, box-shadow .2s ease; }
.textarea-notas:focus { outline: none; border-color: var(--button-bg); box-shadow: 0 0 0 3px rgba(0,229,255,0.15); }

table td, table th { padding: 6px 8px; vertical-align: middle; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; background: var(--input-bg); padding: 12px 15px; border-radius: 12px; border: 1px solid var(--border-color); }
.filters input, .filters select { flex: 1; min-width: 120px; padding: 8px 12px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-main); font-size: 14px; }
.filters .btn { flex: unset; padding: 9px 18px; font-size: 14px; border-radius: 8px; min-width: unset; }
.fecha-fila { display: flex; gap: 10px; align-items: center; flex: 1 1 auto; min-width: 200px; }
.fecha-fila select.tipo-fecha { flex: 1 1 40%; min-width: 100px; padding: 8px 12px; }
.fecha-col-derecha { display: flex; gap: 10px; flex: 1 1 60%; }
.date-input-wrap { display: flex; align-items: center; flex: 1; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 0 8px; box-sizing: border-box; min-width: 90px; }
.date-input-wrap span { color: var(--text-muted); font-size: 12px; font-weight: 600; margin-right: 5px; user-select: none; white-space: nowrap; }
.date-input-wrap input[type="date"] { border: none; background: transparent; padding: 8px 0; color: var(--text-main); width: 100%; outline: none; font-size: 14px; box-sizing: border-box; }
.date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.7; cursor: pointer; }

html[data-theme="light"] body.has-sidebar .filters {
    border-radius: 4px;
    border: 1px solid #7F9DB9;
    background: linear-gradient(180deg, #FFFFFF 0%, #ECE9D8 100%);
}
html[data-theme="light"] body.has-sidebar .date-input-wrap {
    border-radius: 3px;
    border: 1px solid #7F9DB9;
}

.sub-tab { display: flex; gap: 5px; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.sub-tab button { background: none; border: none; color: var(--text-muted); padding: 10px; cursor: pointer; font-weight: bold; border-bottom: 2px solid transparent; flex: 1; font-family: inherit; font-size: 14px; transition: all .2s; }
.sub-tab button:hover { color: var(--text-main); }
.sub-tab button.active { color: var(--accent-color); border-bottom: 2px solid var(--accent-color); }
.subtabcontent { display: none; animation: fadeEffect 0.35s; }
@keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }

.separator-label { display: flex; align-items: center; text-align: center; color: var(--accent-color); font-size: 13px; font-weight: bold; text-transform: uppercase; letter-spacing: 1.5px; margin: 25px 0 15px 0; }
.separator-label::before, .separator-label::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.separator-label::before { margin-right: 15px; }
.separator-label::after { margin-left: 15px; }

html[data-theme="light"] .logo-global { filter: drop-shadow(0 2px 6px rgba(0,0,0,.12)); }
html[data-theme="light"] .coupon-box { background: #fffbeb; color: #92400e; border-color: #d97706; }
html[data-theme="light"] .log-viewer { background: #0f172a; color: #e2e8f0; border-color: #334155; }
html[data-theme="light"] .date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }

/* SIDEBAR */
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 18px 20px 14px;
    border-bottom: 1px solid var(--sidebar-border); flex-shrink: 0;
}
.sidebar-title {
    font-size: 14px; font-weight: bold; color: var(--accent-color);
    letter-spacing: 2px; text-transform: uppercase; margin: 0;
}
.sidebar-close-btn {
    background: transparent; border: 1px solid transparent;
    color: var(--text-muted); font-size: 20px; cursor: pointer;
    padding: 6px 10px; border-radius: 8px; transition: all .2s;
    flex-shrink: 0; font-family: inherit; line-height: 1;
}
.sidebar-close-btn:hover { color: var(--error-color); background: var(--sidebar-hover); border-color: var(--border-color); }

/* Sidebar XP: barra de título azul */
html[data-theme="light"] body.has-sidebar .sidebar-header {
    background: linear-gradient(180deg, #0054E3 0%, #3A6EA5 100%);
    border-bottom: 1px solid #003C74;
}
html[data-theme="light"] body.has-sidebar .sidebar-title {
    color: #FFFFFF;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.35);
}
html[data-theme="light"] body.has-sidebar .sidebar-close-btn {
    color: #FFFFFF;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
}
html[data-theme="light"] body.has-sidebar .sidebar-close-btn:hover {
    background: linear-gradient(180deg, #FF7A5C 0%, #D8402A 100%);
    color: #FFFFFF;
    border-color: #7A1F0F;
}

.sidebar-toggle-btn {
    position: fixed; top: 12px; left: 12px; z-index: 1100;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--card-bg); border: 1px solid var(--border-color);
    color: var(--text-main); font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 12px var(--shadow-color);
    transition: opacity .3s ease, transform .3s ease,
                background-color .25s ease, box-shadow .25s ease;
    font-family: inherit;
}
.sidebar-toggle-btn:hover { background: var(--sidebar-hover); transform: scale(1.06); box-shadow: 0 5px 18px var(--shadow-strong); }
.sidebar-toggle-btn.hidden { opacity: 0; pointer-events: none; transform: scale(.6); }

.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
    z-index: 1050; display: flex; flex-direction: column;
    transform: translateX(-105%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    box-shadow: 6px 0 30px var(--shadow-strong);
    overflow: hidden;
}
.sidebar.open { transform: translateX(0); }

.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px); z-index: 1040;
    opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

.sidebar-nav {
    flex: 1; padding: 15px 12px 20px;
    display: flex; flex-direction: column; gap: 3px;
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.sidebar-section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1.6px;
    color: var(--text-muted); padding: 16px 12px 8px;
    font-weight: bold; opacity: .85;
}
.sidebar-section-title:first-child { padding-top: 4px; }

html[data-theme="light"] body.has-sidebar .sidebar-section-title {
    color: #003C74;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    opacity: 1;
}

.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 10px;
    color: var(--text-main); text-decoration: none;
    font-size: 15px; cursor: pointer;
    border: 1px solid transparent; background: transparent;
    width: 100%; text-align: left; font-family: inherit;
    font-weight: 500; transition: all .2s ease; box-sizing: border-box;
    line-height: 1.3;
}
.sidebar-link:hover { background: var(--sidebar-hover); border-color: var(--border-color); transform: translateX(4px); }
.sidebar-link.active { background: var(--sidebar-active); color: var(--accent-color); font-weight: bold; border-color: var(--border-color); }
.sidebar-link .icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }

html[data-theme="light"] body.has-sidebar .sidebar-link {
    border-radius: 3px;
    border: 1px solid transparent;
    color: #000000;
    font-weight: 600;
}
html[data-theme="light"] body.has-sidebar .sidebar-link:hover {
    background: linear-gradient(180deg, #FFFFFF 0%, #D6DFF7 100%);
    border-color: #7F9DB9;
    transform: none;
}
html[data-theme="light"] body.has-sidebar .sidebar-link.active {
    background: linear-gradient(180deg, #4A9EFF 0%, #0054E3 100%);
    color: #FFFFFF;
    border-color: #003C74;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

.sidebar-user-info {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 10px;
    background: var(--input-bg); border: 1px solid var(--border-color); margin-bottom: 4px;
}
.sidebar-user-info .avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--grad-primary); color: #000;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 16px; flex-shrink: 0;
}
.sidebar-user-info .user-details { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-info .user-name {
    font-weight: bold; color: var(--text-main); font-size: 14px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-info .user-role {
    font-size: 11px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px;
}

html[data-theme="light"] body.has-sidebar .sidebar-user-info .avatar {
    background: linear-gradient(180deg, #4A9EFF 0%, #0054E3 100%);
    color: #FFFFFF;
    border: 1px solid #003C74;
}

.sidebar-footer {
    padding: 14px 16px 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--sidebar-border);
    display: flex; flex-direction: column; gap: 10px;
    flex-shrink: 0; background: var(--sidebar-bg);
}

.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; width: 100%; padding: 11px 14px;
    background: var(--input-bg); color: var(--text-main);
    border: 1px solid var(--border-color); border-radius: 10px;
    cursor: pointer; font-family: inherit;
    font-size: 14px; font-weight: 600; transition: all .25s;
}
.theme-toggle:hover { background: var(--sidebar-hover); border-color: var(--accent-color); transform: scale(1.02); }

html[data-theme="light"] body.has-sidebar .theme-toggle {
    background: linear-gradient(180deg, #FFFFFF 0%, #ECE9D8 100%);
    border: 1px solid #003C74;
    border-radius: 3px;
    color: #000000;
}
html[data-theme="light"] body.has-sidebar .theme-toggle:hover {
    background: linear-gradient(180deg, #FFFFFF 0%, #D6DFF7 100%);
    color: #003C74;
    transform: none;
}

@media (min-width: 769px) {
    .sidebar-overlay { display: none !important; }

    body.sidebar-desktop-open {
        padding-left: calc(var(--sidebar-width) + 15px);
    }
    body.sidebar-desktop-open .sidebar {
        transform: translateX(0);
    }
    body.sidebar-desktop-open .sidebar-toggle-btn {
        opacity: 0;
        pointer-events: none;
        transform: scale(.6);
    }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    body > .container { padding-top: 20px; }
    body.has-sidebar > .container { padding-top: 55px; }
    .container { width: 100%; max-width: 100%; padding: 20px; margin: 0 auto; box-sizing: border-box; overflow-x: hidden; }

    .top-bar .header-row { flex-direction: column; align-items: center; gap: 15px; }
    .top-bar .header-row > div { display: flex; flex-direction: column; width: 100%; gap: 8px; }
    .top-bar .header-row > div .btn { width: 100%; flex: none; }

    .filters { display: flex; flex-direction: column; width: 100%; box-sizing: border-box; padding: 15px; }
    .filters input, .filters select, .filters .btn { width: 100%; box-sizing: border-box; }
    .fecha-fila { display: flex; flex-direction: row; gap: 8px; width: 100%; align-items: stretch; }
    .fecha-fila select.tipo-fecha { flex: 0 0 38%; height: auto; min-height: 76px; padding: 8px 6px; font-size: 13px; }
    .fecha-col-derecha { flex: 1; display: flex; flex-direction: column; gap: 8px; }
    .date-input-wrap { height: 34px; padding: 0 6px; }
    .date-input-wrap span { font-size: 11px; margin-right: 4px; }
    .date-input-wrap input[type="date"] { font-size: 12px; padding: 0; }
    .btn-small { font-size: 12px; padding: 6px 10px; }
    .btn-cancel { font-size: 14px; padding: 8px 12px; }
    .btn-fit { min-width: 180px; }
    table { font-size: 13px; }
    th, td { padding: 6px; }
    .modal-content { padding: 20px; max-width: 95%; }

    .sidebar-toggle-btn { top: 10px; left: 10px; width: 38px; height: 38px; font-size: 18px; }
    .sidebar { width: 88vw; max-width: 340px; }
    .window-header h1 { font-size: 18px; }
    .btn-close-window { width: 38px; height: 38px; font-size: 16px; }
}

/* ══════════════════════════════════════════════════
   ESTILOS Y ANIMACIONES INTENSAS PARA BOTÓN DE WHATSAPP
   ══════════════════════════════════════════════════ */
.td-promocion {
    white-space: normal;
    min-width: 200px;
    font-size: 14px;
    line-height: 1.4;
}

.btn-wa-blink {
    animation: blinkWA 1.2s infinite ease-in-out;
    background-color: #25D366 !important;
}

.btn-wa-fixed {
    opacity: 0.8;
    box-shadow: none;
}

.btn-wa-fixed:hover {
    opacity: 1;
}

@keyframes blinkWA {
    0% {
        background-color: #25D366 !important;
        color: #ffffff !important;
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.9), 0 0 8px #00FF66;
        transform: scale(1);
    }
    50% {
        background-color: #00FF66 !important;
        color: #000000 !important;
        box-shadow: 0 0 18px 6px rgba(0, 255, 102, 0.85), 0 0 22px #25D366;
        transform: scale(1.15) rotate(-3deg);
    }
    75% {
        transform: scale(1.15) rotate(3deg);
    }
    100% {
        background-color: #25D366 !important;
        color: #ffffff !important;
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0), 0 0 0 transparent;
        transform: scale(1) rotate(0deg);
    }
}