/* =======================================================
   Anfibio Gráfica — Paleta corporativa
   Negro #0A0A0A  ·  Amarillo #F5B921  ·  Blancos/grises
   ======================================================= */

:root {
    --anfibio-negro:      #0A0A0A;
    --anfibio-negro-80:   rgba(10, 10, 10, 0.8);
    --anfibio-amarillo:   #F5B921;
    --anfibio-amarillo-oscuro: #D99E0C;
    --anfibio-gris-claro: #F5F5F5;
    --anfibio-gris-medio: #E3E3E3;
    --anfibio-gris-texto: #4a4a4a;
}

body {
    background-color: var(--anfibio-gris-claro);
    color: var(--anfibio-negro);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ====== Sidebar ====== */
.sidebar {
    min-height: 100vh;
    background-color: #1f2329;        /* gris oscuro */
    color: #fff;
    padding-top: 0;                    /* sin espacio negro arriba del logo */
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 0.4rem 0.3rem;
    text-align: center;
    margin-bottom: 0.4rem;
    background: #fff;
    border-radius: 0;
    display: block;
    transition: opacity .15s;
    cursor: pointer;
}
.sidebar-brand:hover { opacity: .9; }

.sidebar-brand img {
    max-width: 123px;
    width: 85%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.sidebar-brand .brand-text {
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 1px;
    margin: 0;
}

.sidebar-brand .brand-text span {
    color: var(--anfibio-amarillo);
}

.sidebar .nav {
    padding: 0 0.5rem;
    flex: 1;
}

.sidebar .nav-link {
    color: #d1d1d1;
    padding: 0.6rem 0.85rem;
    border-left: 3px solid transparent;
    border-radius: 6px;
    transition: all 0.15s ease-in-out;
    font-weight: 500;
    font-size: 0.92rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar .nav-link.active {
    background-color: rgba(245, 185, 33, 0.12);
    color: var(--anfibio-amarillo);
    border-left-color: var(--anfibio-amarillo);
    font-weight: 600;
}

/* Items del sidebar con botón "+" a la derecha (atajo crear nuevo)
   Oculto por default, aparece sólo cuando se hace hover sobre el item.
   Usa el mismo color del texto del item (no destaca). */
.sidebar .nav-with-plus { position: relative; }
.sidebar .nav-with-plus .nav-plus {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: inherit;
    font-size: .75rem;
    text-decoration: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, background .15s ease;
    background: transparent;
}
/* Hover sobre el item completo: aparece el + (mismo color que el texto) */
.sidebar .nav-with-plus:hover .nav-plus {
    opacity: 1;
    pointer-events: auto;
}
/* Hover directo sobre el +: sutil bg para feedback de click */
.sidebar .nav-with-plus .nav-plus:hover {
    background: rgba(255, 255, 255, .12);
}
/* Cuando el sidebar está colapsado, ocultar el + para no tapar el item */
.sidebar-collapsed .nav-plus { display: none !important; }

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.55rem;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #9a9a9a;
    font-size: 0.75rem;
    text-align: center;
    margin-top: auto;
}

/* ====== Sidebar fijo + colapsable ====== */
.sidebar {
    width: 210px;
    position: fixed;
    height: 100vh;
    transition: width .25s ease;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* Items del dropdown de estado (en dashboard y listado de OTs): nombre completo */
.dash-estado-item, .ot-estado-item { white-space: nowrap; padding-right: 1.2rem; }

/* Ocultar scrollbars en todo (excepto sidebar, que tiene su propio estilo arriba).
   El contenido sigue scrolleando con la rueda/teclado, solo se oculta la barra. */
*::-webkit-scrollbar           { width: 0 !important; height: 0 !important; background: transparent !important; }
*::-webkit-scrollbar-thumb     { background: transparent !important; }
*::-webkit-scrollbar-track     { background: transparent !important; }
*::-webkit-scrollbar-button    { display: none !important; width: 0 !important; height: 0 !important; }
* { scrollbar-width: none; }     /* Firefox */
* { -ms-overflow-style: none; }  /* IE/Edge legacy */

.sidebar-toggle-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: #9a9a9a;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    z-index: 101;
    transition: color .15s;
}
.sidebar-toggle-btn:hover { color: #fff; }

/* Estado colapsado */
.sidebar-collapsed {
    width: 54px;
}
.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .sidebar-footer,
.sidebar-collapsed .nav-label {
    display: none !important;
}
.sidebar-collapsed .nav .nav-link {
    justify-content: center;
    padding: 0.65rem;
    border-left: 3px solid transparent;
}
.sidebar-collapsed .nav .nav-link i {
    margin-right: 0;
    font-size: 1.15rem;
}
.sidebar-collapsed .sidebar-toggle-btn {
    position: static;
    display: block;
    margin: 0.5rem auto 0.75rem;
    color: #9a9a9a;
}

/* Separador de secciones en sidebar */
.nav-separator {
    padding: 0.55rem 0.85rem 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.28);
    margin-top: 0.25rem;
    white-space: nowrap;
}
.sidebar-collapsed .nav-separator {
    display: none !important;
}
/* Cuando el sidebar está colapsado, ocultar cualquier badge que no esté
   adentro de .nav-label (evita que un badge huérfano "asome" como sliver). */
.sidebar-collapsed .nav-link > .badge {
    display: none !important;
}

/* ====== Responsive / Celular: la barra lateral pasa a ser un cajón deslizante ====== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 240px !important;
        box-shadow: 2px 0 14px rgba(0,0,0,.35);
    }
    .sidebar.sidebar-mobile-open { transform: translateX(0); }
    /* En el celular el cajón siempre muestra los textos completos (ignora el modo "colapsado" angosto) */
    .sidebar.sidebar-collapsed { width: 240px !important; }
    .sidebar-collapsed .sidebar-brand,
    .sidebar-collapsed .sidebar-footer,
    .sidebar-collapsed .nav-label,
    .sidebar-collapsed .nav-separator { display: block !important; }
    .sidebar-collapsed .nav .nav-link { justify-content: flex-start; padding: 0.65rem 0.85rem; border-left: 3px solid transparent; }
    .sidebar-collapsed .nav .nav-link i { margin-right: 0.6rem; font-size: 1rem; }
    /* El contenido ocupa todo el ancho (pisa el margin-left inline que pone el JS) */
    #main-wrapper { margin-left: 0 !important; }
    .topbar { left: 0 !important; padding: 0.5rem 0.7rem; }
    .main-content { padding: 1rem 0.8rem; }
    .page-title { font-size: 1rem; }
}
/* Fondo oscuro detrás del cajón (solo cuando está abierto en celular) */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
}
.sidebar-backdrop.show { display: block; }

