* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f2f5; /* Light background */
    margin: 0;
    padding: 10px;
    color: #333333; /* Dark text */
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

header h1 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

/* Rejilla Superior */
.top-grid {
    display: grid;
    grid-template-columns: 310px 1.5fr 1.3fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Rejilla Inferior (Gráficos) */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    align-items: stretch;
}

.panel {
    background: #ffffff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dcdcdc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chart-panel {
    background: #ffffff;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #dcdcdc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}

.bottom-grid .chart-panel {
    display: flex;
    flex-direction: column;
    height: 410px;
    min-height: 380px;
    padding: 12px 14px 14px 14px;
    box-sizing: border-box;
}

.bottom-grid .chart-panel h2 {
    flex: 0 0 auto;
    margin-top: 0;
    margin-bottom: 6px;
}

h2 {
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-top: 0;
    color: #0056b3;
}

.form-group {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

select, input, button {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
}

input:focus, select:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 2px rgba(0,86,179,0.2);
}

/* =====================================================================
   SISTEMA DE BOTONES PROFESIONAL
   Mejora forma, sombra, foco y feedback de TODOS los botones.
   Los botones con color propio (definido en el HTML) conservan su color
   semántico pero ganan la misma forma y comportamiento: el oscurecido al
   pasar el ratón se hace con "filter: brightness()", que funciona sea cual
   sea el color de fondo.
   ===================================================================== */
button {
    padding: 7px 14px;
    border: 1px solid #c3ccd6;
    border-radius: 6px;
    background-color: #f4f6f9;
    color: #27313f;
    font-weight: 600;
    font-size: 0.86rem;
    line-height: 1.2;
    letter-spacing: 0.1px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 36, 64, 0.10);
    transition: filter 0.15s ease,
                box-shadow 0.15s ease,
                transform 0.05s ease,
                background-color 0.15s ease,
                border-color 0.15s ease;
    -webkit-font-smoothing: antialiased;
    text-shadow: none;
}

button:hover {
    background-color: #e8edf3;           /* afecta a los botones neutros */
    filter: brightness(0.94);            /* oscurece también a los de color */
    box-shadow: 0 3px 8px rgba(16, 36, 64, 0.16);
}

button:active {
    transform: translateY(1px);
    filter: brightness(0.90);
    box-shadow: 0 1px 2px rgba(16, 36, 64, 0.12);
}

button:focus-visible {
    outline: 2px solid #4d90fe;
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
    filter: none;
    transform: none;
}

/* Botones de acción principal (sin color propio en el HTML): azul corporativo */
button[id^="btn-add"],
button[id="btn-apply-custom-loc"],
button[id="btn-default-he"] {
    background-color: #0b5fb0;
    color: #ffffff;
    border-color: #0a548f;
    box-shadow: 0 1px 2px rgba(11, 95, 176, 0.30);
}

button[id^="btn-add"]:hover,
button[id="btn-apply-custom-loc"]:hover,
button[id="btn-default-he"]:hover {
    background-color: #0a548f;
    box-shadow: 0 3px 8px rgba(11, 95, 176, 0.35);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85rem;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px 6px;
    text-align: center;
}

th {
    background-color: #e6e6e6;
    color: #333;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

.results-box p {
    font-size: 1rem;
    background: #f8f9fa;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin: 5px 0;
}

/* Custom App Alert & Dialog Modal */
#modal-app-alert {
    display: none;
    position: fixed;
    z-index: 3500;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

#modal-app-alert .modal-content {
    background-color: #ffffff;
    color: #333333;
    margin: auto;
    padding: 0;
    width: 92%;
    max-width: 530px;
    border-radius: 8px;
    border: 1px solid #c2d4e8;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: modalAlertPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalAlertPop {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pantalla Previa / Acerca de (Splash Window) */
#modal-splash {
    display: flex;
    position: fixed;
    z-index: 6000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}

#modal-splash .splash-window {
    background-color: #ffffff;
    color: #222222;
    margin: auto;
    width: 94%;
    max-width: 820px;
    border-radius: 8px;
    border: 1px solid #c2c9d1;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: splashPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes splashPop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.splash-titlebar {
    background: #f1f3f5;
    border-bottom: 1px solid #e1e4e8;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.splash-titlebar-text {
    font-size: 0.88rem;
    font-weight: 500;
    color: #333333;
}

