* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.main-header { background: #2c3e50; color: #fff; padding: 12px 0; }
.main-header .container { display: flex; align-items: center; justify-content: space-between; gap: 20px; position: relative; }
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 0.95rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.main-nav a { color: #fff; text-decoration: none; margin-left: 6px; font-size: 0.85rem; white-space: nowrap; padding: 4px 9px; border-top: 2px solid transparent; border-bottom: 2px solid transparent; }
.main-nav a:hover { text-decoration: none; background: rgba(255,255,255,0.12); }
.main-nav a.activo { border-top-color: #7fc4e8; border-bottom-color: #7fc4e8; }

/* Submenú del menú (agrupación Cotizaciones en admin) */
.nav-grupo { position: relative; display: inline-block; }
.nav-grupo-toggle { cursor: pointer; }
.caret { font-size: 0.7rem; opacity: 0.85; }
.nav-submenu { display: none; position: absolute; top: 100%; left: 0; background: #34495e; min-width: 225px; border-radius: 0 0 6px 6px; box-shadow: 0 6px 14px rgba(0,0,0,0.3); z-index: 1001; padding: 4px 0; }
.nav-submenu a { display: block; margin-left: 0; padding: 9px 16px; border: 0 none; }
.nav-submenu a:hover { background: #2c6e91; }
.nav-submenu a.activo { background: rgba(127,196,232,0.22); border-left: 3px solid #7fc4e8; padding-left: 13px; }
.nav-grupo.open .nav-submenu { display: block; }
.nav-logout { font-weight: 600; }
.main-content { padding: 25px 20px; flex: 1; }
.main-footer { background: #2c3e50; color: #fff; text-align: center; padding: 15px 0; margin-top: 40px; }
.main-footer p { margin: 0; font-size: 0.85rem; }

h1, h2, h3 { color: #2c3e50; }
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); margin-bottom: 20px; }
.btn { display: inline-block; padding: 8px 16px; border-radius: 4px; border: none; cursor: pointer; text-decoration: none; color: #fff; background: #2c6e91; font-size: 0.9rem; }
.btn:hover { opacity: 0.9; }
.btn-success { background: #27ae60; }
.btn-danger { background: #c0392b; }
.btn-warning { background: #f39c12; color: #000; }
.btn-secondary { background: #7f8c8d; }
.btn-wa { background: #25d366; }

/* Efecto de relleno al pasar el mouse: el color baja desde arriba y el texto se pone blanco.
   Solo en dispositivos con mouse (en celular/tablet táctil se conservan los botones sólidos). */
@media (hover: hover) {
    .btn {
        --btn-color: #2c6e91;
        border: 2px solid var(--btn-color);
        border-radius: 50px;
        background: transparent;
        color: var(--btn-color);
        padding: 6px 16px;
        position: relative;
        overflow: hidden;
        isolation: isolate;
        z-index: 0;
        transition: all 0.35s;
    }
    .btn-success   { --btn-color: #27ae60; }
    .btn-danger    { --btn-color: #c0392b; }
    .btn-warning   { --btn-color: #d68910; }
    .btn-secondary { --btn-color: #7f8c8d; }
    .btn-wa        { --btn-color: #25d366; }

    .btn::before,
    .btn::after {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        top: -100%;
        left: 0;
        background: var(--btn-color);
        z-index: -1;
        transition: all 0.35s;
    }
    .btn::before { opacity: 0.5; }
    .btn::after  { transition-delay: 0.2s; }

    .btn:hover { color: #fff; opacity: 1; }
    .btn:hover::before,
    .btn:hover::after { top: 0; }
}

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.table th { background: #2c6e91; color: #fff; }
.table tr:hover { background: #f9f9f9; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.95rem; }
.alert { padding: 12px 15px; border-radius: 4px; margin-bottom: 15px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.login-container { max-width: 380px; margin: 80px auto; }
.login-card { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dashboard-item { background: #fff; padding: 20px; border-radius: 8px; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.dashboard-item a { color: #2c3e50; text-decoration: none; font-weight: 600; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; color: #fff; }
.badge-danger { background: #c0392b; }
.badge-warning { background: #f39c12; }
.badge-success { background: #27ae60; }
.badge-info { background: #3498db; }
.badge-secondary { background: #7f8c8d; }

.actions a, .actions button { margin-right: 5px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.menu-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

.ayuda { background: #eef4f8; border-left: 4px solid #2c6e91; padding: 10px 14px; border-radius: 4px; color: #33566b; font-size: 0.92rem; margin: 10px 0 20px; }
.ayuda code { background: #fff; padding: 1px 5px; border-radius: 3px; }

.acciones-inicio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 20px 0 25px; }
.accion-card { display: block; background: #fff; border: 1px solid #e2e8ee; border-radius: 10px; padding: 22px 20px; text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,0.06); transition: box-shadow 0.2s, border-color 0.2s; }
.accion-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.12); border-color: #2c6e91; }
.accion-titulo { display: block; font-size: 1.25rem; font-weight: 700; color: #2c3e50; margin-bottom: 6px; }
.accion-desc { display: block; color: #667; font-size: 0.9rem; }
.accion-primaria { background: #2c6e91; border-color: #2c6e91; }
.accion-primaria .accion-titulo, .accion-primaria .accion-desc { color: #fff; }
.accion-primaria:hover { background: #245b78; border-color: #245b78; }

.fila-campos { display: flex; gap: 18px; flex-wrap: wrap; }
.fila-campos > .form-group { flex: 1; min-width: 240px; margin-bottom: 0; }

.buscador-form { display: flex; gap: 10px; align-items: center; }
.buscador-form .buscador-clave { flex: 1; }
.buscador-form .btn { margin: 0; white-space: nowrap; }

.producto-ficha { border-left: 4px solid #27ae60; }
.info-lista-cot { background: #eef4f8; border-left: 4px solid #2c6e91; border-radius: 4px; padding: 10px 14px; color: #33566b; font-size: 0.92rem; }
.sin-stock { color: #c0392b; font-weight: 600; font-size: 0.85rem; }
.solo-pc { display: none; }

/* Nueva cotización: dos columnas en PC y tabletas */
.cot-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cot-col-der { position: sticky; top: 12px; }
.cot-col-der .card:last-child { margin-bottom: 0; }
.cot-col-der .table th, .cot-col-der .table td { padding: 8px; font-size: 0.85rem; }
.cot-col-der .table td:first-child { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cot-col-der .input-cantidad { width: 70px; padding: 6px; }

/* Título dentro de la barra del menú (solo PC) */
.header-titulo { display: none; margin: 0 0 0 12px; font-size: 0.95rem; font-weight: 600; color: #fff; padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.3); white-space: nowrap; }

/* PC y tabletas (≥769 px). El modo celular NO se toca. */
@media (min-width: 769px) {
    /* Título en la barra y compactado vertical */
    .header-titulo { display: inline-block; }
    .main-content > h1 { display: none; }
    .main-header { padding: 8px 0; }
    .main-content { padding: 10px 20px 20px; }
    .main-footer { margin-top: 16px; padding: 10px 0; }
    .card { padding: 12px 14px; margin-bottom: 10px; }
    .card > h2:first-child, .card > h3:first-child { margin: 0 0 8px; font-size: 1.05rem; }
    .ayuda { padding: 6px 10px; margin: 6px 0 10px; font-size: 0.85rem; line-height: 1.35; }
    .buscador-clave { font-size: 1rem; padding: 8px 12px; }
    .buscador-form { gap: 8px; }
    .buscador-titulo { display: none; }
    .producto-ficha { margin-top: 10px !important; }
    .form-group { margin-bottom: 8px; }
    .form-group label { margin-bottom: 3px; }
    .form-group input, .form-group select, .form-group textarea { padding: 8px 10px; }
    .fila-campos { gap: 12px; }
    .table th, .table td { padding: 8px 10px; }
    .totales-barra { padding: 10px 14px; margin-top: 6px; }
    .acciones-finales { margin-top: 10px; }

    .cot-layout { grid-template-columns: 45fr 55fr; }
    .cot-col-der .table th, .cot-col-der .table td { padding: 9px 10px; font-size: 0.88rem; }
    .cot-col-der .table td:first-child { max-width: none; overflow: visible; text-overflow: clip; white-space: normal; }
    .cot-col-der .input-cantidad { width: 80px; }
    .solo-pc { display: table-cell; }
    th.solo-pc { display: table-cell; }
}
.bloque-lista { background: #fff; border-radius: 8px; padding: 18px 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); margin-bottom: 18px; }
.bloque-lista h3 { margin: 0 0 10px; border-bottom: 2px solid #2c6e91; padding-bottom: 6px; }

.totales-barra { display: flex; gap: 25px; justify-content: flex-end; align-items: center; flex-wrap: wrap; background: #f7fafc; border: 1px solid #e2e8ee; border-radius: 8px; padding: 14px 18px; margin-top: 10px; }
.total-grande { font-size: 1.25rem; color: #27ae60; }
.acciones-finales { display: flex; gap: 12px; margin-top: 15px; }
.acciones-finales .btn { margin: 0; }
.input-cantidad { width: 90px; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.95rem; }
.mov-rapido { display: flex; gap: 6px; align-items: center; margin: 0; }
.mov-rapido .btn { display: inline-block; width: auto; margin: 0; padding: 8px 12px; font-weight: 700; }

.filtro-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 15px 0; }
.filtro-tab { padding: 8px 16px; border-radius: 20px; background: #fff; color: #2c6e91; text-decoration: none; font-weight: 600; font-size: 0.9rem; border: 1px solid #d0d7de; }
.filtro-tab.activo { background: #2c6e91; color: #fff; border-color: #2c6e91; }

.buscador-clave { font-size: 1.15rem; padding: 14px; width: 100%; border: 2px solid #2c6e91; border-radius: 8px; }
.buscador-resultado { margin-top: 20px; }

.resumen-cot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 15px; margin: 20px 0; }
.resumen-cot > div { flex: 1; min-width: 200px; background: #fff; padding: 14px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 2000; overflow-y: auto; -webkit-overflow-scrolling: touch; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal-overlay.open { display: block; }
.modal { position: relative; margin: 8vh auto 20px; background: #fff; border-radius: 8px; width: 90%; max-width: 500px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); z-index: 2001; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #eee; }
.modal-header h2 { margin: 0; font-size: 1.2rem; }
.modal-close { background: none; border: none; font-size: 1.8rem; cursor: pointer; color: #666; line-height: 1; padding: 0 4px; }
.modal-body { padding: 15px 20px 20px; }
.modal-body p { margin: 0 0 12px; }

@media (max-width: 768px) {
    .main-header .container { padding-right: 50px; }
    .menu-toggle { display: block; position: absolute; right: 20px; top: 50%; margin-top: -14px; }
    .main-nav { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: #2c3e50; padding: 5px 0; z-index: 1000; }
    .main-nav.open { display: flex; }
    .main-nav a { display: block; margin: 0; padding: 12px 20px; border-top: 0; border-bottom: 1px solid #34495e; }
    .main-nav a.activo { background: #24343f; }
    .nav-grupo { display: block; }
    .nav-submenu { position: static; min-width: 0; border-radius: 0; box-shadow: none; background: #24343f; padding: 0; }
    .nav-submenu a { padding: 12px 20px 12px 36px; border-bottom: 1px solid #2c3e50; }
    .nav-submenu a.activo { border-left: 0; padding-left: 36px; }
    .main-nav a:last-child { border-bottom: none; }
    .main-content { padding: 15px 15px; }
    h1 { font-size: 1.4rem; }
    .btn { display: block; width: 100%; text-align: center; margin-bottom: 8px; }
    .actions .btn, .actions button, .actions a { display: inline-block; width: auto; margin: 0 5px 5px 0; padding: 6px 10px; font-size: 0.85rem; }
    .table th, .table td { padding: 8px 10px; font-size: 0.9rem; }
    .card { padding: 15px; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .dashboard-item { padding: 15px 10px; }
    .dashboard-item h3 { font-size: 1.3rem; margin: 0 0 6px; }
    .dashboard-item a { font-size: 0.85rem; }
    .resumen-cot { flex-direction: column; }
    .resumen-cot > div { min-width: 0; }
    .cot-layout { grid-template-columns: 1fr; }
    .cot-col-der { position: static; }
    .acciones-inicio { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .accion-card { padding: 16px 14px; }
    .accion-titulo { font-size: 1.05rem; }
    .buscador-form { flex-direction: column; align-items: stretch; }
    .totales-barra { justify-content: space-between; }
    .acciones-finales { flex-direction: column; }
}

@media (max-width: 480px) {
    .container { padding: 0 15px; }
    .logo { font-size: 0.8rem; }
    .btn { padding: 10px 14px; }
    .dashboard-grid { gap: 8px; }
    .dashboard-item { padding: 12px 8px; }
    .dashboard-item h3 { font-size: 1.15rem; }
    .dashboard-item a { font-size: 0.8rem; }
}