/* ============================================================
   Listados: en el celular las tablas se vuelven TARJETAS
   (en vez de scroll horizontal). Marcar la <table> con
   .tabla-movil y cada <td> con data-label="Etiqueta".
   Variantes de celda:
     .celda-titulo   → primera celda, hace de título de la tarjeta
     .celda-bloque   → contenido rico (etiqueta arriba, valor abajo)
     .celda-acciones → botones (centrados, sin etiqueta)
   ============================================================ */
@media (max-width: 767.98px) {
    /* El contenedor deja de necesitar scroll horizontal */
    .table-responsive:has(.tabla-movil) { overflow-x: visible; }

    table.tabla-movil { width: 100%; }
    table.tabla-movil thead { display: none; }            /* la etiqueta va en cada celda */
    table.tabla-movil tbody,
    table.tabla-movil tr,
    table.tabla-movil td { display: block; width: 100%; }

    table.tabla-movil > tbody > tr {
        background: #fff;
        border: 1px solid var(--anfibio-gris-medio);
        border-radius: 12px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        margin-bottom: 0.7rem;
        padding: 0.5rem 0.9rem;
    }
    /* Anular el rayado de table-striped dentro de las tarjetas */
    table.tabla-movil.table-striped > tbody > tr:nth-of-type(odd) > * { background: transparent; }

    table.tabla-movil > tbody > tr > td {
        display: flow-root;            /* contiene el float del label sin recortar dropdowns */
        width: 100%;
        text-align: right;
        padding: 0.4rem 0;
        border: 0;
        border-bottom: 1px solid #f1f1f1;
        white-space: normal !important;
    }
    table.tabla-movil > tbody > tr > td:last-child { border-bottom: 0; }

    /* Etiqueta a la izquierda (sale del atributo data-label); el valor queda a la derecha */
    table.tabla-movil > tbody > tr > td[data-label]::before {
        content: attr(data-label);
        float: left;
        margin-right: 1rem;
        font-weight: 600;
        color: var(--anfibio-gris-texto);
        text-align: left;
    }

    /* Primera celda = título de la tarjeta */
    table.tabla-movil > tbody > tr > td.celda-titulo {
        text-align: left;
        font-weight: 700;
        font-size: 1rem;
        padding-bottom: 0.5rem;
        margin-bottom: 0.15rem;
        border-bottom: 1px solid #ececec;
    }
    table.tabla-movil > tbody > tr > td.celda-titulo::before { content: none; }

    /* Celda con contenido rico/multilínea: etiqueta arriba, valor debajo (alineado a la izquierda) */
    table.tabla-movil > tbody > tr > td.celda-bloque { text-align: left; }
    table.tabla-movil > tbody > tr > td.celda-bloque::before {
        content: attr(data-label);
        display: block;
        float: none;
        margin-right: 0;
        font-weight: 600;
        color: var(--anfibio-gris-texto);
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-bottom: 0.2rem;
    }

    /* Celda de acciones: botones centrados (gana sobre text-end/text-center del markup) */
    table.tabla-movil > tbody > tr > td.celda-acciones {
        text-align: center !important;
        padding-top: 0.6rem;
    }
    table.tabla-movil > tbody > tr > td.celda-acciones::before { content: none; }

    /* En modo tarjeta mostramos también las columnas que en escritorio se
       ocultan (d-none d-md/lg-table-cell): en el celular hay espacio vertical. */
    table.tabla-movil > tbody > tr > td.d-none { display: flow-root !important; }

    /* …pero nunca las celdas realmente vacías (deben quedar sin línea en blanco) */
    table.tabla-movil > tbody > tr > td:empty { display: none !important; }

    /* Tarjetas en modo oscuro (solo en el celular) */
    body.dark-mode table.tabla-movil > tbody > tr {
        background: #2c3038 !important;
        border-color: #3e434c !important;
    }
    body.dark-mode table.tabla-movil > tbody > tr > td { border-bottom-color: #3a3f47 !important; }
    body.dark-mode table.tabla-movil > tbody > tr > td.celda-titulo { border-bottom-color: #3e434c !important; }
}

/* ====== Topbar ====== */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--anfibio-gris-medio);
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: left .25s ease;
}

