:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --radius: 14px;
    --gap: 12px;
    --sidebar-w: 280px;
    --header-h: 56px;
    --card-pad: 12px;
}

@media (min-width: 1024px) {
    :root {
        --gap: 14px;
        --card-pad: 14px;
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    margin: 0;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body.photo-viewer-open {
    overflow: hidden;
}

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

/* Login Screen */
.login-screen {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

.login-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 3rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    animation: fadeIn 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-slot {
    width: 100%;
    height: 80px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo-img {
    max-height: 56px;
    object-fit: contain;
}

.login-header h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-form .btn-primary {
    justify-content: center;
}

.form-group--recaptcha {
    margin-top: -0.25rem;
}

.login-recaptcha-widget {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-recaptcha-widget > div {
    margin: 0 auto;
}

.form-group--recaptcha.form-group--recaptcha-test-key .login-recaptcha-widget {
    min-height: 64px;
    max-height: 64px;
    overflow: hidden;
}

.form-group--recaptcha.form-group--recaptcha-test-key .login-recaptcha-widget iframe {
    margin-top: -12px !important;
}

.login-recaptcha-hint {
    margin-top: 0.45rem;
    display: block;
    font-size: 0.78rem;
    line-height: 1.35;
    color: #64748b;
}

.login-recaptcha-hint[data-tone="error"] {
    color: #b91c1c;
}

.login-footer {
    margin-top: 1.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    color: var(--primary);
    font-size: 0.8rem;
}

.login-footer__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.login-footer__brand::before,
.login-footer__brand::after {
    content: '';
    display: block;
    width: clamp(26px, 10vw, 48px);
    height: 1.2px;
    background: var(--accent);
    border-radius: 999px;
}

.login-footer__link {
    color: var(--primary);
    font-weight: 400;
    text-decoration: underline;
    text-decoration-thickness: 1.2px;
    text-underline-offset: 4px;
}

.login-footer__link:hover {
    color: var(--accent-hover);
}

.app-footer {
    padding: 1.1rem calc(var(--gap) * 2) calc(1.4rem + env(safe-area-inset-bottom));
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    color: var(--primary);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    background: var(--bg-body);
}

@media (max-width: 1023px) {
    .app-footer {
        padding: 0.55rem calc(var(--gap) * 1.2) calc(0.7rem + env(safe-area-inset-bottom));
        gap: 0.35rem;
        font-size: 0.72rem;
    }
}

.login-container {
    max-width: 420px;
}

@media (max-width: 640px) {
    .login-container {
        padding: 2rem 1.5rem;
    }

    .form-group--recaptcha.form-group--recaptcha-test-key .login-recaptcha-widget {
        min-height: 62px;
        max-height: 62px;
    }

    .form-group--recaptcha.form-group--recaptcha-test-key .login-recaptcha-widget iframe {
        margin-top: -11px !important;
    }
}

.demo-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.demo-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.sidebar-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.sidebar-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.toast-container {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: none;
}

.toast-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto;
}

.toast-analysis {
    position: relative;
    pointer-events: auto;
    width: min(520px, calc(100vw - 24px));
    max-width: min(720px, calc(100vw - 24px));
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
    border: 2px solid #38bdf8;
    padding: 24px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.toast-analysis::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 16px;
    border: 2px solid rgba(56, 189, 248, 0.9);
    background: transparent;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.45), 0 0 18px rgba(56, 189, 248, 0.35);
    opacity: 1;
    z-index: 1;
    animation: toast-glow-pulse 1.4s ease-in-out infinite;
    pointer-events: none;
}

.toast-analysis::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 15px;
    background: #ffffff;
    z-index: -1;
}

@keyframes toast-glow-pulse {
    0% { opacity: 0.85; box-shadow: 0 0 8px rgba(56, 189, 248, 0.35), 0 0 18px rgba(56, 189, 248, 0.25); }
    50% { opacity: 1; box-shadow: 0 0 12px rgba(56, 189, 248, 0.55), 0 0 24px rgba(56, 189, 248, 0.45); }
    100% { opacity: 0.85; box-shadow: 0 0 8px rgba(56, 189, 248, 0.35), 0 0 18px rgba(56, 189, 248, 0.25); }
}

.toast-analysis__header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-analysis__title {
    font-size: 15px;
    font-weight: 600;
    color: #222222;
}

.toast-analysis__badge {
    font-size: 12px;
    font-weight: 500;
    color: #666666;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f3f4f6;
}

.toast-analysis__status {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
}

.toast-analysis__bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast-bar {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: #f0f0f0;
    overflow: hidden;
}

.toast-bar__fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: #22c55e;
    border-radius: inherit;
    transform-origin: left center;
    animation-timing-function: ease-in-out;
}

.toast-analysis__hint {
    font-size: 12px;
    color: #888888;
}

.toast-analysis--enter {
    opacity: 0;
    transform: translateY(-8px);
}

.toast-analysis--enter.toast-analysis--visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 160ms ease-out, transform 160ms ease-out;
}

.toast-analysis--exit {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 180ms ease-in, transform 180ms ease-in;
}

@keyframes toast-glow-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(1080deg);
    }
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: 1px solid var(--danger);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    filter: brightness(0.95);
}

.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.bulk-actions.hidden {
    display: none;
}

.bulk-actions__count {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
}

.bulk-actions__right {
    display: flex;
    gap: 8px;
}

.col-check {
    width: 36px;
    text-align: center;
}

.btn-block {
    width: 100%;
}

.app-container,
.app {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 40;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background-color: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: transform 0.22s ease, box-shadow 0.2s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.logo-area .logo-text {
    flex: 1;
    min-width: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    margin-top: 0.35rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.logo-text img {
    max-width: 420px;
    max-height: 144px;
    object-fit: contain;
}

.logo-text h2 {
    margin: 0.35rem 0 0;
    line-height: 1;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 400;
    line-height: 1;
}

.sidebar-collapse-btn {
    background: var(--primary-light);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    width: 29px;
    height: 29px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.sidebar-collapse-btn i {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
}

@media (max-width: 1023px) {
    .sidebar-collapse-btn {
        display: none;
    }

    .nav-item[data-view="facturacion"] {
        display: none;
    }
}

.main-nav {
    flex: 0 0 clamp(152px, 28%, 240px);
    min-height: 0;
    max-height: clamp(152px, 28%, 240px);
    display: flex;
    flex-direction: column;
}

.main-nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.55) var(--primary);
}

.sidebar-bottom {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
}

.sidebar-bottom-scroll {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
    padding-bottom: 0.35rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.55) var(--primary);
}

.main-nav-scroll::-webkit-scrollbar,
.sidebar-bottom-scroll::-webkit-scrollbar {
    width: 10px;
}

.main-nav-scroll::-webkit-scrollbar-track,
.sidebar-bottom-scroll::-webkit-scrollbar-track {
    background: var(--primary);
    border-radius: 999px;
}

.main-nav-scroll::-webkit-scrollbar-thumb,
.sidebar-bottom-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
    border: 2px solid var(--primary);
}

.main-nav-scroll::-webkit-scrollbar-thumb:hover,
.sidebar-bottom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.72);
}

.main-nav-scroll::-webkit-scrollbar-corner,
.sidebar-bottom-scroll::-webkit-scrollbar-corner {
    background: var(--primary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--primary-light);
    color: white;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-badge {
    margin-left: auto;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    background: #f97316;
    color: #fff;
}

.nav-badge[hidden] {
    display: none !important;
}

.sidebar-separator {
    height: 1px;
    width: 100%;
    background: var(--accent);
    opacity: 0.85;
    margin: 0.75rem 0;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 0.25rem 0.75rem 0.25rem;
}

.sidebar-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.sidebar-action-btn i {
    font-size: 1rem;
}

@media (min-width: 1024px) {
    .sidebar-collapsed .sidebar {
        width: 76px;
        flex: 0 0 76px;
        padding: 1.25rem 0.5rem;
    }

    .sidebar-collapsed #sidebarFilters,
    .sidebar-collapsed .sidebar-actions {
        display: none;
    }

    .sidebar-collapsed .sidebar-separator {
        display: none;
    }

    .sidebar-collapsed .logo-area {
        justify-content: center;
        margin-bottom: 1.5rem;
    }

    .sidebar-collapsed .logo-area .logo-text {
        display: none;
    }

    .sidebar-collapsed .sidebar-collapse-btn {
        margin-left: 0;
    }

    .sidebar-collapsed .main-nav {
        align-items: stretch;
        flex: 1 1 auto;
        max-height: none;
    }

    .sidebar-collapsed .main-nav-scroll {
        align-items: center;
        padding-right: 0;
    }

    .sidebar-collapsed .sidebar-bottom {
        flex: 0 0 auto;
        max-height: none;
    }

    .sidebar-collapsed .nav-item {
        justify-content: center;
        padding: 0.75rem 0;
    }

    .sidebar-collapsed .nav-item span {
        display: none;
    }

    .sidebar-collapsed .sidebar-collapse-btn i {
        transform: rotate(180deg);
    }

    .sidebar-collapsed .user-profile {
        justify-content: center;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        position: static;
        bottom: auto;
        background: transparent;
    }

    .sidebar-collapsed .user-info,
    .sidebar-collapsed .logout-btn {
        display: none;
    }
}

.valuation-upload-area {
    margin-top: 0.75rem;
}

.valuation-dropzone {
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    background-color: rgba(8, 68, 164, 0.02);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    cursor: pointer;
}

.valuation-dropzone-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.valuation-dropzone-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.valuation-dropzone.dragover {
    background-color: rgba(8, 68, 164, 0.06);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    flex-shrink: 0;
    padding: 1rem 0.25rem calc(0.5rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--primary-light);
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(8, 68, 164, 0) 0%, var(--primary) 28%);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.user-info .name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-info .role {
    font-size: 0.8rem;
    color: #94a3b8;
}

.logout-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--primary-light);
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.top-bar {
    height: var(--header-h);
    min-height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
    padding: 0 calc(var(--gap) * 1.6);
    position: sticky;
    top: 0;
    z-index: 30;
}

#page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-title-text {
    display: inline-flex;
    align-items: center;
}

.page-title-logo {
    display: none;
    height: 1.1em;
    width: auto;
    object-fit: contain;
}

.claim-number-inline {
    display: inline-flex;
    align-items: center;
    font-size: 0.8em; /* 20% smaller */
    color: var(--primary);
}

.claim-status-inline {
    display: inline-flex;
    align-items: center;
    font-size: 0.78em;
    color: var(--text-muted);
    margin-left: 0.4rem;
}

.inspecciones-hogar-status-inline {
    display: inline-flex;
    align-items: center;
    font-size: 0.78em;
    color: var(--text-muted);
    margin-left: 0.4rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid #d7dfe8;
    border-radius: 999px;
    background: #f7f9fc;
    line-height: 1.2;
    white-space: nowrap;
}

.control-ops-value {
    font-size: 0.9rem;
    line-height: 1.35;
    word-break: break-word;
}

.claim-number-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #c7d2fe;
}

.top-bar .actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.top-bar .actions.actions--claims {
    flex-wrap: nowrap;
}

.top-bar .actions.actions--claims .topbar-search {
    flex: 1;
    min-width: 0;
}

.top-bar .actions.actions--claims .btn-primary {
    white-space: nowrap;
}

.top-bar .actions.actions--dashboard {
    margin-left: auto;
}

.top-bar .actions.actions--compras {
    margin-left: auto;
}

.top-bar .actions.actions--gestion-proveedores {
    margin-left: auto;
}

.top-bar .actions.actions--tracking {
    margin-left: auto;
    flex-wrap: nowrap;
}

.top-bar .actions.actions--tracking .topbar-search {
    flex: 1;
    min-width: 0;
}

.top-bar .actions.actions--tracking .btn-primary {
    white-space: nowrap;
}

.claim-detail-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.claim-detail-quick-save-btn {
    width: 44px;
    min-width: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.claim-detail-quick-save-btn i {
    font-size: 1rem;
}

.btn-dashboard-filters {
    display: none;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.top-bar .actions .topbar-search input {
    min-width: 260px;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.top-bar .actions .topbar-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#sidebarFilters {
    margin: 0 0 0.75rem;
    padding: 0.75rem 0.75rem 0.25rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#sidebarFilters .claims-filter-tabs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow: visible;
}

#sidebarFilters .claims-filter-tabs .btn-primary,
#sidebarFilters .claims-filter-tabs .btn-secondary {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    min-height: 34px;
}

#sidebarFilters .claims-filter-tab {
    position: relative;
    overflow: visible;
}

#sidebarFilters .claims-filter-tab-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

#sidebarFilters .claims-filter-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(12, 20, 36, 0.95);
    pointer-events: none;
}

#sidebarFilters .claims-filter-badge[hidden] {
    display: none;
}

#sidebarFilters .group-filter-btn {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.2rem 0.6rem;
    text-align: left;
    padding: 0.7rem 0.75rem;
}

#sidebarFilters .group-filter-count {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.9;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
}

#sidebarFilters .group-filter-title {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    grid-column: 1;
    grid-row: 1;
}

#sidebarFilters .group-filter-desc {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.85;
    grid-column: 1 / -1;
    grid-row: 2;
}

#claimsGroupsPanel:not([hidden]),
#trackingCasesGroupsPanel:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-filter-group label {
    font-size: 0.75rem;
    opacity: 0.8;
}

.sidebar-flag-filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    overflow: hidden;
    justify-content: space-between;
}

.sidebar-flag-filters .claim-flag-toggle {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

.sidebar-flag-filters .claim-flag-toggle i {
    font-size: 0.75rem;
}

.sidebar-filter-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-filter-group select {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    background: rgba(0, 0, 0, 0.1);
    color: inherit;
    font-size: 0.8rem;
}

@media (max-width: 1023px) {
    .sidebar-filter-group select {
        font-size: 0.95rem;
        padding: 0.45rem 0.6rem;
        min-height: 42px;
    }
}

#sidebarFilters input[type="date"] {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    background: rgba(0, 0, 0, 0.1);
    color: #e2e8f0;
    font-size: 0.8rem;
}

#sidebarFilters input[type="text"],
#sidebarFilters input[type="search"] {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    background: rgba(0, 0, 0, 0.1);
    color: #e2e8f0;
    font-size: 0.8rem;
}

#sidebarFilters input[type="text"]::placeholder,
#sidebarFilters input[type="search"]::placeholder {
    color: rgba(226, 232, 240, 0.7);
}

#sidebarFilters input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
}

#sidebarFilters #dashboardClearDates,
#sidebarFilters #inspeccionesSidebarClearDates {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    font-size: 0.8rem;
    cursor: pointer;
}

.has-tooltip {
    position: relative;
}

.has-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: 110%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: normal;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.08s ease-in;
    z-index: 10;
    min-width: 260px;
    max-width: 520px;
}

.has-tooltip::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%) rotate(180deg);
    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
    opacity: 0;
    transition: opacity 0.08s ease-in;
    pointer-events: none;
    z-index: 11;
}

.has-tooltip:hover::after,
.has-tooltip:hover::before {
    opacity: 1;
}

.claims-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    flex-wrap: wrap;
}

.claims-pagination .page-size-control {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
}

.claims-pagination .page-size-control select {
    padding: 0.2rem 0.4rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border, #e0e0e0);
    font-size: 0.8rem;
    background: white;
}

.claims-pagination .page-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.claims-pagination .page-controls .btn-secondary {
    background: #ffffff;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-main);
    margin-right: 0;
}

.sidebar-toggle i {
    font-size: 1.25rem;
}

