:root {
    --carmin:      #9A0C1A;
    --carmin-dark: #6E0813;
    --ink:         #1A1A1D;
    --muted:       #6B6B6F;
    --bg:          #F4F4F2;
    --surface:     #FFFFFF;
    --sidebar:     #1A1A1D;
    --border:      #E2E2E0;
    --shadow:      0 4px 18px rgba(26,26,29,.08);
    --radius:       14px;
    --bg-alt:       var(--bg);
    --font-display: 'Fraunces', 'Inter', Arial, sans-serif;
}

/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', Arial, sans-serif;
}

/* Reset global de enlaces — antes solo existía ".sidebar a { ... }",
   así que cualquier <a> fuera del sidebar (p. ej. .download-card en
   la sección de Documentos y recursos) caía en el azul/subrayado por
   defecto del navegador. Se resetea acá para que cualquier link del
   panel parta del mismo estado neutro que en la landing/productos. */
a {
    color: inherit;
    text-decoration: none;
}

/* =========================
   BODY GENERAL
========================= */
body {
    background: var(--bg);
    color: var(--ink);
}

/* =========================
   LOGIN
========================= */
.login-container {
    background: var(--surface);
    padding: 36px 30px;
    border-radius: 14px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* TITULO LOGIN */
.login-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--carmin);
}

/* FORM */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    outline: none;
    background: var(--surface);
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
    border: 2px solid var(--carmin);
}

/* =========================
   BOTÓN BASE
========================= */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--carmin);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--carmin-dark);
}

/* Variante ancho completo para forms */
.btn-block {
    width: 100%;
    margin-top: 10px;
}

/* Variante secundaria */
.btn-secondary {
    background: #6B6B6F;
}

.btn-secondary:hover {
    background: #4f4f53;
}

/* FOOTER */
.footer {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: var(--muted);
}

/* =========================
   ADMIN LAYOUT
========================= */
.admin-container {
    display: flex;
    height: 100vh;
}

/* SIDEBAR (se mantiene oscura para anclar el layout) */
.sidebar {
    width: 220px;
    background: var(--sidebar);
    padding: 20px;
    flex-shrink: 0;
}

.sidebar h2 {
    color: #fff;
    margin-bottom: 20px;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin: 10px 0;
}

.sidebar a {
    color: #c9c7cb;
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
}

.sidebar a:hover {
    color: #fff;
}

.sidebar a.active {
    color: #fff;
    font-weight: 600;
    border-left: 3px solid var(--carmin);
    padding-left: 8px;
    margin-left: -11px;
}

/* =========================
   CONTENIDO
========================= */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg);
}

/* TOPBAR */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.topbar h1, .topbar h2 {
    color: var(--ink);
}

/* =========================
   MÉTRICAS
========================= */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.metric-card h3 {
    font-size: 14px;
    color: var(--muted);
}

.metric-card .number {
    font-size: 28px;
    font-weight: bold;
    color: var(--carmin);
}

.metric-card.alert .number {
    color: #dc2626;
}

/* =========================
   CARDS GENERALES
========================= */
.card {
    background: var(--surface);
    padding: 22px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card-header {
    margin-bottom: 20px;
}

.card-header h2 {
    color: var(--ink);
}

/* =========================
   GRID
========================= */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* LISTAS */
.list {
    list-style: none;
    margin-top: 10px;
}

.list li {
    padding: 5px 0;
    color: var(--ink);
}

/* =========================
   BUSCADOR
========================= */
.buscador {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.buscador input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    min-width: 0;
}

.buscador input:focus {
    border: 2px solid var(--carmin);
    outline: none;
}

.buscador .btn {
    flex-shrink: 0;
}

/* =========================
   TABLAS
========================= */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

thead {
    background: var(--bg);
}

th,
td {
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

th {
    color: var(--ink);
    font-weight: 600;
}

td {
    color: #4f4f53;
}

tbody tr {
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--bg);
}

/* =========================
   BOTONES TABLA
========================= */
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-action {
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: 0.3s;
    white-space: nowrap;
}

.btn-action.edit {
    background: #3b82f6;
    color: white;
}

.btn-action.edit:hover {
    background: #2563eb;
}

.btn-action.edit:disabled {
    background: var(--border);
    color: #a3a3a3;
    cursor: not-allowed;
}

.btn-action.delete {
    background: #dc2626;
    color: white;
}

.btn-action.delete:hover {
    background: #b91c1c;
}

/* =========================
   BADGES
========================= */
.badge {
    padding: 5px 10px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.badge.admin {
    background: var(--carmin);
    color: white;
}

.badge.success {
    background: #16a34a;
    color: white;
}

.badge.danger {
    background: #dc2626;
    color: white;
}

/* =========================
   MODAL
========================= */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(26,26,29,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 700px;
    border-radius: 14px;
    padding: 26px;
    position: relative;
    box-shadow: 0 15px 40px rgba(26,26,29,.25);
    color: var(--ink);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--carmin);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #dc2626;
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

.modal-close:hover {
    background: #b91c1c;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 9998;
    display: none;
}

/* =========================
   PROGRESS BAR
========================= */
.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress {
    height: 100%;
    background: var(--carmin);
}

/* =========================
   PAGINACIÓN
========================= */
#paginacion {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
}

#paginacion button {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    background: var(--surface);
    color: var(--ink);
    transition: background 0.2s;
}

