@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

/**
 * SmartClean - Estilos globales
 */

:root {
    --bg: #e8e8e8;
    --card: #ffffff;
    --accent: #82B83E;
    --nav-dark: #000d44;
    --nav-mid: #004aac;
    --mav-mid: #004aac;
    --nav-light: #345681;
    --text: #1a1a1a;
    --muted: #5a5a5a;
    --danger: #c0392b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

button,
input,
select,
textarea {
    font-family: inherit;
}

body {
    font-family: 'Open Sans', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===== Login ===== */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: #071a2f;
    background-image:
        linear-gradient(135deg, rgba(5, 15, 30, 0.72), rgba(8, 35, 70, 0.48)),
        var(--login-bg-image, url('fondo_login.webp'));
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: linear-gradient(135deg, rgba(255,255,255,0.24), rgba(255,255,255,0.1));
    color: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 18px 40px rgba(0,0,0,0.35);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.login-box h1,
.recover-box h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: #fff;
}

.login-box .subtitle,
.recover-box .subtitle {
    color: rgba(255,255,255,0.95);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-box .form-group label {
    color: rgba(255,255,255,0.95);
}

.login-box .form-group .hint {
    color: rgba(255,255,255,0.85) !important;
}

.login-box .form-group input {
    background: rgba(6, 23, 44, 0.45);
    border: 1px solid rgba(255,255,255,0.42);
    color: #fff;
}

.login-box .form-group input::placeholder {
    color: rgba(255,255,255,0.78);
}

.login-box .form-group input:focus {
    border-color: #b7e37a;
    box-shadow: 0 0 0 3px rgba(130,184,62,0.35);
}

.login-box .msg-err {
    background: rgba(192,57,43,0.35);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.login-box .logo-fallback {
    display: none;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #fff;
}

.login-box .password-wrap .eye-btn {
    color: rgba(255,255,255,0.8);
}

.login-box .password-wrap .eye-btn:hover {
    color: #fff;
}

.login-box .recover-link {
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

.login-box .btn {
    width: 100%;
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #e8894f, #dd6d27);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.28);
}

/* ===== Recuperar ===== */
body.recover-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.recover-box {
    width: 100%;
    max-width: 400px;
    background: linear-gradient(135deg, rgba(255,255,255,0.24), rgba(255,255,255,0.1));
    border-radius: 16px;
    padding: 2.5rem;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 18px 40px rgba(0,0,0,0.35);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.recover-box h1 { color: #fff; }
.recover-box .subtitle { color: rgba(255,255,255,0.95); }

.recover-box .form-group input {
    background: rgba(6, 23, 44, 0.45);
    border: 1px solid rgba(255,255,255,0.42);
    color: #fff;
}

.recover-box .form-group input:focus {
    border-color: #b7e37a;
    box-shadow: 0 0 0 3px rgba(130,184,62,0.35);
}

.recover-box .form-group label {
    color: rgba(255,255,255,0.95);
}

.recover-box .form-group input::placeholder {
    color: rgba(255,255,255,0.78);
}

.btn-secondary {
    display: block;
    text-align: center;
    margin-top: 1rem;
    background: transparent;
    color: var(--nav-mid);
    text-decoration: none;
}

.btn-secondary:hover { text-decoration: underline; }

.recover-box .logo-fallback {
    display: none;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #fff;
}

.recover-box .btn {
    width: 100%;
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #e8894f, #dd6d27);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.28);
}

.recover-box .btn-secondary {
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

.recover-box .msg.ok {
    background: rgba(226, 232, 240, 0.9);
    color: #1f2937;
    border: 1px solid rgba(255,255,255,0.45);
}

/* ===== Formularios comunes ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 0.8rem;
    background: #fff;
    border: 1px solid rgba(52, 152, 219, 0.55);
    border-radius: 5px;
    color: var(--text);
    font-size: 0.85rem;
}

.form-group input[readonly]:not([type="checkbox"]),
.form-group textarea[readonly],
.form-group select:disabled,
.form-group input:disabled:not([type="checkbox"]) {
    background: #f1f3f5;
    border-color: #cfd8dc;
    color: #8a9298;
    cursor: not-allowed;
}

.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }
.form-group .hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.form-group input[type="checkbox"] { width: auto; max-width: none; margin-right: 0.5rem; vertical-align: middle; }
.form-group .checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

/* Buscador dentro de cards de tablas */
.table-search-wrap {
    position: relative;
    width: 100%;
}

.table-search-wrap.with-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.table-search-wrap.with-filter .table-search-input {
    flex: 1 1 auto;
    min-width: 260px;
}

.table-search-wrap.with-filter .table-search-icon {
    top: 22px;
}

.table-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.table-search-input {
    width: 100%;
    max-width: 100%;
    height: 44px;
    padding: 0.6rem 0.85rem 0.6rem 2.55rem;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    border: 1px solid rgba(52, 152, 219, 0.55);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.92rem;
    box-shadow: inset 0 1px 2px rgba(0, 13, 68, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.table-search-input:focus {
    outline: none;
    border-color: var(--nav-mid);
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(0, 13, 68, 0.12), 0 0 0 2px rgba(0, 74, 172, 0.15);
}

.table-filter-select {
    width: 280px;
    max-width: 280px;
    min-width: 220px;
    height: 44px;
    padding: 0.6rem 0.85rem;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    border: 1px solid rgba(52, 152, 219, 0.55);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.92rem;
    box-shadow: inset 0 1px 2px rgba(0, 13, 68, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.table-filter-select:focus {
    outline: none;
    border-color: var(--nav-mid);
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(0, 13, 68, 0.12), 0 0 0 2px rgba(0, 74, 172, 0.15);
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn:hover { opacity: 0.9; }
.btn-primary { background: #dd6d27; color: white; }
.btn-secondary { background: var(--nav-light); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.8rem; margin-top: 0; }
.btn-icon-danger {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(192, 57, 43, 0.35);
    background: rgba(192, 57, 43, 0.12);
    color: var(--danger);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.btn-icon-danger:hover {
    background: rgba(192, 57, 43, 0.2);
    border-color: rgba(192, 57, 43, 0.55);
    transform: translateY(-1px);
}

.btn-icon-danger svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

.msg {
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.msg.ok { background: rgba(0,74,172,0.15); color: var(--nav-mid); }
.msg.err,
.msg-err {
    padding: 0.75rem 1rem;
    background: rgba(192,57,43,0.15);
    color: var(--danger);
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.logo-img {
    display: block;
    max-width: 300px;
    max-height: 110px;
    margin: 0 auto 1.25rem;
    object-fit: contain;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 3rem;
}

.password-wrap .eye-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-wrap .eye-btn:hover {
    color: var(--nav-mid);
}

.recover-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--nav-mid);
    text-decoration: none;
}

.recover-link:hover { text-decoration: underline; }

/* ===== Layout / Header ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: 260px;
    background: var(--nav-light);
    color: #fff;
    flex-shrink: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem 0 1.25rem 1.25rem;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0;
}

.sidebar .logo-img {
    max-height: 100px;
    max-width: 100%;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.sidebar-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    color: inherit;
    width: 24px;
    min-height: 80px;
    align-self: stretch;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.nav-main {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}

.nav-section-title {
    width: 100%;
    margin: 0;
    padding: 0.48rem 1.25rem;
    border: none;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.40);
    text-align: left;
    font-size: 0.9rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-family: inherit;
}

.nav-section-title:hover {
    background: rgba(0, 0, 0, 0.78);
}

.nav-section-arrow {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.75rem;
    transform: rotate(90deg);
    transition: transform 0.2s ease;
}

.nav-section.is-collapsed .nav-section-arrow {
    transform: rotate(0deg);
}

.nav-section-content {
    display: flex;
    flex-direction: column;
}

.nav-section.is-collapsed .nav-section-content {
    display: none;
}

.nav-main .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.2s, color 0.2s;
}

.nav-main .nav-link.nav-link-sub {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-size: 0.8rem;
    padding-left: 1.25rem;
}

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

.nav-main .nav-link.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-left: 3px solid var(--accent);
    padding-left: calc(1.25rem - 3px);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.9rem 1.25rem 1.1rem;
    border-top: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.82);
    font-size: 0.75rem;
    line-height: 1.4;
}

.sidebar-footer p + p {
    margin-top: 0.2rem;
}

.app-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.top-company {
    font-weight: 700;
    color: var(--nav-dark);
    white-space: nowrap;
}

.sidebar-toggle-mobile {
    display: none;
    background: rgba(0,13,68,0.08);
    border: none;
    color: var(--nav-dark);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
}

.app-layout.sidebar-collapsed .sidebar-toggle-mobile {
    display: flex;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.9rem;
    color: var(--text);
    margin-left: auto;
}

.user-name { font-weight: 500; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    background: #eceff3;
    color: #3f4650;
}

.user-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6a7380;
}

.btn-logout {
    padding: 0.4rem 0.9rem;
    background: #dd6d27;
    color: #fff !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn-logout:hover { opacity: 0.9; }

.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-x: auto;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 50vw;
        z-index: 1000;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    .sidebar-toggle { display: flex; }
    .sidebar-toggle-mobile { display: flex !important; }
    .top-bar .user-tipo-badge { display: none; }
    .main-content { padding: 1rem; }
}

/* ===== Dashboard ===== */
h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--nav-mid);
}

.subtitle {
    color: var(--muted);
    margin-bottom: 2rem;
}

.monitor-live {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.monitor-zone {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.zone-title {
    font-size: 1.05rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #3b3b3b;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.zone-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
}

.zone-dot-blue { background: #2d75c7; }
.zone-dot-red { background: #d94c43; }
.zone-dot-orange { background: #d8962f; }

.monitor-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 0.8rem;
}

.monitor-kpi {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
}

.monitor-kpi-label {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    color: #4f4f4f;
    font-weight: 600;
}

.monitor-kpi-value {
    margin: 0.1rem 0 0.2rem;
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1;
}

.monitor-kpi-help {
    margin: 0;
    font-size: 0.88rem;
    color: #444;
}

.monitor-kpi-danger .monitor-kpi-value { color: #c0392b; }
.monitor-kpi-warn .monitor-kpi-value { color: #b76c06; }
.monitor-kpi-ok .monitor-kpi-value { color: #568d24; }
.monitor-kpi-neutral .monitor-kpi-value { color: #2a2a2a; }

.mini-kpi-number {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    color: #568d24;
    margin: 0.2rem 0 0.35rem;
    text-align: center;
}

.mini-kpi-text {
    margin: 0;
    color: #4f4f4f;
    text-align: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

a {
    color: var(--nav-mid);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

.bar-list { list-style: none; }

.bar-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.bar-label {
    min-width: 140px;
    font-size: 0.9rem;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: rgba(0,0,0,0.08);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--nav-mid), var(--nav-light));
    border-radius: 6px;
    transition: width 0.4s ease;
}

.bar-value {
    min-width: 2.5rem;
    text-align: right;
    font-weight: 600;
    color: var(--nav-mid);
}

.chart-wrap { height: 200px; margin-top: 0.5rem; }

.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.stat-box {
    flex: 1;
    min-width: 120px;
    padding: 1rem;
    background: rgba(0,74,172,0.1);
    border-radius: 8px;
    text-align: center;
}

.stat-box .num { font-size: 1.5rem; font-weight: 700; color: var(--nav-mid); }
.stat-box .lbl { font-size: 0.75rem; color: var(--muted); }

.user-card {
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(0,74,172,0.06);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.user-card h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--nav-mid); }

.moments-list { list-style: none; }

.moments-list li {
    padding: 0.35rem 0;
    font-size: 0.9rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.moments-list li .time { color: var(--text); font-weight: 500; min-width: 140px; }
.moments-list li .qr { font-size: 0.8rem; opacity: 0.8; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.equipo-uso-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.equipo-uso-item {
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(0, 74, 172, 0.05);
}

.equipo-uso-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.equipo-uso-name {
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
}

.equipo-uso-hours {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.equipo-uso-track {
    height: 14px;
    width: 100%;
    border-radius: 999px;
    background: rgba(0, 74, 172, 0.8);
    overflow: hidden;
}

.equipo-uso-fill {
    height: 100%;
    border-radius: inherit;
    background: #82B83E;
    transition: width 0.35s ease;
}

.equipo-uso-fill.warning {
    background: #f39c12;
}

.equipo-uso-fill.danger {
    background: #c0392b;
}

.preventivo-alert-band {
    position: relative;
    margin: 0.5rem 0 1rem;
    padding: 0.65rem 2rem 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid #d8b74f;
    background: #fff5cc;
    color: #6e5600;
    font-size: 0.9rem;
    line-height: 1.35;
}

.preventivo-alert-band.is-hidden {
    display: none;
}

.preventivo-alert-item {
    font-weight: 600;
}

.preventivo-alert-close {
    position: absolute;
    top: 0.25rem;
    right: 0.45rem;
    border: none;
    background: transparent;
    color: #8a6d00;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

.sede-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: rgba(0,74,172,0.2);
    color: var(--nav-mid);
    border-radius: 6px;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.sede-badge.fuera {
    background: rgba(90,90,90,0.2);
    color: var(--muted);
}

.qr-valido-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    margin-left: 0.5rem;
}

.qr-valido-badge.correcto {
    background: rgba(0,74,172,0.2);
    color: var(--nav-mid);
}

.qr-valido-badge.invalido {
    background: rgba(248,81,73,0.2);
    color: var(--danger);
}

/* ===== Tablas CRUD ===== */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

th {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.85rem;
}

tr:hover { background: rgba(0,0,0,0.02); }

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.actions form {
    display: inline-flex !important;
    margin: 0;
    padding: 0;
    align-items: center;
}

.actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    height: 30px;
}

.qr-box {
    display: inline-block;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-top: 0.5rem;
    border: 1px solid rgba(0,0,0,0.08);
}

.qr-box img { display: block; }

.qr-box-sede {
    padding: 0.5rem;
}

.qr-box-sede img {
    width: 90px;
    height: 90px;
}

.geo-btn { margin-top: 0.35rem; font-size: 0.85rem; }

.crud-form-card .crud-form-toggle {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0 0 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.crud-form-card .crud-form-toggle h2 {
    margin: 0;
}

.crud-form-card .crud-form-arrow {
    color: var(--nav-mid);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-90deg);
    transition: transform 0.2s ease;
}

.crud-form-card .crud-form-arrow svg {
    display: block;
}

.crud-form-card:not(.is-collapsed) .crud-form-arrow {
    transform: rotate(90deg);
}

.crud-form-card.is-collapsed .crud-form-body {
    display: none;
}

.geo-box {
    background: rgba(130, 184, 62, 0.14);
    border: 1px solid rgba(130, 184, 62, 0.4);
    border-radius: 10px;
    padding: 0.9rem;
    margin-top: 0.4rem;
}

.geo-box .geo-btn {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.empty-state {
    color: var(--muted);
    padding: 2rem;
    text-align: center;
}

.estado-badge { font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 6px; }
.estado-disponible { background: rgba(0,74,172,0.2); color: var(--nav-mid); }
.estado-en_uso { background: rgba(59,130,246,0.25); color: #2980b9; }
.estado-bloqueado { background: rgba(192,57,43,0.2); color: var(--danger); }
.estado-mantenimiento { background: rgba(130,184,62,0.25); color: var(--accent); }

.activo-si { color: var(--nav-mid); }
.activo-no { color: var(--muted); }

.avatar-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

.google-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: rgba(59,130,246,0.25);
    color: #2980b9;
    border-radius: 4px;
}

/* ===== Badge tipo de usuario (header + tabla) ===== */
.user-tipo-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.user-tipo-badge.tipo-administrador,
.tipo-badge.tipo-administrador {
    background: rgba(0,74,172,0.2);
    color: var(--nav-mid);
}

.user-tipo-badge.tipo-coordinador,
.tipo-badge.tipo-coordinador {
    background: rgba(130,184,62,0.2);
    color: var(--accent);
}

.user-tipo-badge.tipo-operario,
.tipo-badge.tipo-operario {
    background: rgba(90,90,90,0.2);
    color: var(--muted);
}

.user-tipo-badge.tipo-super,
.tipo-badge.tipo-super {
    background: #82B83E;
    color: #fff;
}

.tipo-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ===== Filtro de Fechas ===== */
.filtro-fechas-card {
    margin-bottom: 1.5rem;
}

.filtro-fechas-form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.filtro-fechas-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filtro-fechas-group label {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
}

.filtro-fechas-group input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(52, 152, 219, 0.55);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    font-size: 0.85rem;
    min-width: 160px;
    height: 36px;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filtro-fechas-group input[type="date"]:focus {
    outline: none;
    border-color: var(--nav-mid);
    box-shadow: 0 0 0 2px rgba(0,74,172,0.15);
}

.filtro-fechas-group input[type="date"]:hover {
    border-color: var(--nav-mid);
}

.filtro-fechas-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filtro-fechas-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    line-height: 1;
    box-sizing: border-box;
    white-space: nowrap;
    font-size: 0.9rem;
    margin-top: 20px;
}

.filtro-fechas-info {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--muted);
    align-self: center;
}

.filtro-fechas-info strong {
    color: var(--nav-mid);
}

@media (max-width: 600px) {
    .filtro-fechas-form {
        flex-direction: column;
        align-items: stretch;
    }
    .filtro-fechas-info {
        margin-left: 0;
    }
}

@media (max-width: 1100px) {
    .monitor-kpi-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 680px) {
    .monitor-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Badge distancia fuera de rango ===== */
.distancia-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
    border-radius: 6px;
    margin-left: 0.25rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===== Uniformizacion de estilos compartidos ===== */
.link-white { color: #fff !important; }
.text-muted { color: var(--muted); }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-075 { margin-bottom: 0.75rem; }
.mt-075 { margin-top: 0.75rem; }
.fs-085 { font-size: 0.85rem; }
.fs-08 { font-size: 0.8rem; }
.hidden { display: none !important; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.section-head h2 { margin: 0; }

.list-reset {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-stack-md {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.list-stack-sm {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.item-soft-accent {
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    background: rgba(130, 184, 62, 0.12);
}

.item-soft-blue {
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    background: rgba(0, 74, 172, 0.06);
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}

.item-row-meta { font-size: 0.83rem; }
.text-strong { font-weight: 600; color: var(--text); }
.text-muted-sm { font-size: 0.82rem; color: var(--muted); }
.text-success { color: #82B83E; font-weight: 600; }
.text-blue-strong { color: #004aac; font-weight: 600; }
.text-success-soft { color: #6f9f34; font-weight: 500; }

/* ===== Registro de Visitas ===== */
.checklist-items-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checklist-item-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 74, 172, 0.18);
    background: linear-gradient(180deg, #ffffff 0%, #f6f9fc 100%);
}

.checklist-item-content {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-width: 0;
}

.checklist-item-title {
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.35;
}

.checklist-item-delete {
    margin: 0;
    flex-shrink: 0;
}

.checklist-delete-form {
    margin-top: 0.45rem;
}

.checklist-item-add-form .form-group {
    margin-bottom: 0.55rem;
}

.checklist-item-add-form .form-group:last-of-type {
    margin-bottom: 0.45rem;
}

.checklist-item-add-form .form-group label {
    font-size: 0.8rem;
}

.checklist-item-add-form .btn {
    width: 100%;
}

tr.checklist-row-a > td {
    background: rgba(0, 74, 172, 0.035);
}

tr.checklist-row-b > td {
    background: rgba(130, 184, 62, 0.06);
}

tr.checklist-row-a:hover > td {
    background: rgba(0, 74, 172, 0.07);
}

tr.checklist-row-b:hover > td {
    background: rgba(130, 184, 62, 0.12);
}

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
}

.progress-fill-inasistencia {
    background: linear-gradient(90deg, #82B83E 0%, #d35400 100%);
}

.progress-fill-cobertura {
    background: linear-gradient(90deg, #82B83E 0%, #004aac 100%);
}

.badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.badge-inline-accent { background: rgba(130, 184, 62, 0.12); }
.badge-inline-blue { background: rgba(0, 74, 172, 0.08); }

.full-span-card { grid-column: 1 / -1; }
.chart-wrap-md { height: 220px; }

.socket-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.socket-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.socket-status.connected { background: rgba(39, 174, 96, 0.15); color: #27ae60; }
.socket-status.connected .dot { background: #27ae60; animation: pulse-dot 2s infinite; }
.socket-status.disconnected { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.socket-status.disconnected .dot { background: #e74c3c; }
.socket-status.connecting { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.socket-status.connecting .dot { background: #f39c12; animation: pulse-dot 0.5s infinite; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.card.updating {
    box-shadow: 0 0 0 2px rgba(0, 74, 172, 0.3);
    transition: box-shadow 0.3s ease;
}

.last-update-info {
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: 0.5rem;
}

.error-shell {
    font-family: 'Open Sans', 'Segoe UI', system-ui, sans-serif;
    padding: 2rem;
    background: #1a1a1a;
    color: #fff;
}

.error-shell-title { color: #f85149; }
.error-shell-back { color: #00d4aa; }