.topbar .page-title {
    margin: 0;
    font-weight: 700;
    color: var(--anfibio-negro);
    font-size: 1.15rem;
}

.topbar .user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--anfibio-gris-texto);
}

.topbar .user-chip .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--anfibio-amarillo);
    color: var(--anfibio-negro);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ====== Contenido ====== */
.main-content {
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: hidden;       /* evita que contenidos anchos rompan el layout */
    min-width: 0;             /* permite que flex-children se contraigan */
}

/* ====== Tarjetas de métricas ====== */
.stat-card {
    border: none;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .card-body {
    padding: 1.25rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.3rem;
    background: var(--anfibio-amarillo);
    color: var(--anfibio-negro);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.5rem 0 0;
    color: var(--anfibio-negro);
}

.stat-card .stat-label {
    color: var(--anfibio-gris-texto);
    font-size: 0.85rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ====== Botones marca ====== */
.btn-anfibio {
    background-color: var(--anfibio-amarillo);
    border-color: var(--anfibio-amarillo);
    color: var(--anfibio-negro);
    font-weight: 600;
}
.btn-anfibio:hover,
.btn-anfibio:focus {
    background-color: var(--anfibio-amarillo-oscuro);
    border-color: var(--anfibio-amarillo-oscuro);
    color: var(--anfibio-negro);
}

.btn-anfibio-dark {
    background-color: var(--anfibio-negro);
    border-color: var(--anfibio-negro);
    color: #fff;
    font-weight: 600;
}
.btn-anfibio-dark:hover {
    background-color: #000;
    color: var(--anfibio-amarillo);
}

/* ====== Login ====== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFD514;
    background-image: radial-gradient(circle at 80% 20%, rgba(255, 235, 130, 0.45) 0%, transparent 55%),
                      radial-gradient(circle at 15% 85%, rgba(255, 255, 255, 0.20) 0%, transparent 55%);
}

.login-card {
    max-width: 420px;
    width: 100%;
    border: none;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
    padding: 2rem 1.75rem;
    background: #fff;
}

.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-brand img {
    max-width: 240px;
    height: auto;
}

.login-brand .brand-text {
    color: var(--anfibio-negro);
    font-weight: 800;
    font-size: 2rem;
    margin: 0;
    letter-spacing: 2px;
}

.login-brand .brand-text span {
    color: var(--anfibio-amarillo);
}

.login-brand small {
    color: var(--anfibio-gris-texto);
    display: block;
    margin-top: 0.25rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.form-control:focus {
    border-color: var(--anfibio-amarillo);
    box-shadow: 0 0 0 0.18rem rgba(245, 185, 33, 0.25);
}

/* ====== Kanban — versión página completa ====== */
.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

.kanban-col {
    flex: 0 0 260px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 260px);
    min-height: 120px;
}

.kanban-col-header {
    padding: 0.65rem 0.85rem;
    border-top: 4px solid #ccc;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--anfibio-negro);
}

.kanban-col-title {
    font-weight: 600;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
}

.kanban-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-col-header .badge {
    background: rgba(255,255,255,0.15) !important;
    color: #fff;
    font-size: 0.72rem;
}

.kanban-col-body {
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
    background: var(--anfibio-gris-claro);
    border-radius: 0 0 10px 10px;
}

.kanban-col-empty {
    text-align: center;
    color: #bbb;
    font-size: 0.78rem;
    padding: 1.5rem 0.5rem;
    pointer-events: none;
}

/* ---- Tarjeta (compartida entre kanban page y dashboard) ---- */
.kanban-card-item,
.kanban-card-dash {
    background: #fff;
    border-radius: 7px;
    margin-bottom: 0.45rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: grab;
    position: relative;
    transition: box-shadow 0.12s;
    overflow: hidden;
    border: 1px solid var(--anfibio-gris-medio);
}

.kanban-card-item:hover,
.kanban-card-dash:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.13);
    border-color: var(--anfibio-amarillo);
}

