/* =====================================================
   ESTILOS GENERALES
===================================================== */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

:root {
    --app-font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    /* Ancho útil principal (tarjeta blanca): más aire que el antiguo 1100px para tablas y textos */
    --app-layout-max-width: 1360px;
    --app-layout-min-gutter: 20px;
}

body {
    font-family: var(--app-font-family);
    margin: 0;
    padding: 0;
    background: #f0f2f5;
    color: #333;
    padding-top: 70px; /* altura navbar + margen */
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

/* Mantiene consistencia tipográfica en todas las pantallas */
body.font-excel {
    font-family: var(--app-font-family);
}

h1, h2 {
    margin-bottom: 20px;
    color: #333;
}

.container {
    background: #fff;
    padding: 30px clamp(18px, 2.8vw, 42px);
    border-radius: 1px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    margin: 0 auto 40px;
    width: min(var(--app-layout-max-width), calc(100% - (var(--app-layout-min-gutter) * 2)));
    max-width: var(--app-layout-max-width);
    /* Evita que tablas / texto largo ensanchen la tarjeta y se salgan del viewport */
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* =====================================================
   LOGIN
===================================================== */
body.login {
    display: grid;
    grid-template-rows: 1fr auto;
    justify-items: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #6CC1FF, #3A8DFF);
    padding: 16px;
    padding-top: 16px;
}

.container.centered {
    background: #fff;
    padding: 50px 60px;
    border-radius: 1px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 450px;
    text-align: center;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    grid-row: 1;
    align-self: center;
}

.container.centered img.logo {
    max-width: 320px;
    height: auto;
    margin-bottom: 30px;
}

body.login { color: #333; }

/* Inputs y botones globales */
input[type="email"],
input[type="password"],
input[type="text"],
input[type="file"],
input[type="number"] {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 18px;
    border-radius: 1px;
    border: 1px solid #ccc;
    font-size: 16px;
    background: #fff;
    font-family: inherit;
}

button {
    width: 100%;
    padding: 14px;
    border: none;
    background: #3A8DFF;
    color: #fff;
    font-size: 18px;
    border-radius: 1px;

    cursor: pointer;
    transition: 0.3s;
    font-family: inherit;
}

button:hover {
    background: #2574D8;
}

body.login button:disabled,
body.login button[disabled] {
    background: #8eb8ea;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.95;
}

body.login button:disabled:hover,
body.login button[disabled]:hover {
    background: #8eb8ea;
}

.error {
    color: red;
    margin-bottom: 15px;
}

.message.success {
    color: #0d6832;
    margin-bottom: 15px;
    text-align: left;
}

.text-muted {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    margin: 0 0 20px;
    text-align: left;
}

body.login .form-footer {
    margin-top: 22px;
    font-size: 15px;
    text-align: center;
}

body.login .form-footer a {
    color: #2a5fb3;
    text-decoration: none;
}

body.login .form-footer a:hover {
    text-decoration: underline;
}

body.login .form-footer--inline {
    margin-top: 14px;
    font-size: 14px;
}

/* Footer global inyectado por config.php: en login debe ir debajo del formulario */
body.login > footer {
    grid-row: 2;
    width: min(450px, 100%);
    margin-top: 8px !important;
    padding: 0 !important;
    border-top: none !important;
    color: rgba(255, 255, 255, 0.9) !important;
    text-align: center;
    font-size: 12px !important;
    line-height: 1.35;
}

body.login > footer a {
    color: #fff;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* =====================================================
   NAVBAR (mobile-first: táctil / iPhone “sitio escritorio” usa pointer: coarse → hamburguesa)
===================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 60px;
    height: auto;
    background: #3A8DFF;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 0 14px;
    border-radius: 1px;
    z-index: 999;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.navbar-logo {
    flex-shrink: 0;
}

.navbar-logo img {
    max-height: 40px;
    display: block;
}

.navbar-user {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Panel de enlaces colapsado hasta pulsar ☰ (JS pone display:flex) */
.navbar-menu {
    list-style: none;
    display: none;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 8px 0 4px;
    width: 100%;
    flex: 1 1 100%;
    order: 3;
    max-width: 100%;
    box-sizing: border-box;
    background: #3A8DFF;
    border-radius: 1px;
}

.navbar-toggle {
    display: block;
    flex-shrink: 0;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

/* Ayuda (icono ?) */
.navbar-menu a.navbar-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 4px 7px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    box-sizing: border-box;
}

.navbar-menu a.navbar-help:hover {
    background: rgba(255, 255, 255, 0.25);
}

.navbar-menu li a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 1px;
    transition: 0.3s;
    width: 100%;
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    display: block;
    box-sizing: border-box;
}

.navbar-menu li a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.navbar-menu li a.navbar-help {
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

.navbar-menu li.dropdown {
    position: relative;
}

.navbar-menu li.dropdown .dropdown-menu {
    display: none;
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    background: #3A8DFF;
    flex-direction: column;
    border-radius: 1px;
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 1000;
}

.navbar-menu li.dropdown .dropdown-menu li a {
    padding: 10px 16px;
    display: block;
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
}

/* Escritorio con ratón/puntero fino: barra horizontal clásica */
@media (min-width: 992px) and (pointer: fine) {
    .navbar {
        flex-wrap: nowrap;
        height: 60px;
        padding: 0 25px;
        row-gap: 0;
    }

    .navbar-left {
        flex: 0 1 auto;
        gap: 20px;
        min-width: auto;
    }

    .navbar-logo img {
        max-height: 100%;
    }

    .navbar-user {
        font-size: 18px;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .navbar-toggle {
        display: none;
    }

    .navbar-menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 16px;
        width: auto;
        flex: 0 1 auto;
        order: 0;
        padding: 0;
        background: transparent;
    }

    .navbar-menu li a {
        width: auto;
        text-align: left;
        background: transparent;
        display: inline-block;
        padding: 10px 16px;
    }

    .navbar-menu li.dropdown .dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: auto;
        min-width: 180px;
        background: #3A8DFF;
    }

    .navbar-menu li.dropdown .dropdown-menu li a {
        display: block;
        text-align: left;
        background: transparent;
        padding: 10px 16px;
    }

    .navbar-menu li.dropdown:hover .dropdown-menu {
        display: flex;
    }

    .navbar-menu li a.navbar-help {
        display: inline-flex;
        margin-left: 0;
        margin-right: 0;
    }
}

/* =====================================================
   FORMULARIOS
===================================================== */
.form {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.form label {
    margin-top: 15px;
    margin-bottom: 6px;
    font-weight: 600;
}

.form input,
.form textarea,
.form select {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 1px;
    margin-bottom: 14px;
}

.form textarea {
    resize: vertical;
    min-height: 90px;
}

.form button,
.form .btn-primary,
.form .btn-secondary {
    margin-top: 18px;
}
/* =====================================================
   FORMULARIOS - ÓRDENES DE TRABAJO
===================================================== */

.form.work-order {
    max-width: 100%;
    width: 100%;
    min-width: 0;
}

.form.work-order textarea {
    min-height: 120px;
}

/* =====================================================
   TABLAS
===================================================== */
.table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table th,
.table td {
    padding: 6px 8px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: break-word;
}

.table th {
    background: #f5f7fa;
    font-weight: 600;
}

/* =====================================================
   BOTONES SECUNDARIOS
===================================================== */
.btn-primary {
    background: #3A8DFF;
    color: #fff;
    padding: 10px 16px;
    border-radius: 1px;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary {
    background: #ccc;
    color: #333;
    padding: 10px 16px;
    border-radius: 1px;
    text-decoration: none;
    display: inline-block;
}
/* =====================================================
   AJUSTES FINALES FORMULARIOS
===================================================== */

select,
textarea {
    border-radius: 1px;
    font-family: inherit;
}

/* =====================================================
   CALENDARIO (7 DÍAS)
===================================================== */
.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.calendar-toolbar__hidden-link {
    opacity: 0;
    pointer-events: none;
    width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.calendar-alert {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #d8e6ff;
    background: #edf4ff;
    color: #143d6b;
}

.calendar-alert--error {
    border-color: #f0c8cf;
    background: #fdecef;
    color: #7a1f2b;
}

.calendar-alert--success {
    border-color: #cbe9d4;
    background: #ebf8ef;
    color: #155724;
}

.autonomopro-calendar {
    max-width: 100%;
}

.autonomopro-calendar .fc {
    max-width: 100%;
}

.autonomopro-calendar .fc-toolbar-title {
    font-size: 1.05rem !important;
}

.autonomopro-calendar .fc-button {
    text-transform: none;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.autonomopro-calendar .fc .fc-toolbar-chunk:first-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.autonomopro-calendar .fc .fc-toolbar-chunk:first-child .fc-button-group {
    margin-right: 0;
}

.autonomopro-calendar .fc-timegrid-slot-label {
    font-size: 12px;
}

.autonomopro-calendar .fc-event {
    border: none !important;
    border-left: 4px solid #3A8DFF !important;
    border-radius: 6px !important;
    padding: 2px 4px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    overflow: hidden !important;
}

.autonomopro-calendar .fc-timegrid-event-harness {
    min-height: 110px;
}

.autonomopro-calendar .fc-timegrid-event,
.autonomopro-calendar .fc-timegrid-event .fc-event-main {
    height: 100%;
    overflow: hidden;
}

.autonomopro-calendar .fc-timegrid-event .fc-event-main-frame {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.autonomopro-calendar .fc-event-status-programada {
    background: #e3f2fd !important;
    border-left-color: #1565c0 !important;
    color: #124d91 !important;
}

.autonomopro-calendar .fc-event-status-en_curso {
    background: #ddf5d5 !important;
    border-left-color: #46f35d !important;
    color: #045504 !important;
}

.autonomopro-calendar .fc-event-status-en_curso_pausada {
    background: #f8d8d8 !important;
    border-left-color: #f5172a !important;
    color: #8e1120 !important;
}

.fc-ap-event {
    line-height: 1.25;
    min-height: 74px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    position: relative;
    padding-bottom: 18px;
}

.fc-ap-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
}

.fc-ap-time {
    font-size: 0.68rem;
    opacity: 0.92;
    white-space: nowrap;
}

.fc-ap-title {
    font-size: 0.74rem;
    font-weight: 700 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-ap-client,
.fc-ap-operator {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-ap-actions {
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 2px;
    margin-top: 0;
    overflow: visible;
}

.fc-ap-actions-icons {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-width: 18px;
}

.fc-ap-actions-icons--single {
    justify-content: flex-end;
    width: 100%;
}

.fc-ap-actions-icons--double {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.fc-ap-btn {
    width: auto;
    margin: 0;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.15;
    border: none;
    color: #fff;
    cursor: pointer;
    text-align: center;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-ap-btn-icon {
    min-width: 15px;
    width: 15px;
    height: 15px;
    padding: 0;
    border-radius: 3px;
    font-size: 9px;
    line-height: 15px;
    text-align: center;
    touch-action: manipulation;
}

.fc-ap-btn-start { background: #28a745 !important; }
.fc-ap-btn-pause { background: #fd7e14 !important; }
.fc-ap-btn-resume { background: #17a2b8 !important; }
.fc-ap-btn-finish { background: #dc3545 !important; }
.fc-ap-btn:hover { filter: brightness(0.95); }

.fc-ap-event-compact .fc-ap-actions {
    justify-content: flex-end;
}

.fc-ap-event-compact .fc-ap-btn {
    min-width: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    font-size: 8px;
}

.fc-ap-event-compact .fc-ap-client,
.fc-ap-event-compact .fc-ap-operator {
    display: block;
    font-size: 0.62rem;
    line-height: 1.15;
}

.calendar-modal[hidden] {
    display: none;
}

.calendar-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.calendar-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 22, 33, 0.45);
}

.calendar-modal__panel {
    position: relative;
    z-index: 1;
    max-width: 620px;
    width: calc(100% - 24px);
    margin: 6vh auto;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.calendar-modal__content {
    margin-top: 10px;
}

.calendar-modal__content p {
    margin: 8px 0;
}

.calendar-modal__actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.calendar-modal__actions .btn-primary,
.calendar-modal__actions .btn-secondary {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.calendar-wrap {
    margin-top: 20px;
    overflow-x: auto;
    margin-left: -4px;
    margin-right: -4px;
}

.calendar-7 {
    display: grid;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    gap: 16px;
    min-width: 980px;
}

.calendar-day {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    min-height: 180px;
    max-height: 420px;
    overflow-y: auto;
    background: #fafafa;
    min-width: 0;
}

.calendar-day h4 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #3A8DFF;
    font-size: 1rem;
}

.calendar-day .date-num {
    display: block;
    font-size: 1.25rem;
    color: #333;
}

.calendar-day .weekday {
    font-size: 0.85rem;
    color: #666;
    text-transform: capitalize;
}

.calendar-order {
    font-size: 0.9rem;
    padding: 8px;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 6px;
    border-left: 4px solid #3A8DFF;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Colores por estado (alineados con listado de órdenes) */
.calendar-order.status-en_curso {
    background: #ddf5d5;
    border-left-color: #46f35d;
    color: #045504;
}

.calendar-order.status-en_curso a {
    color: #045504;
}

.calendar-order:last-child {
    margin-bottom: 0;
}

.calendar-order a {
    color: #3A8DFF;
    text-decoration: none;
    font-weight: 600;
}

.calendar-order a:hover {
    text-decoration: underline;
}

/* En curso pausada: rojo (debe ir después para prevalecer sobre .calendar-order a) */
.calendar-order.status-en_curso-pausada,
.calendar-order.status-en_curso-pausada a {
    color: #f5172a;
}
.calendar-order.status-en_curso-pausada {
    background: #f8d8d8;
    border-left-color: #f5172a;
}
.calendar-order.status-en_curso-pausada a:hover {
    color: #f5172a;
}

.calendar-order .time {
    color: #666;
    font-size: 0.85rem;
}

.calendar-order .client {
    margin-top: 4px;
    color: #444;
}

.calendar-order-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

.calendar-order-actions form {
    margin: 0;
}

.calendar-order-actions button {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 6px;
    white-space: normal;
    word-break: normal;
}

.calendar-no-orders {
    color: #999;
    font-size: 0.9rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.calendar-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #3A8DFF;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.calendar-nav a:hover {
    background: #2a7ae8;
}

.calendar-nav .nav-today {
    background: #666;
}

.calendar-nav .nav-today:hover {
    background: #555;
}

.calendar-nav .nav-range {
    margin-left: auto;
    font-size: 1rem;
    color: #333;
}

/* =====================================================
   ESTILOS EXTRAÍDOS DE INLINE (agrupados por archivo)
===================================================== */

/* --- Utilidades compartidas (varios archivos) --- */
.mb-20 { margin-bottom: 20px; }
.mb-10 { margin-bottom: 10px; }
.mt-20 { margin-top: 20px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-25 { margin-top: 25px; }
.ml-10 { margin-left: 10px; }
.text-error { color: red; }
.text-success { color: green; }
.text-warning { color: #856404; }
.text-muted { font-size: 0.9rem; color: #666; }
.text-muted-sm { font-size: 0.9em; color: #555; }
.text-center { text-align: center; }
.m-0 { margin: 0; }
.inline { display: inline; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.flex-gap { display: flex; gap: 0.5rem; align-items: center; }
.flex-label { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.btn-link-no-underline { text-decoration: none; }
.block-center { display: block; text-align: center; }
.btn-cancel { display: block; margin-top: 12px; text-align: center; padding: 10px; border-radius: 8px; text-decoration: none; background: #e0e0e0; color: #333; }
.alert-success { background: #d4edda; color: #155724; padding: 15px; border-radius: 4px; margin-bottom: 20px; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; padding: 15px; border-radius: 4px; margin-bottom: 20px; border: 1px solid #f5c6cb; }
.logo-img { max-height: 120px; max-width: 100%; margin: 20px 0; }
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 1rem;
}
.required { color: red; }

/* =====================================================
   BLOQUES <style> EXTRAÍDOS - clients.php
===================================================== */
.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
}
.action-icon {
    font-size: 18px;
    text-decoration: none;
    cursor: pointer;
}
.action-icon.view { color: #5bc0de; }
.action-icon.edit { color: #3A8DFF; }
.action-icon.delete { color: #d9534f; }
.action-icon.toggle { color: #f0ad4e; }
.action-icon:hover { opacity: 0.7; }

/* =====================================================
   BLOQUES <style> EXTRAÍDOS - work_orders/index.php, work_orders/all.php
===================================================== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
}
.status-borrador   { background: #f0f0f0; color: #555; }
/* Programada: azul */
.status-programada { background: #e3f2fd; color: #1565c0; }
/* En curso (activa): verde */
.status-en_curso   { background: #ddf5d5; color: #045504; }
/* En curso pero pausada: rojo */
.status-en_curso-pausada { background: #f8d8d8; color: #f5172a; }
/* Resto de estados como antes */
.status-finalizada { background: #e8f5e9; color: #2e7d32; }
.status-facturada  { background: #f3e5f5; color: #6a1b9a; }
.status-cancelada  { background: #ffebee; color: #c62828; }
.status-contabilizada { background: #e0f7f9; color: #006064; }
.status-revision { background: #fff8e1; color: #8d6e00; }
.status-transcripcion { background: #e1f5fe; color: #01579b; }
.status-por_cobrar { background: #fce4ec; color: #880e4f; }
.status-cobrada { background: #c8e6c9; color: #1b5e20; font-weight: 600; }

.page-header .breadcrumb {
    font-size: 0.9rem;
    color: #666;
}
.page-header .breadcrumb a {
    color: #3A8DFF;
    text-decoration: none;
}
.page-header .breadcrumb a:hover {
    text-decoration: underline;
}

.pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.pagination .page-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 4px;
    background: #3A8DFF;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
}
.pagination .page-link.disabled {
    background: #ccc;
    cursor: default;
    pointer-events: none;
}
.pagination .page-info {
    font-size: 0.9rem;
    color: #555;
}

.search-form {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin: 1.5rem 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.search-form input {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    min-width: 0;
    flex: 1 1 12rem;
    max-width: 100%;
    box-sizing: border-box;
}

/* =====================================================
   BLOQUES <style> EXTRAÍDOS - billing/index.php
===================================================== */
.btn-invoice {
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgb(90, 183, 110);
    color: white;
}
.btn-invoice:hover { background: #218838; }
.no-orders {
    text-align: center;
    padding: 40px;
    color: #666;
}
.billing-total-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 18px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f8fbff 0%, #edf4ff 100%);
    border: 1px solid #d8e6ff;
    border-left: 4px solid #3A8DFF;
    border-radius: 4px;
}
.billing-total-card__label {
    font-size: 0.95rem;
    color: #335f8e;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.billing-total-card__amount {
    font-size: 1.35rem;
    color: #0f3f74;
    line-height: 1.1;
}

/* =====================================================
   BLOQUES <style> EXTRAÍDOS - billing/view.php
===================================================== */
.summary-box {
    background: #f5f7fa;
    padding: 20px;
    border-radius: 4px;
    margin: 20px 0;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px 12px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}
.summary-row:last-child {
    border-bottom: none;
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #3A8DFF;
}
.invoice-confirmation {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 20px;
    border-radius: 4px;
    margin: 20px 0;
}
.invoice-confirmation h3 {
    margin-top: 0;
    color: #856404;
}
.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    max-width: 100%;
}
.btn {
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 0;
    display: inline-block;
}
.btn.btn-primary { background: #3A8DFF; color: white; }
.btn.btn-success { background: #28a745; color: white; }
.btn.btn-secondary { background: #6c757d; color: white; }
.btn.btn-danger { background: #dc3545; color: white; }
.btn:hover { opacity: 0.9; }
.info-section {
    margin: 20px 0;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.info-section h3 { margin-bottom: 10px; color: #333; }

/* =====================================================
   BLOQUES <style> EXTRAÍDOS - calendar/work.php
===================================================== */
.work-actions { margin: 20px 0; display: flex; gap: 12px; flex-wrap: wrap; }
.work-actions form { display: inline; }
.btn-start { background: #28a745; color: #fff; }
.btn-start:hover { background: #218838; }
.btn-pause { background: #fd7e14; color: #fff; }
.btn-pause:hover { background: #e96a00; }
.btn-resume { background: #17a2b8; color: #fff; }
.btn-resume:hover { background: #138496; }
.btn-finish { background: #dc3545; color: #fff; }
.btn-finish:hover { background: #c82333; }
.internal-notes {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: auto;
}
.internal-notes-input {
    width: 100%;
    max-width: 600px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: inherit;
    box-sizing: border-box;
}

/* =====================================================
   BLOQUES <style> EXTRAÍDOS - view_client.php
===================================================== */
.client-details {
    max-width: var(--app-layout-max-width);
    width: 100%;
    min-width: 0;
    margin: 0 auto 40px;
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: break-word;
}
.client-details h2 { margin-bottom: 25px; }
.client-details p { font-size: 16px; margin-bottom: 15px; }
.btn-back {
    display: inline-block;
    padding: 14px;
    width: 100%;
    max-width: 200px;
    text-align: center;
    background: #3A8DFF;
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.3s;
}
.btn-back:hover { background: #2574D8; }

/* =====================================================
   REPORTES (índice, horas por cliente / operador)
===================================================== */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 16px;
    margin-top: 20px;
}
.report-card {
    border: 1px solid #dbe5f1;
    background: #f8fbff;
    padding: 18px;
    border-radius: 4px;
    min-width: 0;
}
.report-card h3 {
    margin: 0 0 10px;
    word-break: break-word;
}
.report-card p {
    margin: 0 0 16px;
    color: #4a5568;
    line-height: 1.4;
}

.report-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: flex-start;
    min-width: 0;
}
.report-toolbar h1 {
    margin-bottom: 8px;
    word-break: break-word;
}
.report-actions {
    display: flex;
    gap: 8px 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    min-width: 0;
}
.btn-export {
    color: #fff;
    padding: 10px 16px;
    border-radius: 1px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    min-width: 0;
    flex: 0 1 auto;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}
.btn-export:hover {
    filter: brightness(0.94);
}
.btn-export-csv {
    background: #ff9800;
}
.btn-export-excel {
    background: #2e7d32;
}
.report-filters {
    border: 1px solid #d8e6ff;
    background: #f8fbff;
    border-radius: 4px;
    padding: 14px;
    margin-bottom: 16px;
    max-width: 100%;
    box-sizing: border-box;
}
.report-filters-hint {
    margin-top: 0.75rem;
    margin-bottom: 0;
    font-size: 0.9rem;
}
.report-form-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    min-width: 0;
}
.report-form-grid.report-form-grid--collections {
    grid-template-columns: 1.1fr 1.1fr minmax(10rem, 1.8fr) auto;
}
.report-form-grid label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}
.report-form-grid input,
.report-form-grid select {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    box-sizing: border-box;
}
.report-form-grid .actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}
.report-form-grid .actions .btn-primary,
.report-form-grid .actions .btn-secondary {
    min-width: 0;
    text-align: center;
    flex: 0 1 auto;
}
.report-summary {
    margin: 16px 0;
    background: #f4f8ff;
    border: 1px solid #d8e6ff;
    padding: 12px;
    border-radius: 4px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 100%;
}
.excel-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    min-width: 0;
}
.excel-table th,
.excel-table td {
    border: 1px solid #d0d7de;
    padding: 7px 8px;
    font-size: 13px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: break-word;
}
.excel-table thead th {
    background: #e9f1ff;
}
.excel-table .right,
.right {
    text-align: right;
}
.pager-wrap {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.pager-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pager-link {
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #c8d8ef;
    background: #fff;
    color: #1f4d7a;
    font-weight: 600;
}
.pager-link.active {
    background: #3A8DFF;
    border-color: #3A8DFF;
    color: #fff;
}
.pager-link.disabled {
    pointer-events: none;
    opacity: 0.45;
}
.per-page-field {
    width: 100%;
    max-width: 120px;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .report-actions {
        justify-content: flex-start;
        width: 100%;
    }
    .report-form-grid {
        grid-template-columns: 1fr;
    }
    .report-form-grid .actions {
        justify-content: flex-start;
    }
}

/* =====================================================
   FACTURACIÓN — reporte (detalle por orden)
===================================================== */
body.page-billing-report details > summary {
    cursor: pointer;
    list-style: none;
}
body.page-billing-report details > summary::-webkit-details-marker {
    display: none;
}
body.page-billing-report details > summary::marker {
    content: "";
}
body.page-billing-report .flex-between .report-actions {
    display: flex;
    gap: 10px;
    margin: 10px 0 16px;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
}
.report-small {
    font-size: 12px;
    color: #666;
}
.report-kv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-top: 8px;
    min-width: 0;
}
.report-kv div {
    font-size: 13px;
    overflow-wrap: break-word;
    word-break: break-word;
}
.report-materials {
    margin-top: 8px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.report-materials table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    min-width: 0;
}
.report-materials th,
.report-materials td {
    border: 1px solid #ddd;
    padding: 6px;
    font-size: 12px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: break-word;
}
.report-materials th {
    background: #f5f5f5;
}
.report-summary-label {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    max-width: 100%;
}
.report-accounted-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: 4px;
    border-radius: 50%;
    background: #e0f7f9;
    color: #006064;
    text-decoration: none;
    font-size: 16px;
}
.report-accounted-btn:hover {
    background: #c2edf1;
}

/* =====================================================
   FACTURACIÓN — cobros (public/billing/collections.php)
===================================================== */
body.page-billing-collections .collections-page {
    max-width: none;
}
body.page-billing-collections .collections-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
body.page-billing-collections .collections-card {
    border: 1px solid #dbe3f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}
body.page-billing-collections .collections-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}
body.page-billing-collections .collections-card-head strong {
    font-size: 1.05rem;
    color: #1e293b;
    letter-spacing: -0.01em;
}
body.page-billing-collections .collections-card-head span {
    font-size: 0.9rem;
    color: #64748b;
}
body.page-billing-collections .collections-card-total {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}
body.page-billing-collections .collections-form {
    padding: 16px 18px 20px;
}
body.page-billing-collections .collections-form-grid {
    display: grid;
    column-gap: 28px;
    row-gap: 10px;
    align-items: stretch;
}
body.page-billing-collections .collections-form-label {
    display: block;
    margin: 0;
    padding: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    line-height: 1.35;
    align-self: end;
    min-height: 2.6em;
}
body.page-billing-collections .collections-form-label--action {
    color: #94a3b8;
    text-align: right;
}
body.page-billing-collections .collections-input,
body.page-billing-collections .collections-form-grid select.collections-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.25;
    color: #1e293b;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.page-billing-collections .collections-form-grid select.collections-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
body.page-billing-collections .collections-input:focus,
body.page-billing-collections .collections-form-grid select.collections-input:focus {
    outline: none;
    border-color: #3A8DFF;
    box-shadow: 0 0 0 3px rgba(58, 141, 255, 0.18);
}
body.page-billing-collections .collections-actions {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    margin: 0;
    padding: 0;
}
body.page-billing-collections .collections-btn-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    padding: 0 16px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.25;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(58, 141, 255, 0.35);
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}
body.page-billing-collections .collections-btn-save:hover {
    filter: brightness(0.94);
    box-shadow: 0 2px 6px rgba(58, 141, 255, 0.4);
}
@media (min-width: 821px) {
    body.page-billing-collections .collections-form-grid {
        grid-template-columns: minmax(0, 1.2fr) minmax(118px, 1fr) minmax(118px, 1fr) minmax(118px, 0.95fr) minmax(100px, 118px);
        grid-template-rows: auto 44px;
        grid-template-areas:
            "lb-inv lb-sent lb-coll lb-st lb-act"
            "in-inv in-sent in-coll in-st in-act";
    }
    body.page-billing-collections .collections-g-lb-inv { grid-area: lb-inv; }
    body.page-billing-collections .collections-g-lb-sent { grid-area: lb-sent; }
    body.page-billing-collections .collections-g-lb-coll { grid-area: lb-coll; }
    body.page-billing-collections .collections-g-lb-st { grid-area: lb-st; }
    body.page-billing-collections .collections-g-lb-act { grid-area: lb-act; }
    body.page-billing-collections .collections-g-in-inv { grid-area: in-inv; }
    body.page-billing-collections .collections-g-in-sent { grid-area: in-sent; }
    body.page-billing-collections .collections-g-in-coll { grid-area: in-coll; }
    body.page-billing-collections .collections-g-in-st { grid-area: in-st; }
    body.page-billing-collections .collections-g-in-act { grid-area: in-act; }
}
@media (max-width: 820px) {
    body.page-billing-collections .collections-form-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "lb-inv"
            "in-inv"
            "lb-sent"
            "in-sent"
            "lb-coll"
            "in-coll"
            "lb-st"
            "in-st"
            "lb-act"
            "in-act";
        column-gap: 0;
        row-gap: 6px;
    }
    body.page-billing-collections .collections-g-lb-inv { grid-area: lb-inv; }
    body.page-billing-collections .collections-g-lb-sent { grid-area: lb-sent; }
    body.page-billing-collections .collections-g-lb-coll { grid-area: lb-coll; }
    body.page-billing-collections .collections-g-lb-st { grid-area: lb-st; }
    body.page-billing-collections .collections-g-lb-act { grid-area: lb-act; }
    body.page-billing-collections .collections-g-in-inv { grid-area: in-inv; }
    body.page-billing-collections .collections-g-in-sent { grid-area: in-sent; }
    body.page-billing-collections .collections-g-in-coll { grid-area: in-coll; }
    body.page-billing-collections .collections-g-in-st { grid-area: in-st; }
    body.page-billing-collections .collections-g-in-act { grid-area: in-act; }
    body.page-billing-collections .collections-form-label {
        min-height: 0;
        align-self: start;
        margin-top: 8px;
    }
    body.page-billing-collections .collections-form-label:first-child {
        margin-top: 0;
    }
    body.page-billing-collections .collections-form-label--action {
        text-align: left;
        margin-top: 4px;
    }
}

.billing-row-even td {
    background: #e8f4ff;
}
.billing-row-odd td {
    background: #f3f3f3;
}

/* =====================================================
   IMPRESIÓN ORDEN (vista previa en pantalla)
===================================================== */
@page {
    size: A4;
    margin: 14mm;
}

body.page-print-order {
    background: #fff;
}
.print-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.print-sheet {
    max-width: 210mm;
    margin: 0 auto;
    min-width: 0;
}
.print-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    min-width: 0;
}
.print-logo {
    width: 120px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}
.print-title {
    margin: 0;
    word-break: break-word;
}
.print-meta {
    text-align: right;
    font-size: 13px;
    min-width: 0;
    flex: 1 1 200px;
}
.print-section {
    margin-top: 16px;
}
.print-kv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    min-width: 0;
}
.print-kv div {
    font-size: 13px;
    overflow-wrap: break-word;
    word-break: break-word;
}
.print-kv strong {
    display: inline-block;
    min-width: 0;
    max-width: 100%;
}
.print-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
.print-table th,
.print-table td {
    border: 1px solid #ddd;
    padding: 8px;
    font-size: 13px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: break-word;
}
.print-table th {
    background: #f5f5f5;
}
.print-summary {
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    border: 1px solid #ddd;
    box-sizing: border-box;
}
.print-summary .row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    flex-wrap: wrap;
}
.print-summary .row:last-child {
    border-bottom: 0;
}
.print-summary .total {
    font-weight: 700;
}

/* =====================================================
   FOTOS ORDEN
===================================================== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
    gap: 12px;
    min-width: 0;
}
.photo-grid-item {
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
    min-width: 0;
}
.photo-grid-item img {
    display: block;
    width: 100%;
    height: auto;
}
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.lightbox-overlay img {
    max-width: 95vw;
    max-height: 95vh;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
}
.lightbox-overlay.active {
    display: flex;
}

.table .text-end,
.table th.text-end,
.table td.text-end {
    text-align: right;
}

/* Impresión: solo en páginas marcadas con clase en body */
@media print {
    body.page-report .navbar,
    body.page-report .report-toolbar,
    body.page-report form,
    body.page-report .btn-secondary,
    body.page-report .btn-primary {
        display: none !important;
    }
    body.page-report .container {
        box-shadow: none;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    body.page-billing-report .navbar,
    body.page-billing-report .flex-between .report-actions {
        display: none !important;
    }
    body.page-billing-report .container {
        padding: 0 !important;
    }

    body.page-print-order .navbar,
    body.page-print-order .print-toolbar {
        display: none !important;
    }
    body.page-print-order .container {
        padding: 0 !important;
    }
    body.page-print-order a {
        text-decoration: none;
        color: inherit;
    }
}

/* =====================================================
   MÓVIL: listados, tablas y tarjeta principal
===================================================== */
@media (max-width: 1024px) and (pointer: coarse) {
    body {
        padding-top: 64px;
    }

    body.login {
        padding-top: 16px;
    }

    .container {
        padding: 16px clamp(10px, 3vw, 16px);
        width: calc(100% - max(12px, var(--app-layout-min-gutter)));
        max-width: none;
        margin-bottom: 24px;
    }

    h1, h2 {
        font-size: 1.15rem;
        line-height: 1.35;
        word-break: break-word;
    }

    .container.centered {
        padding: 28px 20px;
        width: calc(100% - 16px);
    }

    .client-details {
        padding: 18px 14px;
    }

    .summary-box {
        padding: 14px;
        max-width: 100%;
        box-sizing: border-box;
    }
    .billing-total-card {
        padding: 12px 14px;
    }
    .billing-total-card__amount {
        font-size: 1.15rem;
    }

    .flex-between {
        align-items: flex-start;
    }

    .page-header {
        align-items: flex-start;
    }

    /* Columnas repartidas dentro del ancho útil (evita desbordamiento) */
    .table,
    .excel-table,
    .print-table {
        table-layout: fixed;
    }

    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 0.9rem;
    }

    .excel-table th,
    .excel-table td,
    .print-table th,
    .print-table td {
        padding: 6px 4px;
        font-size: 0.8rem;
    }

    .report-materials table {
        table-layout: fixed;
    }

    .report-kv,
    .print-kv {
        grid-template-columns: 1fr;
    }

    .print-meta {
        text-align: left;
        flex: 1 1 100%;
    }

    .pagination {
        gap: 8px;
    }

    .calendar-nav .nav-range {
        margin-left: 0;
        width: 100%;
    }

    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .autonomopro-calendar .fc-toolbar {
        gap: 8px;
    }

    .autonomopro-calendar .fc-toolbar.fc-header-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .autonomopro-calendar .fc .fc-toolbar-chunk:first-child {
        justify-content: flex-start;
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .autonomopro-calendar .fc-toolbar-title {
        font-size: 0.95rem !important;
    }

    .autonomopro-calendar .fc .fc-button {
        padding: 0.35em 0.5em;
        font-size: 0.85rem;
    }

    .autonomopro-calendar .fc-timegrid-event {
        min-height: 110px;
    }

    .fc-ap-event {
        padding-bottom: 24px;
    }

    .fc-ap-actions {
        left: 3px;
        right: 3px;
        bottom: 3px;
    }

    .fc-ap-actions-icons {
        width: 100%;
    }

    .fc-ap-btn-icon {
        min-width: 22px;
        width: 22px;
        height: 22px;
        line-height: 22px;
        font-size: 12px;
        border-radius: 5px;
    }

    .fc-ap-title {
        font-size: 0.7rem;
    }

    .fc-ap-client,
    .fc-ap-operator {
        font-size: 0.62rem;
    }

    .fc-ap-btn {
        font-size: 10.5px;
        padding: 4px 5px;
    }

    .autonomopro-calendar .fc-timeGridWeek-view .fc-ap-header {
        gap: 1px;
        align-items: flex-start;
    }

    .autonomopro-calendar .fc-timeGridWeek-view .fc-ap-title {
        display: block;
        font-size: 0.78rem;
        font-weight: 700;
        line-height: 1.1;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        max-width: none;
    }

    .autonomopro-calendar .fc-timeGridWeek-view .fc-ap-time {
        display: block;
        font-size: 0.66rem;
        line-height: 1.05;
    }

    .autonomopro-calendar .fc-timeGridWeek-view .fc-ap-client,
    .autonomopro-calendar .fc-timeGridWeek-view .fc-ap-operator {
        display: none;
    }

    .calendar-modal__panel {
        margin: 3vh auto;
        padding: 12px;
    }

    .calendar-modal__actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .calendar-modal__actions .btn-primary,
    .calendar-modal__actions .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .calendar-order-actions {
        flex-direction: column;
        gap: 8px;
    }

    .calendar-order-actions form {
        width: 100%;
    }

    .calendar-order-actions button {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        font-size: 14px;
    }

    .container .btn-primary,
    .container .btn-secondary {
        max-width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .container p.mt-20 {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .container p.mt-20 .btn-primary,
    .container p.mt-20 .btn-secondary {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Escritorio: versión compacta limpia */
@media (min-width: 992px) {
    .calendar-day {
        padding: 10px;
    }

    .calendar-order {
        padding: 6px;
        margin-bottom: 6px;
        font-size: 0.82rem;
    }

    .calendar-order .time {
        font-size: 0.78rem;
    }

    .calendar-order .client {
        margin-top: 2px;
        font-size: 0.78rem;
        line-height: 1.25;
    }

    .calendar-order-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
        margin-top: 6px;
    }

    .calendar-order-actions form {
        width: 100%;
    }

    .calendar-order-actions button {
        width: 100%;
        padding: 5px 6px;
        font-size: 11px;
        line-height: 1.1;
        border-radius: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* =====================================================
   MÓVIL ESPECÍFICO: páginas de listados
   (no afecta escritorio ni otras vistas)
===================================================== */
@media (max-width: 1024px) and (pointer: coarse) {
    body.page-list-work-orders-index,
    body.page-list-work-orders-all,
    body.page-list-clients,
    body.page-list-billing-index {
        font-size: 9px;
    }

    body.page-list-work-orders-index h1,
    body.page-list-work-orders-index h2,
    body.page-list-work-orders-all h1,
    body.page-list-work-orders-all h2,
    body.page-list-clients h1,
    body.page-list-clients h2,
    body.page-list-billing-index h1,
    body.page-list-billing-index h2 {
        font-size: 0.68rem;
        margin-bottom: 6px;
    }

    body.page-list-work-orders-index .table th,
    body.page-list-work-orders-index .table td,
    body.page-list-work-orders-all .table th,
    body.page-list-work-orders-all .table td,
    body.page-list-clients .table th,
    body.page-list-clients .table td,
    body.page-list-billing-index .table th,
    body.page-list-billing-index .table td {
        font-size: 0.48rem;
        line-height: 1.05;
        padding: 2px 1px;
    }

    body.page-list-work-orders-index .status-badge,
    body.page-list-work-orders-all .status-badge {
        font-size: 0.44rem;
        padding: 1px 3px;
    }

    body.page-list-work-orders-index .actions,
    body.page-list-work-orders-all .actions,
    body.page-list-clients .actions,
    body.page-list-billing-index .actions {
        gap: 2px;
    }

    body.page-list-work-orders-index .action-icon,
    body.page-list-work-orders-all .action-icon,
    body.page-list-clients .action-icon,
    body.page-list-billing-index .action-icon {
        font-size: 8px;
    }

    body.page-list-work-orders-all .search-form input,
    body.page-list-work-orders-all .search-form button,
    body.page-list-work-orders-all .search-form .btn-link,
    body.page-list-clients .search-form input,
    body.page-list-clients .search-form button,
    body.page-list-clients .search-form .btn-link {
        font-size: 0.52rem;
    }

    body.page-list-billing-index .btn-invoice {
        font-size: 0.46rem;
        padding: 2px 4px;
    }

    body.page-list-work-orders-index .btn-primary,
    body.page-list-work-orders-index .btn-secondary,
    body.page-list-work-orders-all .btn-primary,
    body.page-list-work-orders-all .btn-secondary,
    body.page-list-clients .btn-primary,
    body.page-list-clients .btn-secondary,
    body.page-list-billing-index .btn-primary,
    body.page-list-billing-index .btn-secondary {
        font-size: 0.52rem;
        padding: 3px 5px;
    }

    body.page-list-work-orders-index .container,
    body.page-list-work-orders-all .container,
    body.page-list-clients .container,
    body.page-list-billing-index .container {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    body.page-list-work-orders-index .table th,
    body.page-list-work-orders-index .table td,
    body.page-list-work-orders-all .table th,
    body.page-list-work-orders-all .table td,
    body.page-list-clients .table th,
    body.page-list-clients .table td,
    body.page-list-billing-index .table th,
    body.page-list-billing-index .table td {
        font-size: 0.42rem;
        padding: 1px;
    }

    body.page-list-work-orders-index .action-icon,
    body.page-list-work-orders-all .action-icon,
    body.page-list-clients .action-icon,
    body.page-list-billing-index .action-icon {
        font-size: 7px;
    }

    body.page-list-work-orders-index .status-badge,
    body.page-list-work-orders-all .status-badge {
        font-size: 0.4rem;
        padding: 0 2px;
    }
}

@media (max-width: 390px) {
    body.page-list-work-orders-index .table th,
    body.page-list-work-orders-index .table td,
    body.page-list-work-orders-all .table th,
    body.page-list-work-orders-all .table td,
    body.page-list-clients .table th,
    body.page-list-clients .table td,
    body.page-list-billing-index .table th,
    body.page-list-billing-index .table td {
        font-size: 0.36rem;
        line-height: 1;
        padding: 0;
    }
}

/* =====================================================
   TABLAS A TARJETA EN MOVIL (listados clave)
===================================================== */
@media (max-width: 1024px) and (pointer: coarse) {
    body.page-list-work-orders-index .table,
    body.page-list-work-orders-all .table,
    body.page-list-clients .table,
    body.page-list-billing-index .table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    body.page-list-work-orders-index .table thead,
    body.page-list-work-orders-all .table thead,
    body.page-list-clients .table thead,
    body.page-list-billing-index .table thead {
        display: none !important;
    }

    body.page-list-work-orders-index .table tbody,
    body.page-list-work-orders-all .table tbody,
    body.page-list-clients .table tbody,
    body.page-list-billing-index .table tbody {
        display: block !important;
    }

    body.page-list-work-orders-index .table tr,
    body.page-list-work-orders-all .table tr,
    body.page-list-clients .table tr,
    body.page-list-billing-index .table tr {
        display: block !important;
        background: #fff;
        border: 1px solid #dfe3ea;
        border-radius: 8px;
        padding: 8px 7px;
        margin-bottom: 10px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    body.page-list-work-orders-index .table td,
    body.page-list-work-orders-all .table td,
    body.page-list-clients .table td,
    body.page-list-billing-index .table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        gap: 8px;
        width: 100% !important;
        border: 0 !important;
        border-bottom: 1px dashed #eceff4;
        padding: 4px 0;
        font-size: 0.72rem;
        line-height: 1.2;
        text-align: left !important;
    }

    body.page-list-work-orders-index .table td:last-child,
    body.page-list-work-orders-all .table td:last-child,
    body.page-list-clients .table td:last-child,
    body.page-list-billing-index .table td:last-child {
        border-bottom: 0;
    }

    body.page-list-work-orders-index .table td::before,
    body.page-list-work-orders-all .table td::before,
    body.page-list-clients .table td::before,
    body.page-list-billing-index .table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 42%;
        font-weight: 700;
        color: #3a4960;
        font-size: 0.66rem;
        line-height: 1.15;
        padding-right: 6px;
    }

    body.page-list-work-orders-index .table td > *:not(.actions),
    body.page-list-work-orders-all .table td > *:not(.actions),
    body.page-list-clients .table td > *:not(.actions),
    body.page-list-billing-index .table td > *:not(.actions) {
        margin-left: auto;
        text-align: right;
    }

    body.page-list-work-orders-index .table td .card-value-stack,
    body.page-list-work-orders-all .table td .card-value-stack {
        margin-left: auto;
        text-align: right;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0;
        line-height: 1.15;
    }

    body.page-list-work-orders-index .table td .card-value-stack small,
    body.page-list-work-orders-all .table td .card-value-stack small {
        font-size: inherit;
        font-weight: inherit;
        color: inherit;
        margin: 0;
        line-height: inherit;
    }

    body.page-list-work-orders-index .table td .actions,
    body.page-list-work-orders-all .table td .actions,
    body.page-list-clients .table td .actions,
    body.page-list-billing-index .table td .actions {
        margin-left: auto;
        justify-content: flex-end;
        width: auto;
    }

    /* Cabecera visual de tarjeta: Nº Orden y Estado destacados */
    body.page-list-work-orders-index .table td[data-label="Nº Orden"],
    body.page-list-work-orders-all .table td[data-label="Nº Orden"],
    body.page-list-billing-index .table td[data-label="Nº Orden"] {
        background: #f2f7ff;
        border: 1px solid #d7e5ff;
        border-radius: 6px;
        margin-bottom: 5px;
        padding: 5px 6px;
        font-weight: 700;
        font-size: 0.8rem;
    }

    body.page-list-work-orders-index .table td[data-label="Estado"],
    body.page-list-work-orders-all .table td[data-label="Estado"] {
        background: #f7f9fc;
        border: 1px solid #e3e8f1;
        border-radius: 6px;
        margin-bottom: 5px;
        padding: 5px 6px;
        font-weight: 700;
    }

    body.page-list-work-orders-index .table td[data-label="Nº Orden"]::before,
    body.page-list-work-orders-all .table td[data-label="Nº Orden"]::before,
    body.page-list-billing-index .table td[data-label="Nº Orden"]::before,
    body.page-list-work-orders-index .table td[data-label="Estado"]::before,
    body.page-list-work-orders-all .table td[data-label="Estado"]::before {
        color: #20314e;
        font-size: 0.64rem;
    }

    /* Barra inferior de acciones */
    body.page-list-work-orders-index .table td[data-label="Acciones"],
    body.page-list-work-orders-all .table td[data-label="Acciones"],
    body.page-list-clients .table td[data-label="Acciones"],
    body.page-list-billing-index .table td[data-label="Acciones"] {
        background: #f6f8fb;
        border: 1px solid #e4e9f1;
        border-radius: 6px;
        margin-top: 6px;
        padding: 5px 6px;
    }

    body.page-list-work-orders-index .table td[data-label="Acciones"]::before,
    body.page-list-work-orders-all .table td[data-label="Acciones"]::before,
    body.page-list-clients .table td[data-label="Acciones"]::before,
    body.page-list-billing-index .table td[data-label="Acciones"]::before {
        align-self: center;
    }

    body.page-list-work-orders-index .table td[data-label="Acciones"] .actions,
    body.page-list-work-orders-all .table td[data-label="Acciones"] .actions,
    body.page-list-clients .table td[data-label="Acciones"] .actions,
    body.page-list-billing-index .table td[data-label="Acciones"] .actions {
        width: 100%;
        justify-content: flex-end;
        gap: 12px;
    }
}