.splash-close-btn {
    width: 32px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #555555;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.splash-close-btn:hover {
    background-color: #e81123;
    color: #ffffff;
}

.splash-body {
    padding: 24px 34px 24px 34px;
    color: #222222;
}

.splash-credits {
    font-size: 0.92rem;
    font-weight: 700;
    color: #111111;
    line-height: 1.45;
}

.splash-headline {
    text-align: center;
    font-style: italic;
    font-weight: 800;
    font-size: 1.15rem;
    line-height: 1.4;
    color: #111111;
    margin: 26px auto 22px auto;
    max-width: 720px;
}

.splash-logo-container {
    text-align: center;
    margin: 15px 0 25px 0;
}

.splash-logo-img {
    max-width: 330px;
    width: 100%;
    height: auto;
    object-fit: contain;
    display: inline-block;
}

.splash-disclaimer {
    text-align: center;
    font-size: 0.82rem;
    color: #333333;
    line-height: 1.45;
    margin: 0 auto;
    max-width: 760px;
}

.splash-actions {
    text-align: center;
    margin-top: 24px;
}

.splash-btn-enter {
    background-color: #0056b3;
    color: #ffffff;
    border: none;
    padding: 8px 30px;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 86, 179, 0.25);
    transition: background 0.2s, transform 0.1s;
}

.splash-btn-enter:hover {
    background-color: #004494;
}

.splash-btn-enter:active {
    transform: translateY(1px);
}

/* =====================================================================
   BOTONES SOBRIOS — CONTORNO, CON UNA ACCIÓN PRINCIPAL
   Los botones de acción son blancos con borde y texto azul pizarra.
   Solo las acciones principales (añadir capa, guardar, aplicar) van
   rellenas. Las reglas detectan el color de fondo que cada botón tenía
   en el HTML (atributo style) y lo sustituyen; las pestañas y los
   botones de solo icono no se tocan.
   ===================================================================== */