#content-area {
    flex: 1;
    overflow-y: auto;
    padding: calc(var(--gap) * 2);
    min-height: 0;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 1023px) {
    .app-container,
    .app {
        display: block;
    }

    .main-nav .nav-item[data-view="usuarios"],
    .main-nav .nav-item[data-view="clientes"],
    .main-nav .nav-item[data-view="inventario"] {
        display: none;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        height: 100dvh;
        width: min(85vw, var(--sidebar-w));
        max-width: var(--sidebar-w);
        transform: translateX(-102%);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
        z-index: 50;
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
        padding-top: calc(1.5rem + env(safe-area-inset-top));
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .main-nav {
        flex: 0 0 clamp(136px, 26%, 216px);
        max-height: clamp(136px, 26%, 216px);
    }

    .sidebar-bottom {
        flex: 1 1 auto;
        max-height: none;
    }

    .main-nav-scroll,
    .sidebar-bottom-scroll {
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-actions {
        display: none;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .main {
        min-height: 100vh;
        min-height: 100dvh;
        height: 100vh;
        height: 100dvh;
    }

    .top-bar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: calc(var(--gap) * 0.6 + env(safe-area-inset-top)) calc(var(--gap) * 1.2);
        justify-content: flex-start;
        gap: 0.6rem;
        z-index: 45;
    }

    #page-title {
        min-width: 0;
        line-height: 1;
    }

    .top-bar .actions {
        margin-left: auto;
    }

    #content-area {
        padding: calc(var(--gap) * 1.4);
        padding-top: calc(var(--gap) * 1.4 + var(--topbar-offset, var(--header-h)));
    }

    body.is-claims-view #content-area {
        padding-top: calc(var(--topbar-offset, var(--header-h)) + 0.4rem);
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    body.is-claims-view .top-bar {
        background: var(--primary);
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }

    body.is-claims-view #page-title {
        color: #ffffff;
        font-size: 1rem;
    }

    body.is-claims-view .sidebar-toggle {
        background: var(--primary-light);
        border-color: rgba(255, 255, 255, 0.2);
        color: #ffffff;
    }

    body.is-claims-view .sidebar-toggle i {
        color: inherit;
    }

    body.is-claims-view .page-title-logo[data-has-logo="true"] {
        display: inline-block;
        height: 1em;
    }

    body.is-claims-view .top-bar .claim-number-inline {
        color: #e2e8f0;
    }

    .top-bar .actions.actions--claims .btn-label {
        display: none;
    }

    .top-bar .actions.actions--claims #btnNewClaimTop {
        padding: 0.48rem 0.96rem;
        min-height: 35px;
        font-size: 0.8rem;
    }

    .top-bar .actions.actions--claims #btnNewClaimTop i {
        font-size: 0.8rem;
    }

    .btn-dashboard-filters {
        display: inline-flex;
        min-height: 36px;
        padding: 0.45rem 0.9rem;
        font-size: 0.85rem;
    }

    .top-bar .actions.actions--dashboard {
        flex-wrap: nowrap;
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-wrap: wrap;
        height: auto;
        padding: calc(var(--gap) * 0.9 + env(safe-area-inset-top)) calc(var(--gap) * 1.1);
    }

    #page-title {
        font-size: 1.1rem;
    }

    .top-bar .actions {
        width: 100%;
        justify-content: flex-start;
    }

    .top-bar .actions .topbar-search input {
        min-width: 0;
        width: 100%;
        font-size: 16px;
    }

    .top-bar .actions.actions--dashboard {
        width: auto;
        justify-content: flex-end;
    }
}

/* Components */
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
    min-height: 44px;
}

.btn-loading {
    cursor: progress;
    opacity: 0.9;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    animation: btnSpin 0.8s linear infinite;
    flex: 0 0 auto;
}

@keyframes btnSpin {
    to {
        transform: rotate(360deg);
    }
}

.app-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem;
    color: #64748b;
    font-size: 0.95rem;
}

.app-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(100, 116, 139, 0.3);
    border-top-color: #3b82f6;
    animation: btnSpin 0.8s linear infinite;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    margin-right: 1rem;
}

a.icon-btn {
    text-decoration: none;
}

.dt-block {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.dt-block-inline {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
    vertical-align: middle;
}

.claim-sla-type {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.claim-sla-meta {
    margin-top: 0.35rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.claim-sla-meta .claim-sla-type {
    margin: 0;
    font-size: inherit;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.claim-sla-type-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.claim-sla-authorized {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dt-time {
    font-size: 0.95em;
    color: #374151;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dashboard Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--gap);
    margin-bottom: calc(var(--gap) * 1.5);
}

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

    .kpi-grid > .kpi-card:nth-child(3) {
        order: 1;
    }

    .kpi-grid > .kpi-card:nth-child(4) {
        order: 0;
    }
}

.dashboard-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--card-pad);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    min-width: 0;
    overflow: hidden;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kpi-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kpi-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex: 0 0 auto;
}

.kpi-icon i {
    font-size: 1.45rem;
}

.kpi-icon--blue {
    background: rgba(59, 130, 246, 0.14);
    color: #2563eb;
}

.kpi-icon--orange {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
}

.kpi-icon--green {
    background: rgba(16, 185, 129, 0.16);
    color: #10b981;
}

.kpi-icon--teal {
    background: rgba(20, 184, 166, 0.16);
    color: #14b8a6;
}

@media (max-width: 1023px) {
    .kpi-icon {
        display: none;
    }

    .kpi-card-header {
        gap: 0.35rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .kpi-card-text {
        width: 100%;
    }

    .kpi-card {
        padding: 0.85rem;
        gap: 0.5rem;
        justify-content: space-between;
        min-height: 120px;
    }

    .kpi-card h3 {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .kpi-value {
        font-size: 1.7rem;
        line-height: 1.1;
    }

    .kpi-trend {
        margin-top: 0;
        font-size: 0.8rem;
    }
}

.kpi-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--danger);
}

/* Table */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
}

.claims-table-wrap {
    width: 100%;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrap {
    width: 100%;
    overflow: hidden;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.status-inactive {
    background: #e2e8f0;
    color: #475569;
}

.claim-row--inactive {
    opacity: 0.7;
}

.claim-row-card--inactive {
    opacity: 0.75;
    border-style: dashed;
}

.claims-table th,
.claims-table td {
    padding: 0.65rem 0.9rem;
}

.claims-sortable {
    white-space: nowrap;
}

.claims-sort-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.claims-sort-btn--compact {
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-main);
}

.claims-sort-btn--compact .claims-sort-icon {
    color: var(--text-muted);
}

.claims-sort-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
    border-radius: 4px;
}

.claims-sort-btn.is-active {
    color: var(--text-main);
}

.claims-sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    font-size: 0.95em;
    color: var(--text-muted);
}

.claims-sort-btn.is-active .claims-sort-icon {
    color: var(--text-main);
}

.claim-id-cell {
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 110px;
}

.claim-id-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.claim-id-text {
    font-weight: 600;
}

.claim-dynamic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.claim-dynamic-header h3 {
    margin: 0;
}

.claim-flag-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.claim-dynamic-card {
    overflow: visible;
}

.inspecciones-hogar-view .claim-dynamic-card {
    overflow: auto;
    max-width: 100%;
}

.media-left-stack {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    height: 100%;
    align-self: stretch;
    min-width: 0;
}

.detail-side-stack {
    display: grid;
    gap: var(--gap);
    align-content: start;
    height: 100%;
    align-self: stretch;
}

.claim-flag-toggle {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.claim-flag-toggle i {
    font-size: 0.95rem;
}

.claim-flag-toggle.is-active {
    color: #0f172a;
}

.claim-flag-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.claim-flag-toggle.is-readonly:not(.claim-flag-filter) {
    cursor: default;
}

.claim-flag-toggle.claim-flag--urgent.is-active {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #bae6fd;
}

.claim-flag-toggle.claim-flag--parts.is-active {
    background: #dcfce7;
    color: #16a34a;
    border-color: #bbf7d0;
}

.claim-flag-toggle.claim-flag--labor.is-active {
    background: #ffedd5;
    color: #ea580c;
    border-color: #fed7aa;
}

.claim-flag-toggle.claim-flag--attention.is-active {
    background: #fef3c7;
    color: #d97706;
    border-color: #fde68a;
}

.claim-flag-toggle.claim-flag--workshop.is-active {
    background: #ecfeff;
    color: #0f766e;
    border-color: #a5f3fc;
}

.claim-flag-toggle.claim-flag--outshop.is-active {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

.claim-flag-toggle.claim-flag--price-up.is-active {
    background: #ffe4e6;
    color: #be123c;
    border-color: #fecdd3;
}

.claim-flag-list {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.claim-flag-list--table {
    margin-top: 0.075rem;
}

.claim-flag-list--card {
    margin-left: 0.35rem;
}

.claim-flag-icon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.claim-flag-icon i {
    font-size: 0.7rem;
}

.claim-flag-icon.claim-flag--urgent {
    background: #e0f2fe;
    color: #0284c7;
}

.claim-flag-icon.claim-flag--parts {
    background: #dcfce7;
    color: #16a34a;
}

.claim-flag-icon.claim-flag--labor {
    background: #ffedd5;
    color: #ea580c;
}

.claim-flag-icon.claim-flag--attention {
    background: #fef3c7;
    color: #d97706;
}

.claim-flag-icon.claim-flag--workshop {
    background: #ecfeff;
    color: #0f766e;
}

.claim-flag-icon.claim-flag--outshop {
    background: #fee2e2;
    color: #dc2626;
}

.claim-flag-icon.claim-flag--price-up {
    background: #ffe4e6;
    color: #be123c;
}

.claim-flag-tooltip {
    position: relative;
}

.claim-flag-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.08s ease-in;
    z-index: 20;
}

.claim-flag-tooltip::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
    opacity: 0;
    transition: opacity 0.08s ease-in;
    pointer-events: none;
    z-index: 21;
}

.claim-flag-tooltip:hover::after,
.claim-flag-tooltip:hover::before {
    opacity: 1;
}

.claims-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.claims-actions .icon-btn {
    margin-right: 0;
}

.valuation-summary-value {
    display: block;
    text-align: right;
}

.cost-summary-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: stretch;
}

tr:hover {
    background-color: #f8fafc;
}

.claims-table tbody tr.claim-row--no-cambiar {
    background: rgba(56, 189, 248, 0.12);
}

.claims-table tbody tr.claim-row--no-cambiar:hover {
    background: rgba(56, 189, 248, 0.18);
}

.claims-list {
    display: none;
    gap: var(--gap);
}

#claimsCards {
    display: grid;
    gap: var(--gap);
}

.claim-row-card {
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    padding: 12px;
    background: #fff;
    display: grid;
    gap: 6px;
}

.claim-row-card--no-cambiar {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
}