.kanban-card-item:active,
.kanban-card-dash:active { cursor: grabbing; }

/* Barras de etiquetas */
.kanban-card-labels {
    display: flex;
    gap: 4px;
    padding: 6px 8px 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.kanban-label-bar {
    height: 8px;
    min-width: 36px;
    border-radius: 4px;
    flex: 1 0 36px;
    max-width: 52px;
    transition: filter 0.1s;
}

.kanban-label-bar:hover { filter: brightness(1.15); }

.kanban-card-body { padding: 0.45rem 0.7rem 0; }

.kanban-card-link {
    position: absolute;
    inset: 0;
    border-radius: 7px;
    z-index: 0;
}

.kanban-card-numero {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--anfibio-gris-texto);
    letter-spacing: 0.3px;
    margin-bottom: 0.15rem;
}

.kanban-card-titulo {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--anfibio-negro);
    line-height: 1.35;
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-cliente {
    font-size: 0.75rem;
    color: var(--anfibio-gris-texto);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.35rem;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    padding-bottom: 0.4rem;
}

.kanban-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: var(--anfibio-gris-texto);
    padding: 1px 4px;
    border-radius: 4px;
}

.kanban-badge.done    { color: #198754; }
.kanban-badge.overdue { color: #dc3545; font-weight: 600; background: rgba(220,53,69,0.08); }

/* ---- Drag & drop ---- */
.kanban-ghost {
    opacity: 0.35;
    background: rgba(245,185,33,0.12) !important;
    border: 2px dashed var(--anfibio-amarillo) !important;
}

.kanban-drag {
    box-shadow: 0 6px 20px rgba(0,0,0,0.18) !important;
    transform: rotate(1.5deg);
}

/* ====== Kanban dashboard (columnas más angostas dentro del card) ====== */
.kanban-board-dash {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 0.75rem;
    align-items: flex-start;
    background: var(--anfibio-gris-claro);
    min-height: 200px;
}

.kanban-col-dash {
    flex: 0 0 190px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 340px);
}

.kanban-col-header-dash {
    padding: 0.55rem 0.7rem;
    border-top: 3px solid #ccc;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--anfibio-negro);
}

.kanban-col-title-dash {
    font-weight: 600;
    font-size: 0.76rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #fff;
}

.kanban-col-body-dash {
    padding: 0.4rem;
    overflow-y: auto;
    flex: 1;
    min-height: 50px;
    background: var(--anfibio-gris-claro);
    border-radius: 0 0 8px 8px;
}

/* ====== Planificación semanal ====== */
.plan-semana {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .plan-semana { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
    .plan-semana { grid-template-columns: repeat(2, 1fr); }
}

.plan-dia {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    overflow: hidden;
    min-height: 120px;
}

.plan-dia-sabado {
    background: #fffbf0;
    border: 1px solid #fde68a;
}

.plan-dia-hoy .plan-dia-header {
    background: var(--anfibio-amarillo);
    color: var(--anfibio-negro);
}

.plan-dia-header {
    background: var(--anfibio-negro);
    color: #fff;
    padding: 0.55rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.plan-dia-sabado .plan-dia-header {
    background: #fd7e14;
    color: #fff;
}

.plan-dia-nombre {
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-dia-fecha {
    font-size: 0.78rem;
    opacity: 0.8;
}

.plan-dia-body {
    padding: 0.5rem;
}

.plan-vacio {
    text-align: center;
    color: #ccc;
    font-size: 0.85rem;
    padding: 1rem 0;
}

.plan-card {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.4rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--anfibio-gris-medio);
    transition: box-shadow 0.12s;
}

.plan-card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.13);
    border-color: var(--anfibio-amarillo);
}

.plan-card-estado {
    width: 4px;
    flex-shrink: 0;
}

.plan-card-body {
    padding: 0.4rem 0.55rem;
    flex: 1;
    background: #fff;
}

.plan-card-numero {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--anfibio-gris-texto);
    margin-bottom: 0.1rem;
}

