/* ── Reset y base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f4f8;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.app-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    padding: 20px 32px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.app-header .logo {
    font-size: 28px;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.app-header p {
    font-size: 13px;
    opacity: 0.75;
    margin-top: 2px;
}

/* ── Contenido principal ──────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 32px 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ── Tarjeta de búsqueda ──────────────────────────────────────────────────── */
.search-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
    padding: 28px 32px;
    margin-bottom: 24px;
}

.search-card h2 {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 20px;
}

/* ── Layout interno de la tarjeta de búsqueda ────────────────────────────── */
.search-card-inner {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.search-controls {
    flex: 1;
    min-width: 0;
}

/* ── Cuadro de indicaciones ───────────────────────────────────────────────── */
.indicaciones-box {
    border: 2px solid #1e293b;
    border-radius: 8px;
    padding: 16px 24px;
    min-width: 280px;
    flex-shrink: 0;
}

.indicaciones-title {
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    color: #dc2626;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.indicaciones-cols {
    display: flex;
    gap: 24px;
}

.indicaciones-col {
    flex: 1;
    text-align: center;
}

.ind-empresa {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 8px;
}

.ind-clave {
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    color: #2563eb;
}

.ind-clave:hover       { text-decoration: underline; }
.ind-clave.verde       { color: #16a34a; }
.ind-clave.verde:hover { color: #15803d; }

/* ── Selector de empresa ──────────────────────────────────────────────────── */
.empresa-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.empresa-group label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    display: block;
    margin-bottom: 8px;
}

.empresa-btn {
    flex: 1;
    max-width: 200px;
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.empresa-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.empresa-btn.active-1 {
    background: #dcfce7;
    border-color: #16a34a;
    color: #15803d;
}

.empresa-btn.active-2 {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
}

/* ── Fila de búsqueda ─────────────────────────────────────────────────────── */
.search-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-group {
    flex: 1;
    max-width: 420px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn-buscar {
    padding: 10px 28px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-buscar:hover  { background: #1d4ed8; }
.btn-buscar:active { transform: scale(0.98); }

/* ── Spinner de carga ─────────────────────────────────────────────────────── */
.spinner-wrap {
    display: none;
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

.spinner-wrap p {
    color: #64748b;
    font-size: 14px;
}

/* ── Tarjeta de resultados ────────────────────────────────────────────────── */
.results-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
    overflow: hidden;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.results-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.results-badge {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    display: none;
}

/* ── Tabla ────────────────────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead tr {
    background: #f8fafc;
    position: sticky;
    top: 0;
}

th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    white-space: nowrap;
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── Mensaje vacío / error ────────────────────────────────────────────────── */
.msg-empty, .msg-error {
    padding: 48px 24px;
    text-align: center;
    color: #94a3b8;
    font-size: 15px;
}

.msg-empty span, .msg-error span {
    display: block;
    font-size: 36px;
    margin-bottom: 10px;
}

.msg-error { color: #ef4444; }

/* ── Botón exportar ───────────────────────────────────────────────────────── */
.export-row {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: none;
}

.btn-export {
    padding: 9px 22px;
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-export:hover { background: #047857; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.app-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    background: white;
}