.claim-row-card input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.claim-row-card .row-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.claim-row-card .row-id {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.claim-row-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.claim-row-meta strong {
    color: var(--text-main);
    display: block;
}

.claim-row-card .claim-sla-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.claim-row-card .claim-sla-track {
    width: 72px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.claim-row-card .claim-sla-fill {
    height: 100%;
    border-radius: 3px;
}

.claim-row-card .claim-sla-value {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.claim-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.claims-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0 2px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.claims-list-header label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-repair {
    background: #dbeafe;
    color: #1e40af;
}

.status-parts {
    background: #fef3c7;
    color: #92400e;
}

.status-qa {
    background: #d1fae5;
    color: #065f46;
}

@media (max-width: 1023px) {
    th,
    td {
        padding: 0.85rem 1rem;
    }

    .valuation-items-row--cambio {
        background: rgba(56, 189, 248, 0.12);
    }

    .valuation-items-row--cambio:hover {
        background: rgba(56, 189, 248, 0.18);
    }
}

@media (max-width: 768px) {
    .table-wrap {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table {
        min-width: 960px;
    }

    .claims-table-wrap {
        display: none;
    }

    .claims-table {
        min-width: 980px;
    }

    .claims-list {
        display: grid;
    }

    .claims-list-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0 0 4px;
    }

    .table-container {
        background: var(--bg-body);
        border-color: var(--bg-body);
        box-shadow: none;
    }

    .claims-pagination .page-size-control {
        display: none;
    }

    .claims-pagination .page-controls .btn-secondary {
        padding: 0.51rem 1.02rem;
        min-height: 37px;
        font-size: 0.85rem;
    }

    #newClaimForm .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #newClaimForm .form-group {
        grid-column: 1 / -1;
        order: 10;
    }

    #newClaimForm .form-group--half {
        grid-column: span 1;
    }

    #newClaimForm .form-group--claim-number {
        order: 1;
    }

    #newClaimForm .form-group--type {
        order: 2;
    }

    #newClaimForm .form-group--brand {
        order: 3;
    }

    #newClaimForm .form-group--model {
        order: 4;
    }

    #newClaimForm .form-group--plate {
        order: 5;
    }

    #newClaimForm .form-group--year {
        order: 6;
    }

    #newClaimForm .form-group--workshop {
        order: 7;
    }

    #newClaimForm .form-group--adjuster {
        order: 8;
    }

    #newClaimForm .form-group-full {
        order: 9;
    }

    .claim-row-card .claim-meta--workshop,
    .claim-row-card .claim-meta--type,
    .claim-row-card .claim-meta--plate {
        display: none;
    }

    .claim-row-card .claim-meta--created,
    .claim-row-card .claim-meta--updated {
        display: none;
    }

    .claim-row-card .claim-sla-label {
        display: none;
    }

    .claim-row-card .claim-sla-row {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .claim-row-card .claim-sla-track {
        width: 100%;
    }

    .claim-row-card .claim-sla-value {
        justify-self: end;
        font-size: 0.8rem;
    }

    .claim-row-card .claim-row-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .claim-row-card .icon-btn {
        margin-right: 0;
    }

    .claim-row-card .claim-id-cell {
        display: inline-flex;
        align-items: baseline;
        gap: 0.35rem;
    }

    .claim-row-card .claim-plate-inline {
        color: var(--text-muted);
        font-weight: 500;
    }

    .claim-dynamic-header {
        flex-wrap: wrap;
        align-items: flex-start;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Claim Detail Styles */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.detail-header > div {
    flex: 1;
    min-width: 0;
}

.detail-meta-toggle-row {
    display: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-left: 3rem;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail-meta-toggle {
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    color: inherit;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.detail-meta-toggle i {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.detail-meta-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.detail-meta {
    margin-left: 3rem;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-muted);
    align-items: flex-start;
}

.detail-meta-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-meta-field {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.detail-meta-select {
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);
    font-size: 0.85rem;
}

@media (max-width: 1023px) {
    .detail-meta-toggle-row {
        display: flex;
        margin-left: 0;
    }

    .detail-meta {
        display: none;
        margin-left: 0;
        gap: 0.75rem;
    }

    .detail-meta.is-open {
        display: flex;
    }
}

.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    flex: 0 0 auto;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.media-tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    margin: 1.5rem 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.media-tabs::-webkit-scrollbar {
    display: none;
}

.media-tab {
    padding: 0.65rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    flex: 0 0 auto;
}

.media-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.media-tab-content {
    display: none;
}

.media-tab-content.active {
    display: block;
}

@media (max-width: 768px) {
    .tabs {
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }

    .tab-btn {
        padding: 0.65rem 1rem;
    }
}

.photo-grid {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.photo-grid > .photo-item {
    flex: 0 0 clamp(240px, 32vw, 320px);
    scroll-snap-align: start;
}

.photo-grid > p {
    flex: 0 0 100%;
}

@media (max-width: 1023px) {
    .photo-grid {
        gap: 0.75rem;
    }

    .photo-grid > .photo-item {
        flex: 0 0 80%;
        max-width: 340px;
    }
}

.photo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.photo-upload-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.photo-upload-actions--stack {
    flex-direction: column;
    align-items: stretch;
}

.recupero-mobile-capture__btn {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.recupero-inspection-flow {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 10010;
}

.recupero-inspection-flow.active {
    display: block;
}

.recupero-inspection-flow__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
}

.recupero-inspection-flow__panel {
    position: absolute;
    inset: 0;
    background: #f8fafc;
    display: grid;
    grid-template-rows: auto auto auto auto 1fr;
}

.recupero-inspection-flow__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: max(0.85rem, env(safe-area-inset-top)) 0.9rem 0.65rem;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.recupero-inspection-flow__header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.recupero-inspection-flow__header p {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.recupero-inspection-flow__close {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

.recupero-inspection-flow__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem 0.55rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.recupero-inspection-flow__toolbar span {
    font-size: 0.82rem;
    color: var(--text-main);
    font-weight: 600;
}

.recupero-inspection-flow__finish {
    min-height: 38px;
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.recupero-inspection-flow__finish.is-ready {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.recupero-inspection-flow__status {
    padding: 0.55rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.recupero-inspection-flow__capture {
    padding: 0.6rem 0.9rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.recupero-inspection-preview {
    border: 1px solid #dbe5f3;
    border-radius: 12px;
    background: #f8fafc;
    padding: 0.55rem;
    display: grid;
    gap: 0.5rem;
}

.recupero-inspection-preview--actions-only {
    background: #f1f5f9;
}

.recupero-inspection-preview__media {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #dbe5f3;
    background: #ffffff;
    max-height: 180px;
}

.recupero-inspection-preview__media img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    display: block;
}

.recupero-inspection-preview__meta {
    font-size: 0.75rem;
    color: #334155;
    font-weight: 600;
}

.recupero-inspection-preview__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.recupero-inspection-preview__actions .btn-primary,
.recupero-inspection-preview__actions .btn-secondary {
    width: 100%;
    min-height: 36px;
    font-size: 0.78rem;
}

.recupero-inspection-flow__steps {
    padding: 0.85rem 0.9rem max(1.1rem, env(safe-area-inset-bottom));
    overflow: auto;
    display: grid;
    gap: 0.7rem;
    align-content: start;
}

.recupero-inspection-flow__group {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #334155;
    padding: 0.1rem 0.1rem 0;
}

.recupero-inspection-step {
    border: 1px solid #dbe5f3;
    background: #ffffff;
    border-radius: 12px;
    padding: 0.65rem;
    display: grid;
    gap: 0.55rem;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.recupero-inspection-step:disabled {
    opacity: 0.72;
}

.recupero-inspection-step.is-active {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.16);
}

.recupero-inspection-step.is-complete {
    border-color: #22c55e;
}

.recupero-inspection-step__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.recupero-inspection-step__order {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.recupero-inspection-step__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.recupero-inspection-step__required,
.recupero-inspection-step__optional,
.recupero-inspection-step__count {
    font-size: 0.7rem;
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
}

.recupero-inspection-step__required {
    background: #eff6ff;
    color: #1d4ed8;
}

.recupero-inspection-step__optional {
    background: #f1f5f9;
    color: #475569;
}

.recupero-inspection-step__count {
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
}

.recupero-inspection-step__body {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr) 74px;
    gap: 0.65rem;
    align-items: start;
}

.recupero-inspection-step__illustration {
    width: 108px;
    height: 82px;
    border-radius: 12px;
    background: #eef6ff;
    color: #2563eb;
    overflow: hidden;
    border: 1px solid #dbe5f3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.recupero-inspection-step__illustration img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.recupero-inspection-step__illustration.is-image i {
    display: none;
}

.recupero-inspection-step__illustration.is-fallback i {
    display: inline-flex;
}

.recupero-inspection-step__copy {
    display: grid;
    gap: 0.25rem;
    align-content: start;
}

.recupero-inspection-step__description {
    font-size: 0.78rem;
    color: #334155;
    line-height: 1.3;
}

.recupero-inspection-step__hint {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.recupero-inspection-step__thumb {
    width: 74px;
    height: 54px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dbe5f3;
    background: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.recupero-inspection-step__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recupero-inspection-step__thumb--empty {
    color: #94a3b8;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

@media (max-width: 420px) {
    .recupero-inspection-step__body {
        grid-template-columns: 1fr;
    }

    .recupero-inspection-step__illustration,
    .recupero-inspection-step__thumb {
        width: 100%;
        height: 120px;
    }

    .recupero-inspection-preview__actions {
        grid-template-columns: 1fr;
    }
}

body.recupero-inspection-open {
    overflow: hidden;
}

.photo-dropzone {
    width: 100%;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    padding: 14px 16px;
    text-align: center;
    color: #475569;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.photo-dropzone__icon {
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: inherit;
}

.photo-dropzone__text strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.photo-dropzone__text span {
    font-size: 0.85rem;
    color: #64748b;
}

.photo-dropzone.is-dragover {
    border-color: #00b5ff;
    background: #f0f9ff;
    box-shadow: 0 0 12px rgba(0, 181, 255, 0.3), 0 0 20px rgba(0, 181, 255, 0.18);
}

@media (max-width: 1023px) {
    .photo-dropzone {
        background: var(--primary);
        border: 2px solid #38bdf8;
        color: #e2e8f0;
        padding: 18px 16px;
    }

    .photo-dropzone__text {
        display: none;
    }

    .photo-dropzone__icon {
        display: inline-flex;
    }

    .photo-dropzone.is-dragover {
        border-color: #7dd3fc;
        background: var(--primary-light);
        box-shadow: none;
    }

    .recupero-inspection-flow__panel {
        max-width: none;
    }
}

.photo-docs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.photo-docs-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.document-grid {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.45) transparent;
}

.document-grid::-webkit-scrollbar {
    height: 8px;
}

.document-grid::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.45);
    border-radius: 999px;
}

.document-grid::-webkit-scrollbar-track {
    background: transparent;
}

.document-card {
    flex: 0 0 clamp(200px, 28vw, 260px);
    scroll-snap-align: start;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #fff;
}

.document-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eef6ff;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.document-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
    word-break: break-word;
}

.document-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.document-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: auto;
}

.document-actions .btn-secondary,
.document-actions .btn-danger,
.document-actions .document-open-btn {
    padding: 0.35rem 0.75rem;
    min-height: 34px;
    font-size: 0.8rem;
}

.document-open-btn.is-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.save-success-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(2px);
    z-index: 9999;
}

.save-success-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 16px 20px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.save-success-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.save-success-text {
    font-weight: 600;
    color: var(--text-main);
}

.auth-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    z-index: 10000;
    transition: opacity 0.2s ease;
}

.auth-overlay--hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.auth-overlay__card {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 14px 18px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
    font-weight: 500;
}

.auth-overlay__spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    border-top-color: var(--accent);
    animation: authSpin 0.8s linear infinite;
}

@keyframes authSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1023px) {
    .document-grid {
        gap: 0.75rem;
    }

    .document-card {
        flex: 0 0 80%;
        max-width: 300px;
    }
}

@media (min-width: 1024px) {
    .photo-docs-grid {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
        gap: 1.5rem;
    }
}

.photo-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s;
    border-radius: 10px;
    position: relative;
    z-index: 0;
    pointer-events: none;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-view-btn,
.photo-download-btn,
.photo-meta-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: none;
    background: rgba(15, 23, 42, 0.82);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.9;
    transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: 2;
}

.photo-meta-btn {
    right: 88px;
}

.photo-download-btn {
    right: 48px;
}

.photo-view-btn i,
.photo-download-btn i,
.photo-meta-btn i {
    font-size: 1rem;
}

.photo-view-btn:hover,
.photo-download-btn:hover,
.photo-meta-btn:hover {
    opacity: 1;
    transform: scale(1.05);
}

.photo-selected {
    outline: 2px solid #00b5ff;
}

.photo-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #00b5ff;
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 181, 255, 0.35);
    z-index: 2;
}

.photo-viewer {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    z-index: 1200;
    padding: 1.5rem;
}

.photo-viewer__backdrop {
    position: absolute;
    inset: 0;
}

.photo-viewer.active {
    display: flex;
}

.photo-viewer__panel {
    position: relative;
    z-index: 1;
    width: min(1459px, 100%);
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.photo-viewer__header {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    border-bottom: none;
    background: transparent;
    z-index: 2;
}

.photo-viewer__title {
    font-weight: 600;
    color: var(--text-main);
}

.photo-viewer__close {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
}

.photo-viewer__body {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    background: #0f172a;
    position: relative;
}

.photo-viewer__overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    z-index: 2;
    pointer-events: none;
}

.photo-viewer__canvas {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 240px;
    touch-action: none;
    cursor: grab;
}

.photo-viewer__canvas.is-panning {
    cursor: grabbing;
}

.photo-viewer__stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
}

.photo-viewer__media {
    position: relative;
    display: inline-block;
    transform-origin: center;
    will-change: transform;
}

.photo-viewer__img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    transform-origin: center;
    transition: transform 0.2s ease;
    will-change: transform;
    pointer-events: none;
}

.photo-viewer__annot {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.photo-viewer__annot.is-editing {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
}

.photo-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    touch-action: manipulation;
}

.photo-viewer__nav--prev {
    left: 12px;
}

.photo-viewer__nav--next {
    right: 12px;
}

.photo-viewer__nav:disabled {
    opacity: 0.4;
    cursor: default;
}

.photo-viewer__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    flex-wrap: wrap;
    background: var(--primary);
}

.photo-viewer__counter {
    color: #e2e8f0;
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    pointer-events: auto;
}

.photo-viewer__tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    pointer-events: auto;
}

.photo-viewer__zoom-group {
    display: inline-flex;
    align-items: center;
}

.photo-viewer__zoom-slider-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    margin-left: 0;
    padding: 0;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(15, 23, 42, 0.82);
    transform: translateX(-4px);
    transition: max-width 0.2s ease, opacity 0.2s ease, transform 0.2s ease, margin-left 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
    pointer-events: none;
}

.photo-viewer__zoom-group.is-open .photo-viewer__zoom-slider-wrap {
    max-width: 220px;
    opacity: 1;
    margin-left: 0.45rem;
    padding: 0.3rem 0.55rem;
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateX(0);
    pointer-events: auto;
}

.photo-viewer__zoom-slider {
    width: 130px;
    accent-color: #38bdf8;
    touch-action: manipulation;
}

.photo-viewer__zoom-value {
    min-width: 44px;
    text-align: right;
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 700;
}

.photo-viewer__tool-sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.25rem;
}

.photo-viewer__tool {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--primary-light);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
}

.photo-viewer__tool-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    align-self: flex-start;
}

