:root {
    --bg: #eff3f9;
    --surface: rgba(255,255,255,.82);
    --surface-strong: rgba(255,255,255,.94);
    --line: rgba(15,23,42,.08);
    --line-strong: rgba(15,23,42,.14);
    --text: #10213c;
    --muted: #6e7c94;
    --shadow: 0 24px 70px rgba(16,35,74,.12);
    --shadow-soft: 0 16px 32px rgba(16,35,74,.08);
    --radius: 30px;
    --good: #179c58;
    --fair: #f08c00;
    --bad: #e03131;
    --hero1: #182e72;
    --hero2: #2855d9;
    --brand: #2855d9;
    --brand-dark: #163172;
    --map-height: 58vh;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 0% 0%, rgba(40,85,217,.18), transparent 28%),
        radial-gradient(circle at 100% 100%, rgba(23,156,88,.14), transparent 24%),
        linear-gradient(180deg,#f8fbff 0%, #eef3fa 100%);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ambient {
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    opacity: .45;
    z-index: 0;
}

.ambient-one {
    width: 22rem;
    height: 22rem;
    top: -6rem;
    left: -6rem;
    background: rgba(40,85,217,.24);
}

.ambient-two {
    width: 24rem;
    height: 24rem;
    right: -4rem;
    bottom: 2rem;
    background: rgba(23,156,88,.14);
}

.auth-screen, #appScreen {
    position: relative;
    z-index: 1;
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-card {
    width: min(980px,100%);
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 1rem;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 34px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.auth-brand {
    padding: 3rem;
    background: linear-gradient(145deg, rgba(24,46,114,.97), rgba(40,85,217,.94));
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-brand::after {
    content: '';
    position: absolute;
    inset: auto -3rem -3rem auto;
    width: 14rem;
    height: 14rem;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    filter: blur(2px);
}

.eyebrow,
.section-kicker {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: .72rem;
    font-weight: 800;
}

.auth-brand .eyebrow,
.top-eyebrow {
    color: rgba(255,255,255,.68);
}

.brand-lockup,
.brand-title {
    margin: .35rem 0 1rem;
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -.05em;
}

.brand-lockup span,
.brand-title span {
    color: rgba(255,255,255,.92);
    font-size: .66em;
    font-weight: 700;
}

.auth-copy {
    max-width: 34rem;
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(255,255,255,.82);
}

.auth-form {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.1rem;
    background: rgba(255,255,255,.72);
}

.hint-card {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    background: rgba(40,85,217,.06);
    border: 1px solid rgba(40,85,217,.12);
    border-radius: 18px;
    color: var(--muted);
}

.topbar {
    background: linear-gradient(135deg, var(--hero1), var(--hero2));
    color: #fff;
    box-shadow: 0 16px 36px rgba(40,85,217,.22);
}

.app-shell {
    max-width: 1450px;
}

.badge-soft-success,
.badge-soft-warning,
.badge-soft-neutral {
    color: #172033;
    border: 1px solid transparent;
}

.badge-soft-success {
    background: rgba(52,211,153,.2);
    border-color: rgba(52,211,153,.28);
}

.badge-soft-warning {
    background: rgba(251,191,36,.24);
    border-color: rgba(251,191,36,.28);
}

.badge-soft-neutral {
    background: rgba(255,255,255,.16);
    color: #fff;
    border-color: rgba(255,255,255,.18);
}

.badge-soft-danger {
    background: rgba(239,68,68,.16);
    color: #fff;
    border-color: rgba(239,68,68,.24);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .55rem .85rem;
    border-radius: 18px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.14);
}

.user-badge i {
    font-size: 1.45rem;
}

.user-badge small {
    display: block;
    color: rgba(255,255,255,.72);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(320px,420px) minmax(0,1fr);
    gap: 1.5rem;
    align-items: start;
}

.right-column {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

.panel-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.7);
    box-shadow: var(--shadow);
}

.capture-card {
    position: sticky;
    top: 1.25rem;
    z-index: 1;
}

