/* ============================================================
   Facturas de Luz - App styles
   Design language: soft teal, rounded cards, Manrope/Sora
   (inspired by the 470results dashboard)
   ============================================================ */

:root {
    --bg-app: #f5f8f8;
    --bg-card: #ffffff;
    --bg-soft: #f0f5f6;
    --border-color: #d9e6ea;
    --text-primary: #1f2f39;
    --text-secondary: #5d7280;
    --text-muted: #7f939f;

    --accent-blue: #4ea7cf;
    --accent-indigo: #5a9d8a;
    --accent-emerald: #2b9f85;
    --accent-amber: #f0b659;
    --accent-rose: #de7f8f;

    --link-color: #2f7fa8;
    --link-hover: #205f7f;
    --focus-ring: rgba(46, 125, 167, 0.38);

    --font-sans: "Manrope", "Segoe UI", sans-serif;
    --font-display: "Sora", "Manrope", sans-serif;

    --shadow-sm: 0 1px 2px rgba(34, 62, 75, 0.06);
    --shadow-md: 0 8px 18px rgba(34, 62, 75, 0.07);
    --shadow-lg: 0 14px 28px rgba(34, 62, 75, 0.11);

    --gradient-accent: linear-gradient(135deg, #2f9f86 0%, #4aa8cd 100%);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0 !important;
    background:
        radial-gradient(circle at 4% 10%, #ddeef3 0%, rgba(221, 238, 243, 0) 26%),
        radial-gradient(circle at 92% 2%, #e1f6ed 0%, rgba(225, 246, 237, 0) 24%),
        linear-gradient(160deg, #f8fbfc 0%, #f0f6f7 50%, #eef4f5 100%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--link-color);
    text-decoration-color: rgba(47, 127, 168, 0.45);
    text-underline-offset: 2px;
    text-decoration-thickness: 1.2px;
}

a:hover {
    color: var(--link-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.container {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Keep Bootstrap-based pages on the same content width as the home page */
body .container {
    max-width: 1060px;
}

/* ---------------- Top bar ---------------- */

.topbar {
    background: rgba(250, 252, 252, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
}

.brand {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #284a58;
    text-decoration: none;
    white-space: nowrap;
}

.brand:hover {
    color: #1e3a46;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.topnav a {
    border-radius: 999px;
    padding: 9px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
}

.topnav a:hover {
    background-color: #edf6f8;
    color: var(--text-primary);
}

.topnav a.active {
    background: linear-gradient(135deg, #d8f3ee 0%, #ebf8fb 100%);
    color: #256a73;
    box-shadow: inset 0 0 0 1px rgba(88, 162, 184, 0.35);
}

/* ---------------- Hero ---------------- */

.hero {
    text-align: center;
    padding: 54px 0 10px;
}

.badge-pill {
    display: inline-block;
    border: 1px solid #bcdce8;
    background: #eef8fb;
    color: #256a73;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: #223843;
    margin: 0 0 14px;
}

.hero-sub {
    max-width: 640px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
}

.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 8px 14px 8px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gradient-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.step-arrow {
    color: #9ab5c1;
    font-weight: 800;
}

/* ---------------- Cards ---------------- */

.card {
    background: var(--bg-card);
    border: 1px solid #d5e4e9;
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.upload-card {
    max-width: 720px;
    margin: 26px auto 10px;
}

.upload-card h2 {
    font-family: var(--font-display);
    font-size: 21px;
    color: #25424f;
    margin: 0 0 4px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 16px;
}

/* ---------------- Dropzone ---------------- */

.dropzone {
    border: 2px dashed #b8d4de;
    border-radius: 16px;
    background: #f8fcfd;
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #5fa9c6;
    background: #f0f9fc;
}

.dropzone-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 10px;
}

.dropzone-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: #25424f;
    margin: 0 0 4px;
}

.dropzone-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 18px;
}

/* ---------------- Buttons ---------------- */

.btn-primary,
.btn-ghost {
    border: none;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    padding: 12px 22px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--gradient-accent);
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: #ffffff;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ghost {
    background: #ffffff;
    color: var(--link-color);
    border: 1px solid #c7dbe1;
}

.btn-ghost:hover {
    background: #eef6f8;
    border-color: #6eb4ca;
}

/* ---------------- File list & progress ---------------- */

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #d6e6eb;
    border-radius: 12px;
    background: #fcfefe;
    padding: 10px 14px;
    font-size: 13px;
}

.file-item .file-name {
    font-weight: 700;
    color: #203741;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.file-item .remove-file {
    border: none;
    background: transparent;
    color: var(--accent-rose);
    font-size: 17px;
    cursor: pointer;
    padding: 0 4px;
}

.upload-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.progress-area {
    margin-top: 20px;
    text-align: center;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #f8fcfd;
}

.spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #d9e9ef;
    border-top-color: #4ca8cd;
    margin: 0 auto 10px;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------- Result ---------------- */

.result-card {
    max-width: 820px;
    margin: 26px auto 10px;
}

.result-banner {
    border-radius: 14px;
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
}

.result-banner.success {
    background: #e4f6ee;
    color: #1e6a55;
    border: 1px solid #b7e3d2;
}

.result-banner.duplicate {
    background: #fdf3e2;
    color: #8a5c16;
    border: 1px solid #f0d7a8;
}

.result-banner.ignored {
    background: #eef3f7;
    color: #4d6473;
    border: 1px solid #d3dfe7;
}

.result-banner.error {
    background: #fdecef;
    color: #9c3346;
    border: 1px solid #f0c3cd;
}

.result-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.result-header h2 {
    font-family: var(--font-display);
    font-size: 19px;
    color: #25424f;
    margin: 0;
}

.result-file {
    color: var(--text-muted);
    font-size: 12px;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.summary-pill {
    border: 1px solid #d8e8ed;
    background: #f6fbfc;
    border-radius: 12px;
    padding: 11px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 800;
    color: #7895a1;
}

.summary-value {
    font-size: 16px;
    color: #2b4b58;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Per-file list for multiple uploads */

.batch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #d6e6eb;
    border-radius: 12px;
    background: #fcfefe;
    padding: 12px 14px;
    margin-top: 8px;
    font-size: 13px;
}

.batch-item .batch-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.batch-item .batch-file {
    font-weight: 700;
    color: #203741;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-item .batch-detail {
    color: var(--text-secondary);
    font-size: 12px;
}

.batch-status {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
    padding: 5px 10px;
    white-space: nowrap;
}

.batch-status.ok {
    background: #e4f6ee;
    color: #1e6a55;
}

.batch-status.dup {
    background: #fdf3e2;
    color: #8a5c16;
}

.batch-status.err {
    background: #fdecef;
    color: #9c3346;
}

/* Distribuidora badges */

.dist-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dist-EDELAP {
    color: #1e6a55;
    background: #def4eb;
}

.dist-EDENOR {
    color: #2f7a9b;
    background: #e6f3f8;
}

.dist-EDESUR {
    color: #7a5c1e;
    background: #fbf0d9;
}

.dist-OTRA {
    color: #447971;
    background: #e7f4ef;
}

/* ---------------- Customer history (after upload) ---------------- */

.history-card {
    max-width: 860px;
    margin: 20px auto 10px;
}

.welcome-title {
    font-family: var(--font-display);
    font-size: 21px;
    color: #25424f;
    margin: 0 0 4px;
}

.welcome-note {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 14px;
}

.client-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0 16px;
}

.client-pill {
    border: 1px solid #c7dbe1;
    background: #ffffff;
    color: var(--link-color);
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.client-pill:hover {
    background: #eef6f8;
    border-color: #6eb4ca;
}

.client-pill.active {
    background: var(--gradient-accent);
    border-color: transparent;
    color: #ffffff;
}

.forget-link {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

.forget-link:hover {
    color: var(--accent-rose);
}

.history-client {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.history-client h2 {
    font-family: var(--font-display);
    font-size: 19px;
    color: #25424f;
    margin: 0;
}

.history-client .client-id {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.history-note {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0 0 16px;
}

.history-block {
    margin-bottom: 22px;
}

.history-block:last-child {
    margin-bottom: 0;
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    border: 1px solid #d7e7ed;
    border-radius: 14px;
    overflow: hidden;
}

.history-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #d7e7ed;
    border-radius: 14px;
}

.history-table-wrap .history-table {
    width: 100%;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e1edf1;
    text-align: left;
    /* Permitir que el texto se ajuste: evita scroll horizontal dentro de la
       tabla en pantallas grandes (el scroll se reserva para pantallas chicas). */
    white-space: normal;
    vertical-align: middle;
}

/* Mantener compactos los valores que no deberían partirse en dos líneas */
.history-table .history-amount,
.history-table td.text-end,
.history-table .dist-badge,
.history-table .change-up,
.history-table .change-down,
.history-table .change-flat {
    white-space: nowrap;
}

.history-table th {
    background: #f4fafb;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6f8a97;
    font-weight: 800;
}

.history-table tbody tr {
    transition: background 0.15s ease;
}

.history-table tbody tr:hover {
    background: #f6fbfc;
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.history-table .row-current {
    background: #f0faf6;
}

.history-amount {
    font-weight: 700;
    color: #21424f;
}

.history-new {
    display: inline-block;
    background: var(--gradient-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 2px 8px;
    margin-left: 6px;
}

/* Profile prompt (vivienda / m2 / habitantes) */
.profile-prompt {
    margin-top: 16px;
    border: 1px solid #d7e6eb;
    border-radius: 14px;
    background: #f8fcfd;
    padding: 16px;
}

.profile-prompt h3 {
    font-family: var(--font-display);
    font-size: 16px;
    color: #25424f;
    margin: 0 0 4px;
}

.profile-prompt p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 14px;
}

.profile-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.profile-field select,
.profile-field input {
    border: 1px solid #cfe0e6;
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--font-sans);
}

.profile-field select:focus,
.profile-field input:focus {
    border-color: #6eb3ca;
    box-shadow: 0 0 0 3px rgba(109, 179, 202, 0.2);
    outline: none;
}

.profile-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}

.profile-error {
    color: #c0505f;
    font-size: 13px;
    font-weight: 700;
    margin-top: 10px;
}

.profile-saved {
    background: #e4f6ee;
    color: #1e6a55;
    border: 1px solid #b7e3d2;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    margin-top: 12px;
}

.change-up {
    color: #1e8a5f;
    font-weight: 700;
}

.change-down {
    color: #c0505f;
    font-weight: 700;
}

.change-flat {
    color: var(--text-muted);
}

/* ---------------- Footer ---------------- */

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 34px 20px 24px;
}

/* ---------------- Bootstrap page overrides ---------------- */

/* Shared top bar look for the legacy pages (they keep Bootstrap markup) */
.navbar-dark.bg-dark {
    background: rgba(250, 252, 252, 0.92) !important;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
}

.navbar-dark .navbar-brand {
    color: #284a58;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.navbar-dark .navbar-nav .nav-link {
    color: var(--text-secondary);
    font-weight: 700;
    border-radius: 999px;
    padding-left: 14px;
    padding-right: 14px;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--text-primary);
    background: #edf6f8;
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #256a73;
    background: linear-gradient(135deg, #d8f3ee 0%, #ebf8fb 100%);
    box-shadow: inset 0 0 0 1px rgba(88, 162, 184, 0.35);
}

.navbar-dark .navbar-toggler {
    border-color: #b8d4de;
}

.navbar-dark .navbar-toggler-icon {
    filter: invert(0.4);
}

/* Análisis shortcut button inside the nav */
.navbar .btn-warning {
    background: var(--gradient-accent) !important;
    border: none !important;
    color: #ffffff !important;
}

/* Blend legacy cards/tables with the new palette */
body .card {
    border-radius: 18px;
    border-color: #d5e4e9;
    box-shadow: var(--shadow-sm);
}

body .card-header.bg-dark,
body .card-header.bg-success,
body .card-header.bg-primary,
body .card-header.bg-secondary {
    background: linear-gradient(135deg, #2f9f86 0%, #4aa8cd 100%) !important;
    color: #ffffff;
}

body .table {
    --bs-table-hover-bg: #f6fbfc;
}

/* ------------ "Todas las Facturas" table details ------------ */

/* Rows: keep the soft teal hover (override the old gray hover) */
body .table .clickable-row:hover {
    background-color: #f0f8f6 !important;
}

body .table .clickable-row:hover td {
    background-color: transparent !important;
}

/* Masked customer number: bold */
body .table tbody td:first-child {
    font-weight: 800;
    color: #21424f;
    white-space: nowrap;
}

/* Amounts and numbers: tabular, bold */
body .table tbody td.text-end {
    font-weight: 700;
    color: #21424f;
    font-variant-numeric: tabular-nums;
}

/* Localidad badge + partido hint */
body .table tbody .badge.bg-light {
    background: #f0f5f6 !important;
    color: #5d7280;
    border: 1px solid #d9e6ea;
    border-radius: 999px;
    font-weight: 700;
}

body .table tbody small.text-muted {
    color: #7f939f !important;
}

/* "Datos adicionales" cell: keep badges aligned and pill-shaped */
body .table tbody .client-data-summary {
    white-space: nowrap;
}

/* Badges used by the table (Bootstrap classes -> app palette) */
body .badge {
    border-radius: 999px;
    padding: 0.45em 0.75em;
    font-weight: 700;
    letter-spacing: 0.02em;
}

body .badge.bg-primary {
    background: #4ea7cf !important;
    color: #ffffff;
}

body .badge.bg-success {
    background: #def4eb !important;
    color: #1e6a55;
}

body .badge.bg-info {
    background: #e6f3f8 !important;
    color: #2f7a9b;
}

body .badge.bg-warning,
body .badge.bg-warning.text-dark {
    background: #fbf0d9 !important;
    color: #7a5c1e !important;
}

body .badge.bg-secondary {
    background: #e7f4ef !important;
    color: #287868;
}

body .form-control,
body .form-select {
    border-radius: 12px;
    border-color: #cfe0e6;
}

body .form-control:focus,
body .form-select:focus {
    border-color: #6eb3ca;
    box-shadow: 0 0 0 3px rgba(109, 179, 202, 0.2);
}

/* Card headers on legacy pages */
.app-card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border-color);
    border-radius: 18px 18px 0 0 !important;
    padding: 18px 20px;
}

.app-card-header h5 {
    font-family: var(--font-display);
    font-size: 18px;
    color: #25424f;
    font-weight: 600;
}

/* Legacy tables: soft, rounded, teal headers */
.table-responsive {
    border: 1px solid #d7e7ed;
    border-radius: 14px;
    overflow: auto;
}

/* "Todas las Facturas": reuse the home-page table look */
.table-responsive .history-table {
    width: 100%;
    border: 0;
    border-radius: 0;
    table-layout: auto;
}

body .table-responsive .history-table th,
body .table-responsive .history-table td {
    padding: 11px 12px;
    font-size: 13px;
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 1px solid #e1edf1;
    border-top: 0;
}

body .table-responsive .history-table th {
    background: #f4fafb;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6f8a97;
    font-weight: 800;
}

/* Home table has no stripes - keep it clean here too */
body .table-responsive .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: transparent;
}

body .table-responsive .history-table tbody tr:hover {
    background: #f6fbfc;
}

body .table-responsive .history-table tbody tr:hover td {
    background: transparent;
}

body .table-responsive .history-table tbody tr:last-child td {
    border-bottom: none;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f4fafb;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6f8a97;
    font-weight: 800;
    border-bottom: 1px solid #e1edf1 !important;
    padding: 12px;
}

.table tbody td {
    border-bottom: 1px solid #e1edf1;
    padding: 11px 12px;
    vertical-align: middle;
}

.table-hover tbody tr:hover,
.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #f6fbfc;
}

.table-hover tbody tr:hover td {
    background-color: transparent;
}

/* Sort buttons on the table headers */
.table .sort-btn {
    border-radius: 999px;
    border-color: #d3e4ea;
    background: #fbfefe;
    color: #567180;
    font-size: 11px;
    padding: 2px 7px;
}

.table .sort-btn:hover {
    background: #eef6f8;
    border-color: #6eb4ca;
    color: #254857;
}

/* Legacy alerts */
.alert-warning {
    background: #fdf3e2;
    border-color: #f0d7a8;
    color: #8a5c16;
    border-radius: 14px;
}

.alert {
    border-radius: 14px;
}

/* Spinner color on legacy pages */
.spinner-border.text-primary {
    color: #4ca8cd !important;
}

/* ------------ Markdown content (Análisis / Cómo funciona) ------------ */

.md-content {
    max-width: 780px;
    margin: 0 auto;
    padding: 26px 4px 40px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.7;
}

.md-content h1,
.md-content h2,
.md-content h3,
.md-content h4 {
    font-family: var(--font-display);
    color: #223843;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.md-content h1 {
    font-size: 30px;
    margin: 0 0 18px;
}

.md-content h2 {
    font-size: 23px;
    margin: 30px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.md-content h3 {
    font-size: 18px;
    margin: 24px 0 10px;
}

.md-content h4 {
    font-size: 16px;
    margin: 20px 0 8px;
}

.md-content p {
    margin: 0 0 14px;
}

.md-content ul,
.md-content ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.md-content li {
    margin-bottom: 6px;
}

.md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 14px;
    border: 1px solid #d7e7ed;
    border-radius: 12px;
    overflow: hidden;
}

.md-content th,
.md-content td {
    padding: 10px 12px;
    border-bottom: 1px solid #e1edf1;
    text-align: left;
}

.md-content th {
    background: #f4fafb;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6f8a97;
    font-weight: 800;
}

.md-content pre {
    background: #f0f5f6;
    border: 1px solid #d9e6ea;
    border-radius: 12px;
    padding: 14px;
    overflow-x: auto;
    font-size: 13px;
}

.md-content code {
    background: #eef4f5;
    border-radius: 6px;
    padding: 2px 5px;
    font-size: 13px;
    color: #1f4d5e;
}

.md-content pre code {
    background: transparent;
    padding: 0;
}

.md-content blockquote {
    border-left: 3px solid #4ea7cf;
    background: #f6fbfc;
    margin: 0 0 16px;
    padding: 10px 16px;
    border-radius: 0 12px 12px 0;
    color: var(--text-secondary);
}

.md-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.md-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 26px 0;
}

/* Pantallas grandes: un poco más de ancho para aprovechar el monitor */
@media (min-width: 1280px) {
    .container,
    body .container {
        max-width: 1200px;
    }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 640px) {
    .topbar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .topnav {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .hero {
        padding-top: 36px;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .result-file {
        max-width: 100%;
    }
}