.photo-viewer__tool-stack-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.photo-viewer__tool--size {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.photo-viewer__tool:disabled {
    opacity: 0.5;
    cursor: default;
}

.photo-viewer__tool.is-active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.photo-viewer__annot-tool {
    display: none;
}

.photo-viewer__tools.is-annotating .photo-viewer__annot-tool {
    display: inline-flex;
}

.photo-viewer__annot.is-drawing {
    cursor: crosshair;
}

.photo-viewer__tool i {
    font-size: 1rem;
}

.photo-meta-modal {
    max-width: 640px;
}

.photo-meta-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.photo-meta-list {
    display: grid;
    gap: 0.65rem;
}

.photo-meta-row {
    display: grid;
    grid-template-columns: minmax(140px, 0.45fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.photo-meta-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.photo-meta-value {
    font-size: 0.9rem;
    color: var(--text-main);
    word-break: break-word;
}

.photo-meta-value a {
    color: var(--accent);
    text-decoration: none;
}

.photo-meta-value a:hover {
    text-decoration: underline;
}

.photo-meta-hint {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .photo-meta-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .photo-viewer {
        padding: 0;
    }

    .photo-viewer__body {
        justify-content: center;
    }

    .photo-viewer__canvas {
        flex: 0 0 auto;
        width: min(1459px, 100%);
        height: auto;
        aspect-ratio: 16 / 9;
        max-width: min(1459px, 100%);
        max-height: 90vh;
    }

    .photo-viewer__img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        max-height: 100%;
    }
}

@media (max-width: 768px) {
    .photo-viewer {
        padding: 0;
    }

    .photo-viewer__panel {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .photo-viewer__body {
        padding: 0;
        gap: 0;
    }

    .photo-viewer__img {
        max-height: 60vh;
    }

    .photo-viewer__toolbar {
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    }

    .photo-viewer__zoom-group.is-open .photo-viewer__zoom-slider-wrap {
        max-width: 180px;
    }

    .photo-viewer__zoom-slider {
        width: 96px;
    }

    .photo-viewer__header {
        top: calc(12px + env(safe-area-inset-top));
        right: calc(12px + env(safe-area-inset-right));
    }

    .photo-viewer__overlay {
        top: calc(12px + env(safe-area-inset-top));
        left: calc(12px + env(safe-area-inset-left));
        right: calc(64px + env(safe-area-inset-right));
    }

    .photo-viewer__nav--prev {
        left: calc(12px + env(safe-area-inset-left));
    }

    .photo-viewer__nav--next {
        right: calc(12px + env(safe-area-inset-right));
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: min(980px, calc(100vw - 24px));
    max-width: 980px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.valuation-import-hint {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.valuation-import-options {
    display: grid;
    gap: 0.75rem;
}

.valuation-import-options .btn-primary,
.valuation-import-options .btn-secondary {
    width: 100%;
    justify-content: center;
}

@media (max-width: 640px) {
    .modal {
        align-items: flex-start;
    }

    .modal-content {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    #newClaimModal .modal-content {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        max-height: 100dvh;
    }

    #newClaimForm {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #newClaimForm input,
    #newClaimForm select,
    #newClaimForm textarea {
        font-size: 16px;
    }

    #newClaimForm .form-grid {
        flex: 1;
    }

    #newClaimForm .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        padding: 1rem 2rem calc(1rem + env(safe-area-inset-bottom));
    }
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.client-multi-select {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    display: grid;
    gap: 0.5rem;
    max-height: 220px;
    overflow: auto;
    background: #ffffff;
}

.client-multi-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
}

.client-multi-item:hover {
    background: var(--bg-body);
}

.client-multi-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.client-multi-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.client-multi-rut {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.account-actions {
    display: grid;
    gap: 0.75rem;
}

.modal-helper {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.client-switch-list {
    display: grid;
    gap: 0.5rem;
    max-height: 260px;
    overflow: auto;
    padding-right: 0.25rem;
}

.account-actions-modal {
    max-width: 420px;
}

.client-switch-modal {
    max-width: 560px;
}

.client-switch-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: #ffffff;
}

.client-switch-item:hover {
    border-color: var(--accent);
}

.client-switch-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.client-switch-name {
    font-weight: 600;
}

.client-switch-rut {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.client-switch-badge {
    align-self: flex-start;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    background: var(--accent);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 999px;
}

.empty-state {
    padding: 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tracking-view {
    width: 100%;
}

.tracking-root {
    min-height: 220px;
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.btn-secondary:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

.save-status-option-btn {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.save-status-option-btn--default:hover {
    background: #edf2f7;
    border-color: #d4dde8;
    color: #334155;
}

.save-status-option-btn--in-review:hover {
    background: #e9f1fb;
    border-color: #c9dcf4;
    color: #355d8f;
}

.save-status-option-btn--review:hover {
    background: #f8f1df;
    border-color: #ecdcb3;
    color: #7b6632;
}

.save-status-option-btn--approved:hover {
    background: #e9f7ef;
    border-color: #c6e8d4;
    color: #336b4e;
}

.save-status-option-btn--rejected:hover {
    background: #f9eaea;
    border-color: #e9c8c8;
    color: #8a4545;
}

.save-status-option-btn--cancelled:hover {
    background: #eef1f4;
    border-color: #d6dde6;
    color: #475569;
}

.toast-pdf-section {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-pdf-title {
    font-size: 0.85rem;
    opacity: 0.9;
}

.pdf-dropzone {
    border: 1px dashed var(--accent, #4dabf7);
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    background: rgba(77, 171, 247, 0.06);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pdf-dropzone:hover,
.pdf-dropzone.dragover {
    background: rgba(77, 171, 247, 0.12);
    border-color: var(--primary, #0d6efd);
}

.pdf-dropzone-icon {
    font-size: 1.4rem;
}

.pdf-dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pdf-dropzone-text strong {
    font-size: 0.9rem;
}

.pdf-dropzone-text span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.pdf-dropzone-hint {
    font-size: 0.72rem;
    opacity: 0.75;
}

.valuation-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.valuation-tab {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    font-size: 0.75rem;
    cursor: pointer;
}

.valuation-tab.active {
    border-color: #0f766e;
    background: #0f766e;
    color: #ffffff;
}

.audit-selects {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    align-items: flex-end;
}

.audit-export {
    flex: 1 1 200px;
    display: flex;
    justify-content: flex-end;
    margin-left: auto;
}

.audit-export #exportAuditBudgetBtn {
    margin-right: 20px;
}

.audit-valuation-selector label,
.audit-result-selector label,
.audit-paint-selector label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.audit-valuation-selector select,
.audit-result-selector select,
.audit-paint-selector select {
    font-size: 0.85rem;
    padding: 6px 8px;
    min-width: 180px;
}

.audit-valuation-selector,
.audit-result-selector,
.audit-paint-selector {
    flex: 0 1 200px;
    margin: 0;
}

.audit-paint-selector {
    transform: translateX(-20px);
}

.audit-valuation-selector {
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.audit-valuation-selector label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.audit-savings {
    flex: 0 1 300px;
    margin: 0;
}

.audit-savings-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.audit-savings-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.audit-savings-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--success);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    min-height: 34px;
    background: #fff;
    display: flex;
    align-items: center;
}

.audit-liked-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    user-select: none;
}

.audit-liked-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.audit-liked-toggle input[type="checkbox"]:disabled + span {
    opacity: 0.75;
}

.audit-totals {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.audit-total {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    background: #ffffff;
}

.audit-total-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.audit-total-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    display: block;
}

.dashboard-filters {
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    border-radius: 14px;
    margin-bottom: 1.25rem;
}

@media (max-width: 1023px) {
    .dashboard-filters {
        display: none;
    }

    .dashboard-filters.is-open {
        display: block;
    }
}

.dash-filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
}

.dash-filter label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.dash-filter select {
    width: 100%;
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.dash-filter select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.grid-layout--stack {
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .grid-layout {
        grid-template-columns: 2fr 1fr;
        gap: calc(var(--gap) * 1.5);
        margin-bottom: calc(var(--gap) * 1.5);
    }

    .grid-layout--stack {
        grid-template-columns: 1fr;
    }
}

.ranking-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .ranking-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

.ranking-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ranking-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ranking-controls .input-select {
    min-width: 140px;
}

.status-donut-total {
    margin-top: 0.35rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.status-donut-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.status-donut-chart {
    flex: 1 1 220px;
    min-width: 200px;
}

.status-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 180px;
}

.status-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-donut-swatch {
    width: 10px;
    height: 10px;
    border-radius: 4px;
    flex: 0 0 auto;
}

.status-donut-label {
    flex: 1;
    text-align: left;
    font-size: 0.95rem;
    color: var(--text-main);
}

.status-donut-value {
    font-weight: 700;
    font-size: 1.17em;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .status-donut-layout {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-donut-legend {
        width: 100%;
    }
}

.dashboard-results-card {
    margin-top: var(--gap);
}

.dashboard-insights-grid {
    margin-top: var(--gap);
    display: grid;
    gap: var(--gap);
    grid-template-columns: 1fr;
    align-items: stretch;
}

@media (min-width: 1024px) {
    .dashboard-insights-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .dashboard-insights-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
        justify-items: stretch;
    }

    .dashboard-insights-stack {
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
    }

    .dashboard-treemap-card {
        height: auto;
    }

    .dashboard-treemap-card,
    .dashboard-alerts-card,
    .dashboard-delay-card {
        width: 100%;
        max-width: 100%;
        align-self: stretch;
        justify-self: stretch;
        padding: 0.9rem;
    }

    .dashboard-insights-grid > *,
    .dashboard-insights-stack > * {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        align-self: stretch;
        justify-self: stretch;
    }

    .dashboard-treemap-header h3,
    .dashboard-alerts-header h3,
    .dashboard-delay-header h3 {
        font-size: 0.95rem;
    }

    .dashboard-treemap-body {
        min-height: 200px;
        overflow-x: hidden;
        overflow-y: hidden;
    }

    .dashboard-treemap-body canvas {
        height: 100%;
        min-width: 100%;
    }

    .dashboard-alerts-body,
    .dashboard-delay-body {
        height: 260px;
    }

    .dashboard-alerts-body canvas {
        height: 100%;
    }

    .dashboard-alerts-body {
        min-width: 100%;
    }

    .dashboard-alerts-scroll {
        min-width: 600px;
    }

    .dashboard-delay-table {
        min-width: 1600px;
    }

    .dashboard-delay-table th,
    .dashboard-delay-table td {
        padding: 0.55rem 0.75rem;
        font-size: 0.85rem;
    }

    .dashboard-delay-table td:nth-child(2),
    .dashboard-delay-table td:nth-child(3) {
        text-align: right;
    }
}

.dashboard-treemap-card,
.dashboard-alerts-card,
.dashboard-delay-card {
    margin-top: 0;
}

.dashboard-insights-stack {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.dashboard-treemap-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dashboard-treemap-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-treemap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-treemap-header h3 {
    margin: 0;
}

.dashboard-treemap-view-picker {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.dashboard-treemap-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 240px;
}

.dashboard-treemap-view-button {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    white-space: nowrap;
    min-width: 220px;
}

.dashboard-treemap-view-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 7;
    min-width: 220px;
    max-width: min(320px, 75vw);
    display: grid;
    gap: 0.35rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    padding: 0.5rem;
}

.dashboard-treemap-view-menu[hidden] {
    display: none;
}

.dashboard-treemap-view-option {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
}

.dashboard-treemap-view-option:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.dashboard-treemap-view-option.is-active {
    border-color: #5b7fb3;
    background: rgba(91, 127, 179, 0.12);
    color: #1f3a60;
    font-weight: 600;
}

.dashboard-treemap-legend {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.dashboard-treemap-total {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

.dashboard-treemap-body {
    position: relative;
    flex: 1;
    min-height: 200px;
}

.dashboard-treemap-body canvas {
    width: 100%;
    height: 100%;
}

.dashboard-treemap-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    padding: 1rem;
}

.dashboard-alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-alerts-header h3 {
    margin: 0;
}

.dashboard-alerts-body {
    position: relative;
    height: 320px;
}

.dashboard-alerts-scroll {
    height: 100%;
    display: inline-block;
    min-width: 100%;
}

.dashboard-alerts-body canvas {
    width: 100%;
    height: 320px;
}

.dashboard-alerts-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    padding: 1rem;
}

.dashboard-delay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-delay-header h3 {
    margin: 0;
}

.dashboard-delay-stats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-delay-pill {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

.dashboard-delay-body {
    position: relative;
    height: 320px;
}

.dashboard-delay-table-wrap {
    height: calc(100% - 1rem);
    max-height: none;
    overflow-x: auto;
    overflow-y: auto;
}

.dashboard-delay-table {
    min-width: 90px;
}

.dashboard-delay-table th,
.dashboard-delay-table td {
    white-space: nowrap;
}

.dashboard-delay-table th,
.dashboard-delay-table td {
    padding: 0.65rem 0.9rem;
}

.dashboard-delay-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
}

.dashboard-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-results-subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dashboard-results-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

.dashboard-results-table,
.dashboard-treemap-container,
.dashboard-alerts-container,
.dashboard-delay-table-wrap {
    margin-top: 1rem;
}

.dashboard-results-table {
    overflow-y: visible;
}

.dashboard-th {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
}

.dashboard-th-filter {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.dashboard-th-filter:hover {
    color: var(--text);
    border-color: var(--accent);
}

.dashboard-th-filter.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.dashboard-th-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    z-index: 5;
    display: none;
}

.dashboard-th:focus-within .dashboard-th-popover {
    display: block;
}

.dashboard-filter-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.dashboard-filter-select,
.dashboard-filter-input {
    width: 100%;
    font-size: 0.85rem;
    padding: 0.45rem 0.6rem;
}

.dashboard-filter-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.dashboard-filter-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
}

.dashboard-filter-clear:hover {
    color: var(--accent);
}

.inventory-th {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
}

.inventory-th-filter {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    position: relative;
}

.inventory-th-filter:hover {
    color: var(--text);
    border-color: var(--accent);
}

.inventory-th-filter.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.inventory-th-count {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.inventory-th-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: auto;
    min-width: 260px;
    max-width: 320px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    z-index: 7;
    display: none;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.inventory-th:focus-within .inventory-th-popover {
    display: block;
}

.inventario-view .card,
.inventario-view .card-body {
    overflow: visible;
}

.inventario-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.inventario-table-scroll.inventario-table-scroll--empty {
    min-height: 320px;
}

.inventario-view #tablaInventario {
    min-width: 1650px;
}

.inventario-view #tablaInventario th,
.inventario-view #tablaInventario td {
    white-space: nowrap;
}

.inventario-view #tablaInventario thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 9;
    background: #f8fafc;
}

.inventario-view #tablaInventario tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 4;
    background: var(--bg-card);
    box-shadow: 1px 0 0 var(--border);
}

.inventory-th-popover * {
    text-transform: none;
    letter-spacing: normal;
}

.inventory-filter-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.inventory-filter-select {
    width: 100%;
    font-size: 0.84rem;
    padding: 0.45rem 0.6rem;
}

.inventory-filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin: 0.55rem 0;
}

.inventory-filter-action {
    border: none;
    background: none;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.inventory-filter-action:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.inventory-repuesto-options {
    max-height: 225px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.35rem;
    background: #fff;
}

.inventory-repuesto-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border-radius: 8px;
    padding: 0.25rem 0.35rem;
    font-size: 0.82rem;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
}

.inventory-repuesto-option span {
    flex: 1;
}

.inventory-repuesto-option:hover {
    background: #f8fafc;
}

.inventory-repuesto-option input {
    margin: 0;
}

.inventory-repuesto-empty {
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.dashboard-claims-table {
    min-width: 1600px;
    width: 100%;
}

.dashboard-claims-table th,
.dashboard-claims-table td {
    white-space: nowrap;
}

.dashboard-claim-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.dashboard-claim-link:hover {
    text-decoration: underline;
}

.dashboard-pagination {
    padding: 0.75rem 0 0;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .inventory-th-popover {
        right: auto;
        left: 0;
        max-width: 80vw;
    }

    .dashboard-treemap-header,
    .dashboard-alerts-header,
    .dashboard-delay-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-treemap-view-button {
        width: 100%;
        min-width: 0;
    }

    .dashboard-treemap-header-left {
        width: 100%;
    }

    .dashboard-treemap-view-menu {
        width: 100%;
        max-width: none;
    }

    .dashboard-delay-stats {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-delay-pill {
        width: 100%;
        text-align: left;
    }

    .dashboard-treemap-body {
        min-height: 200px;
    }

    .dashboard-treemap-body canvas {
        height: 100%;
    }

    .dashboard-alerts-body {
        height: 240px;
    }

    .dashboard-alerts-body canvas {
        height: 240px;
    }

    .dashboard-delay-table-wrap {
        height: calc(100% - 1rem);
    }

    .dashboard-delay-body {
        height: 240px;
    }

    .dashboard-delay-table td:first-child {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 1024px) {
    .dashboard-delay-card {
        display: block;
    }
}

.workshop-ranking {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ranking-row {
    display: grid;
    grid-template-columns: 1.2fr 2.4fr auto;
    gap: 0.5rem;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.ranking-row:hover {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.ranking-label {
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-bar-wrap {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.ranking-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #0ea5e9);
    border-radius: 999px;
}

.ranking-value {
    font-weight: 700;
    color: #0f172a;
    min-width: 70px;
    text-align: right;
}

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

.kensa-tooltip {
    position: fixed;
    z-index: 9999;
    min-width: 220px;
    max-width: 320px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    pointer-events: none;
    font-size: 12px;
    color: #e2e8f0;
}

.kensa-tooltip.hidden {
    display: none;
}

.ktt-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: #ffffff;
}

.ktt-body {
    color: #ffffff;
    line-height: 1.35;
}

.ktt-body .ktt-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.ktt-body .ktt-row b {
    color: #ffffff;
    font-weight: 600;
}

.kensa-tooltip--price-history {
    width: min(460px, calc(100vw - 24px));
    min-width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    pointer-events: auto;
}

.ktt-price-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ktt-price-history-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
}

.ktt-trend--up {
    color: #fca5a5;
}

.ktt-trend--down {
    color: #86efac;
}

.ktt-trend--flat {
    color: #cbd5e1;
}

.ktt-trend--none {
    color: #94a3b8;
}

.ktt-price-history-graph {
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.35);
    padding: 6px 8px 4px;
}

.ktt-price-history-mini-tooltip {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 8px;
    padding: 5px 7px;
    min-width: 158px;
    max-width: min(220px, calc(100% - 12px));
    color: #e2e8f0;
    font-size: 10px;
    line-height: 1.25;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.35);
    pointer-events: none;
    z-index: 2;
}

.ktt-price-history-mini-tooltip[hidden] {
    display: none;
}

.ktt-ph-mini-month {
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 3px;
}

.ktt-ph-mini-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.ktt-ph-mini-row b {
    color: #ffffff;
}

.ktt-price-history-hover-hint {
    font-size: 10px;
    color: #94a3b8;
}

.ktt-price-history-chart {
    width: 100%;
    height: auto;
    display: block;
}

.ktt-ph-grid {
    stroke: rgba(148, 163, 184, 0.2);
    stroke-width: 1;
}

.ktt-ph-series {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.ktt-ph-series--supplier {
    stroke: #38bdf8;
}

.ktt-ph-series--market {
    stroke: #fbbf24;
}

.ktt-ph-marker {
    stroke-width: 1.4;
}

.ktt-ph-marker--supplier {
    fill: #38bdf8;
    stroke: rgba(15, 23, 42, 0.9);
}

.ktt-ph-marker--market {
    fill: #fbbf24;
    stroke: rgba(15, 23, 42, 0.9);
}

.ktt-ph-hit-zone {
    fill: transparent;
    pointer-events: all;
    cursor: crosshair;
}

.ktt-ph-hit-zone:focus {
    outline: none;
    fill: rgba(56, 189, 248, 0.1);
}

.ktt-ph-hover-line {
    stroke: rgba(226, 232, 240, 0.65);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
}

.ktt-ph-hover-dot {
    stroke-width: 1.3;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
}

.ktt-ph-hover-dot--supplier {
    fill: #38bdf8;
    stroke: rgba(2, 6, 23, 0.95);
}

.ktt-ph-hover-dot--market {
    fill: #fbbf24;
    stroke: rgba(2, 6, 23, 0.95);
}

.ktt-ph-axis {
    fill: #cbd5e1;
    font-size: 9.5px;
}

.ktt-price-history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: #cbd5e1;
}

.ktt-price-history-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ktt-ph-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.ktt-ph-dot--supplier {
    background: #38bdf8;
}

.ktt-ph-dot--market {
    background: #fbbf24;
}

.ktt-price-history-empty {
    font-size: 11px;
    color: #cbd5e1;
    padding: 4px 2px;
}

.audit-valuation-selector select,
.audit-paint-selector select {
    font-size: 0.85rem;
    padding: 6px 8px;
    width: 100%;
}

/* Presupuesto (PDF export) */
.budget-page {
    width: 210mm;
    min-height: 297mm;
    padding: 15mm 10mm 25mm 10mm;
    background: #ffffff;
    color: #000000;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    position: relative;
    padding-bottom: 25mm;
}

.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    position: relative;
}

.budget-header h1 {
    margin: 0;
    font-size: 16px;
}

.budget-logo {
    max-height: 26px;
    object-fit: contain;
    display: block;
}

.budget-qr {
    display: block;
    margin-top: 6px;
    width: 60px;
    height: 60px;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

.budget-claim {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    transform: translateY(-20px);
}

.budget-plate {
    font-size: 35px;
    color: var(--report-blue, #21509D);
    font-weight: 700;
    text-align: right;
}

.budget-info {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 10px;
    margin-bottom: 12px;
}

.budget-content {
    position: relative;
}

.budget-body {
    position: relative;
}

.budget-header-line {
    position: absolute;
    left: 10mm;
    right: 10mm;
    height: 16px;
    background: #d7dfe9;
    top: 125px; /* subido 5mm aprox desde la posición anterior */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    box-sizing: border-box;
    z-index: 1;
}

.budget-header-line__model {
    font-weight: 700;
    font-style: italic;
    color: #1f3d68;
}

.budget-info-left,
.budget-info-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.budget-info-left {
    text-align: left;
}

.budget-info-right {
    text-align: left;
}

.budget-info-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    text-align: left;
    font-size: 10px;
}

.budget-info-right .budget-info-row {
    transform: translateX(-30px);
}

.budget-info-row .label {
    font-weight: 700;
}

.budget-info-row .value.bold {
    font-weight: 700;
}
.budget-section-title {
    margin: 12px 0 6px;
    font-size: 13px;
    font-weight: 700;
}

.budget-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

.budget-section-title {
    break-after: avoid;
    page-break-after: avoid;
}

.budget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin-bottom: 10px;
}

.budget-table th,
.budget-table td {
    border: 1px solid #d9d9d9;
    padding: 6px 8px;
}

.budget-table th {
    background: #f2f6fb;
    text-align: left;
    font-weight: 700;
    font-size: 9px;
}

.budget-table td.num {
    text-align: right;
}

.budget-table td.hh {
    text-align: center;
}

.budget-totals {
    width: 220px;
    margin-left: auto;
    font-size: 10px;
    border: 1px solid #d9d9d9;
}

.budget-totals .total-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 6px;
    border-bottom: 1px solid #d9d9d9;
}

.budget-totals .total-row:last-child {
    border-bottom: none;
}

.budget-totals .total-row strong {
    font-size: 10px;
}

.budget-footer {
    position: absolute;
    left: 10mm;
    right: 10mm;
    bottom: 15mm; /* margen fijo de 15mm respecto al borde inferior */
    padding: 0 4px;
}

.budget-footer__bar {
    height: 12px;
    background: var(--report-blue, #21509D);
    color: #ffffff;
    text-align: center;
    font-weight: 700;
    font-size: 10px;
    line-height: 12px;
}

.bitacora-card {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 260px;
    max-height: 520px;
    overflow: hidden;
}

.inspecciones-hogar-view .detail-side-stack {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-self: stretch;
    overflow: hidden;
    position: static;
    top: auto;
}

.inspecciones-hogar-inspeccion-card {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    border-radius: 14px;
}

.inspecciones-hogar-inspeccion-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-height: 0;
    height: 100%;
}

.inspecciones-hogar-inspeccion-head-controls {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.inspecciones-hogar-inspeccion-control {
    display: grid;
    gap: 0.3rem;
    min-width: 150px;
}

.inspecciones-hogar-inspeccion-control > span {
    color: #607089;
    font-size: 0.74rem;
    font-weight: 700;
}

.inspecciones-hogar-inspeccion-control .input-text,
.inspecciones-hogar-inspeccion-control .input-select {
    min-height: 36px;
    padding: 0.42rem 0.62rem;
    font-size: 0.84rem;
}

.inspecciones-hogar-fields--inspection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inspecciones-hogar-inspeccion-footer {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: auto;
}

.hogar-photo-request-panel {
    border: 1px solid #d6e2f1;
    border-radius: 12px;
    background: #f8fbff;
    padding: 0.75rem;
    display: grid;
    gap: 0.65rem;
}

.hogar-photo-request-copy {
    display: grid;
    gap: 0.24rem;
}

.hogar-photo-request-copy strong {
    color: #0f2f57;
    font-size: 0.9rem;
}

.hogar-photo-request-copy span {
    color: #516884;
    font-size: 0.8rem;
    line-height: 1.35;
}

.hogar-photo-request-meta {
    display: grid;
    gap: 0.18rem;
    font-size: 0.78rem;
    color: #516884;
}

.hogar-photo-request-options {
    display: grid;
    gap: 0.4rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.hogar-photo-request-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid #d6e2f1;
    border-radius: 10px;
    padding: 0.38rem 0.5rem;
    background: #ffffff;
    color: #183a62;
    font-size: 0.8rem;
    cursor: pointer;
}

.hogar-photo-request-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

.hogar-photo-request-option.is-selected {
    border-color: #60a5fa;
    background: #eff6ff;
}

.hogar-photo-request-comment {
    display: grid;
    gap: 0.35rem;
}

.hogar-photo-request-comment > span {
    color: #1f3654;
    font-size: 0.78rem;
    font-weight: 700;
}

.hogar-photo-request-comment textarea {
    resize: vertical;
    min-height: 72px;
}

.hogar-photo-request-actions {
    display: flex;
}

.hogar-photo-request-actions .btn-primary {
    width: 100%;
}

.inspecciones-hogar-view .grid-layout {
    align-items: stretch;
}

.inspecciones-hogar-view .bitacora-card {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
    border-radius: 14px;
}

.inspecciones-hogar-view .bitacora-list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
}

.hogar-validation-card {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: hidden;
    border-radius: 14px;
}

.hogar-validation-card__subtitle {
    margin-top: -0.15rem;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: left;
}

.inspecciones-hogar-fields--validation {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inspecciones-hogar-field--validation strong {
    text-transform: none;
}

.inspecciones-hogar-field-question {
    display: block;
    margin-top: 0.28rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.35;
    text-transform: none;
    font-style: italic;
}

.bitacora-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bitacora-header h3 {
    margin: 0;
}

.bitacora-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bitacora-template-btn {
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
}

.bitacora-template-btn i {
    font-size: 0.95rem;
}

.bitacora-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.bitacora-filter-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #0f172a;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bitacora-filter-btn.active {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.bitacora-filter-btn--green {
    border-color: #059669;
    color: #065f46;
}

.bitacora-filter-btn--green.active {
    background: #ecfdf3;
}

.bitacora-filter-btn--blue {
    border-color: #2563eb;
    color: #1d4ed8;
}

.bitacora-filter-btn--blue.active {
    background: #eff6ff;
}

.bitacora-filter-btn--black {
    border-color: #1f2937;
    color: #111827;
}

.bitacora-filter-btn--black.active {
    background: #f3f4f6;
}

.bitacora-compose {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

#bitacoraCommentInput,
#hogarBitacoraCommentInput {
    flex: 1;
    min-height: 44px;
    resize: none;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px;
}

#bitacoraCommentInput:focus,
#hogarBitacoraCommentInput:focus {
    outline: none;
    border-color: #cbd5e1;
    box-shadow: 0 0 0 1px #e5e7eb;
}

.bitacora-list {
    margin-top: 10px;
    padding-right: 6px;
    overflow: auto;
    flex: 1;
    max-height: calc(520px - 130px); /* deja margen para header + input */
    min-height: 0;
}

.related-claims-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.related-claims-table th,
.related-claims-table td {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.65rem 0.8rem;
}

.bitacora-item {
    padding: 8px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 8px;
    font-size: 12.5px;
    line-height: 1.35;
}

.bitacora-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: #6B7280;
    margin-bottom: 4px;
}

.bitacora-user {
    font-weight: 600;
}

.bitacora-time {
    white-space: nowrap;
}

.bitacora-message {
    color: #111827;
}

.bitacora-item[data-type="status"] .bitacora-message,
.bitacora-item[data-type="photo"] .bitacora-message,
.bitacora-item[data-type="document"] .bitacora-message {
    color: #1D4ED8;
    font-weight: 600;
}

.bitacora-item[data-type="view"] .bitacora-message {
    color: #065F46;
    font-weight: 600;
}

.bitacora-item[data-type="comment"] .bitacora-message {
    color: #111827;
}

.bitacora-empty {
    color: var(--text-muted);
    font-size: 12px;
}

.bitacora-templates-modal {
    max-width: 820px;
    display: flex;
    flex-direction: column;
    height: min(88vh, 720px);
    max-height: calc(100vh - 24px);
    overflow: hidden;
}

.bitacora-templates-modal .modal-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.bitacora-templates-modal .modal-header,
.bitacora-templates-modal .modal-footer {
    flex: 0 0 auto;
}

.bitacora-template-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 1rem;
    min-height: 0;
}

.bitacora-template-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.bitacora-template-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.bitacora-template-subtle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bitacora-template-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.bitacora-template-list-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: clamp(180px, 34vh, 360px);
    overflow: auto;
    padding-right: 6px;
}

.bitacora-template-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.bitacora-template-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.bitacora-template-title {
    font-weight: 600;
}

.bitacora-template-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bitacora-template-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.bitacora-template-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bitacora-template-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.bitacora-template-form textarea {
    min-height: 120px;
    resize: vertical;
}

@media (max-width: 768px) {
    #bitacoraCommentInput {
        font-size: 16px;
    }

    .bitacora-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .bitacora-filters {
        width: 100%;
    }

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

    .bitacora-template-list-body {
        height: clamp(160px, 30vh, 240px);
    }

    .bitacora-template-form {
        display: none;
    }

    .bitacora-templates-modal .modal-footer {
        display: none;
    }

    .bitacora-template-card-top {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 3.5rem;
    }

    .bitacora-template-actions {
        position: absolute;
        top: 0.6rem;
        right: 0.6rem;
    }

    .bitacora-template-actions [data-action="edit"],
    .bitacora-template-actions [data-action="delete"] {
        display: none;
    }
}

