:root {
    --bg: #f2f5fa;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --primary: #0b5ed7;
    --primary-dark: #0847a8;
    --line: #dbe4f0;
    --danger: #dc3545;
    --success: #198754;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Inter', Helvetica, Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f6f9ff 0%, var(--bg) 100%);
    padding: 16px;
}

/* Menú principal */
.main-nav {
    position: sticky;
    top: 10px;
    z-index: 100;
    margin: 0 auto 14px;
    max-width: 1200px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(6px);
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.main-nav li {
    margin: 0;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #e6edf7;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.main-nav a.active {
    background: #fff;
    color: #0f172a;
}

/* Contenedor principal */
.container {
    width: min(1200px, 100%);
    margin: 0 auto;
    background: var(--card);
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid #e7eef8;
}

h1,
h2 {
    color: #0f2f5c;
    margin: 0 0 12px;
    line-height: 1.2;
}

h1 {
    text-align: left;
    font-size: clamp(1.25rem, 1.5vw, 1.7rem);
}

h2 {
    font-size: clamp(1rem, 1.1vw, 1.25rem);
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

/* Formularios */
form label {
    display: block;
    margin-top: 8px;
    margin-bottom: 4px;
    font-weight: 600;
    color: #1e3a5f;
    font-size: 0.92rem;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 9px 10px;
    margin-bottom: 10px;
    border: 1px solid #cfd8e6;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 0.92rem;
    background: #fff;
    color: var(--text);
}

textarea {
    min-height: 84px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #8ab4ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Tablas */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.88rem;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

table,
th,
td {
    border: 1px solid #e5e9f2;
}

th,
td {
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: #f2f6fc;
    color: #1f3f69;
    font-weight: 700;
}

tr:hover {
    background-color: #f8fbff;
}

/* Anchos tabla items */
#tabla-items th:nth-child(1) { width: 20%; }
#tabla-items th:nth-child(2) { width: 30%; }
#tabla-items th:nth-child(3) { width: 10%; }
#tabla-items th:nth-child(4) { width: 15%; }
#tabla-items th:nth-child(5) { width: 15%; }
#tabla-items th:nth-child(6) { width: 10%; }

/* Botones compactos */
.btn,
button.btn,
.filtro-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--primary);
    color: #fff;
    padding: 7px 12px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1;
    transition: all 0.2s ease;
    margin-top: 0;
}

.btn:hover,
button.btn:hover,
.filtro-form button:hover {
    background-color: var(--primary-dark);
}

.btn-remove {
    background-color: var(--danger);
    color: white;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.8rem;
}

.btn-remove:hover {
    background-color: #bb2d3b;
}

.btn-success { background-color: var(--success); color: white; }
.btn-danger { background-color: var(--danger); color: white; }
.btn-warning { background-color: var(--warning); color: #1f2937; }
.btn-delete { background-color: #6b7280 !important; color: white !important; }

.btn-add {
    background-color: #facc15;
    color: #1f2937;
    border: 1px solid #eab308;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color 0.2s;
    margin-top: 8px;
    margin-bottom: 10px;
}
.btn-add:hover {
    background-color: #eab308;
    color: #111827;
}

/* Acciones */
.actions {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.actions a {
    text-decoration: none;
    color: white;
    padding: 7px 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    font-size: 0.84rem;
}

/* Totales */
.totals {
    margin-top: 10px;
    text-align: right;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f9fbff;
}
.totals p {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 4px 0;
}

/* Filtros */
.filtros {
    margin-bottom: 14px;
    background: #f8fbff;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.filtro-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.filtro-form input,
.filtro-form select,
.filtro-form button {
    flex: 1 1 180px;
    min-width: 160px;
    margin-bottom: 0;
}

.filtro-botones {
    margin-bottom: 10px;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.filtro-botones a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    background-color: #eef2f7;
    color: #334155;
    border: 1px solid #d0d8e6;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.82rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    min-width: 90px;
    text-align: center;
}
.filtro-botones a:hover { background-color: #e2e8f0; }
.filtro-botones a.active {
    background-color: #0b5ed7;
    color: white;
    border-color: #0847a8;
}
.filtro-botones a[href*="estado=oculta"] {
    background-color: #fde2e2;
    color: #9f1239;
    border-color: #fecaca;
}
.filtro-botones a[href*="estado=oculta"].active {
    background-color: #dc2626;
    color: #fff;
    border-color: #b91c1c;
}
.filtro-botones i { margin-right: 5px; }

.checkbox-container {
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
    cursor: pointer;
    user-select: none;
    font-size: 0.84rem;
    color: #374151;
}

/* Estados de filas */
.cotizacion-aceptada { background-color: rgba(40, 167, 69, 0.08); }
.cotizacion-rechazada { background-color: rgba(220, 53, 69, 0.08); }
.cotizacion-oculta { opacity: 0.72; }

/* Bloques de detalle */
.quote-container {
    border: 1px solid #dbe4f0;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    background: #fff;
}
.quote-header {
    text-align: right;
    margin-bottom: 20px;
}
.quote-header h1 {
    margin: 0;
    color: #0f172a;
    font-size: 1.2rem;
}
.quote-details {
    margin-bottom: 18px;
    padding: 14px;
    background: #f8fbff;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
}

/* Status buttons */
.status-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-right: 0;
}

.status-buttons form {
    display: inline-block;
    margin: 0;
}

.status-icons {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 0.82rem;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.icon-btn:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.icon-success { background: #198754; }
.icon-danger { background: #dc3545; }
.icon-warning { background: #f59e0b; color: #111827; }

/* ===== LOGIN MODERNO CON FONDO ===== */
body.login-page {
    margin: 0;
    min-height: 100vh;
    padding: 0;
    background: url('../images/carro_dos.webp') center/cover no-repeat fixed;
    position: relative;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
body.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(120deg, rgba(6, 22, 43, 0.82), rgba(6, 22, 43, 0.55));
    z-index: 0;
}
.login-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    color: #fff;
}
.login-card h1 {
    margin: 0 0 8px 0;
    color: #fff;
    text-align: left;
    font-size: 1.8rem;
}
.login-card p {
    margin: 0 0 16px 0;
    color: rgba(255, 255, 255, 0.9);
}
.login-form label {
    color: #fff;
    margin-top: 12px;
    display: block;
    font-weight: 600;
}
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 11px 12px;
    margin-top: 6px;
    margin-bottom: 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    font-size: 15px;
    box-sizing: border-box;
}
.login-form input:focus {
    outline: none;
    border-color: #7cc0ff;
    box-shadow: 0 0 0 3px rgba(124, 192, 255, 0.28);
}
.login-form .btn {
    width: 100%;
    margin-top: 8px;
    background: #007bff;
    border-radius: 10px;
    font-weight: 700;
}
.login-form .btn:hover {
    background: #0056b3;
}
.alert-error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-weight: 600;
}
.back-link {
    margin-top: 14px;
    display: inline-block;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    opacity: 0.92;
}
.back-link:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        width: min(100%, 980px);
    }
}
@media (max-width: 768px) {
    body { padding: 10px; }

    .main-nav {
        top: 6px;
        border-radius: 12px;
    }

    .main-nav ul {
        gap: 6px;
        padding: 6px;
    }

    .main-nav a {
        padding: 7px 10px;
        font-size: 0.82rem;
    }

    .container {
        padding: 14px;
        border-radius: 10px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .actions {
        justify-content: flex-start;
    }

    .filtro-form input,
    .filtro-form select,
    .filtro-form button {
        flex: 1 1 100%;
        min-width: 100%;
    }

    table {
        font-size: 0.82rem;
    }

    .status-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .status-buttons .btn,
    .status-buttons button {
        width: 100%;
    }
}
@media (max-width: 560px) {
    .login-card {
        padding: 22px 18px;
        border-radius: 14px;
    }

    .login-card h1 {
        font-size: 1.5rem;
    }

    .btn,
    .actions a {
        width: 100%;
    }

    .table-wrap {
        margin: 0 -4px;
    }
}