.plan-card-titulo {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--anfibio-negro);
    line-height: 1.3;
    margin-bottom: 0.1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plan-card-cliente {
    font-size: 0.72rem;
    color: var(--anfibio-gris-texto);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-card-precio {
    font-size: 0.72rem;
    font-weight: 600;
    color: #198754;
    margin-top: 0.15rem;
}

/* ====== Tablas ====== */
.table thead th {
    background: var(--anfibio-negro);
    color: #fff;
    font-weight: 600;
    border: none;
}

.table tbody tr:hover {
    background: rgba(245, 185, 33, 0.06);
}

/* ====== Badges de estado OT ====== */
.badge-estado {
    padding: 0.35em 0.7em;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* ====== Presupuestos ====== */
.badge-pres {
    display: inline-block;
    padding: 0.3em 0.7em;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}
.badge-pres-borrador  { background: #6c757d; color: #fff; }
.badge-pres-enviado   { background: #0d6efd; color: #fff; }
.badge-pres-aprobado  { background: #198754; color: #fff; }
.badge-pres-rechazado { background: #dc3545; color: #fff; }
.badge-pres-vencido   { background: #fd7e14; color: #fff; }

.pres-items-table thead th {
    background: var(--anfibio-negro);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    padding: 0.55rem 0.75rem;
}
.pres-items-table tbody td {
    vertical-align: middle;
    padding: 0.45rem 0.75rem;
}

/* ====== Planificación: drag-and-drop ====== */
.plan-card {
    position: relative; /* needed for stretched-link */
    cursor: grab;
}
.plan-card:active { cursor: grabbing; }

.plan-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.plan-drag-handle {
    display: flex;
    align-items: center;
    padding: 0 0.4rem;
    color: #aaa;
    font-size: 0.9rem;
    cursor: grab;
    position: relative;
    z-index: 2;   /* por encima del stretched-link */
    flex-shrink: 0;
}
.plan-drag-handle:hover { color: #555; }
.plan-drag-handle:active { cursor: grabbing; }

.plan-ghost {
    opacity: 0.35;
    background: rgba(245,185,33,0.15) !important;
    border: 2px dashed var(--anfibio-amarillo) !important;
    border-radius: 6px;
}

.plan-dragging {
    box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important;
    transform: rotate(1deg);
    cursor: grabbing !important;
    z-index: 200;
}

.plan-drop-zone {
    min-height: 50px;
    transition: background .15s;
}
.plan-drop-zone.sortable-over {
    background: rgba(245,185,33,0.08);
    border-radius: 0 0 10px 10px;
}

/* Zona "sin fecha" — cards en fila con wrap */
.plan-sin-fecha-zone {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    min-height: 70px;
}
.plan-sin-fecha-zone .plan-card {
    width: 170px;
    flex-shrink: 0;
}
.plan-sin-fecha-zone .plan-vacio {
    width: 100%;
}

/* =======================================================
   Stock — Indicadores visuales de rollos
   ======================================================= */

/* Indicador tipo cápsula (rollo visto de costado) */
.roll-gauge {
    width: 44px;
    height: 88px;
    border: 2px solid #ced4da;
    border-radius: 22px;
    background: #f1f3f5;
    position: relative;
    overflow: hidden;
    display: inline-block;
    flex-shrink: 0;
}

/* Relleno de color (material restante) */
.roll-gauge .rg-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    border-radius: 0 0 20px 20px;
    transition: height .35s ease, background .35s ease;
}

/* Núcleo del rollo (círculo central) */
.roll-gauge .rg-core {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 18px; height: 18px;
    background: #fff;
    border: 2px solid #ced4da;
    border-radius: 50%;
    z-index: 2;
}

/* Estado vacío / sin rollo en uso */
.roll-gauge.rg-empty {
    border-style: dashed;
    background: #fff;
    opacity: .55;
}

/* Chips para rollos cerrados */
.roll-chip {
    display: inline-block;
    width: 11px;
    height: 22px;
    background: linear-gradient(to bottom, #F5B921, #d4a017);
    border: 1px solid #c49510;
    border-radius: 5px;
    opacity: .9;
}

/* =======================================================
   MODO OSCURO
   ======================================================= */
body.dark-mode {
    background-color: #1a1d23 !important;
    color: #d8dde3 !important;
}
body.dark-mode .main-content { background-color: transparent; }
body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .dropdown-menu {
    background-color: #262a30 !important;
    color: #d8dde3 !important;
    border-color: #353a42 !important;
}
body.dark-mode .card-header,
body.dark-mode .card-footer { background-color: #2c3038 !important; border-color: #353a42 !important; }
body.dark-mode .table        { color: #d8dde3 !important; }
body.dark-mode .table-light  { background-color: #2c3038 !important; color: #d8dde3 !important; }
body.dark-mode .table-light th { background: #2c3038 !important; color: #d8dde3 !important; }
body.dark-mode .table-hover tbody tr:hover { background-color: rgba(245,185,33,0.05) !important; }
body.dark-mode .table tbody tr,
body.dark-mode .table tbody td { background: transparent !important; color: #d8dde3 !important; border-color: #353a42 !important; }
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .input-group-text {
    background-color: #2c3038 !important;
    color: #d8dde3 !important;
    border-color: #3e434c !important;
}
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus { background-color: #2c3038 !important; color: #d8dde3 !important; border-color: var(--anfibio-amarillo) !important; }
body.dark-mode .form-control::placeholder { color: #888 !important; }

/* ─────────────────────────────────────────────────────────────────────
   Inputs de FECHA en modo OSCURO
   El navegador renderiza los dígitos del input[type=date] con color del
   sistema, no del CSS — para forzarlo a blanco hace falta `color-scheme`.
   También aplicamos al body.dark-mode entero por si algún input nuevo
   no respeta la regla específica.
   ───────────────────────────────────────────────────────────────────── */
body.dark-mode { color-scheme: dark; }
body.dark-mode input[type="date"],
body.dark-mode input[type="time"],
body.dark-mode input[type="datetime-local"],
body.dark-mode input[type="month"],
body.dark-mode input[type="week"] {
    color-scheme: dark !important;
    color: #f0f2f5 !important;
    background-color: #2c3038 !important;
}
body.dark-mode input[type="date"]::-webkit-datetime-edit,
body.dark-mode input[type="date"]::-webkit-datetime-edit-fields-wrapper,
body.dark-mode input[type="date"]::-webkit-datetime-edit-text,
body.dark-mode input[type="date"]::-webkit-datetime-edit-month-field,
body.dark-mode input[type="date"]::-webkit-datetime-edit-day-field,
body.dark-mode input[type="date"]::-webkit-datetime-edit-year-field {
    color: #f0f2f5 !important;
}
body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator,
body.dark-mode input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.3);
    cursor: pointer;
}
body.dark-mode .text-muted    { color: #8b929c !important; }
body.dark-mode .text-dark     { color: #d8dde3 !important; }
body.dark-mode .bg-white      { background-color: #262a30 !important; }
body.dark-mode .bg-light      { background-color: #2c3038 !important; color: #d8dde3 !important; }
body.dark-mode .border        { border-color: #3e434c !important; }
body.dark-mode .border-bottom { border-bottom-color: #3e434c !important; }
body.dark-mode .border-top    { border-top-color: #3e434c !important; }
body.dark-mode .breadcrumb a  { color: #c8d3e0 !important; }
body.dark-mode .alert-info    { background-color: #1d3a4a !important; color: #b8dff5 !important; border-color: #2a5670 !important; }
body.dark-mode .alert-success { background-color: #1d3a25 !important; color: #b8e6c5 !important; border-color: #2a5638 !important; }
body.dark-mode .alert-warning { background-color: #3a2e15 !important; color: #ffd966 !important; border-color: #5e4a1e !important; }
body.dark-mode .alert-danger  { background-color: #3a1d20 !important; color: #ff9a9d !important; border-color: #5e2a30 !important; }
body.dark-mode .btn-outline-dark      { color: #d8dde3 !important; border-color: #4a505b !important; }
body.dark-mode .btn-outline-dark:hover { background-color: #4a505b !important; color: #fff !important; }
body.dark-mode .btn-outline-secondary  { color: #b0b6bf !important; border-color: #4a505b !important; }
body.dark-mode .nav-tabs .nav-link.active { background-color: #262a30 !important; border-color: #3e434c #3e434c #262a30 !important; color: var(--anfibio-amarillo) !important; }
body.dark-mode .badge.bg-light { background-color: #3e434c !important; color: #d8dde3 !important; }
body.dark-mode .dashboard-bg { background: #15171c !important; }
body.dark-mode .dashboard-bg .card { background: #262a30 !important; }
body.dark-mode .topbar { background-color: #262a30 !important; border-bottom-color: #353a42 !important; }
body.dark-mode .page-title { color: #d8dde3 !important; }
body.dark-mode .sidebar-brand { background: #f4f4f4 !important; }  /* logo se mantiene legible */
body.dark-mode .progress { background-color: #353a42 !important; }
body.dark-mode hr, body.dark-mode .dropdown-divider { border-color: #3e434c !important; }
body.dark-mode .dropdown-item { color: #d8dde3 !important; }
body.dark-mode .dropdown-item:hover { background-color: #2c3038 !important; }
body.dark-mode pre, body.dark-mode code { background-color: #2c3038 !important; color: #d8dde3 !important; }

/* No invertir en print */
@media print { body.dark-mode { background: #fff !important; color: #000 !important; } }

/* Toggle button */
.theme-toggle { transition: transform .25s; }
.theme-toggle:hover { transform: rotate(15deg); }