@media (max-width: 640px) {
    .bitacora-templates-modal {
        height: 100dvh;
        max-height: 100dvh;
    }
}

.audit-lines-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.audit-lines-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.audit-lines-table th,
.audit-lines-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 6px 8px;
    font-size: 0.8rem;
}

.audit-lines-table input[type="number"],
.audit-lines-table input[type="text"],
.audit-lines-table select {
    width: 100%;
    font-size: 0.75rem;
    padding: 2px 4px;
}

.audit-line-void {
    text-decoration: line-through;
    opacity: 0.6;
}

.audit-comment-counter {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-link-small {
    background: none;
    border: none;
    color: var(--accent, #0f766e);
    cursor: pointer;
    font-size: 0.9rem;
}

.audit-checklist {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.audit-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

/* PDF Export */
.pdf-report {
    width: 800px;
    background: #ffffff;
    color: #0f172a;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    padding: 24px;
    box-sizing: border-box;
}

.pdf-page {
    page-break-after: always;
}

.pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pdf-logos {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pdf-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 10px;
    background: #f8fafc;
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    font-size: 0.85rem;
}

.pdf-title {
    font-size: 0.9rem;
    margin: 0 0 6px 0;
    font-weight: 700;
}

.pdf-subtitle {
    font-size: 0.8rem;
    margin: 0;
    color: #475569;
}

.pdf-obs-box {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    min-height: 60px;
    background: #fff;
    font-size: 0.85rem;
}

.pdf-gestion {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdf-gestion .status {
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.pdf-gestion .status.ok {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #86efac;
}

.pdf-gestion .status.warn {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fcd34d;
}

.pdf-gestion ul {
    margin: 0;
    padding-left: 16px;
    font-size: 0.8rem;
    color: #475569;
}

.pdf-photos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.pdf-photo {
    position: relative;
    width: 100%;
    padding-top: 70%;
    border-radius: 10px;
    overflow: hidden;
    background: #e5e7eb;
}

.pdf-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdf-photo.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

.pdf-footer {
    margin-top: 14px;
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.new-claim-dropzone {
    margin-top: 0.75rem;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.new-claim-dropzone.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.new-claim-dropzone:hover {
    box-shadow: 0 2px 6px rgba(17, 24, 39, 0.06);
    border-color: #d4d4d4;
}

.new-claim-dropzone.is-dragover {
    background-color: #fdfdfd;
    border-style: dashed;
    border-color: #00b5ff;
    box-shadow: 0 0 12px rgba(0, 181, 255, 0.45), 0 0 24px rgba(0, 181, 255, 0.25);
    animation: dropzone-pulse 1.4s ease-in-out infinite;
}

.new-claim-dropzone-content {
    flex: 1;
    text-align: center;
}

.new-claim-dropzone-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #111827;
    text-shadow: 0 0 6px rgba(0, 181, 255, 0.25);
}

.new-claim-dropzone-subtitle {
    margin: 4px 0 2px;
    font-size: 0.8rem;
    color: #6b7280;
    text-shadow: 0 0 5px rgba(0, 181, 255, 0.2);
}

.new-claim-dropzone-helper {
    margin: 0;
    font-size: 0.75rem;
    color: #9ca3af;
    text-shadow: 0 0 4px rgba(0, 181, 255, 0.18);
}

@keyframes dropzone-pulse {
    0% { box-shadow: 0 0 10px rgba(0, 181, 255, 0.3), 0 0 20px rgba(0, 181, 255, 0.15); }
    50% { box-shadow: 0 0 16px rgba(0, 181, 255, 0.55), 0 0 32px rgba(0, 181, 255, 0.35); }
    100% { box-shadow: 0 0 10px rgba(0, 181, 255, 0.3), 0 0 20px rgba(0, 181, 255, 0.15); }
}

.dropzone-futurista {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    border-radius: 24px;
    background: rgba(5, 10, 30, 0.92);
    border: 1px solid rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 28px rgba(18, 0, 255, 0.35);
    backdrop-filter: blur(16px);
    color: #f7f9ff;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.dropzone-futurista:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 229, 255, 0.9);
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.65);
    background: radial-gradient(circle at top left, rgba(0, 229, 255, 0.15), rgba(5, 10, 30, 0.98));
}

.dropzone-futurista.is-dragover {
    border-color: #00E5FF;
    box-shadow: 0 0 50px rgba(0, 229, 255, 0.9);
    background: radial-gradient(circle at top, rgba(0, 229, 255, 0.25), rgba(5, 10, 30, 0.98));
}

.dropzone-visual {
    position: relative;
    width: 76px;
    height: 76px;
    flex-shrink: 0;
}

.dropzone-glow {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: linear-gradient(135deg, #00E5FF, #1200FF);
    opacity: 0.9;
    filter: blur(1px);
    animation: glowPulse 3.2s ease-in-out infinite;
}

.dropzone-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    z-index: 1;
    animation: iconBreath 2.6s ease-in-out infinite;
}

.dropzone-icon svg {
    width: 42px;
    height: 42px;
}

.dropzone-content {
    flex: 1;
    min-width: 0;
}

.dropzone-content h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.dropzone-subtitle {
    margin: 6px 0 2px;
    font-size: 0.85rem;
    opacity: 0.85;
}

.dropzone-helper {
    margin: 0 0 10px;
    font-size: 0.8rem;
    opacity: 0.8;
}

.badge-ia {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #00E5FF, #1200FF);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.7);
    color: #ffffff;
}

.badge-ia small {
    font-size: 0.6rem;
    opacity: 0.9;
    text-transform: none;
}

@media (max-width: 640px) {
    .dropzone-futurista {
        flex-direction: column;
        align-items: flex-start;
    }

    .dropzone-visual {
        width: 64px;
        height: 64px;
    }
}

@keyframes iconBreath {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08) translateY(-1px);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 18px rgba(0, 229, 255, 0.55);
        opacity: 0.9;
    }

    50% {
        box-shadow: 0 0 32px rgba(18, 0, 255, 0.8);
        opacity: 1;
    }
}

/* === Informe de Auditoría (maquetación estática A4) === */
@page {
    size: A4;
    margin: 20mm 15mm;
}

:root {
    --report-blue: #21509D;
    --report-light: #d7ebf9;
    --report-dark: #004B8D;
    --report-accent: #87CEEB;
    --report-text: #000000;
    --report-label: #333333;
    --report-page-w: 210mm;
    --report-page-h: 297mm;
    --report-padding: 14mm;
    --photo-max-h: 78mm;
    --mg-height: 83mm;
    --mg-graph-h: 68mm;
}

.audit-report {
    font-family: 'Open Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--report-text);
    font-size: 9px;
}

.audit-report .page {
    width: var(--report-page-w);
    min-height: var(--report-page-h);
    background: #fff;
    padding: calc(var(--report-padding) - 8px) var(--report-padding) var(--report-padding);
    position: relative;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .06);
    box-sizing: border-box;
    page-break-after: always;
}

.audit-report .brand-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    margin-bottom: 6mm;
}

.audit-report .brand-row__logo {
    height: 8mm;
    object-fit: contain;
}

.audit-report .brand-row__logo--left {
    justify-self: start;
}

.audit-report .brand-row__logo--right {
    justify-self: end;
}

.audit-report .date-pill {
    width: 45mm;
    background: var(--report-light);
    border-radius: 10px;
    padding: 6px 8px;
    line-height: 1.2;
    margin-bottom: 6mm;
    margin-top: 18px;
}

.audit-report .date-pill__label {
    font-size: 9px;
}

.audit-report .date-pill__value {
    font-size: 9px;
}

.audit-report .title-band {
    width: 100%;
    background: var(--report-light);
    border-radius: 10px;
    padding: 8px 0 10px;
    text-align: center;
    margin-bottom: 8mm;
}

.audit-report .title-band h1 {
    color: var(--report-blue);
    font-size: 16px;
    margin: 0 0 2px;
}

.audit-report .title-band h2 {
    font-size: 12px;
    margin: 0;
}

.audit-report .uf-card {
    position: absolute;
    right: 14mm;
    top: 60mm;
}

.audit-report .uf-card--pill {
    width: 50mm;
    height: 25mm;
    background: #ffffff;
    border: 2px solid #cfe5f6;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(33, 80, 157, 0.08);
}

.audit-report .uf-card__value {
    color: var(--report-blue);
    font-weight: 700;
    font-size: 22px;
    line-height: 1;
}

.audit-report .uf-card__statusText {
    display: none;
}

.audit-report .uf-card__status {
    border: none;
    color: var(--report-blue);
    background: #fff;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 18px;
}

.audit-report .estado-aprobado {
    color: #0f9d58;
}

.audit-report .estado-revisar {
    color: #f59e0b;
}

.audit-report .estado-rechazado {
    color: #dc2626;
}

.audit-report .case-grid {
    display: grid;
    gap: 6px 14px;
    grid-template-columns: 1fr 1fr;
    margin-top: -15px;
    margin-bottom: 6mm;
}

.audit-report .case-item {
    min-height: 18px;
    display: flex;
    align-items: baseline;
    gap: 0;
}

.audit-report .case-item strong {
    flex: 0 0 90px;
    color: var(--report-label);
}

.audit-report .case-item span {
    display: inline-block;
    min-height: 20px;
    line-height: 1.2;
    padding: 0;
    border: none;
    background: transparent;
    transform: translateX(-15px);
}

.audit-report .case-item.taller,
.audit-report .case-item.modelo,
.audit-report .case-item.anio {
    transform: none;
}

.audit-report .case-item.taller span,
.audit-report .case-item.modelo span,
.audit-report .case-item.anio span {
    transform: translateX(-100px);
}

.audit-report .case-item.taller strong,
.audit-report .case-item.modelo strong,
.audit-report .case-item.anio strong {
    transform: translateX(-60px);
}

.audit-report .panel-box {
    margin-bottom: 6mm;
}

.audit-report .panel-box__title {
    text-align: center;
    color: var(--report-blue);
    font-weight: 700;
    margin: 0 0 4px;
}

.audit-report .panel-box__body {
    background: #fff;
    border-radius: 14px;
    padding: 10px 12px;
    border: 2px solid #cfe5f6;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
}

.audit-report .panel-box--denuncio .panel-box__body {
    height: 65px;
    max-height: 65px;
    overflow: hidden;
}

.panel-box--denuncio .panel-box__body {
    height: 65px;
    max-height: 65px;
    overflow: hidden;
}

/* Desplazar hacia abajo el bloque de Denuncio sólo en la página 1 del informe */
.audit-report .page-1 .panel-box--denuncio {
    margin-top: 30px;
}

/* Subir ligeramente Observación de Liquidación en la página 1 */
.audit-report .page-1 .panel-box--obsliq {
    margin-top: -12px;
}

.audit-report .page-1 .table-wrap {
    margin-top: -12px;
}

.audit-report .panel-box--obstec .panel-box__body,
.panel-box--obstec .panel-box__body {
    height: 120px;
    max-height: 120px;
    overflow: hidden;
}

/* Subir ligeramente Observación Técnica en la página 1 */
.audit-report .page-1 .panel-box--obstec {
    margin-top: -12px;
}

.audit-report .panel-box--obsliq .panel-box__body,
.panel-box--obsliq .panel-box__body {
    height: 120px;
    max-height: 120px;
    overflow: hidden;
}

.audit-report .table-wrap .table-title {
    color: var(--report-blue);
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
}

.audit-report .table {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #cfe5f6;
    background: #ffffff;
}

.audit-report .table__row {
    display: flex;
    align-items: center;
}

.audit-report .table__row--head {
    background: var(--report-light);
    color: var(--report-blue);
    font-weight: 700;
}

.audit-report .table__row--head .table__cell {
    padding: 6px 8px;
    border-bottom: 0 !important;
    white-space: normal;
}

.audit-report .table__row--head .report-col-obstec {
    padding-left: 1cm;
}

.audit-report .table__cell {
    padding: 6px 8px;
    border-bottom: 1px solid #eef2f6;
}

.audit-report .table__body .table__row:last-child .table__cell {
    border-bottom: none;
}

.audit-report .w-25 { width: 25%; }
.audit-report .w-35 { width: 35%; }
.audit-report .w-15 { width: 15%; }
.audit-report .w-10 { width: 10%; }
.audit-report .ta-right { text-align: right; }

/* Ajuste de OBS. TÉCNICA y OBS. REPUESTOS */
.audit-report .report-col-obstec {
    width: 20%;
    padding-left: 1cm;
}

.audit-report .report-col-obsrep {
    width: 25%;
    padding-left: 0.3cm;
    padding-right: 1cm;
    white-space: nowrap;
}

.audit-report .table__body {
    max-height: 60mm;
    overflow: auto;
}

.audit-report .table__body::-webkit-scrollbar {
    width: 8px;
}

.audit-report .table__body::-webkit-scrollbar-thumb {
    background: #c9d6ea;
    border-radius: 8px;
}

.audit-report .table__row--foot {
    background: #f0f0f0;
    font-weight: 800;
}

.audit-report .table__row--foot .table__cell strong {
    white-space: nowrap;
}

.audit-report .doc-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10mm;
    text-align: center;
}

