:root {
    --primary-blue: #003366;
    --accent-orange: #ff6600;
    --bg-light: #f4f7f9;
    --text-main: #333;
    --white: #ffffff;
}

/* =====================
   RESET & BASE
   ===================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-light);
    color: var(--text-main);
    font-size: 15px;
}

/* =====================
   HEADER
   ===================== */
header {
    background-color: #1f4e79;
    color: white;
    padding: 12px 20px;
    border-bottom: 4px solid var(--accent-orange);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

header img {
    height: 44px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

header h1 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
}

nav {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

nav a {
    color: #cbd5e0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.15s;
}

nav a:hover {
    color: var(--accent-orange);
    background: rgba(255,255,255,0.08);
}

.logout-btn {
    background: rgba(255,255,255,0.1);
}

/* =====================
   MAIN CONTAINER
   ===================== */
main {
    padding: 20px 16px;
    max-width: 1100px;
    margin: 0 auto;
}

/* =====================
   CARDS & FORMS
   ===================== */
form, .card {
    background: var(--white);
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border: 1px solid #e2e8f0;
}

.card h3 {
    margin-top: 0;
}

/* =====================
   GRID DE FORMULARIO
   ===================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 20px;
}

/* En móvil: una columna */
@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Anular span 2 en móvil */
    .form-grid [style*="grid-column: span 2"],
    .form-grid div[style*="span 2"] {
        grid-column: span 1 !important;
    }
}

/* =====================
   LABELS E INPUTS
   ===================== */
label {
    display: block;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    margin-top: 14px;
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}

input[type="text"],
input[type="date"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-main);
    background: #fff;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(0,51,102,0.1);
}

textarea { resize: vertical; }

button[type="submit"],
button.btn-primary {
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 12px 28px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    margin-top: 20px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background 0.15s;
}

button[type="submit"]:hover,
button.btn-primary:hover {
    background: #e05500;
}

/* =====================
   TABLAS — DESKTOP
   ===================== */
.tabla-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 520px; /* evita que colapse feo en móvil */
}

th {
    background: #f8fafc;
    color: var(--primary-blue);
    padding: 11px 12px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    white-space: nowrap;
}

td {
    padding: 11px 12px;
    border-bottom: 1px solid #edf2f7;
    font-size: 14px;
    vertical-align: middle;
}

tr:hover td { background: #f8fafc; }

/* =====================
   ADJUNTOS — TARJETAS EN MÓVIL
   ===================== */

/* Vista desktop: tabla normal */
.adjuntos-tabla { display: block; }
.adjuntos-cards { display: none; }

/* Vista móvil: tarjetas apiladas */
@media (max-width: 600px) {
    .adjuntos-tabla { display: none; }
    .adjuntos-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

    .adjunto-card {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        padding: 12px 14px;
        font-size: 13px;
    }

    .adjunto-card .adj-nombre {
        font-weight: 600;
        color: var(--primary-blue);
        word-break: break-all;
        margin-bottom: 6px;
        font-size: 14px;
    }

    .adjunto-card .adj-meta {
        color: #64748b;
        font-size: 12px;
        margin-bottom: 8px;
    }

    .adjunto-card a {
        display: inline-block;
        background: var(--primary-blue);
        color: white;
        padding: 7px 16px;
        border-radius: 4px;
        font-size: 13px;
        text-decoration: none;
        font-weight: 600;
    }
}

/* =====================
   BADGES DE ESTADO
   ===================== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-Nuevo            { background: #e0f2fe; color: #0369a1; }
.status-En-revisión,
.status-En-revisic3b3n   { background: #fef9c3; color: #854d0e; }
.status-En-proceso       { background: #fff7ed; color: #c2410c; }
.status-Pendiente-usuario{ background: #faf5ff; color: #7e22ce; }
.status-Solucionado      { background: #dcfce7; color: #166534; }
.status-Cerrado          { background: #f1f5f9; color: #475569; }

/* Compat con nombres anteriores */
.status-Abierto          { background: #fee2e2; color: #991b1b; }
.status-Cerrado          { background: #dcfce7; color: #166534; }
.status-En-Progreso      { background: #fef9c3; color: #854d0e; }

/* =====================
   BOTONES GENERALES
   ===================== */
a.btn, .btn {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.15s;
}

a.btn:hover { opacity: 0.85; }

/* =====================
   ALERTAS / MENSAJES
   ===================== */
.alerta {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alerta-warning { background: #fff3cd; border: 1px solid #ffc107; color: #856404; }
.alerta-error   { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.alerta-ok      { background: #dcfce7; border: 1px solid #86efac; color: #166534; }

/* =====================
   FILTROS
   ===================== */
.filtros .form-grid {
    align-items: flex-end;
}

/* =====================
   UTILIDADES
   ===================== */
.text-muted { color: #94a3b8; }
.text-small { font-size: 12px; }

/* =====================
   RESPONSIVE GENERAL
   ===================== */
@media (max-width: 768px) {
    main { padding: 14px 12px; }

    header h1 { font-size: 14px; }

    form, .card { padding: 16px 14px; }

    h2 { font-size: 1.2rem; }

    /* Tabla de lista de tickets: scroll horizontal */
    .tabla-responsive { border-radius: 6px; border: 1px solid #e2e8f0; }
}

@media (max-width: 480px) {
    header { padding: 10px 12px; }
    header img { height: 36px; }

    button[type="submit"] {
        width: 100%;
        text-align: center;
    }

    nav a { font-size: 12px; padding: 4px 7px; }
}