.context-card,
.content-card {
    grid-column: auto;
}


.context-photo-toolbar {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.context-photo-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255,255,255,.92);
}

.context-photo-preview {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    background: #eef3fb;
}

.context-photo-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    color: var(--muted);
}

.context-photo-meta small {
    display: block;
    color: #7c8ca8;
}

.panel-heading,
.content-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.panel-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -.04em;
}

.section-kicker {
    color: #7c8ca8;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg,#34d399,#38bdf8);
    box-shadow: 0 0 0 8px rgba(52,211,153,.16);
}

.panel-heading-capture {
    align-items: flex-start;
}

.capture-metrics {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-left: auto;
}

.mini-metric {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    padding: .42rem .72rem;
    border-radius: 999px;
    background: rgba(40,85,217,.08);
    border: 1px solid rgba(40,85,217,.10);
    color: var(--muted);
    font-size: .84rem;
    font-weight: 700;
    line-height: 1;
}

.mini-metric i {
    font-size: .92rem;
    color: var(--brand);
}

.gps-card-inline {
    padding: .85rem .9rem;
    background: linear-gradient(180deg, rgba(251,253,255,.98), rgba(245,248,255,.88));
}

.gps-topline.compact {
    gap: .5rem;
    margin-bottom: .55rem;
}

.gps-title-row {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.gps-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(40,85,217,.08);
    color: var(--brand);
    font-size: 1rem;
}

.gps-badges.compact .soft-badge,
.gps-badges.compact .status-pill {
    padding: .42rem .72rem;
    font-size: .76rem;
}

.meter-wrap.compact {
    height: 10px;
}

.gps-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .55rem;
}

.gps-grid.compact div {
    min-height: 0;
    padding: .72rem .8rem;
    border-radius: 16px;
}

.gps-grid.compact span {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .76rem;
    margin-bottom: .18rem;
}

.gps-grid.compact strong {
    font-size: .95rem;
    line-height: 1.25;
}

.gps-card-inline {
    padding: .82rem .9rem;
    background: linear-gradient(180deg, rgba(251,253,255,.98), rgba(245,248,255,.9));
}

.gps-inline-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
}

.gps-inline-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: nowrap;
}

.gps-inline-head {
    display: flex;
    align-items: center;
    gap: .62rem;
    min-width: 0;
}

.gps-inline-head strong {
    display: block;
    font-size: 1rem;
    line-height: 1.1;
    white-space: nowrap;
}

.gps-inline-badge {
    padding: .42rem .72rem;
    font-size: .76rem;
    white-space: nowrap;
    flex: 0 0 auto;
}

.gps-state-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
}

.gps-state-icon.good {
    background: rgba(23,156,88,.12);
    color: var(--good);
}

.gps-state-icon.fair {
    background: rgba(240,140,0,.14);
    color: var(--fair);
}

.gps-state-icon.danger {
    background: rgba(224,49,49,.12);
    color: var(--bad);
}

.gps-state-icon i {
    font-size: 1.05rem;
    line-height: 1;
}

.gps-state-icon .spin {
    animation: gbSpin 1s linear infinite;
}

@keyframes gbSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.gps-inline-row-bottom {
    justify-content: flex-start;
}

.gps-inline-meta {
    display: inline-flex;
    align-items: center;
    gap: .46rem;
    min-height: 38px;
    padding: .35rem .55rem;
    border-radius: 14px;
    background: rgba(255,255,255,.88);
    border: 1px solid var(--line);
    color: var(--muted);
    flex: 0 0 auto;
}

.gps-inline-meta > i {
    color: #8090aa;
    font-size: .92rem;
}

.gps-inline-values {
    display: flex;
    flex-direction: column;
    gap: .02rem;
    line-height: 1.05;
}

.gps-inline-location strong,
.gps-inline-accuracy strong {
    font-size: .84rem;
    color: var(--text);
    font-weight: 700;
}