.audit-report .doc-footer__bar {
    height: 6.5mm;
    background: var(--report-blue);
    margin: 0;
    border-radius: 0;
}

.audit-report .doc-footer__brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    color: #ffffff;
    font-weight: 700;
    line-height: 6.5mm;
    width: calc(100% - 28mm);
    pointer-events: none;
}

.audit-report .photo-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.audit-report .photo-card {
    border: 1px solid #d9dee8;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: block;
}

.audit-report .photo-stage {
    width: 100%;
    height: 100%;
    background: #f4f7fb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audit-report .photo-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
}

.audit-report .mg-section {
    height: var(--mg-height);
    margin-top: 6mm;
    margin-bottom: 3mm;
    background: var(--report-blue);
    color: #fff;
    border-radius: 10px;
    padding: 3mm 12mm 18mm;
    overflow: hidden;
    position: relative;
    break-inside: avoid;
    page-break-inside: avoid;
}

.audit-report .mg-title {
    text-align: center;
    font-weight: 700;
    margin: 0 0 0mm;
    font-size: 1.05em;
}

.audit-report .mg-scale {
    position: absolute;
    left: 8mm;
    top: 20mm;
    bottom: 25mm;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 1em;
    opacity: .95;
}

.audit-report .mg-graph {
    width: 100%;
    height: var(--mg-graph-h);
    display: block;
}

.audit-report .mg-graph text {
    fill: #fff;
}

.audit-report .mg-graph .guideline {
    stroke: #fff;
    opacity: .22;
}

.audit-report .mg-graph .poly {
    stroke: #fff;
    stroke-width: 3;
    fill: none;
}

.audit-report .gestion-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    margin-top: 10px;
}

.audit-report .gestion-categories span {
    font-size: 0.7rem;
    text-align: center;
    display: block;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }
    .audit-report .page {
        width: 210mm !important;
        min-height: 297mm !important;
        height: auto !important;
        margin: 0 !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
        break-after: page;
        page-break-after: always;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .audit-report .page:last-of-type {
        break-after: auto;
        page-break-after: auto;
    }
}

/* === Clientes === */
.inspecciones-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.view-header.inspecciones-view-header {
    margin-bottom: 0;
    justify-content: space-between;
}

.inspecciones-header-left {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    min-width: 0;
}

.inspecciones-header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.inspecciones-section-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.inspecciones-section-btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1;
    color: #334155;
    font-weight: 600;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.82);
}

.inspecciones-section-btn:hover,
.inspecciones-section-btn:focus-visible {
    color: #0f172a;
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.12);
}

.inspecciones-section-btn.is-active {
    background: #3b82f6;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
}

.inspecciones-refresh-btn,
.inspecciones-import-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

@media (max-width: 900px) {
    .inspecciones-header-left,
    .inspecciones-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .inspecciones-section-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }
}

.inspecciones-status {
    padding: 0.75rem 0.9rem;
    border-radius: 0.7rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.inspecciones-status--warn {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #92400e;
}

.inspecciones-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}

.inspecciones-kpi-grid .kpi-value {
    font-size: 1.6rem;
}

.inspecciones-filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.inspecciones-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.inspecciones-filters-actions {
    margin-top: 0.85rem;
    display: flex;
    gap: 0.65rem;
    justify-content: flex-end;
}

.inspecciones-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row dense;
    gap: 0.75rem;
}

.inspecciones-card-wide {
    grid-column: span 2;
}

.inspecciones-card-channel {
    grid-column: 1;
    grid-row: 2;
}

.inspecciones-card-reasons {
    grid-column: 1;
    grid-row: 3;
}

.inspecciones-card-map {
    grid-column: 2;
    grid-row: 2 / span 2;
}

.inspecciones-chart-wrap {
    position: relative;
    min-height: 300px;
}

.inspecciones-chart-wrap canvas {
    width: 100% !important;
    height: 300px !important;
}

.inspecciones-chart-wrap--small {
    min-height: 260px;
}

.inspecciones-chart-wrap--small canvas {
    height: 260px !important;
}

.inspecciones-chart-wrap .empty-state {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    background: linear-gradient(to bottom, rgba(255,255,255,0.65), rgba(255,255,255,0.8));
    border-radius: 0.5rem;
}

.inspecciones-ranking-container {
    min-height: 300px;
}

.inspecciones-map-wrap {
    position: relative;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(170px, 46%) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.inspecciones-map-viz {
    width: 100%;
    aspect-ratio: 0.44 / 1;
    min-height: 0;
    height: auto;
    max-height: 820px;
    justify-self: center;
    border-radius: 0.65rem;
    border: 1px solid #dbe7ff;
    position: relative;
    isolation: isolate;
    background: #ffffff;
    overflow: hidden;
}

.inspecciones-map-viz.leaflet-container {
    background: #ffffff !important;
}

.inspecciones-map-viz::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: url('/Imagenes/lineas%20y%20puntos2.png') center / cover no-repeat;
    filter: invert(1) hue-rotate(180deg) saturate(1.15);
    opacity: 0.42;
    pointer-events: none;
}

.inspecciones-map-viz .leaflet-pane {
    background: transparent;
    position: relative;
    z-index: 1;
}

.inspecciones-map-viz .leaflet-control-container {
    background: transparent;
}

.inspecciones-map-viz .inspecciones-map-zoom-controls {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inspecciones-map-viz .inspecciones-map-zoom-btn {
    width: 36px;
    height: 36px;
    border: none;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: #1d4ed8;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}

.inspecciones-map-viz .inspecciones-map-zoom-btn:hover,
.inspecciones-map-viz .inspecciones-map-zoom-btn:focus {
    background: #eff6ff;
    color: #1e40af;
}

.inspecciones-map-viz.leaflet-container,
.inspecciones-map-viz .leaflet-container {
    width: 100%;
    height: 100%;
    font-family: inherit;
}

.inspecciones-map-viz .leaflet-tooltip {
    border-radius: 0.45rem;
    border-color: rgba(15, 23, 42, 0.2);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
    color: #0f172a;
    font-size: 0.76rem;
    font-weight: 600;
}

.inspecciones-map-legend {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0.5rem;
    max-height: 820px;
    min-height: 0;
    overflow: auto;
    padding-right: 0.15rem;
}

.inspecciones-map-legend-scale {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: #64748b;
}

.inspecciones-map-legend-scale span {
    font-size: 0.78rem;
    font-weight: 700;
    color: #1b3a86;
}

.inspecciones-map-legend-gradient {
    height: 18px;
    border-radius: 999px;
    border: 1px solid #c4d9f7;
    background: linear-gradient(90deg, #9fbef0 0%, #4f95e7 45%, #2ca320 100%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45);
}

.inspecciones-map-legend-top {
    display: grid;
    gap: 0.38rem;
    align-content: start;
}

.inspecciones-map-legend-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid #bfd3f2;
    border-radius: 0.74rem;
    background: #dce5f2;
    padding: 0.38rem 0.62rem;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.inspecciones-map-legend-item-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    opacity: 0.95;
    transition: width 0.25s ease;
    pointer-events: none;
}

.inspecciones-map-legend-item .name,
.inspecciones-map-legend-item .value {
    position: relative;
    z-index: 1;
}

.inspecciones-map-legend-item .name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0d2f77;
}

.inspecciones-map-legend-item .value {
    flex: 0 0 auto;
    margin-left: auto;
    white-space: nowrap;
    text-align: right;
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f3ca4;
}

.inspecciones-map-legend-item.is-dominant .name,
.inspecciones-map-legend-item.is-dominant .value {
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.inspecciones-map-legend-top > .inspecciones-map-legend-item:nth-child(-n+2) .value {
    color: #0f3ca4;
    text-shadow: none;
}

.inspecciones-map-legend-item.is-selected {
    border-color: #1d4ed8;
    box-shadow: inset 0 0 0 2px rgba(29, 78, 216, 0.22);
}

.inspecciones-map-sla-block {
    margin-top: 0.5rem;
    border: 1px solid #bfd3f2;
    border-radius: 0.74rem;
    background: #f5f8ff;
    min-height: 132px;
    padding: 0.9rem 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.inspecciones-map-sla-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f3b77;
    margin-bottom: 0.55rem;
}

.inspecciones-map-sla-items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.inspecciones-map-sla-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid #d6e4fb;
    border-radius: 999px;
    background: #ffffff;
    padding: 0.65rem 0.7rem;
    font-weight: 700;
    font-size: 1rem;
}

.inspecciones-map-sla-item i {
    font-size: 2rem;
    line-height: 1;
}

.inspecciones-map-sla-item.is-red {
    color: #e25a5a;
}

.inspecciones-map-sla-item.is-yellow {
    color: #b08b11;
}

.inspecciones-map-sla-item.is-green {
    color: #3c9b45;
}

.inspecciones-map-wrap .empty-state {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    background: linear-gradient(to bottom, rgba(255,255,255,0.65), rgba(255,255,255,0.8));
    border-radius: 0.5rem;
}

.inspecciones-region-grid {
    display: grid;
    gap: 0.35rem;
    max-height: 100%;
    height: 100%;
    overflow: auto;
    padding-right: 0.15rem;
}

.inspecciones-region-row {
    display: grid;
    grid-template-columns: 28px minmax(120px, 1fr) minmax(90px, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
    border: 1px solid #dbe7ff;
    border-radius: 0.55rem;
    background: #f8faff;
    padding: 0.34rem 0.45rem;
}

.inspecciones-region-rank {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #1d4ed8;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.inspecciones-region-name {
    font-size: 0.84rem;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inspecciones-region-bar-wrap {
    height: 9px;
    border-radius: 999px;
    background: #dbeafe;
    overflow: hidden;
}

.inspecciones-region-bar {
    height: 100%;
    border-radius: 999px;
}

.inspecciones-region-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e3a8a;
}

.inspecciones-detail-table td,
.inspecciones-detail-table th {
    white-space: nowrap;
}

.inspecciones-hogar-view .inspecciones-status {
    margin-bottom: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.inspecciones-hogar-table .inspecciones-hogar-row {
    cursor: default;
    transition: background-color 0.18s ease;
}

.inspecciones-hogar-table .inspecciones-hogar-row:hover,
.inspecciones-hogar-table .inspecciones-hogar-row:focus-visible {
    background: #eef4ff;
    outline: none;
}

.inspecciones-hogar-share-head-cell,
.inspecciones-hogar-share-cell {
    width: 86px;
    min-width: 86px;
    text-align: center;
}

.inspecciones-hogar-share-tools {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.inspecciones-hogar-row-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
}

.inspecciones-hogar-share-menu-wrap {
    position: relative;
    display: inline-flex;
}

.inspecciones-hogar-share-layer {
    position: fixed;
    inset: 0;
    z-index: 10060;
    pointer-events: auto;
    background: transparent;
}

.inspecciones-hogar-share-btn {
    margin-right: 0;
}

.inspecciones-hogar-list-card,
.inspecciones-hogar-list-card .card-body {
    overflow: visible;
}

.inspecciones-hogar-view .table-container {
    overflow: visible;
}

.inspecciones-hogar-share-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: calc(100% + 0.4rem);
    transform: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: min(360px, calc(100vw - 3rem));
    min-width: 250px;
    max-width: calc(100vw - 3rem);
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    padding: 0.35rem;
    background: #fff;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.2);
    box-sizing: border-box;
    z-index: 10070;
    max-height: min(320px, calc(100vh - 2rem));
    overflow-y: auto;
    pointer-events: auto;
}

.inspecciones-hogar-share-menu.is-open-up {
    top: auto;
    bottom: calc(100% + 0.35rem);
}

.inspecciones-hogar-share-menu.is-open-down {
    top: calc(100% + 0.35rem);
    bottom: auto;
}

.inspecciones-hogar-share-menu[hidden] {
    display: none;
}

.inspecciones-hogar-share-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border: 0;
    background: transparent;
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1f2937;
    cursor: pointer;
    text-align: left;
}

.inspecciones-hogar-share-menu button:hover,
.inspecciones-hogar-share-menu button:focus-visible {
    background: #eff6ff;
    outline: none;
}

.inspecciones-hogar-share-menu button i {
    color: #2563eb;
    font-size: 1rem;
}

.inspecciones-hogar-action-cell {
    text-align: center;
    width: 84px;
}

.inspecciones-hogar-actions {
    justify-content: center;
}

.inspecciones-hogar-view-btn {
    margin-right: 0;
}

.inspecciones-hogar-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.8rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.1;
    background: #eef2ff;
    color: #1e3a8a;
    white-space: nowrap;
}