#paginacion button:hover {
    background: var(--bg);
}

#paginacion button.active {
    background: var(--carmin);
    color: white;
    border-color: var(--carmin);
}

/* =========================
   UTILIDADES
========================= */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {

    .admin-container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
    }

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

    .topbar {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .topbar .btn {
        width: 100%;
        text-align: center;
    }

    .actions {
        flex-direction: column;
    }

    .buscador {
        flex-direction: column;
    }

    .buscador .btn {
        width: 100%;
        text-align: center;
    }
}


/* =========================
   DASHBOARD CLIENTE
   Obras con ruta ondulada
========================= */
.oc {
    background: var(--surface);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.oc-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.oc-titulo {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 3px;
}

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

/* Badges vigencia */
.badge-vigente {
    background: #ecfdf3;
    color: #15803d;
    border: 0.5px solid #86efac;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-vencida {
    background: #fef2f2;
    color: #b91c1c;
    border: 0.5px solid #fca5a5;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Contador días */
.dias-wrap {
    text-align: center;
    margin: 16px 0;
}

.dias-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 28px;
}

.dias-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.dias-num {
    font-size: 38px;
    font-weight: 700;
    color: var(--carmin);
    line-height: 1.05;
}

/* Variante cuando la fecha de entrega ya pasó y la obra llegó a la
   etapa final: en vez del contador "Venció hace X días" se muestra
   este texto, en verde (estado positivo, no una alerta). */
.dias-inner-finalizada {
    background: #ecfdf3;
    border-color: #86efac;
    padding: 14px 28px;
}

.dias-finalizada-texto {
    font-size: 15px;
    font-weight: 700;
    color: #15803d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* =========================
   LÍNEA DE TIEMPO DE OBRA (SVG ondulado + camión)
   Todo el posicionamiento (curva, círculos, íconos, labels y camión)
   se calcula en PHP y se renderiza como SVG — no depende de JS ni de
   medir el DOM, así que es igual de confiable en cualquier pantalla.
========================= */
.stepper-alerta {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
}

.oc-wave {
    padding: 0 8px 8px;
}

.oc-wave svg {
    display: block;
    width: 100%;
    overflow: visible;
}

/* Resaltado cuando la obra tiene una incidencia: se distingue del
   flujo normal sin cambiar el color base de la línea */
.oc-wave--incidencia {
    outline: 2px dashed #f97316;
    outline-offset: 10px;
    border-radius: 12px;
}

/* Meta fila */
.oc-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}

/* Botón ver tareas */
.btn-tareas {
    margin-top: 14px;
    display: inline-block;
    padding: 8px 18px;
    background: var(--carmin);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-tareas:hover {
    background: var(--carmin-dark);
}

/* Tarea item en modal */
.tarea-item {
    background: var(--bg);
    border-radius: 8px;
    padding: 14px 16px;
    border-left: 3px solid var(--carmin);
    margin-bottom: 12px;
}

.tarea-item:last-child {
    margin-bottom: 0;
}

/* =========================
   RESPONSIVE CLIENTE
========================= */
@media (max-width: 600px) {
    .oc {
        padding: 16px;
    }
    .dias-num {
        font-size: 30px;
    }
    .oc-meta {
        flex-direction: column;
        gap: 8px;
    }
}

/* =========================
   DASHBOARD CLIENTE
   Sección "Documentos y recursos" (descargas privadas)
   Usa la paleta de marca (--ink, --muted, --border, --bg, --radius),
   las mismas variables que productos.css, para que se vea igual
   que "Recursos para descargar" en rollkit.php/plegakit.php.
   (Antes vivía como <style> inline en cliente_dashboard.php — se
   movió acá para mantener CSS en un solo lugar en todo el proyecto.)
========================= */
.dashboard-downloads {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.dashboard-downloads-header {
    margin-bottom: 1.6rem;
    text-align: center;
}

.dashboard-downloads-eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--carmin);
    margin-bottom: 8px;
}

.dashboard-downloads-eyebrow::before {
    content: '';
    width: 16px;
    height: 2px;
    background: var(--carmin);
}

.dashboard-downloads-title {
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ink);
    margin: 0 0 6px 0;
}

.dashboard-downloads-sub {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}
.dashboard-downloads-panel {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1.5rem;
}