.gps-inline-accuracy {
    white-space: nowrap;
}

.filter-shell {
    padding: 1rem;
    background: rgba(255,255,255,.74);
    border: 1px solid var(--line);
    border-radius: 24px;
}

.form-control,
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control,
.btn {
    border-radius: 18px !important;
}

.form-control,
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    min-height: 54px;
    border: 1px solid var(--line-strong) !important;
    box-shadow: none !important;
    background: rgba(255,255,255,.92) !important;
}

.form-control:focus,
.ts-wrapper.focus .ts-control {
    border-color: rgba(40,85,217,.35) !important;
    box-shadow: 0 0 0 4px rgba(40,85,217,.10) !important;
}

.ts-dropdown {
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.counter-shell {
    display: grid;
    grid-template-columns: 72px 1fr 72px;
    gap: .9rem;
    align-items: center;
}

.counter-btn,
.counter-value {
    min-height: 72px;
    border-radius: 22px;
}

.counter-btn {
    border: 0;
    background: linear-gradient(180deg,#fff,#eef4ff);
    box-shadow: inset 0 0 0 1px var(--line), 0 12px 22px rgba(20,33,61,.08);
    color: var(--text);
    font-size: 1.25rem;
}

.counter-btn.positive {
    background: linear-gradient(180deg,#f4fff8,#e7f8ef);
}

.counter-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.counter-value {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.96);
    font-size: 2rem;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px var(--line);
}

.gps-card {
    border-radius: 24px;
    padding: 1rem;
    background: linear-gradient(180deg,#fbfdff,#f5f8ff);
    border: 1px solid var(--line);
}

.gps-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.gps-badges {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.soft-badge {
    border-radius: 999px;
    padding: .55rem .85rem;
    font-weight: 700;
}

.status-pill {
    padding: .5rem .85rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
}

.status-pill.good { background: var(--good); }
.status-pill.fair { background: var(--fair); }
.status-pill.danger { background: var(--bad); }

.meter-wrap {
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: #e9eef7;
}

.meter-bar {
    height: 100%;
    border-radius: 999px;
    transition: width .3s ease, background-color .3s ease;
}

.meter-bar.good { background: linear-gradient(90deg,#34d399,#179c58); }
.meter-bar.fair { background: linear-gradient(90deg,#ffd166,#f08c00); }
.meter-bar.danger { background: linear-gradient(90deg,#ff8787,#e03131); }

.gps-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: .85rem;
}

.gps-grid div {
    border-radius: 18px;
    background: rgba(255,255,255,.92);
    padding: .95rem 1rem;
    border: 1px solid var(--line);
}

.gps-grid span {
    display: block;
    color: var(--muted);
    margin-bottom: .15rem;
}

.btn-brand {
    background: linear-gradient(135deg,var(--brand-dark),var(--brand));
    border: 0;
    color: #fff;
    box-shadow: 0 18px 34px rgba(40,85,217,.22);
}

.btn-brand:hover,
.btn-brand:focus,
.btn-brand:active {
    color: #fff !important;
}

/* NUEVA BARRA DE ACCIONES */
.action-dock {
    margin-top: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: .9rem 1rem;
    border-radius: 999px;
    background: rgba(255,255,255,.68);
    border: 1px solid rgba(255,255,255,.78);
    backdrop-filter: blur(14px);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.55),
        0 16px 30px rgba(16,35,74,.08);
}

.icon-action {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        opacity .18s ease,
        filter .18s ease;
    box-shadow:
        0 14px 26px rgba(16,35,74,.18),
        inset 0 1px 0 rgba(255,255,255,.18);
}

.icon-action:hover {
    transform: translateY(-2px);
    box-shadow:
        0 18px 32px rgba(16,35,74,.22),
        inset 0 1px 0 rgba(255,255,255,.22);
}

.icon-action:active {
    transform: scale(.96);
}

.icon-action:focus-visible {
    outline: 4px solid rgba(40,85,217,.16);
    outline-offset: 4px;
}

.icon-action:disabled {
    opacity: .42;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: grayscale(.15);
}

.icon-action-save {
    background: linear-gradient(135deg, #129a51, #25c06d);
}

.icon-action-save:hover {
    background: linear-gradient(135deg, #108648, #1faa60);
}

.icon-action-sync {
    background: linear-gradient(135deg, #1d4ed8, #4f7cff);
}

.icon-action-sync:hover {
    background: linear-gradient(135deg, #1a44bc, #3f6ff5);
}

/* Opcional: color cuando haya pendientes */
.icon-action-sync.has-pending {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    animation: pulseSoft 1.8s infinite;
}

@keyframes pulseSoft {
    0% { box-shadow: 0 0 0 0 rgba(245,158,11,.34); }
    70% { box-shadow: 0 0 0 14px rgba(245,158,11,0); }
    100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}

.tabs-toolbar {
    display: flex;
    justify-content: flex-start;
}

.modern-tabs .nav-link {
    border-radius: 999px;
    padding: .8rem 1.05rem;
    font-weight: 700;
    color: var(--muted);
}

.modern-tabs .nav-link.active {
    background: linear-gradient(135deg,#1d4ed8,#2855d9);
    color: #fff;
    box-shadow: 0 14px 28px rgba(40,85,217,.22);
}

#map {
    min-height: var(--map-height);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--line);
}

.list-shell,
.request-shell {
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.96);
}

.dashboard-grid > * ,
.right-column > * ,
.view-panel,
#listPanel {
    min-width: 0;
}

.list-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x pinch-zoom;
}

#listPanel .table {
    width: 100%;
    min-width: 860px;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 1rem .9rem;
}

.table thead th {
    background: #f5f8fc;
    color: var(--muted);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.table tbody tr:hover {
    background: #f8fbff;
}

.audit-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 999px;
    padding: .35rem .6rem;
    background: #f3f6fb;
    color: var(--muted);
    font-size: .78rem;
    margin-bottom: .25rem;
}

.row-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.alert {
    border-radius: 18px;
    border: 0;
}

.modal-content {
    border-radius: 28px;
    background: rgba(255,255,255,.96);
}

.map-popup {
    min-width: 200px;
}

.admin-summary {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .7rem 1rem;
    border-radius: 999px;
    background: rgba(40,85,217,.08);
    border: 1px solid rgba(40,85,217,.12);
    color: var(--text);
}


.sync-hint {
    margin-top: .9rem;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .45rem .8rem;
    border-radius: 999px;
    background: rgba(255,255,255,.56);
    border: 1px solid rgba(15,23,42,.06);
    color: var(--muted);
    font-size: .84rem;
    backdrop-filter: blur(10px);
}

.sync-hint small {
    color: #8a96ab;
    font-size: .78rem;
}

.sync-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 4px rgba(16,35,74,.04);
}

.sync-dot.synced { background: #22c55e; }
.sync-dot.pending { background: #f59e0b; }
.sync-dot.offline { background: #94a3b8; }
.sync-dot.syncing { background: #3b82f6; animation: syncBlink 1.2s ease-in-out infinite; }
.sync-dot.error { background: #ef4444; }

@keyframes syncBlink {
    0%, 100% { opacity: .55; transform: scale(.95); }
    50% { opacity: 1; transform: scale(1.08); }
}

@media (max-width: 1199.98px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .right-column {
        grid-column: auto;
        width: 100%;
        gap: 1.25rem;
    }

    .capture-card {
        position: static;
    }

    .context-card,
    .content-card {
        grid-column: auto;
        width: 100%;
    }
}

@media (max-width: 991.98px) {
    .auth-card {
        grid-template-columns: 1fr;
    }

    .auth-brand,
    .auth-form {
        padding: 2rem;
    }
}

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

@media (max-width: 767.98px) {
    :root {
        --map-height: 46vh;
    }

    .topbar .app-shell {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .brand-title {
        font-size: 2.1rem;
    }

    .panel-title {
        font-size: 1.45rem;
    }

    .counter-shell {
        grid-template-columns: 60px 1fr 60px;
    }

    .counter-btn,
    .counter-value {
        min-height: 62px;
    }

    .gps-grid,
    .gps-grid.compact {
        grid-template-columns: 1fr;
    }

    .capture-metrics {
        width: 100%;
        justify-content: flex-start;
        margin-top: .4rem;
    }

    .mini-metric {
        font-size: .8rem;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .btn {
        flex: 1 1 auto;
    }

    .action-dock {
        gap: .85rem;
        padding: .8rem .9rem;
    }

    .icon-action {
        width: 58px;
        height: 58px;
        font-size: 1.25rem;
    }

    .gps-inline-head-row,
    .gps-inline-row-bottom {
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .list-shell {
        border-radius: 20px;
    }

    #listPanel .table {
        min-width: 760px;
    }
}

@media (max-width: 767.98px) {
    .dashboard-grid,
    .right-column {
        display: flex;
        flex-direction: column;
    }

    .panel-card {
        width: 100%;
    }
}


.icon-action-photo {
    background: linear-gradient(135deg, #6f42c1, #8b5cf6);
}

.icon-action-photo:hover {
    background: linear-gradient(135deg, #6137aa, #7c4df1);
}

.photo-strip {
    margin-top: .9rem;
    padding: .9rem 1rem;
    border-radius: 20px;
    background: rgba(255,255,255,.72);
    border: 1px solid var(--line);
}

.photo-strip-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: .75rem;
}

.photo-preview-list {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

.photo-thumb {
    position: relative;
    width: 78px;
    height: 78px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(15,23,42,.08);
    box-shadow: var(--shadow-soft);
    background: #f7f9fc;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,.72);
    color: #fff;
    font-size: .8rem;
}

.photo-empty {
    color: var(--muted);
    font-size: .9rem;
}


.caste-selector {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.caste-chip {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  border: 1px solid rgba(51, 65, 85, .32);
  background: #334155;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-weight: 800;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .14);
}

.caste-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(71, 85, 105, .72);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .18);
}

.caste-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(134, 239, 172, .35), 0 12px 24px rgba(15, 23, 42, .18);
}

.caste-chip.active {
  color: #166534;
  border-color: rgba(74, 222, 128, .9);
  background: #bbf7d0;
  box-shadow: 0 14px 28px rgba(74, 222, 128, .28);
}

.caste-chip-check {
  display: none;
}

.caste-chip-letter {
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: .02em;
}

.caste-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 .5rem;
  margin-left: .45rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, .12);
  color: #1d4ed8;
  font-size: .78rem;
  font-weight: 800;
  vertical-align: middle;
}


.install-hint {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-top: 1rem;
    padding: .9rem 1rem;
    border-radius: 18px;
    background: rgba(24,46,114,.08);
    border: 1px solid rgba(24,46,114,.12);
    color: var(--text);
}
.install-hint i {
    font-size: 1.15rem;
    color: var(--brand-dark);
}
.install-hint small {
    display: block;
    color: var(--muted);
}
.btn-brand-soft {
    background: rgba(40,85,217,.12);
    border: 1px solid rgba(40,85,217,.16);
    color: var(--brand-dark);
    border-radius: 999px;
    white-space: nowrap;
}
.btn-brand-soft:hover {
    background: rgba(40,85,217,.18);
    color: var(--brand-dark);
}
@media (max-width: 575.98px) {
    .install-hint {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .install-hint .btn {
        width: 100%;
    }
}


.calibration-card {
    background: linear-gradient(180deg, rgba(219,234,254,.55), rgba(255,255,255,.96));
    border-radius: 20px;
}

.calibration-table th,
.calibration-table td {
    font-size: .9rem;
    vertical-align: middle;
}

#ecoCalibrationPanel textarea,
#ecoCalibrationPanel input[type="text"] {
    font-size: .9rem;
}

#ecoCalibrationPanel .form-control-sm {
    border-radius: 12px;
}

#ecoCalibrationStatusBadge {
    align-self: flex-start;
}


/* === v5 ecological calibration & comparison === */
.calibration-card,
.comparison-card {
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.comparison-side {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.72);
}

.comparison-results {
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    padding: 1rem;
    background: rgba(255,255,255,.62);
}

.comparison-results.empty {
    min-height: 4.5rem;
    display: grid;
    align-items: center;
}

.comparison-metric-grid {
    display: grid;
    grid-template-columns: minmax(170px, 1.1fr) repeat(2, minmax(120px, 1fr));
    gap: .65rem;
    align-items: center;
}

.comparison-metric-grid .comparison-head {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 800;
}

.comparison-metric-grid .metric-name {
    font-weight: 700;
    color: var(--text);
}

.comparison-value-box {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: .75rem .9rem;
    background: rgba(255,255,255,.9);
}

.comparison-value-box strong {
    font-size: 1.05rem;
    display: block;
}

.comparison-kicker {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
}

.comparison-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: .9rem;
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
    .comparison-summary,
    .comparison-metric-grid {
        grid-template-columns: 1fr;
    }
}

.context-tabs {
    gap: .5rem;
    flex-wrap: wrap;
}

.context-tabs .nav-link {
    border-radius: 999px;
    border: 1px solid rgba(40,85,217,.14);
    background: rgba(40,85,217,.06);
    color: var(--brand-dark);
    font-weight: 700;
}

.context-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--hero1), var(--hero2));
    color: #fff;
}

.context-photo-gallery {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: .75rem;
}

.context-thumb {
    border: 1px solid rgba(15,23,42,.08);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255,255,255,.86);
    box-shadow: var(--shadow-soft);
}

.context-thumb img {
    width: 100%;
    height: 92px;
    object-fit: cover;
    display: block;
}

.context-thumb small {
    display: block;
    padding: .45rem .6rem .6rem;
    color: var(--muted);
    text-transform: capitalize;
}

.context-actions {
    border-top: 1px solid rgba(15,23,42,.08);
    padding-top: 1rem;
}


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

.analytics-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.92);
    padding: .85rem .95rem;
}

.analytics-card .label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 700;
}

.analytics-card .value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
}