.inspecciones-hogar-status-pill.is-success {
    border-color: #86efac;
    background: #ecfdf5;
    color: #166534;
}

.inspecciones-hogar-status-pill.is-warning {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}

.inspecciones-hogar-status-pill.is-danger {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

.inspecciones-hogar-status-pill.is-neutral {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.inspecciones-hogar-sla {
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 0.24rem;
}

.inspecciones-hogar-sla-track {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    overflow: hidden;
}

.inspecciones-hogar-sla-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.2s ease;
}

.inspecciones-hogar-sla-fill.is-green {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.inspecciones-hogar-sla-fill.is-yellow {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.inspecciones-hogar-sla-fill.is-red {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.inspecciones-hogar-sla-time {
    font-size: 0.71rem;
    font-weight: 700;
    color: #475569;
    line-height: 1;
}

.inspecciones-hogar-sla-time.is-overdue {
    color: #b91c1c;
}

.inspecciones-hogar-sla-empty {
    font-size: 0.78rem;
    color: #94a3b8;
}

.inspecciones-hogar-detail-shell {
    padding-top: 0.6rem;
    padding-bottom: var(--card-pad);
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
}

body.is-inspecciones-hogar-detail #content-area {
    padding-top: 0.85rem;
}

body.is-inspecciones-hogar-detail .inspecciones-hogar-detail-shell {
    padding-top: 0;
}

.inspecciones-hogar-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.45rem;
}

.inspecciones-hogar-detail-header-main {
    min-width: 0;
}

.inspecciones-hogar-detail-header h2 {
    margin: 0;
    font-size: 1.32rem;
    color: #0f172a;
}

.inspecciones-hogar-detail-header p {
    margin: 0.22rem 0 0;
    color: #475569;
}

.inspecciones-hogar-detail-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.inspecciones-hogar-detail-state {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.2rem 0;
}

.inspecciones-hogar-detail-state-label {
    font-size: 0.86rem;
    font-weight: 700;
    color: #64748b;
}

.hogar-save-as-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-top: 0.35rem;
}

.hogar-save-as-options .save-status-option-btn {
    width: 100%;
    min-height: 44px;
}

.hogar-save-as-modal {
    width: min(180px, calc(100vw - 24px));
    max-width: 180px;
}

.hogar-save-as-modal .modal-body {
    padding-bottom: 0.9rem;
}

.hogar-save-as-modal .modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.hogar-save-as-modal .modal-footer .btn-primary,
.hogar-save-as-modal .modal-footer .btn-secondary {
    min-width: 0;
    width: auto;
    flex: 1 1 0;
    text-align: center;
}

.hogar-save-as-modal .modal-footer .btn-primary {
    flex: 1.3 1 0;
}

.inspecciones-hogar-detail-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    font-size: 0.84rem;
    color: #475569;
    margin-bottom: 0.95rem;
}

.inspecciones-hogar-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    align-items: stretch;
}

.inspecciones-hogar-grid .card {
    border: 1px solid #d7e4f8;
    background: #ffffff;
}

.inspecciones-hogar-detail-card {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid #dbe7f8 !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.inspecciones-hogar-detail-card:hover {
    transform: translateY(-1px);
    border-color: #bfd5f5 !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.inspecciones-hogar-detail-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}

.inspecciones-hogar-detail-card--asegurado::before {
    background: linear-gradient(90deg, #2563eb 0%, #22d3ee 100%);
}

.inspecciones-hogar-detail-card--solicitante::before {
    background: linear-gradient(90deg, #0ea5e9 0%, #3b82f6 100%);
}

.inspecciones-hogar-detail-card--riesgo::before {
    background: linear-gradient(90deg, #0284c7 0%, #34d399 100%);
}

.inspecciones-hogar-detail-card--integracion::before {
    background: linear-gradient(90deg, #1d4ed8 0%, #3b82f6 100%);
}

.inspecciones-hogar-detail-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    min-height: 100%;
}

.inspecciones-hogar-detail-card-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.62rem;
    align-items: start;
    margin-bottom: 0.05rem;
}

.inspecciones-hogar-detail-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1d4ed8;
    background: #eaf2ff;
    border: 1px solid #d7e7ff;
    font-size: 1rem;
    flex: 0 0 34px;
}

.inspecciones-hogar-detail-card-head-copy h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
    color: #0f172a;
}

.inspecciones-hogar-detail-card-head-copy p {
    margin: 0.18rem 0 0;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.35;
}

.inspecciones-hogar-grid h3 {
    margin: 0 0 0.65rem;
    font-size: 0.98rem;
    color: #0f172a;
}

.inspecciones-hogar-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 0.75rem;
}

.inspecciones-hogar-fields--detail {
    gap: 0.52rem 0.58rem;
}

.inspecciones-hogar-field {
    display: grid;
    gap: 0.2rem;
    padding: 0.46rem 0.56rem;
    border-radius: 10px;
    border: 1px solid #dce9fb;
    background: #f8fbff;
    min-height: 56px;
    align-content: start;
}

.inspecciones-hogar-field span {
    color: #5c6f8d;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.inspecciones-hogar-field strong {
    color: #0f172a;
    font-size: 0.91rem;
    line-height: 1.28;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.inspecciones-hogar-field--wide {
    grid-column: 1 / -1;
}

.inspecciones-hogar-flags--detail {
    margin-top: 0.12rem;
}

.inspecciones-hogar-flags {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.inspecciones-hogar-flag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    padding: 0.22rem 0.62rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f8fafc;
    color: #475569;
}

.inspecciones-hogar-flag.is-true {
    border-color: #86efac;
    background: #ecfdf5;
    color: #166534;
}

.inspecciones-hogar-flag.is-false {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #475569;
}

.inspecciones-hogar-link-block {
    margin-top: 0.8rem;
    display: grid;
    gap: 0.45rem;
}

.inspecciones-hogar-link-block--detail {
    margin-top: 0.12rem;
    padding: 0.65rem;
    border-radius: 12px;
    border: 1px solid #d8e6fb;
    background: #f8fbff;
}

.inspecciones-hogar-link-block label {
    font-size: 0.82rem;
    color: #475569;
    font-weight: 600;
}

.inspecciones-hogar-link-status {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.56rem;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1e40af;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.inspecciones-hogar-link-status.is-ready {
    border-color: #86efac;
    background: #ecfdf5;
    color: #166534;
}

.inspecciones-hogar-link-status.is-pending {
    border-color: #fcd34d;
    background: #fef9c3;
    color: #92400e;
}

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

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

.inspecciones-section-head h3 {
    margin: 0;
}

.inspecciones-window-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.is-hidden {
    display: none !important;
}

.inspecciones-agenda-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.inspecciones-agenda-nav,
.inspecciones-agenda-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

@media (max-width: 1023px) {
    .inspecciones-hogar-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .inspecciones-hogar-detail-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .hogar-save-as-options {
        grid-template-columns: 1fr;
    }

    .inspecciones-hogar-grid {
        grid-template-columns: 1fr;
    }

    .inspecciones-hogar-fields {
        grid-template-columns: 1fr;
    }

    .inspecciones-hogar-detail-card-head {
        grid-template-columns: auto 1fr;
    }

    .inspecciones-hogar-link-status {
        justify-self: start;
        grid-column: 1 / -1;
    }

    .inspecciones-hogar-field--wide {
        grid-column: auto;
    }

    .inspecciones-hogar-fields--inspection {
        grid-template-columns: 1fr;
    }

    .inspecciones-hogar-view .detail-side-stack {
        height: auto;
    }
}

.inspecciones-agenda-toolbar-actions {
    margin-left: auto;
}

.inspecciones-agenda-range-label {
    color: #0f172a;
    font-size: 0.96rem;
    font-weight: 700;
}

.inspecciones-agenda-view-switch,
.inspecciones-prefactura-filter-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem;
    border-radius: 0.95rem;
    border: 1px solid #dbe6f7;
    background: #f8fbff;
}

.inspecciones-agenda-view-switch .btn-secondary,
.inspecciones-prefactura-filter-mode .btn-secondary {
    min-height: 40px;
    padding: 0.5rem 0.85rem;
    border-color: transparent;
    background: transparent;
    color: #475569;
    font-weight: 600;
}

.inspecciones-agenda-view-switch .btn-secondary.is-active,
.inspecciones-prefactura-filter-mode .btn-secondary.is-active {
    background: #e8f0ff;
    color: #154aa8;
    border-color: #9fc1ff;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.14);
}

.inspecciones-agenda-calendar-shell {
    overflow-x: auto;
    padding-bottom: 0.2rem;
}

.inspecciones-agenda-columns {
    display: grid;
    gap: 0.8rem;
}

.inspecciones-agenda-columns.is-week {
    grid-template-columns: repeat(7, minmax(180px, 1fr));
    min-width: 1380px;
}

.inspecciones-agenda-columns.is-day {
    grid-template-columns: minmax(320px, 1fr);
}

.inspecciones-agenda-day-column,
.inspecciones-agenda-month-cell {
    border: 1px solid #dbe6f7;
    border-radius: 1rem;
    background: linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.inspecciones-agenda-day-column {
    min-height: 460px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inspecciones-agenda-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #dbe6f7;
    background: rgba(255, 255, 255, 0.9);
}

.inspecciones-agenda-day-head span {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

.inspecciones-agenda-day-jump {
    border: none;
    padding: 0;
    background: transparent;
    color: #0f172a;
    font-size: 0.93rem;
    font-weight: 700;
    text-transform: capitalize;
    cursor: pointer;
}

.inspecciones-agenda-day-jump:hover,
.inspecciones-agenda-day-jump:focus-visible {
    color: #1d4ed8;
}

.inspecciones-agenda-day-events {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.9rem;
    flex: 1 1 auto;
}

.inspecciones-agenda-event-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.82rem 0.88rem;
    border-radius: 0.9rem;
    border: 1px solid #d9e4f7;
    border-left: 4px solid #93c5fd;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    text-align: left;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.inspecciones-agenda-event-card:hover,
.inspecciones-agenda-event-card:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
    border-color: #bfd4f6;
}

.inspecciones-agenda-event-card strong {
    font-size: 0.92rem;
    line-height: 1.3;
    color: #0f172a;
}

.inspecciones-agenda-event-card span {
    display: block;
    font-size: 0.79rem;
    line-height: 1.35;
    color: #475569;
}

.inspecciones-agenda-event-time {
    font-size: 0.74rem !important;
    font-weight: 700;
    color: #1d4ed8 !important;
    letter-spacing: 0.01em;
}

.inspecciones-agenda-event-card.is-pendiente {
    border-left-color: #f59e0b;
    background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
}

.inspecciones-agenda-event-card.is-confirmada {
    border-left-color: #3b82f6;
    background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
}

.inspecciones-agenda-event-card.is-realizada {
    border-left-color: #10b981;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf7 100%);
}

.inspecciones-agenda-event-card.is-anulada {
    border-left-color: #ef4444;
    background: linear-gradient(180deg, #ffffff 0%, #fff2f2 100%);
    opacity: 0.88;
}

.inspecciones-agenda-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(160px, 1fr));
    gap: 0.8rem;
    min-width: 1220px;
}

.inspecciones-agenda-month-cell {
    min-height: 190px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.inspecciones-agenda-month-cell.is-outside {
    opacity: 0.62;
    background: #f8fafc;
}

.inspecciones-agenda-month-day {
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid #d7e4f8;
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.inspecciones-agenda-month-day:hover,
.inspecciones-agenda-month-day:focus-visible {
    border-color: #93c5fd;
    color: #1d4ed8;
}

.inspecciones-agenda-month-events {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 0;
}

.inspecciones-agenda-month-events .inspecciones-agenda-event-card {
    padding: 0.62rem 0.68rem;
    gap: 0.18rem;
}

.inspecciones-agenda-month-events .inspecciones-agenda-event-card strong {
    font-size: 0.82rem;
}

.inspecciones-agenda-month-events .inspecciones-agenda-event-card span {
    font-size: 0.72rem;
}

.inspecciones-agenda-more {
    font-size: 0.74rem;
    font-weight: 700;
    color: #1d4ed8;
    padding-left: 0.15rem;
}

.inspecciones-agenda-modal {
    width: min(900px, calc(100vw - 24px));
    max-width: 900px;
}

.modal-dialog.inspecciones-agenda-modal.hogar-save-as-modal {
    width: min(323px, calc(100vw - 24px));
    max-width: 323px;
}

.inspecciones-agenda-modal-copy {
    margin: 0 0 1rem 0;
    color: #64748b;
    font-size: 0.9rem;
}

.inspecciones-agenda-tariffs-table-wrap {
    overflow: auto;
    max-height: 420px;
    margin-bottom: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
}

.inspecciones-agenda-tariffs-table {
    min-width: 520px;
}

.inspecciones-agenda-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.inspecciones-agenda-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    color: #475569;
    font-size: 0.86rem;
}

.inspecciones-agenda-form-field > span {
    font-weight: 600;
}

.inspecciones-agenda-form-field--full {
    grid-column: 1 / -1;
}

.inspecciones-agenda-form-field textarea {
    min-height: 92px;
    resize: vertical;
}

.inspecciones-agenda-search-results {
    border: 1px solid #dbe6f7;
    border-radius: 0.75rem;
    background: #f8fbff;
    max-height: 220px;
    overflow: auto;
    display: grid;
    gap: 0.2rem;
    padding: 0.25rem;
}

.inspecciones-agenda-search-option {
    border: 1px solid transparent;
    border-radius: 0.65rem;
    background: #fff;
    text-align: left;
    display: grid;
    gap: 0.14rem;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
}

.inspecciones-agenda-search-option:hover,
.inspecciones-agenda-search-option:focus-visible {
    border-color: rgba(59, 130, 246, 0.45);
    background: #eef5ff;
}

.inspecciones-agenda-search-option.is-selected {
    border-color: rgba(59, 130, 246, 0.55);
    background: #e6f0ff;
}

.inspecciones-agenda-search-option.is-active {
    border-color: rgba(37, 99, 235, 0.8);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.28);
}

.inspecciones-agenda-search-main {
    color: #0f172a;
    font-size: 0.82rem;
    font-weight: 600;
}

.inspecciones-agenda-search-meta {
    color: #64748b;
    font-size: 0.76rem;
}

.inspecciones-agenda-search-empty {
    color: #64748b;
    font-size: 0.78rem;
    padding: 0.35rem 0.45rem;
}

.inspecciones-agenda-summary-box {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    border-radius: 0.95rem;
    border: 1px solid #dbe6f7;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
    color: #334155;
    font-size: 0.84rem;
}

.inspecciones-prefactura-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.inspecciones-prefactura-range-label {
    grid-column: 1 / -1;
    color: #64748b;
    font-size: 0.86rem;
    font-weight: 600;
}

tr[data-prefact-event-id] {
    cursor: pointer;
}

tr[data-prefact-event-id]:hover td {
    background: #f8fbff;
}

.inspecciones-pagination {
    padding: 0.9rem 0.25rem 0 0.25rem;
}

@media (max-width: 1180px) {
    .inspecciones-agenda-toolbar-actions {
        margin-left: 0;
    }

    .inspecciones-prefactura-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .inspecciones-agenda-toolbar,
    .inspecciones-agenda-nav,
    .inspecciones-agenda-toolbar-actions {
        align-items: stretch;
    }

    .inspecciones-agenda-nav,
    .inspecciones-agenda-toolbar-actions,
    .inspecciones-agenda-view-switch,
    .inspecciones-prefactura-filter-mode {
        width: 100%;
    }

    .inspecciones-agenda-view-switch .btn-secondary,
    .inspecciones-prefactura-filter-mode .btn-secondary,
    .inspecciones-agenda-toolbar-actions .btn-primary,
    .inspecciones-agenda-toolbar-actions .btn-secondary {
        flex: 1 1 0;
        justify-content: center;
    }

    .inspecciones-agenda-form-grid,
    .inspecciones-agenda-summary-box,
    .inspecciones-prefactura-filters {
        grid-template-columns: 1fr;
    }

    .inspecciones-agenda-modal .modal-footer {
        flex-wrap: wrap;
    }

    .inspecciones-agenda-modal .modal-footer .btn-primary,
    .inspecciones-agenda-modal .modal-footer .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 860px) {
    .inspecciones-kpi-grid {
        grid-template-columns: 1fr;
    }
    .inspecciones-filters-grid {
        grid-template-columns: 1fr;
    }
    .inspecciones-filters-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .inspecciones-dashboard-grid {
        grid-template-columns: 1fr;
    }
    .inspecciones-card-wide {
        grid-column: span 1;
    }
    .inspecciones-card-channel,
    .inspecciones-card-reasons,
    .inspecciones-card-map {
        grid-column: auto;
        grid-row: auto;
    }
    .inspecciones-chart-wrap,
    .inspecciones-chart-wrap canvas,
    .inspecciones-ranking-container {
        min-height: 250px;
        height: 250px !important;
    }
    .inspecciones-map-wrap {
        min-height: auto;
        height: auto !important;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }
    .inspecciones-chart-wrap--small,
    .inspecciones-chart-wrap--small canvas {
        min-height: 250px;
        height: 250px !important;
    }
    .inspecciones-map-viz {
        min-height: 320px;
        height: 320px !important;
    }
    .inspecciones-map-legend {
        max-height: none;
        overflow: visible;
    }
    .inspecciones-map-legend-item {
        flex-direction: row;
        align-items: center;
        gap: 0.45rem;
    }
    .inspecciones-map-sla-items {
        grid-template-columns: 1fr;
    }
    .inspecciones-map-sla-item {
        justify-content: flex-start;
    }
    .inspecciones-region-row {
        grid-template-columns: 24px minmax(88px, 1fr) minmax(72px, 1fr) auto;
        gap: 0.35rem;
    }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.view-title {
    margin: 0;
    font-size: 1.5rem;
}

.view-subtitle {
    margin: 0.15rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.toolbar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1rem;
}

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

.toolbar-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.input-text,
.input-select {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.table-striped thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 0.65rem;
}

.table-striped tbody td {
    border-bottom: 1px solid var(--border);
    padding: 0.65rem;
}

.facturacion-view {
    position: relative;
}

.facturacion-loader {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: block;
    --facturacion-k-size: min(147px, 31vw);
    background:
        radial-gradient(circle at 28% 20%, rgba(195, 236, 255, 0.45), rgba(195, 236, 255, 0) 58%),
        rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.facturacion-loader.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.facturacion-loader__glyph {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--facturacion-k-size);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
}

.facturacion-loader__svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 8px rgba(65, 189, 255, 0.42));
}