button[id="btn-default-he"],
button[style*="background: #0056b3"],
button[style*="background:#0056b3"],
button[style*="background-color: #0056b3"],
button[style*="background-color:#0056b3"],
button[style*="background: #2980b9"],
button[style*="background:#2980b9"],
button[style*="background-color: #2980b9"],
button[style*="background-color:#2980b9"],
button[style*="background: #27ae60"],
button[style*="background:#27ae60"],
button[style*="background-color: #27ae60"],
button[style*="background-color:#27ae60"],
button[style*="background: #f39c12"],
button[style*="background:#f39c12"],
button[style*="background-color: #f39c12"],
button[style*="background-color:#f39c12"],
button[style*="background: #8e44ad"],
button[style*="background:#8e44ad"],
button[style*="background-color: #8e44ad"],
button[style*="background-color:#8e44ad"],
button[style*="background: #16a085"],
button[style*="background:#16a085"],
button[style*="background-color: #16a085"],
button[style*="background-color:#16a085"],
button[style*="background: #e67e22"],
button[style*="background:#e67e22"],
button[style*="background-color: #e67e22"],
button[style*="background-color:#e67e22"],
button[style*="background: #d98a2c"],
button[style*="background:#d98a2c"],
button[style*="background-color: #d98a2c"],
button[style*="background-color:#d98a2c"],
button[style*="background: #d35400"],
button[style*="background:#d35400"],
button[style*="background-color: #d35400"],
button[style*="background-color:#d35400"],
button[style*="background: #7f8c8d"],
button[style*="background:#7f8c8d"],
button[style*="background-color: #7f8c8d"],
button[style*="background-color:#7f8c8d"],
button[style*="background: #6c757d"],
button[style*="background:#6c757d"],
button[style*="background-color: #6c757d"],
button[style*="background-color:#6c757d"],
button[style*="background: #2c3e50"],
button[style*="background:#2c3e50"],
button[style*="background-color: #2c3e50"],
button[style*="background-color:#2c3e50"],
button[style*="background: #3f6ea6"],
button[style*="background:#3f6ea6"],
button[style*="background-color: #3f6ea6"],
button[style*="background-color:#3f6ea6"],
button[style*="background: #0b5fb0"],
button[style*="background:#0b5fb0"],
button[style*="background-color: #0b5fb0"],
button[style*="background-color:#0b5fb0"] {
    background-color: #ffffff !important;
    border: 1px solid #2f4a66 !important;
    color: #2f4a66 !important;
    font-weight: 500 !important;
    text-shadow: none !important;
}
button[id="btn-default-he"]:hover,
button[style*="background: #0056b3"]:hover,
button[style*="background:#0056b3"]:hover,
button[style*="background-color: #0056b3"]:hover,
button[style*="background-color:#0056b3"]:hover,
button[style*="background: #2980b9"]:hover,
button[style*="background:#2980b9"]:hover,
button[style*="background-color: #2980b9"]:hover,
button[style*="background-color:#2980b9"]:hover,
button[style*="background: #27ae60"]:hover,
button[style*="background:#27ae60"]:hover,
button[style*="background-color: #27ae60"]:hover,
button[style*="background-color:#27ae60"]:hover,
button[style*="background: #f39c12"]:hover,
button[style*="background:#f39c12"]:hover,
button[style*="background-color: #f39c12"]:hover,
button[style*="background-color:#f39c12"]:hover,
button[style*="background: #8e44ad"]:hover,
button[style*="background:#8e44ad"]:hover,
button[style*="background-color: #8e44ad"]:hover,
button[style*="background-color:#8e44ad"]:hover,
button[style*="background: #16a085"]:hover,
button[style*="background:#16a085"]:hover,
button[style*="background-color: #16a085"]:hover,
button[style*="background-color:#16a085"]:hover,
button[style*="background: #e67e22"]:hover,
button[style*="background:#e67e22"]:hover,
button[style*="background-color: #e67e22"]:hover,
button[style*="background-color:#e67e22"]:hover,
button[style*="background: #d98a2c"]:hover,
button[style*="background:#d98a2c"]:hover,
button[style*="background-color: #d98a2c"]:hover,
button[style*="background-color:#d98a2c"]:hover,
button[style*="background: #d35400"]:hover,
button[style*="background:#d35400"]:hover,
button[style*="background-color: #d35400"]:hover,
button[style*="background-color:#d35400"]:hover,
button[style*="background: #7f8c8d"]:hover,
button[style*="background:#7f8c8d"]:hover,
button[style*="background-color: #7f8c8d"]:hover,
button[style*="background-color:#7f8c8d"]:hover,
button[style*="background: #6c757d"]:hover,
button[style*="background:#6c757d"]:hover,
button[style*="background-color: #6c757d"]:hover,
button[style*="background-color:#6c757d"]:hover,
button[style*="background: #2c3e50"]:hover,
button[style*="background:#2c3e50"]:hover,
button[style*="background-color: #2c3e50"]:hover,
button[style*="background-color:#2c3e50"]:hover,
button[style*="background: #3f6ea6"]:hover,
button[style*="background:#3f6ea6"]:hover,
button[style*="background-color: #3f6ea6"]:hover,
button[style*="background-color:#3f6ea6"]:hover,
button[style*="background: #0b5fb0"]:hover,
button[style*="background:#0b5fb0"]:hover,
button[style*="background-color: #0b5fb0"]:hover,
button[style*="background-color:#0b5fb0"]:hover {
    background-color: #eef2f6 !important;
    filter: none;
}

/* Acciones principales: rellenas */
#btn-add-layer, #mens-add, #btn-save-cerramiento, #btn-apply-custom-loc,
#btn-db-add, #btn-marcos-add, #btn-vidrios-add, .btn-principal {
    background-color: #2f4a66 !important;
    border: 1px solid #263d55 !important;
    color: #ffffff !important;
    font-weight: 500 !important;
}
#btn-add-layer:hover, #mens-add:hover, #btn-save-cerramiento:hover, #btn-apply-custom-loc:hover,
#btn-db-add:hover, #btn-marcos-add:hover, #btn-vidrios-add:hover, .btn-principal:hover {
    background-color: #263d55 !important;
}

/* Acción destructiva (borrar la medición cargada) */
#btn-cr-load-csv.btn-peligro {
    color: #b03a2e !important;
    border-color: #b03a2e !important;
}
#btn-cr-load-csv.btn-peligro:hover {
    background-color: #fbeceb !important;
}