.analytics-card .detail {
    font-size: .85rem;
    color: var(--muted);
}

/* v6.3.1 compass support for standardized context photos */
.context-compass-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 1rem;
  padding: 0.85rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(241,245,249,0.92));
}
.compass-dial {
  position: relative;
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.18);
  background: radial-gradient(circle, #fff 0%, #f8fafc 62%, #e2e8f0 100%);
  box-shadow: inset 0 1px 4px rgba(15, 23, 42, 0.12);
}
.compass-dial::before,
.compass-dial::after {
  content: '';
  position: absolute;
  background: rgba(15, 23, 42, 0.18);
}
.compass-dial::before { width: 1px; height: 86%; left: 50%; top: 7%; }
.compass-dial::after { height: 1px; width: 86%; left: 7%; top: 50%; }
.compass-needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 54px;
  margin-left: -2px;
  margin-top: -27px;
  transform-origin: center center;
  transition: transform 160ms ease-out;
  z-index: 2;
}
.compass-needle::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 30px solid #dc2626;
}
.compass-needle::after {
  content: '';
  position: absolute;
  left: -5px;
  bottom: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 24px solid #334155;
}
.compass-north {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 800;
  color: #dc2626;
  z-index: 3;
}
.compass-meta { display: flex; flex-direction: column; gap: 0.2rem; }
.compass-meta strong { color: #0f172a; }
.compass-meta small { color: #64748b; line-height: 1.25; }
@media (max-width: 576px) {
  .context-compass-card { align-items: flex-start; }
  .compass-dial { width: 60px; height: 60px; min-width: 60px; }
  .compass-needle { height: 46px; margin-top: -23px; }
}