.facturacion-loader__line,
.facturacion-loader__node-ring {
    fill: none;
    stroke: url(#facturacionLoaderGradient);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    opacity: 0;
}

.facturacion-loader__line {
    stroke-width: 26;
}

.facturacion-loader__line--c,
.facturacion-loader__line--d {
    stroke-linecap: butt;
}

.facturacion-loader__node-ring {
    stroke-width: 24;
}

.facturacion-loader__line--a {
    --fact-k-delay: 0s;
    --fact-k-dur: 0.28s;
}

.facturacion-loader__line--b {
    --fact-k-delay: 0.22s;
    --fact-k-dur: 0.16s;
}

.facturacion-loader__line--c {
    --fact-k-delay: 0.36s;
    --fact-k-dur: 0.18s;
}

.facturacion-loader__line--d {
    --fact-k-delay: 0.52s;
    --fact-k-dur: 0.18s;
}

.facturacion-loader__node-ring--right {
    --fact-k-delay: 0.44s;
    --fact-k-dur: 0.16s;
}

.facturacion-loader__node-ring--left {
    --fact-k-delay: 0.68s;
    --fact-k-dur: 0.16s;
}

.facturacion-loader__node-ring--top {
    --fact-k-delay: 0.86s;
    --fact-k-dur: 0.16s;
}

.facturacion-loader.is-active .facturacion-loader__line,
.facturacion-loader.is-active .facturacion-loader__node-ring {
    animation-name: facturacionKDraw;
    animation-duration: var(--fact-k-dur, 0.12s);
    animation-timing-function: cubic-bezier(0.33, 1, 0.68, 1);
    animation-delay: var(--fact-k-delay, 0s);
    animation-fill-mode: forwards;
}

.facturacion-loader__node-flash {
    fill: #beefff;
    opacity: 0;
    filter: blur(1.2px);
    transform-box: fill-box;
    transform-origin: center;
}

.facturacion-loader__node-flash--right {
    --fact-k-flash-delay: 0.62s;
}

.facturacion-loader__node-flash--left {
    --fact-k-flash-delay: 0.86s;
}

.facturacion-loader__node-flash--top {
    --fact-k-flash-delay: 1.02s;
}

.facturacion-loader.is-active .facturacion-loader__node-flash {
    animation: facturacionKNodeFlash 0.16s ease-out var(--fact-k-flash-delay, 0.62s) forwards;
}

.facturacion-loader__final-glow {
    position: absolute;
    inset: 16% 10%;
    border-radius: 44%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(189, 240, 255, 0.96) 0%, rgba(105, 205, 255, 0.38) 40%, rgba(105, 205, 255, 0) 75%);
    opacity: 0;
    transform: scale(0.84);
}

.facturacion-loader.is-active .facturacion-loader__final-glow {
    animation: facturacionKFinalFlash 0.12s ease-out 1.08s forwards;
}

.facturacion-loader__label {
    position: absolute;
    left: 50%;
    top: calc(50% + (var(--facturacion-k-size) / 2) + 14px);
    transform: translateX(-50%);
    margin: 0;
    color: #0873a7;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

@keyframes facturacionKDraw {
    from {
        stroke-dashoffset: 100;
        opacity: 0.2;
    }
    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

@keyframes facturacionKNodeFlash {
    0% {
        opacity: 0;
        transform: scale(0.65);
    }
    45% {
        opacity: 0.78;
        transform: scale(1.05);
    }
    100% {
        opacity: 0;
        transform: scale(1.55);
    }
}

@keyframes facturacionKFinalFlash {
    0% {
        opacity: 0;
        transform: scale(0.84);
    }
    45% {
        opacity: 0.74;
        transform: scale(1.04);
    }
    100% {
        opacity: 0;
        transform: scale(1.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .facturacion-loader {
        transition: none;
    }

    .facturacion-loader.is-active .facturacion-loader__line,
    .facturacion-loader.is-active .facturacion-loader__node-ring,
    .facturacion-loader.is-active .facturacion-loader__node-flash,
    .facturacion-loader.is-active .facturacion-loader__final-glow {
        animation: none !important;
    }

    .facturacion-loader.is-active .facturacion-loader__line,
    .facturacion-loader.is-active .facturacion-loader__node-ring {
        opacity: 1;
        stroke-dashoffset: 0;
    }
}

.facturacion-view .facturacion-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.facturacion-view .facturacion-table {
    width: max-content;
    min-width: 1800px;
    table-layout: auto;
}

.facturacion-view .facturacion-table th,
.facturacion-view .facturacion-table td {
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
    vertical-align: middle;
}

.facturacion-view .facturacion-table th {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.facturacion-view .facturacion-table td {
    white-space: nowrap;
}

.facturacion-view .card-body {
    overflow-x: auto;
}

.facturacion-view .facturacion-status-select {
    min-width: 130px;
    font-size: 0.8rem;
    padding: 0.4rem 0.55rem;
}

.facturacion-view .facturacion-input {
    min-width: 130px;
    font-size: 0.8rem;
    padding: 0.4rem 0.55rem;
}

.facturacion-view .facturacion-number-input {
    min-width: 120px;
}

.facturacion-view .facturacion-summary-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.facturacion-view .facturacion-summary-table th,
.facturacion-view .facturacion-summary-table td {
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
}

.facturacion-view .facturacion-summary-table th {
    white-space: normal;
    line-height: 1.2;
}

.facturacion-view .facturacion-summary-table td {
    white-space: nowrap;
}

.facturacion-view .facturacion-summary-table {
    width: 100%;
    table-layout: fixed;
}

.facturacion-view .facturacion-summary-table th:nth-child(1),
.facturacion-view .facturacion-summary-table td:nth-child(1) {
    width: 34%;
    text-align: left;
}

.facturacion-view .facturacion-summary-table th:nth-child(2),
.facturacion-view .facturacion-summary-table th:nth-child(3),
.facturacion-view .facturacion-summary-table th:nth-child(4),
.facturacion-view .facturacion-summary-table td:nth-child(2),
.facturacion-view .facturacion-summary-table td:nth-child(3),
.facturacion-view .facturacion-summary-table td:nth-child(4) {
    width: 22%;
    text-align: right;
}

.facturacion-view .facturacion-summary-table tfoot td {
    font-weight: 700;
    background: #f8fafc;
}

.facturacion-view .facturacion-summary-grid {
    align-items: start;
}

.facturacion-view .facturacion-summary-grid .facturacion-monthly-grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: 1fr;
    grid-column: 1 / -1;
}

.facturacion-view .facturacion-summary-grid .facturacion-monthly-grid .card {
    width: 100%;
}

.facturacion-view .facturacion-summary-grid .status-donut-chart {
    width: 168px;
    max-width: 168px;
}

.facturacion-view .facturacion-summary-grid .status-donut-chart canvas {
    max-height: 168px;
    background: #ffffff;
    border-radius: 50%;
}

@media (min-width: 1024px) {
    .facturacion-view .facturacion-summary-grid .facturacion-monthly-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.text-right {
    text-align: right;
}

.text-danger {
    color: var(--danger);
}

.pagination-container {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.75rem;
}

.usuarios-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.usuarios-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #d7e1ec;
    background: #ffffff;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.usuarios-action-btn i {
    font-size: 1rem;
    line-height: 1;
    pointer-events: none;
}

.usuarios-action-btn:hover {
    transform: translateY(-1px);
}

.usuarios-action-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.usuarios-action-btn--edit {
    color: #1d4ed8;
}

.usuarios-action-btn--edit:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}

.usuarios-action-btn--activate {
    color: #047857;
}

.usuarios-action-btn--activate:hover {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.usuarios-action-btn--deactivate {
    color: #b91c1c;
}

.usuarios-action-btn--deactivate:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.usuarios-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.usuarios-toolbar-actions .btn-primary {
    white-space: nowrap;
}

.usuarios-workspace {
    --usuarios-subnav-width: 250px;
    display: grid;
    grid-template-columns: var(--usuarios-subnav-width) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.usuarios-subnav {
    position: sticky;
    top: calc(var(--topbar-height, 72px) + 1rem);
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    padding: 0.7rem;
    display: grid;
    gap: 0.65rem;
    box-shadow: var(--shadow-sm);
}

.usuarios-subnav-toggle {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.usuarios-subnav-menu {
    display: grid;
    gap: 0.45rem;
}

.usuarios-subnav-item {
    width: 100%;
    border: 1px solid #d8e0eb;
    background: #f8fbff;
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.usuarios-subnav-item:hover {
    border-color: #8db2ec;
    background: #edf4ff;
}

.usuarios-subnav-item:focus-visible {
    outline: 2px solid #4b8df8;
    outline-offset: 2px;
}

.usuarios-subnav-item.is-active {
    border-color: #4b8df8;
    background: #e8f1ff;
    color: #103d8c;
}

.usuarios-subnav-item[hidden] {
    display: none !important;
}

.usuarios-subview-content {
    min-width: 0;
}

.usuarios-subview-panel {
    display: none;
}

.usuarios-subview-panel.is-active {
    display: grid;
    gap: 1rem;
}

.usuarios-workspace.is-subnav-collapsed {
    --usuarios-subnav-width: 86px;
}

.usuarios-workspace.is-subnav-collapsed .usuarios-subnav-item {
    justify-content: center;
    padding: 0.65rem 0.45rem;
}

.usuarios-workspace.is-subnav-collapsed .usuarios-subnav-item__label {
    display: none;
}

.usuarios-workspace.is-subnav-collapsed .usuarios-subnav-toggle__label {
    display: none;
}

.usuarios-role-policy-card .card-body {
    display: grid;
    gap: 0.85rem;
}

.usuarios-role-policy-toolbar {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
}

.usuarios-role-policy-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.usuarios-role-policy-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.usuarios-role-policy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.usuarios-role-policy-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    padding: 0.75rem;
}

.usuarios-role-policy-section h3 {
    margin: 0 0 0.55rem;
    font-size: 0.92rem;
}

.usuarios-role-policy-status {
    margin: 0;
    min-height: 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.policy-toggle-grid {
    display: grid;
    gap: 0.6rem;
}

.policy-toggle-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfdff;
    padding: 0.55rem;
    display: grid;
    gap: 0.4rem;
}

.policy-toggle-group__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #4b5563;
}

.policy-toggle-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 0.55rem;
    align-items: start;
}

.policy-toggle-item input[type="checkbox"] {
    margin-top: 0.15rem;
}

.policy-toggle-item__label {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--text-main);
}

.policy-toggle-item__desc {
    margin: 0.1rem 0 0;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.usuario-advanced-permissions {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    background: #fbfdff;
}

.usuario-inline-checkbox {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    font-weight: 600;
}

.usuario-overrides-panel {
    margin-top: 0.55rem;
}

.usuario-overrides-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

@media (max-width: 960px) {
    .usuarios-workspace {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .usuarios-subnav {
        position: static;
    }

    .usuarios-subnav-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .usuarios-workspace.is-subnav-collapsed .usuarios-subnav-menu {
        display: none;
    }

    .usuarios-workspace.is-subnav-collapsed .usuarios-subnav-toggle__label {
        display: inline;
    }

    .usuarios-role-policy-grid,
    .usuario-overrides-grid {
        grid-template-columns: 1fr;
    }

    .usuarios-toolbar-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

.sync-card__body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.sync-card__title {
    margin: 0;
    font-size: 1rem;
}

.sync-card__subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.sync-card__status {
    padding: 0 1.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .sync-card__status {
        padding: 0 1rem 1rem;
    }
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1;
}

.modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: min(980px, calc(100vw - 24px));
    max-width: 980px;
    max-height: calc(100vh - 24px);
    overflow: auto;
    z-index: 2;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    margin: 5vh auto;
}

.modal-dialog.account-actions-modal {
    width: min(420px, calc(100vw - 32px));
    max-width: 420px;
    border-radius: 14px;
}

.account-actions-modal .modal-body {
    padding: 1rem 1.25rem 1.25rem;
}

.account-actions-modal .account-actions .btn-secondary,
.account-actions-modal .account-actions .btn-danger {
    width: 100%;
    justify-content: center;
}

.modal-dialog.client-switch-modal {
    width: min(520px, calc(100vw - 32px));
    max-width: 520px;
    border-radius: 14px;
}

.client-switch-modal .modal-body {
    display: grid;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem;
}

.client-switch-modal .modal-footer {
    padding: 0.9rem 1.25rem 1rem;
}

.modal-header,
.modal-footer {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-footer {
    border-top: 1px solid var(--border);
    border-bottom: 0;
    gap: 0.5rem;
    justify-content: flex-end;
}

.modal-body {
    padding: 1.25rem;
}

@media (max-width: 640px) {
    .modal-dialog {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        margin: 0;
        border-radius: 0;
    }
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

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

.form-group label {
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.input-error {
    border-color: var(--danger) !important;
}
