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

/* Remove focus styling from non-input elements (buttons, links, images, etc.) */
button:focus,
a:focus,
img:focus,
.btn:focus,
.nav-btn:focus,
.view-toggle-btn:focus,
.sidebar-menu-btn:focus,
.thumbnail-button:focus,
.modal-close:focus,
.hamburger-menu-btn:focus,
.settings-tab:focus,
.span-btn:focus {
    outline: none;
    box-shadow: none;
}

html {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    overflow-y: scroll; /* Always show scrollbar to prevent layout shift */
}

:root {
    /* Layout tokens */
    --app-max-width: 1280px;
    --app-gutter: 24px;

    /* Sidebar */
    --sidebar-expanded-width: 200px;
    --sidebar-collapsed-width: 64px;
    --sidebar-icon-size: 24px;

    /* Fluid sizing (desktop↔tablet). Use clamp() to avoid breakpoint explosion. */
    --fs-page-title: clamp(16px, 1.7vw, 24px);
    --fs-header-brand: clamp(16px, 1.7vw, 24px);
    --fs-small: clamp(12px, 1.1vw, 13px);
    --fs-table-header: clamp(10px, 1.05vw, 13px);
    --fs-table-cell: clamp(10px, 1.1vw, 14px);

    --pad-card: clamp(12px, 1.6vw, 24px);
    --pad-table-cell: clamp(6px, 1.2vw, 12px);
    --gap-md: clamp(10px, 1.3vw, 16px);

    --thumb-max-w: clamp(44px, 7vw, 70px);
    --thumb-max-h: clamp(34px, 5.5vw, 52px);

    --weather-icon-size: clamp(36px, 4.5vw, 70px);
    --moon-icon-size: clamp(22px, 3vw, 30px);
    --precip-icon-scale: 1;
    --precip-icon-size: calc(var(--weather-icon-size) * var(--precip-icon-scale));
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f4f1ea;
    color: #27302a;
    line-height: 1.6;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
}

.hidden {
    display: none !important;
}

/* VERSION UPDATE BAR */
.version-update-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    padding: 12px 20px;
    text-align: center;
    z-index: 3000;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}

.version-update-bar:hover {
    background: #c82333;
}

.version-update-content {
    font-weight: 600;
    font-size: 14px;
}

.version-update-bar:not(.hidden)~#appContent {
    margin-top: 48px;
}

/* LOGIN */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.login-card {
    background: #f7f3ea;
    border-radius: 16px;
    padding: 32px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid #dfd6c6;
}

/* CONFIRMATION DIALOG */
.confirm-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: 24px;
}

/* Must always be above any app modal using .confirm-dialog-overlay (Boundary tools, etc.). */
#confirmDialogOverlay,
#refreshDialogOverlay {
    z-index: 12000;
}

.confirm-dialog-card {
    background: #f7f3ea;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid #dfd6c6;
}

.confirm-dialog-card.confirm-dialog-card--success {
    border-color: rgba(79, 111, 82, 0.35);
    background: rgba(79, 111, 82, 0.08);
}

.confirm-dialog-message {
    font-size: 16px;
    font-weight: 500;
    color: #2f3a33;
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.5;
}

.confirm-dialog-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-dialog-button {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.2s, transform 0.1s;
}

.confirm-dialog-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.confirm-dialog-button:active {
    transform: scale(0.98);
}

.confirm-dialog-button--secondary {
    background: #e8e5df;
    color: #27302a;
}

.confirm-dialog-button--secondary:hover {
    background: #dcd2c4;
}

.confirm-dialog-button--primary {
    background: #4f6f52;
    color: white;
}

.confirm-dialog-button--primary:hover:not(:disabled) {
    background: #3e5741;
}

.confirm-dialog-button--success {
    background: #4f6f52;
    color: white;
}

.confirm-dialog-button--success:hover:not(:disabled) {
    background: #3e5741;
}

.confirm-dialog-button--danger {
    background: #dc3545;
    color: white;
}

.confirm-dialog-button--danger:hover {
    background: #c82333;
}

/* AREA SPECIES ADMIN MODAL */
.area-species-admin-card {
    max-width: 980px;
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: clamp(16px, 3vw, 32px);
}

.area-species-remap-card {
    width: min(92vw, 460px);
    max-width: 460px;
    padding: clamp(16px, 3vw, 28px);
}

.area-species-remap-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.area-species-remap-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.area-species-remap-helper {
    font-size: 13px;
    color: #5f6d60;
}

.area-species-remap-actions {
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.area-species-remap-list-wrap {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(79, 111, 82, 0.18);
}

.area-species-remap-list-title {
    font-size: 13px;
    font-weight: 700;
    color: #2f3a33;
    margin-bottom: 6px;
}

.area-species-remap-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 170px;
    overflow: auto;
    padding-right: 4px;
}

.area-species-remap-list-empty {
    font-size: 12px;
    color: #6a766f;
}

.area-species-remap-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    background: rgba(79, 111, 82, 0.06);
    border: 1px solid rgba(79, 111, 82, 0.16);
    border-radius: 10px;
    padding: 6px 8px;
}

.area-species-remap-list-cell {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
}

.area-species-remap-list-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex: 0 0 auto;
}

.area-species-remap-list-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #2f3a33;
}

.area-species-remap-list-arrow {
    width: 14px;
    height: 14px;
    opacity: 0.8;
}

.area-species-remap-list-delete {
    border: none;
    background: transparent;
    color: #8f2f2f;
    padding: 2px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 0;
}

.area-species-remap-list-delete:hover:not(:disabled) {
    background: rgba(220, 53, 69, 0.1);
}

.area-species-remap-list-delete:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.area-species-remap-list-delete-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.area-species-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.area-species-admin-title {
    font-size: clamp(16px, 2.2vw, 18px);
    font-weight: 700;
    color: #2f3a33;
}

.area-species-admin-close {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #2f3a33;
}

.area-species-admin-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(12px, 2vw, 16px);
    margin-bottom: clamp(12px, 2vw, 16px);
    flex-wrap: wrap;
}

.area-species-admin-search {
    flex: 1;
    min-width: clamp(200px, 40vw, 240px);
}

.area-species-admin-search-input {
    padding: 10px 12px;
    font-size: 14px;
}

.area-species-admin-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(220px, 42vw, 460px), 1fr));
    gap: clamp(12px, 2vw, 16px);
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.area-species-admin-column {
    background: rgba(79, 111, 82, 0.06);
    border: 1px solid rgba(79, 111, 82, 0.18);
    border-radius: 12px;
    padding: clamp(10px, 2vw, 12px);
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.area-species-admin-column-title {
    font-weight: 700;
    color: #2f3a33;
    margin-bottom: 10px;
}

.area-species-admin-list {
    max-height: none;
    overflow: auto;
    padding-right: 6px;
    flex: 1 1 auto;
    min-height: 0;
}

@media (max-width: 860px) {
    .area-species-admin-card {
        width: min(94vw, 860px);
        max-height: calc(100dvh - 24px);
        padding: clamp(12px, 2.4vw, 20px);
    }

    .area-species-admin-title {
        font-size: clamp(15px, 2.1vw, 17px);
    }
}

.area-species-admin-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border-radius: 10px;
}

.area-species-admin-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 8px 8px;
    border-radius: 10px;
    cursor: pointer;
}

.area-species-admin-row-main:hover {
    background: rgba(79, 111, 82, 0.10);
}

.area-species-admin-row--disabled {
    /* Row is still clickable (opens info). Only the arrow button is disabled. */
    opacity: 1;
    cursor: pointer;
}

.area-species-admin-row--disabled:hover {
    background: transparent;
}

.area-species-admin-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.area-species-admin-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: contain; /* do not crop animals */
    background: transparent; /* no white tile */
    border: none;
}

.area-species-admin-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(79, 111, 82, 0.08);
    border: 1px solid rgba(79, 111, 82, 0.20);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    color: #4f6f52;
}

.area-species-admin-action-btn:hover {
    background: rgba(79, 111, 82, 0.14);
}

.area-species-admin-action-btn:active {
    transform: scale(0.98);
}

.area-species-admin-action-btn.is-disabled {
    /* Visually disabled, but still hoverable for tooltip. */
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.area-species-admin-action-icon {
    width: 18px;
    height: 18px;
}

.tc-tooltip {
    position: fixed;
    z-index: 99999;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(247, 243, 234, 0.98);
    color: #2f3a33;
    border: 1px solid rgba(79, 111, 82, 0.22);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    font-size: 13px;
    line-height: 1.35;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.tc-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tc-help-anchor {
    position: relative;
}

.tc-help-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid #166534;
    background: #16a34a;
    color: #ffffff;
    font-size: 8px;
    line-height: 1;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    user-select: none;
    z-index: 5;
}

.tc-help-mode-on .tc-help-badge {
    display: inline-flex;
}

.tc-help-badge:hover {
    background: #15803d;
}

.tc-help-badge:focus-visible {
    outline: 2px solid rgba(22, 101, 52, 0.45);
    outline-offset: 1px;
}

.species-info-card {
    max-width: 520px;
}

.species-info-body {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.species-info-image-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    flex: 0 0 auto;
}

.species-info-image-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(247, 243, 234, 0.55);
    border-radius: 12px;
}

.species-info-image-spinner .spinner {
    width: 30px;
    height: 30px;
    border: 4px solid rgba(79, 111, 82, 0.25);
    border-top-color: #4f6f52;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.species-info-image {
    width: 160px;
    height: 160px;
    object-fit: contain;
    background: transparent;
    border-radius: 12px;
    display: block;
    cursor: pointer;
}

.species-info-preview-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(47, 58, 51, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.species-info-preview-card {
    position: relative;
    width: min(1000px, 92vw);
    height: min(1000px, 70vh);
    background: rgba(247, 243, 234, 0.98);
    border-radius: 14px;
    border: 1px solid rgba(79, 111, 82, 0.22);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.20);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
}

.species-info-preview-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.species-info-preview-spinner .spinner {
    width: 34px;
    height: 34px;
    border: 4px solid rgba(79, 111, 82, 0.25);
    border-top-color: #4f6f52;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.species-info-preview-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    background: transparent;
    display: block;
}

.species-info-details {
    flex: 1;
    min-width: 0;
}

.species-info-name {
    font-size: 18px;
    font-weight: 700;
    color: #2f3a33;
    margin-bottom: 8px;
}

.species-info-kv {
    font-size: 13px;
    color: #2f3a33;
    line-height: 1.4;
    margin-bottom: 6px;
    word-break: break-word;
}

.species-info-kv span {
    color: #5e6b63;
    font-weight: 600;
}

.species-info-classification {
    margin-top: 10px;
}

.species-info-classification-table {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 0 10px;
    align-items: baseline;
    font-size: 12px;
}

.species-info-classification-label {
    font-weight: 700;
    color: #2f3a33;
}

.species-info-classification-value {
    color: #2f3a33;
}

.species-info-classification-value--italic {
    font-style: italic;
}

.area-species-admin-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: #2f3a33;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.area-species-admin-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: rgba(247, 243, 234, 0.85);
    border-radius: 12px;
}

.area-species-admin-spinner .spinner {
    width: 32px;
    height: 32px;
    border: 4px solid rgba(79, 111, 82, 0.25);
    border-top-color: #4f6f52;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.area-species-admin-actions {
    margin-top: 18px;
}

/* NOTE: Removed the old 860px "break" for this modal.
   We keep a stable 2-column layout and let the body scroll inside the viewport. */

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2f3a33;
    text-align: center;
}

.login-subtitle {
    font-size: 14px;
    color: #5e6b63;
    text-align: center;
    margin-bottom: 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form label {
    font-size: 13px;
    font-weight: 600;
    color: #435044;
}

.login-input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    font-size: 14px;
    color: #27302a;
    background: #fbf9f4;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.25);
}

.login-button {
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    background: #4f6f52;
    color: #f1f5f1;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.login-button:hover:not(:disabled) {
    background: #3f5845;
    transform: translateY(-1px);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: progress;
}

.login-error {
    display: none;
    color: #b43d3d;
    background: rgba(180, 61, 61, 0.08);
    border: 1px solid rgba(180, 61, 61, 0.3);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
}

.login-error:empty {
    display: none !important;
}

.login-error:not(.hidden) {
    display: block;
}

/* HEADER */
.header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: var(--app-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
}

.header-left-rail {
    width: var(--sidebar-collapsed-width);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    padding-left: 10px;
    gap: 10px;
    border-right: 1px solid #e6dfd3;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    #appContent.sidebar-open .header-left-rail {
        width: var(--sidebar-expanded-width);
    }
}

.header-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-right: var(--app-gutter);
    padding-left: var(--app-gutter);
    min-width: 0;
}

.header-area-selector {
    display: none;
    flex: 1;
    min-width: 0;
}

@media (min-width: 768px) {
    #appContent.sidebar-open .header-area-selector:not(.hidden) {
        display: block;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--fs-header-brand);
    font-weight: 700;
    color: #3f4f3f;
}

.area-quality-indicator {
    border: none;
    background: transparent;
    padding: 0;
    margin-left: 2px;
    width: auto;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex: 0 0 auto;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.area-quality-indicator:hover {
    transform: scale(1.06);
}

.area-quality-indicator:active {
    transform: scale(0.96);
}

.area-quality-indicator-icon {
    display: block;
    height: 24px;
    width: auto;
}

.area-quality-popover {
    position: fixed;
    z-index: 10050;
    width: min(520px, calc(100vw - 20px));
    max-height: min(70vh, 560px);
    overflow: auto;
    background: rgba(247, 243, 234, 0.98);
    color: #2f3a33;
    border: 1px solid #dfd6c6;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    border-radius: 16px;
    padding: 12px 12px 10px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    pointer-events: none;
}

.area-quality-popover.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.area-quality-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 4px 10px;
    border-bottom: 1px solid rgba(79, 111, 82, 0.14);
    margin-bottom: 10px;
}

.area-quality-popover-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.area-quality-popover-title {
    font-size: 14px;
    font-weight: 800;
    color: #2f3a33;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.area-quality-popover-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-left: auto;
    min-width: 122px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    color: rgba(47, 58, 51, 0.78);
    white-space: nowrap;
    line-height: 1;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.14s ease, background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.area-quality-popover-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #4f6f52;
    opacity: 0.35;
}

.area-quality-popover-status.is-active {
    visibility: visible;
    opacity: 1;
    color: #21452c;
    background: rgba(79, 111, 82, 0.16);
    border-color: rgba(79, 111, 82, 0.36);
}

.area-quality-popover-status.is-active::before {
    opacity: 1;
    animation: area-quality-status-pulse 1.1s ease-in-out infinite;
}

@keyframes area-quality-status-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.35);
        opacity: 1;
    }
}

.area-quality-close-btn {
    border: none;
    background: transparent;
    padding: 4px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #2f3a33;
    transition: background 0.15s ease, transform 0.1s ease;
}

.area-quality-close-btn:hover {
    background: rgba(79, 111, 82, 0.10);
}

.area-quality-close-btn:active {
    transform: scale(0.96);
}

.area-quality-empty {
    padding: 10px 10px;
    border-radius: 12px;
    background: rgba(79, 111, 82, 0.06);
    border: 1px solid rgba(79, 111, 82, 0.18);
    font-size: 13px;
}

.area-quality-loading {
    padding: 10px 10px;
    border-radius: 12px;
    background: rgba(79, 111, 82, 0.04);
    border: 1px dashed rgba(79, 111, 82, 0.22);
    font-size: 13px;
    color: rgba(47, 58, 51, 0.82);
    margin-bottom: 10px;
}

.area-quality-issue {
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid rgba(79, 111, 82, 0.18);
    background: rgba(79, 111, 82, 0.04);
    margin-bottom: 10px;
}

.area-quality-issue--error {
    border-color: rgba(185, 28, 28, 0.30);
    background: rgba(185, 28, 28, 0.06);
}

.area-quality-issue--warn {
    border-color: rgba(217, 119, 6, 0.30);
    background: rgba(217, 119, 6, 0.06);
}

.area-quality-issue-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.area-quality-issue-sev {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(79, 111, 82, 0.10);
    color: #3f4d42;
}

.area-quality-issue--error .area-quality-issue-sev {
    background: rgba(185, 28, 28, 0.12);
    color: #7f1d1d;
}

.area-quality-issue--warn .area-quality-issue-sev {
    background: rgba(217, 119, 6, 0.12);
    color: #7c2d12;
}

.area-quality-issue-title {
    font-size: 13px;
    font-weight: 800;
    color: #2f3a33;
}

.area-quality-issue-message {
    font-size: 13px;
    line-height: 1.35;
    color: #27302a;
}

.area-quality-issue-fixhint {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(47, 58, 51, 0.82);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.area-quality-issue-fixhint--inline {
    display: block;
}

.area-quality-fix-link {
    color: #4f6f52;
    font-weight: 800;
    text-decoration: none;
    border-bottom: 1px solid rgba(79, 111, 82, 0.32);
}

.area-quality-fix-link:hover {
    border-bottom-color: rgba(79, 111, 82, 0.85);
}

.area-quality-fix-link--plain,
.area-quality-fix-link--plain:hover {
    border-bottom: none;
}

.area-quality-popover-footer {
    margin-top: 12px;
    padding: 10px 4px 2px;
    border-top: 1px solid rgba(79, 111, 82, 0.14);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.area-quality-dot {
    opacity: 0.6;
}

.page-title {
    font-size: var(--fs-page-title);
    font-weight: 700;
    color: #3f4f3f;
    flex: 1;
    text-align: right;
    padding-right: 20px;
}

.area-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.area-selector-select {
    min-width: 180px;
    padding: 6px 28px 6px 12px;
    font-size: 14px;
    border-radius: 999px;
    border: 1px solid #d5d9de;
    background: #f8fafc;
    color: #27302a;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    appearance: none;
    accent-color: #4f6f52;
    background-image:
        linear-gradient(45deg, transparent 50%, #4f6f52 50%),
        linear-gradient(135deg, #4f6f52 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 1px),
        calc(100% - 10px) calc(50% - 1px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
}

.area-selector-select:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.15);
}

.area-selector-select:hover {
    background: #fff;
}

.area-selector.hidden {
    display: none !important;
}

.logo-icon {
    width: auto;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    position: relative;
    margin-top: -5px;
}

.logo-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
}

.btn-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.view-toggle {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d7dcd2;
    height: 38px;
}

.view-toggle button,
.view-toggle-btn {
    background: white;
    color: #46524a;
    border: none;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.view-toggle button:hover,
.view-toggle-btn:hover {
    background: #eef1eb;
}

.view-toggle button.active,
.view-toggle-btn.active {
    background: #4f6f52;
    color: white;
}

/* CONTAINER */
.container {
    max-width: var(--app-max-width);
    margin: 0 auto;
    padding-right: 16px;
    padding-left: calc(16px + var(--sidebar-collapsed-width));
    padding-top: 16px;
    padding-bottom: 16px;
    position: relative;
    transition: padding-left 0.3s ease;
}

@media (min-width: 768px) {
    #appContent.sidebar-open .container {
        padding-left: calc(16px + var(--sidebar-expanded-width));
    }
}

/* HAMBURGER MENU BUTTON */
.hamburger-menu-btn {
    position: relative;
    z-index: 200;
    background: white;
    border: 1px solid #d7dcd2;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.hamburger-menu-btn:hover {
    background: #eef1eb;
    border-color: #c9d1c5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hamburger-menu-btn.active {
    background: #4f6f52;
    border-color: #4f6f52;
}

@media (min-width: 768px) {
    /* Desktop: hamburger should feel like part of the left rail (not a floating card). */
    .hamburger-menu-btn {
        background: transparent;
        border: none;
        box-shadow: none;
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .hamburger-menu-btn:hover {
        background: #eef1eb;
        box-shadow: none;
    }

    .hamburger-menu-btn.active {
        background: #4f6f52;
    }
}

.hamburger-menu-btn.active .hamburger-line {
    background: white;
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: #46524a;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-menu-btn.active .hamburger-line {
    background: white;
}

/* SIDEBAR MENU */
.sidebar-menu {
    position: fixed;
    top: 0;
    left: max(0px, calc((100vw - var(--app-max-width)) / 2));
    width: var(--sidebar-collapsed-width);
    height: 100vh;
    background: white;
    z-index: 90;
    transition: width 0.3s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu.open {
    width: var(--sidebar-expanded-width);
}

.sidebar-menu-content {
    box-sizing: border-box;
    padding: 80px 0 24px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar-menu .btn-icon {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    object-fit: contain;
    flex-shrink: 0;
}

/* Collapsed desktop rail (default state): icons only */
.sidebar-menu:not(.open) .sidebar-section-title {
    display: none;
}

.sidebar-menu:not(.open) .btn-label {
    display: none;
}

.sidebar-menu:not(.open) .sidebar-section {
    padding: 10px 0;
    margin-bottom: 0;
    border-top: none;
}

.sidebar-menu:not(.open) .sidebar-section + .sidebar-section {
    border-top: 1px solid #e6dfd3;
}

.sidebar-menu:not(.open) .sidebar-menu-btn {
    padding: 10px 0;
    margin-bottom: 0;
    justify-content: center;
    gap: 0;
}

.sidebar-menu:not(.open) .sidebar-view-toggle .view-toggle-btn {
    flex: 0 0 auto !important;
    justify-content: center !important;
    min-width: 0 !important;
    padding: 10px 0 !important;
    gap: 0 !important;
    width: 100% !important;
}

.sidebar-menu:not(.open) .sidebar-view-toggle {
    align-items: stretch !important;
    width: 100% !important;
}

.sidebar-section {
    padding: 0 16px;
    margin-bottom: 24px;
}

.sidebar-section--bottom {
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid #e6dfd3;
}

.sidebar-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 4px;
}



.sidebar-area-selector {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L2 4h8L6 8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.sidebar-area-selector:hover {
    border-color: #9ca3af;
}

.sidebar-area-selector:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.sidebar-menu-btn {
    box-sizing: border-box;
    width: 100%;
    padding: 4px 16px;
    margin-bottom: 8px;
    background: transparent;
    color: #46524a;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.sidebar-menu-btn:hover {
    background: #f5f5f5;
}

.sidebar-menu-btn:active {
    transform: none;
}

.sidebar-menu-btn--help-toggle.is-active {
    background: #166534;
    color: #ffffff;
    font-weight: 600;
}

.sidebar-menu-btn--help-toggle.is-active:hover {
    background: #14532d;
    color: #ffffff;
}

.sidebar-menu-btn--help-toggle.is-active .btn-icon {
    filter: brightness(0) invert(1);
}

.sidebar-view-toggle {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    height: auto !important;
    overflow: visible !important;
    border: none !important;
}

.sidebar-view-toggle .view-toggle-btn {
    box-sizing: border-box;
    width: 100% !important;
    padding: 4px 16px !important;
    background: transparent;
    color: #46524a;
    border: none !important;
    border-radius: 0;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    height: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    pointer-events: auto !important;
    position: relative;
    z-index: 1;
    font-family: inherit;
}

.sidebar-view-toggle .view-toggle-btn .btn-icon {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-view-toggle .view-toggle-btn:hover {
    background: #f5f5f5;
}

.sidebar-view-toggle .view-toggle-btn.active {
    background: transparent;
    color: #46524a;
    font-weight: 600;
}

/* SIDEBAR OVERLAY - Hidden when using push layout */
.sidebar-overlay {
    display: none;
}

/* NAVIGATION */
.date-navigation {
    background: white;
    border-radius: 12px;
    padding: var(--pad-card);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--gap-md);
    flex-wrap: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nav-group {
    display: flex;
    gap: clamp(6px, 0.9vw, 8px);
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.date-display {
    font-size: clamp(14px, 1.4vw, 18px);
    font-weight: 600;
    color: #2d3c32;
    min-width: clamp(140px, 22vw, 220px);
    text-align: center;
}

.nav-btn {
    padding: clamp(6px, 0.9vw, 8px) clamp(10px, 1.2vw, 16px);
    background: white;
    border: 1px solid #d7dcd2;
    border-radius: 8px;
    color: #46524a;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: clamp(12px, 1.1vw, 14px);
    font-weight: 500;
}

.nav-btn:hover:not(:disabled) {
    background: #eef1eb;
    border-color: #4f6f52;
    color: #4f6f52;
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


.skip-empty-days-toggle {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.skip-empty-days-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: clamp(11px, 1.05vw, 13px);
    color: #46524a;
    font-weight: 500;
    user-select: none;
}

.skip-empty-days-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4f6f52;
}

.span-toggle {
    display: inline-flex;
    gap: clamp(4px, 0.8vw, 6px);
    background: #f1ede3;
    border: 1px solid #d7d0c2;
    border-radius: 999px;
    padding: clamp(2px, 0.6vw, 4px);
    white-space: nowrap;
    flex-shrink: 1;
}

.span-btn {
    border: none;
    background: transparent;
    color: #46524a;
    font-size: clamp(11px, 1.05vw, 13px);
    font-weight: 600;
    padding: clamp(4px, 0.8vw, 6px) clamp(8px, 1.2vw, 14px);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.span-btn:hover {
    background: rgba(79, 111, 82, 0.12);
}

.span-btn.active {
    background: #4f6f52;
    color: #f2f5f1;
}

/* STATS CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(140px, 1fr)); /* Default, will be overridden by JS */
    gap: 12px;
    margin-bottom: 24px;
}

/* Debug-only: test harness container for dynamic stat cards (created by JS helper). */
.stats-grid--test {
    margin-top: 20px;
    border-top: 2px solid #dc3545;
    padding-top: 20px;
}

.stat-card {
    background: #f1ede3;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #d7d0c2;
    min-width: 140px;
    cursor: pointer;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.stat-card--temporary-unselected {
    opacity: 0.4;
    filter: grayscale(100%);
}

.stat-card--temporary-selected {
    opacity: 1;
    filter: none;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: clamp(18px, 1.8vw, 22px);
    font-weight: 700;
    color: #27302a;
    line-height: 1.1;
}

.stat-label {
    font-size: var(--fs-small);
    color: #5e6b63;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* Timeline-only species accent for stat cards (dynamic color is set as --stat-accent-color by JS). */
.view-timeline .stat-card.stat-card--timeline-accent {
    border-color: var(--stat-accent-color);
}
.view-timeline .stat-card.stat-card--timeline-accent .stat-label {
    color: var(--stat-accent-color);
    font-weight: 900;
}
.view-timeline .stat-card.stat-card--timeline-accent .stat-value {
    color: var(--stat-accent-color);
}

/* SUMMARY BOX */
.action-buttons-container {
    margin-bottom: 24px;
}

.action-buttons-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.action-buttons-desktop {
    display: grid;
}

.action-buttons-mobile {
    display: none;
}

.action-buttons-wrapper .btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
}

.action-buttons-wrapper .btn-label {
    display: inline;
}

.action-buttons-wrapper .btn-icon {
    margin-right: 8px;
    width: 20px;
    height: 20px;
}


/* OVERVIEW VIEW */
.table-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

#secacamTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    /* Ensures equal width distribution for columns with width: 1% */
}

.dataTables_wrapper {
    width: 100%;
}

#secacamTable thead th {
    background: #fefcf7;
    color: #475649;
    font-weight: 600;
    font-size: var(--fs-table-header);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid #d7d0c2;
    padding: var(--pad-table-cell) clamp(6px, 0.9vw, 8px);
}

.table-header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(3px, 0.6vw, 6px);
}

.table-header-icon {
    width: clamp(18px, 3vw, 28px);
    height: clamp(18px, 3vw, 28px);
    object-fit: contain;
}

.table-header-label {
    display: block;
    text-align: center;
}

/* Overview species headers: labels are JS-truncated with a single dot; JS can toggle icon-only mode when unreadable. */
#secacamTable thead th.animal-col .table-header-cell {
    min-width: 0;
    max-width: 100%;
}

#secacamTable thead th.animal-col .table-header-label {
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

#tableSpeciesHeaders.species-header-fit--icon-only th.animal-col .table-header-label {
    display: none;
}

#tableSpeciesHeaders.species-header-fit--icon-only th.animal-col .table-header-cell {
    justify-content: center;
    gap: 0;
}

#secacamTable thead th:nth-child(1),
#secacamTable thead th:nth-child(2),
#secacamTable thead th:nth-child(3),
#secacamTable thead th:nth-child(4),
#secacamTable thead th:nth-child(5),
#secacamTable thead th:nth-child(6),
#secacamTable thead th:nth-child(7),
#secacamTable thead th:nth-child(8) {
    text-align: center !important;
}

#secacamTable tbody td {
    padding: var(--pad-table-cell) clamp(10px, 1.1vw, 12px);
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: var(--fs-table-cell);
}

#secacamTable tbody tr:nth-child(odd) {
    background: #f8f6f1;
}

#secacamTable tbody tr:nth-child(even) {
    background: #f1ede3;
}

#secacamTable tbody td:nth-child(-n+8) {
    text-align: center;
}

#secacamTable tbody tr:hover {
    background: #f8fafc;
}

#secacamTable tbody tr:last-child td {
    border-bottom: none;
}

.thumbnail {
    width: min(100%, var(--thumb-max-w));
    max-width: 100%;
    max-height: var(--thumb-max-h);
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.thumbnail--placeholder {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
    scale: 0.5;
}

.thumbnail--placeholder:hover {
    transform: none;
}

.animal-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #4f6f52;
    color: white;
    min-width: clamp(22px, 3.2vw, 32px);
    height: clamp(22px, 3.2vw, 32px);
    padding: 0 clamp(6px, 1.2vw, 10px);
    border-radius: clamp(6px, 0.9vw, 8px);
    font-size: clamp(12px, 1.6vw, 15px);
    font-weight: 600;
    line-height: 1;
}

#secacamTable.tc-badge-sizer-active .animal-count {
    min-width: calc(var(--tc-badge-base-min-width, 22px) * var(--tc-badge-scale, 1));
    height: calc(var(--tc-badge-base-height, 22px) * var(--tc-badge-scale, 1));
    padding-left: calc(var(--tc-badge-base-pad-left, 6px) * var(--tc-badge-scale, 1));
    padding-right: calc(var(--tc-badge-base-pad-right, 6px) * var(--tc-badge-scale, 1));
    border-radius: calc(var(--tc-badge-base-radius, 6px) * var(--tc-badge-scale, 1));
    font-size: calc(var(--tc-badge-base-font-size, 12px) * var(--tc-badge-scale, 1));
}

.animal-count.zero {
    background: #d9ded1;
    color: #7c857c;
}

.animal-count.highlighted {
    background: #ce4b4b;
}

.animal-count.edited-zero {
    background: transparent;
    border: 2px solid #4f6f52;
    color: #4f6f52;
}

.animal-count.edited-zero.highlighted {
    border-color: #ce4b4b;
    color: #ce4b4b;
}

#secacamTable thead th.animal-col,
#secacamTable tbody td.animal-col {
    text-align: center;
}

#secacamTable tbody td.animal-col {
    vertical-align: middle;
}

#secacamTable thead th.camera-col,
#secacamTable tbody td.camera-col,
#secacamTable thead th.image-col,
#secacamTable tbody td.image-col {
    position: relative;
}

/* Widths are measured from real content at runtime and written as CSS variables on #secacamTable. */
#secacamTable thead th.camera-col,
#secacamTable tbody td.camera-col {
    width: var(--overview-col-camera-width, auto);
    min-width: var(--overview-col-camera-width, 0px);
}

#secacamTable thead th.image-col,
#secacamTable tbody td.image-col {
    width: var(--overview-col-image-width, auto);
    min-width: var(--overview-col-image-width, 0px);
}

#secacamTable thead th.time-col,
#secacamTable tbody td.time-col {
    width: var(--overview-col-time-width, auto);
    min-width: var(--overview-col-time-width, 0px);
}

#secacamTable thead th.camera-col,
#secacamTable tbody td.camera-col,
#secacamTable tbody td.image-col,
#secacamTable thead th.time-col,
#secacamTable tbody td.time-col {
    text-align: center;
}

#secacamTable tbody td.camera-col,
#secacamTable tbody td.image-col,
#secacamTable tbody td.time-col {
    vertical-align: middle;
}

/* Overview table: keep thumbnail inside its own column at narrow widths (no bleed into time column). */
#secacamTable tbody td.image-col {
    overflow: hidden;
    padding-left: clamp(6px, 0.9vw, 8px);
    padding-right: clamp(6px, 0.9vw, 8px);
}

#secacamTable tbody td.time-col {
    padding-left: clamp(6px, 0.9vw, 8px);
    padding-right: clamp(6px, 0.9vw, 8px);
}

#secacamTable tbody td.image-col .thumbnail-overlay-wrap {
    /* Stable positioning context: overlay is a sibling of thumbnail button. */
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

#secacamTable tbody td.image-col .thumbnail-overlay-wrap .thumbnail-button {
    display: block;
    width: auto;
    max-width: 100%;
}

.camera-name {
    font-size: clamp(12px, 1.4vw, 15px);
    font-weight: 600;
    color: #2d3748;
    text-align: center;
    white-space: nowrap;
}

.camera-name-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.2s ease;
}

.camera-name-link:hover {
    transform: scale(1.02);
}

/* Mobile: ensure camera links are clickable */
@media (max-width: 767px) {

    /* Ensure camera links in table cards are clickable */
    .table-card-location .camera-name-link {
        display: inline;
    }

    /* Ensure camera links in details view location cell are clickable */
    .list-location-name .camera-name-link {
        display: inline;
    }
}

.date-time-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1px, 0.4vw, 2px);
    line-height: 1.2;
}

.date-time-stack .date-part {
    font-size: clamp(9px, 1.1vw, 12px);
    color: #6b776f;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.date-time-stack .time-part {
    font-size: clamp(10px, 1.4vw, 15px);
    font-weight: 600;
    color: #2f3a33;
    white-space: nowrap;
}

/* Near-mobile desktop/tablet: last column is the first to visually collide; shrink its stack a bit more. */
@media (max-width: 860px) and (min-width: 768px) {
    #secacamTable tbody td.time-col .date-time-stack {
        gap: 0;
        line-height: 1.1;
    }

    #secacamTable tbody td.time-col .date-time-stack .date-part {
        font-size: clamp(8px, 1.0vw, 11px);
    }

    #secacamTable tbody td.time-col .date-time-stack .time-part {
        font-size: clamp(9px, 1.2vw, 13px);
    }
}

/* TIMELINE STYLES */

.night-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.night-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.night-title {
    font-size: 18px;
    font-weight: 600;
    color: #3f4f3f;
}

.timeline-container {
    position: relative;
    margin: 16px 0;
    overflow: visible;
}

.timeline-hours {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    margin-bottom: 8px;
    padding: 0 60px;
}

.hour-label {
    text-align: center;
    font-size: 11px;
    color: #a0aec0;
    font-weight: 500;
}

.timeline-track {
    position: relative;
    height: 40px;
    background: linear-gradient(90deg, #2f3f34 0%, #4a5c4d 100%);
    border-radius: 20px;
    margin: 8px 60px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18);
}

.timeline-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.camera-label {
    position: absolute;
    left: -32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #5e6b63;
    white-space: nowrap;
}

.observation-dot {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.12s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: 700;
}

.observation-dot:hover {
    transform: translate(-50%, -50%) scale(1.18);
    z-index: 20;
}

/* Background colors now come from database via inline styles */

.zoom-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, #3a4f40 0%, #4f6552 100%);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    outline: 3px solid rgba(255, 255, 255, 0.75);
    display: none;
    z-index: 30;
    transform: scaleY(0.95);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    pointer-events: none;
}

.zoom-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.zoom-overlay .observation-dot {
    width: 26px;
    height: 26px;
    font-size: 12px;
    pointer-events: auto;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f1f5f9;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: #f1ede3;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
}

.stat-emoji {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-emoji-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.stat-name {
    font-size: 12px;
    color: #5e6b63;
    margin: 6px 0;
    font-weight: 500;
}

.stat-count {
    font-size: 18px;
    font-weight: 600;
    color: #3f4f3f;
}

.stat-detail {
    font-size: 11px;
    color: #8b978d;
    margin-top: 2px;
}

/* TOOLTIP */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    pointer-events: none;
    z-index: 100;
    max-width: 240px;
    white-space: normal;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tooltip-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.tooltip.show {
    display: block;
}

/* LIGHTBOX OVERLAY */
.lb-container {
    position: relative;
}

.lb-overlay-inner {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
}

.lb-overlay-inner.show {
    display: block;
}

.lb-overlay-inner .lb-overlay-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lb-overlay-inner.show .lb-overlay-image,
.lb-overlay-image.show {
    opacity: 1;
}

.lb-overlay-toggle-wrapper {
    margin-top: 8px;
    text-align: center;
}

.lb-overlay-toggle {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #27302a;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
    border: 1px solid rgba(148, 163, 184, 0.3);
    font-family: inherit;
}

.lb-overlay-toggle:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(148, 163, 184, 0.5);
}

.lb-overlay-toggle:active {
    background: rgba(0, 0, 0, 1);
}

.lb-overlay-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* MODALS */
.image-modal,
.map-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

#imageModal {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#imageModal::-webkit-scrollbar {
    width: 0;
    height: 0;
}

#mapboxModal {
    z-index: 1100;
}

#killedAnimalsLocationModal {
    z-index: 2000;
}

#userManagementModal {
    /* Must stay above settings UI, but below confirm dialog (2500) and datepicker (3000). */
    z-index: 2400;
}

/* Air Datepicker (used in killed animals modal; keep above map-modals) */
#air-datepicker-global-container,
.air-datepicker {
    z-index: 3000;
}

/* Air Datepicker theme overrides (scoped; do NOT edit vendor css) */
#killedAnimalsModal .air-datepicker,
#logsView .air-datepicker,
#settingsView .air-datepicker,
#air-datepicker-global-container .air-datepicker {
    /* Use app fonts/colors */
    --adp-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --adp-font-size: 14px;

    /* Match app surface */
    --adp-background-color: #f7f3ea;
    --adp-border-color: #dfd6c6;
    --adp-border-color-inner: rgba(223, 214, 198, 0.7);
    --adp-color: #27302a;
    --adp-color-secondary: rgba(39, 48, 42, 0.6);
    --adp-accent-color: #4f6f52;
    --adp-color-current-date: #4f6f52;

    /* Hover/active */
    --adp-background-color-hover: rgba(79, 111, 82, 0.10);
    --adp-background-color-active: rgba(79, 111, 82, 0.16);

    /* Ranges (if used later) */
    --adp-background-color-in-range: rgba(79, 111, 82, 0.10);
    --adp-background-color-in-range-focused: rgba(79, 111, 82, 0.16);

    /* Day names (vendor default is orange) */
    --adp-day-name-color: rgba(79, 111, 82, 0.85);

    /* Time picker (sliders) */
    --adp-time-track-height: 2px;
    --adp-time-track-color: rgba(39, 48, 42, 0.22);
    --adp-time-track-color-hover: rgba(39, 48, 42, 0.38);
    --adp-time-thumb-size: 14px;
    --adp-time-padding-inner: 12px;
    --adp-time-day-period-color: rgba(39, 48, 42, 0.6);

    /* Shape */
    --adp-border-radius: 16px;
    --adp-cell-border-radius: 10px;
    --adp-btn-border-radius: 10px;
    --adp-btn-height: 36px;
    --adp-padding: 10px;
    --adp-width: 290px;
    --adp-mobile-width: calc(100vw - 48px);
    --adp-mobile-nav-height: 44px;
    --adp-mobile-font-size: 16px;
    --adp-mobile-day-cell-height: 40px;

    /* Ensure the actual widget surface matches */
    background: var(--adp-background-color);
    border: 1px solid var(--adp-border-color);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

/* Heatmap datepicker must NEVER be transparent on mobile; always paint its surface. */
.air-datepicker.heatmap-range-datepicker {
    background: #f7f3ea;
    border: 1px solid #dfd6c6;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

#killedAnimalsModal .air-datepicker--pointer,
#logsView .air-datepicker--pointer,
#settingsView .air-datepicker--pointer,
#air-datepicker-global-container .air-datepicker--pointer {
    display: none;
}

#killedAnimalsModal .air-datepicker-nav,
#logsView .air-datepicker-nav,
#settingsView .air-datepicker-nav,
#air-datepicker-global-container .air-datepicker-nav {
    border-bottom: 1px solid var(--adp-border-color-inner);
}

#killedAnimalsModal .air-datepicker-nav--title,
#logsView .air-datepicker-nav--title,
#settingsView .air-datepicker-nav--title,
#air-datepicker-global-container .air-datepicker-nav--title {
    font-weight: 600;
}

#killedAnimalsModal .air-datepicker-cell.-selected-,
#logsView .air-datepicker-cell.-selected-,
#settingsView .air-datepicker-cell.-selected-,
#air-datepicker-global-container .air-datepicker-cell.-selected- {
    background: #4f6f52;
}

#killedAnimalsModal .air-datepicker-button,
#logsView .air-datepicker-button,
#settingsView .air-datepicker-button,
#air-datepicker-global-container .air-datepicker-button {
    font-weight: 600;
}

/* Heatmap range picker: make footer buttons look like proper app buttons (not link text). */
.air-datepicker.heatmap-range-datepicker .air-datepicker-buttons {
    /* Override vendor "one-row" grid-auto-flow: column */
    display: grid !important;
    grid-auto-flow: row !important;
    grid-auto-columns: initial !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px;
    padding-top: 12px;
}

.air-datepicker.heatmap-range-datepicker .air-datepicker-button.heatmap-range-btn {
    /* Make Air Datepicker buttons behave like real buttons in our layout */
    width: 100%;
    justify-content: center;
    white-space: nowrap;
}

.air-datepicker.heatmap-range-datepicker .air-datepicker-button.heatmap-range-btn--preset {
    /* Match neutral buttons used across the app (white surface + border + gentle hover) */
    background: white;
    border: 1px solid #d7dcd2;
    color: #46524a;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    height: 38px;
    transition: all 0.2s;
}

.air-datepicker.heatmap-range-datepicker .air-datepicker-button.heatmap-range-btn--preset:hover {
    background: #eef1eb;
    border-color: #c9d1c5;
    transform: translateY(-1px);
}

.air-datepicker.heatmap-range-datepicker .air-datepicker-nav.tc-airdp-nav--split {
    position: relative;
    justify-content: center;
    min-height: 34px;
}

.air-datepicker.heatmap-range-datepicker .air-datepicker-nav.tc-airdp-nav--split .air-datepicker-nav--action {
    display: none;
}

.air-datepicker.heatmap-range-datepicker .air-datepicker-nav.tc-airdp-nav--split .air-datepicker-nav--title {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
    visibility: hidden;
    pointer-events: none;
}

.air-datepicker.heatmap-range-datepicker .tc-airdp-split-nav {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: auto;
    pointer-events: auto;
}

.air-datepicker.heatmap-range-datepicker .tc-airdp-split-nav-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.air-datepicker.heatmap-range-datepicker .tc-airdp-split-nav-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #d7dcd2;
    border-radius: 6px;
    background: white;
    color: #46524a;
    font-weight: 700;
    line-height: 1;
    padding: 0;
}

.air-datepicker.heatmap-range-datepicker .tc-airdp-split-nav-btn:hover {
    background: #eef1eb;
    border-color: #c9d1c5;
}

.air-datepicker.heatmap-range-datepicker .tc-airdp-split-nav-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    font-size: 13px;
    font-weight: 600;
    color: #46524a;
}

.air-datepicker.heatmap-range-datepicker .tc-airdp-split-nav-label--year {
    min-width: 48px;
}

@media (max-width: 767px) {
    /* On mobile, avoid full-screen-wide pickers (too much). */
    #killedAnimalsModal .air-datepicker,
    #logsView .air-datepicker,
    #settingsView .air-datepicker,
    #air-datepicker-global-container .air-datepicker {
        --adp-width: min(340px, calc(100vw - 48px));
    }
}

.user-management-delete-button {
    margin-left: auto;
}

.image-modal.show,
.map-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

#imageModal.show {
    align-items: flex-start;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Observation image modal uses outer modal scrolling (no inner scrollbar). */
#imageModal .modal-content {
    max-width: 95%;
    max-height: none;
    overflow: visible;
    display: block;
    margin: 12px auto;
    padding: 12px;
    position: relative;
}

#imageModal .modal-body {
    overflow: visible;
    min-height: auto;
}

#imageModal .modal-image-wrapper {
    position: sticky;
    top: clamp(8px, 2vw, 12px);
    z-index: 12;
}

#killImageModal .kill-image-modal-content {
    max-width: 85%;
    max-height: 95%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#killImageModal .modal-body {
    overflow-y: auto;
    min-height: 0;
}

#killImageModal .modal-info {
    text-align: left;
}

#killImageModal .modal-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

#killImageModal .modal-info-row-left,
#killImageModal .modal-info-row-right {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
}

#killImageModal .modal-info-row-left {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

#killImageModal .modal-info-row-right {
    flex: 0 0 auto;
    justify-content: flex-end;
    text-align: right;
}

#killImageModal .kill-modal-label {
    font-weight: 600;
    color: #334155;
}

#killImageModal .kill-modal-value {
    color: #475569;
}

#killImageModalImg {
    position: relative;
    z-index: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#killImageModal .modal-info-row-center .modal-weather-item {
    min-width: 0;
}

.kill-modal-weather-icon-wrap {
    width: var(--modal-icon-size);
    height: var(--modal-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kill-modal-weather-caption {
    min-height: 1em;
    line-height: 1;
    white-space: nowrap;
}

.kill-modal-gender-icon {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.kill-modal-gender-empty {
    font-size: clamp(14px, 2.2vw, 20px);
    line-height: 1;
    color: #475569;
}

.kill-modal-icon-empty {
    font-size: clamp(14px, 2.2vw, 20px);
    line-height: 1;
    color: #475569;
}

#killImageModal .kill-modal-weather-icon-wrap .weather-icon,
#killImageModal .kill-modal-weather-icon-wrap .precipitation-gauge-svg,
#killImageModal .kill-modal-weather-icon-wrap .kill-modal-gender-icon {
    width: 100%;
    height: 100%;
}

#killImageModal .kill-modal-weather-icon-wrap .moon-phase-container {
    width: 100%;
    height: 100%;
    display: block;
}

#killImageModal .kill-modal-weather-icon-wrap .moon-phase-container > div {
    width: 100% !important;
    height: 100% !important;
}

#killImageModal .kill-modal-weather-item--wind .kill-modal-weather-icon-wrap .wind__arrow,
#killImageModal .kill-modal-weather-item--wind .kill-modal-weather-icon-wrap .wind-arrow__arrow,
#killImageModal .kill-modal-weather-item--wind .kill-modal-weather-icon-wrap .wind-arrow__arrow svg {
    width: 100%;
    height: 100%;
}

.kill-modal-location-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#killImageModal .kill-modal-value--location {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

#killImageModal .kills-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.kill-modal-map-button {
    border: none;
    background: none;
    color: inherit;
    border-radius: 0;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.kill-modal-map-button:hover {
    transform: scale(1.05);
}

.kill-modal-map-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (max-width: 767px) {
    #killImageModal .modal-info-row {
        gap: 8px;
    }

    #killImageModal .kill-modal-label--location {
        font-size: clamp(10px, 2.8vw, 12px);
    }
}

@media (max-width: 520px) {
    #killImageModal .kill-modal-label--location {
        display: none;
    }
}


.map-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 95vw;
    position: relative;
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
}

.map-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    margin-bottom: 0;
}

.map-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    word-break: break-word;
}

@media (max-width: 767px) {
    .map-modal-header h3 {
        font-size: 18px;
        line-height: 1.3;
    }
}

.modal-close,
.map-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #a0aec0;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover,
.map-modal-close:hover {
    color: #4a5568;
}

#imageModal .image-modal-close-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #f8fafc;
    font-size: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

#imageModal .image-modal-close-button:hover {
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
}

.map-iframe {
    width: 100%;
    height: calc(100% - 70px);
    border: none;
    border-radius: 0 0 16px 16px;
}

/* LOADING & NO DATA */
.loading,
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
    font-size: 16px;
}

/* MODAL LOADING OVERLAY */
.modal-loading-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    pointer-events: none;
}

/* When used inside page views (Heatmap/Trends/Comparison), center relative to the view content
   so the spinner doesn't look offset when the sidebar pushes the main container. */
.page-view,
.page-view-body,
.mapbox-body,
.insights-body,
.mapbox-wrapper {
    position: relative;
}

.page-view .modal-loading-overlay,
.page-view-body .modal-loading-overlay {
    position: absolute;
}

.modal-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-loading-spinner .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #4f6f52;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.modal-loading-spinner .loading-message {
    color: #4a5568;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

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

/* VIEW SWITCHING */
.view-overview #timelineView,
.view-overview #detailsView,
.view-overview .page-view {
    display: none;
}

.view-timeline #overviewView,
.view-timeline #detailsView,
.view-timeline .page-view {
    display: none;
}

.view-details #overviewView,
.view-details #timelineView,
.view-details .page-view {
    display: none;
}

/* PAGE VIEWS */
.page-view {
    display: none;
}

.page-view:not(.hidden) {
    display: block;
}

.page-view-header {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-view-title {
    font-size: 28px;
    font-weight: 700;
    color: #27302a;
    margin: 0;
}

.page-view-body {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-height: 400px;
}

.settings-page-container {
    max-width: 100%;
    padding: 24px;
}

.settings-page-container .settings-card {
    background: white;
    border-radius: 0;
    padding: 24px;
    width: 100%;
    max-width: none;
    margin: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: auto;
    /* Page view must not act like a modal with internal scrolling.
       Otherwise dynamic content (e.g. weather job rows) makes the "menu" appear to disappear. */
    max-height: none;
    overflow: visible;
}

@media (min-width: 768px) {
    .settings-page-container .settings-card {
        padding: 24px;
    }
}

.settings-page-header {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.settings-page-title {
    font-size: 28px;
    font-weight: 700;
    color: #27302a;
    margin: 0;
}

.settings-page-container .settings-actions {
    margin-top: 0;
    padding: 0;
}

.settings-page-container .settings-body {
    overflow: visible;
}

#settingsView .settings-hydration-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(247, 243, 234, 0.72);
    z-index: 20;
}

#settingsView.settings-view--hydrating .settings-hydration-overlay {
    display: flex;
}

#settingsView.settings-view--hydrating .settings-card {
    opacity: 0.35;
    pointer-events: none;
}

/* OCR2 upload page view (admin) */
.ocr2-upload-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dfd6c6;
}

.ocr2-upload-title {
    font-size: 20px;
    font-weight: 700;
    color: #27302a;
    line-height: 1.2;
}

.ocr2-upload-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ocr2-upload-eligibility {
    border: 1px solid #dfd6c6;
    border-radius: 12px;
    background: rgba(251, 249, 244, 0.85);
    padding: 12px;
}

.ocr2-upload-eligibility-title {
    font-size: 14px;
    font-weight: 800;
    color: #27302a;
}

.ocr2-upload-eligibility-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: rgba(39, 48, 42, 0.75);
}

.ocr2-upload-eligibility-empty {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 700;
    color: rgba(39, 48, 42, 0.78);
}

.ocr2-upload-eligibility-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ocr2-upload-eligibility-item {
    position: relative;
}

.ocr2-upload-eligibility-item-btn {
    position: relative;
    width: 36px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #d7cfbf;
    background: rgba(255, 255, 255, 0.96);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.06s ease;
}

.ocr2-upload-eligibility-item-btn:hover {
    background: #ffffff;
}

.ocr2-upload-eligibility-item-btn:active {
    transform: scale(0.98);
}

.ocr2-upload-eligibility-item-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.35);
    outline-offset: 1px;
}

.ocr2-upload-eligibility-item-btn--ready {
    border-color: rgba(79, 111, 82, 0.45);
    background: rgba(79, 111, 82, 0.08);
}

.ocr2-upload-eligibility-item-btn--blocked {
    border-color: rgba(178, 42, 55, 0.36);
    background: rgba(220, 53, 69, 0.08);
}

.ocr2-upload-eligibility-icon-wrap {
    position: relative;
    width: 24px;
    height: 20px;
    flex: 0 0 auto;
    pointer-events: none;
}

.ocr2-upload-eligibility-camera-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.ocr2-upload-eligibility-mark {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.ocr2-upload-eligibility-mark--ready {
    filter: saturate(1.1) brightness(1.02);
}

.ocr2-upload-eligibility-mark--blocked {
    filter: saturate(1.06) brightness(0.98);
}

.ocr2-upload-eligibility-tooltip {
    position: fixed;
    z-index: 1200;
    max-width: min(280px, calc(100vw - 24px));
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(79, 111, 82, 0.28);
    background: rgba(247, 243, 234, 0.98);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    font-size: 12px;
    font-weight: 700;
    color: rgba(39, 48, 42, 0.92);
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.ocr2-upload-eligibility-tooltip.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.ocr2-upload-eligibility-tooltip-title {
    font-size: 12px;
    font-weight: 800;
    color: #27302a;
}

.ocr2-upload-eligibility-tooltip-sub {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(39, 48, 42, 0.82);
}

.ocr2-upload-eligibility-tooltip-reason {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(39, 48, 42, 0.8);
}

.ocr2-upload-dropzone {
    border: 2px dashed #d6cebf;
    background: rgba(244, 241, 234, 0.65);
    border-radius: 16px;
    padding: 22px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.06s ease;
    user-select: none;
}

.ocr2-upload-dropzone:active {
    transform: scale(0.995);
}

.ocr2-upload-dropzone.is-dragover {
    border-color: rgba(79, 111, 82, 0.85);
    background: rgba(79, 111, 82, 0.08);
}

.ocr2-upload-dropzone.is-disabled {
    cursor: not-allowed;
    opacity: 0.62;
    border-style: solid;
}

.ocr2-upload-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.ocr2-upload-dropzone-title {
    font-weight: 700;
    color: #27302a;
    font-size: 16px;
}

.ocr2-upload-dropzone-subtitle {
    color: rgba(39, 48, 42, 0.75);
    font-size: 13px;
}

.ocr2-upload-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.ocr2-upload-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ocr2-upload-counters {
    font-size: 13px;
    color: rgba(39, 48, 42, 0.8);
}

.ocr2-upload-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 2px;
}

.ocr2-upload-item {
    border: 1px solid #dfd6c6;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px 12px;
}

.ocr2-upload-item-name {
    font-weight: 700;
    color: #27302a;
    font-size: 13px;
    word-break: break-word;
}

.ocr2-upload-item-status {
    color: rgba(39, 48, 42, 0.7);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.ocr2-upload-item-progress {
    grid-column: 1 / -1;
    height: 8px;
    border-radius: 999px;
    background: rgba(232, 229, 223, 0.95);
    overflow: hidden;
    border: 1px solid rgba(223, 214, 198, 0.75);
}

.ocr2-upload-item-progress-bar {
    height: 100%;
    width: var(--pct, 0%);
    background: rgba(79, 111, 82, 0.95);
    transition: width 0.12s linear;
}

.ocr2-upload-item.ocr2-upload-item--failed .ocr2-upload-item-progress-bar {
    background: rgba(220, 53, 69, 0.95);
}

.ocr2-upload-item.ocr2-upload-item--cancelled .ocr2-upload-item-progress-bar {
    background: rgba(39, 48, 42, 0.35);
}

@media (max-width: 767px) {
    .ocr2-upload-item {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .ocr2-upload-item-status {
        text-align: left;
        white-space: normal;
    }
}

.list-table-animal {
    text-align: left;
}

.list-table-count,
.list-table-prob,
.list-table-camera,
.list-table-location,
.list-table-time {
    text-align: center;
    white-space: nowrap;
}

/* Hide location column header and cells on desktop */
#listTable thead th.list-table-location,
#listTable tbody td.list-table-location {
    display: none;
}

.list-table-time {
    font-size: var(--fs-table-cell);
}

.list-table-count {
    width: clamp(54px, 7vw, 88px);
}

.list-table-prob {
    width: clamp(60px, 8vw, 96px);
}

.list-table-camera {
    width: clamp(140px, 18vw, 200px);
    text-align: left;
    white-space: normal;
}

.weather-icon {
    width: var(--weather-icon-size);
    height: var(--weather-icon-size);
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    filter: saturate(3.0) contrast(0.8);
}

/* Android app WebView rendering workaround:
   - WebView sometimes composites filtered SVG <img> with a pale/tinted overlay until a repaint.
   - Forcing a composited layer stabilizes rendering without affecting normal browsers. */
html.tc-mobile-app .weather-icon,
body.tc-mobile-app .weather-icon {
    will-change: transform;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.moon-phase-container {
    width: var(--moon-icon-size);
    height: var(--moon-icon-size);
    display: inline-block;
    vertical-align: middle;
    position: relative;
}

.wind-arrow {
    /* Preserve current effective styling (previously split across two blocks). */
    width: 100%;
    height: 100%;
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    color: #27302a;
    position: relative;
}

.precipitation-gauge-svg {
    width: var(--precip-icon-size);
    height: var(--precip-icon-size);
    display: block;
    margin: 0 auto;
}

.precip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.precip-icon {
    width: var(--precip-icon-size);
    height: var(--precip-icon-size);
    object-fit: contain;
    display: block;
}

.precip-value {
    font-size: inherit;
    color: #64748b;
    font-weight: 500;
}

.list-table-weather-wind-speed,
.list-table-weather-wind-gusts {
    text-align: center;
    width: clamp(70px, 9vw, 100px);
}


.wind__arrow {
    display: inline-block;
    width: 24px;
    height: 24px;
    position: relative;
}

/* Detaljer: align wind + precip value baselines */
#listTable tbody td.list-table-weather-precip,
#listTable tbody td.list-table-weather-wind-speed {
    --details-icon-row: clamp(28px, 3.2vw, 40px);
}

.wind-item {
    display: grid;
    grid-template-rows: var(--details-icon-row) auto;
    justify-items: center;
    align-content: start;
    row-gap: 2px;
}

.wind-item .wind-arrow {
    margin-left: 0;
}

#listTable tbody td.list-table-weather-wind-speed .wind__arrow,
#listTable tbody td.list-table-weather-wind-speed .wind-arrow__arrow,
#listTable tbody td.list-table-weather-wind-speed .wind-arrow__arrow svg {
    width: calc(var(--details-icon-row) * 0.75);
    height: calc(var(--details-icon-row) * 0.75);
}

#listTable tbody td.list-table-weather-precip .precip-item {
    display: grid;
    grid-template-rows: var(--details-icon-row) auto;
    justify-items: center;
    align-content: start;
    row-gap: 2px;
}

#listTable tbody td.list-table-weather-precip .precip-icon {
    width: var(--details-icon-row);
    height: var(--details-icon-row);
}

#listTable tbody td.list-table-weather-precip .precip-value,
#listTable tbody td.list-table-weather-wind-speed .wind-value {
    line-height: 1.1;
}

.wind-arrow__arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
}

.wind-arrow__arrow svg {
    width: 24px;
    height: 24px;
    color: #27302a;
}


/* Wind color classes - applied to both mobile and desktop */
.wind-color-green {
    color: #22c55e !important;
    /* Green for 0-3 m/s */
    font-weight: 500;
}

.wind-color-yellow {
    color: #eab308 !important;
    /* Yellow for 3-7 m/s */
    font-weight: 500;
}

.wind-color-orange {
    color: #f97316 !important;
    /* Orange for 7-12 m/s */
    font-weight: 500;
}

.wind-color-red {
    color: #ef4444 !important;
    /* Red for 12+ m/s */
    font-weight: 600;
}

.list-table-image {
    position: relative;
    width: 80px;
    text-align: center;
}

/* DATATABLE OVERRIDES */
.dataTables_length,
.dataTables_filter {
    display: none !important;
}

#secacamTable thead th.sorting:after,
#secacamTable thead th.sorting_asc:after,
#secacamTable thead th.sorting_desc:after,
#secacamTable thead th.sorting:before,
#secacamTable thead th.sorting_asc:before,
#secacamTable thead th.sorting_desc:before {
    display: none !important;
}

/* RESPONSIVE */
@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .date-navigation {
        flex-wrap: wrap;
        gap: 8px;
    }

    .stats-grid {
        gap: 6px;
        justify-items: stretch;
    }

    .container {
        padding: 8px;
    }
}

/* IMAGE VIEWER */
.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-image-wrapper {
    background: #0f172a;
    border-radius: 12px;
    padding: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.modal-image-inner {
    position: relative;
    display: inline-block;
    line-height: 0;
    width: 100%;
    max-width: 100%;
}

.modal-image-inner img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}


#modalBaseImage {
    position: relative;
    z-index: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.modal-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    flex-wrap: wrap;
}

#overlayToggleButton {
    background: #4f6f52;
    color: #ffffff;
    border-color: #3d5540;
}

#overlayToggleButton:hover {
    background: #3d5540;
    border-color: #2d3f2f;
}

#openDetectionEditor.btn-secondary-ghost {
    background: #f4f1ea;
    color: #27302a;
    border-color: #f4f1ea;
}

#openDetectionEditor.btn-secondary-ghost:hover {
    background: #f4f1ea;
    border-color: #f4f1ea;
}

#deleteImageButton {
    margin-left: auto;
}

/* Button icon/text switching for mobile */
.btn-icon-mobile {
    display: none;
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
}

.btn-text {
    display: inline;
}

/* On mobile, hide text and show icons */
@media (max-width: 767px) {

    #overlayToggleButton .btn-text,
    #openDetectionEditor .btn-text,
    #deleteImageButton .btn-text {
        display: none !important;
    }

    #overlayToggleButton .btn-icon-mobile,
    #openDetectionEditor .btn-icon-mobile,
    #deleteImageButton .btn-icon-mobile {
        display: inline-block !important;
    }

    /* Adjust button padding for icon-only buttons on mobile */
    #overlayToggleButton,
    #openDetectionEditor,
    #deleteImageButton {
        padding: 8px 12px;
        min-width: 44px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}

/* Fullscreen Image Viewer */
.fullscreen-image-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.fullscreen-image-viewer.active {
    display: flex;
}

.fullscreen-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#fullscreenImage {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    touch-action: manipulation;
}

.fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.fullscreen-close:active {
    background: rgba(0, 0, 0, 1);
}

@media (max-width: 767px) {
    .fullscreen-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
}

.overlay-status {
    /* The inline "loading detections..." text caused modal layout shift.
       We no longer use this element for loading state; hide it to avoid wasting space. */
    display: none;
}

/* Full-screen loading overlay for image modal (spinner only; modal opens when ready). */
.image-modal-loading-screen {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1200; /* above .image-modal (1000) */
}

.image-modal-loading-screen.is-visible {
    display: flex;
}

.detection-edit-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.detection-edit-overlay.drawing-mode {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
}

.detection-drawing-rectangle {
    position: absolute;
    border: 2px dashed rgba(34, 197, 94, 0.9);
    background: rgba(34, 197, 94, 0.1);
    pointer-events: none;
    z-index: 5;
}

.detection-edit-box {
    position: absolute;
    border: 2px dashed var(--det-accent-color, rgba(0, 255, 0, 0.9));
    border-radius: 4px;
    background: transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.detection-edit-box.detection-edit-box--untracked {
    --det-accent-color: rgba(220, 53, 69, 0.95); /* red */
    border-color: var(--det-accent-color);
    opacity: 0.5;
}

.detection-edit-box.detection-edit-box--inactive {
    opacity: 0;
}

.detection-edit-box.detection-edit-box--inactive.highlight {
    opacity: 1;
}

.detection-edit-box.highlight {
    border: 2px dashed rgba(56, 189, 248, 0.9);
    background: transparent;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.6);
    transform: translateY(-1px);
}

.detection-edit-connector {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 2px;
    background: var(--det-accent-color, rgba(0, 255, 0, 0.92));
    border-radius: 999px;
    pointer-events: none;
    z-index: 5;
    transform-origin: 0 50%;
    opacity: 0.95;
}

.detection-edit-connector.detection-edit-connector--untracked {
    --det-accent-color: rgba(220, 53, 69, 0.95);
    opacity: 0.5;
}

.detection-edit-connector.detection-edit-connector--overlap {
    opacity: 0.75;
}

.detection-edit-connector.highlight {
    background: rgba(56, 189, 248, 0.95);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
    opacity: 1;
}

.detection-edit-connector.detection-edit-connector--untracked.highlight {
    opacity: 0.5;
}

.detection-edit-label {
    position: absolute;
    left: 0;
    top: 0;
    max-width: 70%;
    padding: 2px 6px;
    font-size: clamp(8px, 1.1vw, 14px);
    line-height: 1.2;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid var(--det-accent-color, rgba(0, 255, 0, 0.9));
    border-radius: 6px;
    pointer-events: none;
    z-index: 6; /* above bbox border */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detection-edit-label.detection-edit-label--untracked {
    --det-accent-color: rgba(220, 53, 69, 0.95); /* red */
    border-color: var(--det-accent-color);
}

.detection-edit-label.highlight {
    background: rgba(2, 132, 199, 0.75);
    border-color: rgba(56, 189, 248, 0.7);
}

.detection-edit-label--overlap {
    opacity: 0.9;
}

/* Responsive border width for smaller screens */
@media (max-width: 768px) {
    .detection-edit-box {
        border-width: 1px;
    }

    .detection-edit-connector {
        height: 1px;
    }

    .detection-edit-box.highlight {
        border-width: 1px;
        box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.6);
    }

    .detection-drawing-rectangle {
        border-width: 1px;
    }

    .detection-edit-label {
        font-size: clamp(7px, 2.0vw, 9px);
        padding: 2px 5px;
        max-width: 78%;
    }
}

@media (max-width: 480px) {
    .detection-edit-label {
        font-size: clamp(6px, 2.6vw, 8px);
        padding: 2px 4px;
        max-width: 86%;
    }
}

.detection-editor {
    background: white;
    border-radius: 12px;
    padding: 16px;
    color: #27302a;
    display: none;
    flex-direction: column;
    gap: 16px;
    border: 1px solid #d7dcd2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.detection-editor.show {
    display: flex;
}

.detection-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.detection-editor-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detection-species-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2f3a33;
}

.detection-species-label span {
    font-weight: 500;
}

.detection-new-species-row {
    margin-top: 10px;
    margin-bottom: 12px;
    justify-content: center;
    width: 100%;
}

.detection-species-select {
    padding: 6px 12px;
    border: 1px solid #d7dcd2;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #2f3a33;
    min-width: 100px;
    width: auto;
    cursor: pointer;
    accent-color: #4f6f52;
}

.detection-species-select:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 2px rgba(79, 111, 82, 0.1);
}

.detection-add-btn {
    font-size: 13px;
    padding: 8px 16px;
    background: #4f6f52 !important;
    color: white !important;
    border: none !important;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.detection-add-btn:hover {
    background: #3f5845 !important;
    border-color: transparent !important;
    transform: translateY(-1px);
}

.detection-add-btn.active {
    background: #dc3545 !important;
    color: white !important;
}

.detection-add-btn.active:hover {
    background: #c82333 !important;
    border-color: transparent !important;
}

@media (max-width: 767px) {
    .detection-add-btn {
        display: none;
    }
}

.detection-editor-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2f3a33;
}

.detection-editor-body {
    max-height: none;
    overflow: visible;
    padding-right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detection-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: #f8f6f1;
    margin-bottom: 0;
    align-items: start;
    border: 1px solid rgba(212, 165, 116, 0.3);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    width: 100%;
    max-width: 100%;
}

.detection-row:nth-child(odd) {
    background: #f8f6f1;
}

.detection-row:nth-child(even) {
    background: #f1ede3;
}

.detection-row.detection-row-hover {
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.9) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2) !important;
}

.detection-row:last-child {
    margin-bottom: 0;
}

.detection-row select,
.detection-row input[type="number"],
.detection-row input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d7dcd2;
    background: white;
    color: #27302a;
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.detection-row select {
    accent-color: #4f6f52;
}

.detection-row select:focus,
.detection-row input[type="number"]:focus,
.detection-row input[type="text"]:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.15);
}

.detection-row-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
}

.detection-include-checkbox {
    display: none;
}

.detection-row-actions button {
    width: calc(50% - 4px);
    flex: 1 1 calc(50% - 4px);
    height: 34px;
    border-radius: 8px;
    border: 1px solid transparent;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.18s ease;
}

.detection-row-actions button:hover:not(:disabled) {
    filter: brightness(0.95);
}

.detection-include-btn.is-include {
    background: #4f6f52;
    border-color: #3d5540;
}

.detection-include-btn.is-exclude {
    background: #c62828;
    border-color: #8e0000;
}

.detection-confirm-btn {
    background: #4f6f52;
    border-color: #3d5540;
}

.detection-confirm-btn:disabled {
    background: #d5dbd3;
    border-color: #c4cbc1;
    color: #6b7280;
    cursor: not-allowed;
    filter: none;
}


/* New Detection Dialog */
.new-detection-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.new-detection-dialog.hidden {
    display: none;
}

.new-detection-dialog-content {
    background: #0f172a;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    color: #e2e8f0;
}

.new-detection-dialog-content h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #f8fafc;
}

.new-detection-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.new-detection-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.new-detection-form label span {
    font-size: 13px;
    color: #cbd5f5;
    font-weight: 500;
}

.new-detection-form select,
.new-detection-form input {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    font-size: 14px;
    font-family: inherit;
}

.new-detection-form select:focus,
.new-detection-form input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.8);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Hide count input - always 1 per detection box */
#newDetectionCount {
    display: none;
}

#newDetectionCount+label,
label[for="newDetectionCount"] {
    display: none;
}

.new-detection-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.new-detection-dialog-actions button {
    padding: 8px 16px;
    font-size: 14px;
}

.detection-row .detection-meta {
    font-size: 12px;
    color: #5e6b63;
    line-height: 1.5;
}

.detection-meta-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.detection-meta-main-text {
    color: #27302a;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
}

.detection-meta-type-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex: 0 0 auto;
    padding-bottom: 3px;
}

@media (min-width: 992px) {
    .detection-editor-body {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: stretch;
        justify-content: flex-start;
    }

    .detection-row {
        flex: 0 1 250px;
        max-width: 250px;
    }
}

.detection-reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8faf6;
    color: #9ca3af;
}

.detection-editor-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#detectionEditorStatus {
    font-size: 13px;
    color: #4f6f52;
    font-weight: 500;
}

#saveDetectionsButton {
    background: #4f6f52;
    color: #ffffff;
    border-color: #3d5540;
}

#saveDetectionsButton:hover:not(:disabled) {
    background: #3d5540;
    border-color: #2d3f2f;
}

#saveDetectionsButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary-ghost {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: #27302a;
}

.btn-secondary-ghost:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(148, 163, 184, 0.8);
}

.btn-danger {
    background: #d32f2f;
    border: 1px solid #b71c1c;
    color: #ffffff;
}

.btn-danger:hover {
    background: #b71c1c;
    border-color: #8b0000;
}

.modal-info {
    font-size: 14px;
    color: #475569;
    text-align: center;
    width: 100%;
}

#imageModal .modal-info {
    color: #000000;
    font-size: clamp(12px, 1.8vw, 16px);
    padding-inline: clamp(8px, 2.6vw, 20px);
}

#imageModal .modal-info-row-left,
#imageModal .modal-info-row-right {
    color: #000000;
    font-size: inherit;
}

@media (max-width: 767px) {
    .modal-info {
        text-align: left;
        padding: 0;
    }
}

/* Modal info  rows for mobile */
.modal-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-info-row:last-child {
    border-bottom: none;
}

.modal-info-row-left {
    text-align: left;
    flex: 1;
}

.modal-info-row-right {
    text-align: right;
    flex: 1;
}

.modal-info-row-center {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 16px;
    padding: 10px 0 8px;
    --modal-icon-size: var(--weather-icon-size);
    --modal-moon-scale: 0.70;
    --modal-wind-scale: 0.70;
    --modal-moon-size: calc(var(--weather-icon-size) * var(--modal-moon-scale));
    --modal-wind-size: calc(var(--weather-icon-size) * var(--modal-wind-scale));
    --moon-icon-size: var(--modal-moon-size);
    --precip-icon-size: var(--modal-icon-size);
}

.modal-info-row-center .modal-weather-item {
    display: grid;
    grid-template-rows: var(--modal-icon-size) auto;
    justify-items: center;
    align-content: start;
    row-gap: 4px;
    flex: 1;
}

.modal-info-row-center .wind__arrow,
.modal-info-row-center .wind-arrow__arrow,
.modal-info-row-center .wind-arrow__arrow svg {
    width: var(--modal-wind-size);
    height: var(--modal-wind-size);
}

.modal-info-row-center .modal-wind-container {
    display: grid;
    grid-template-rows: var(--modal-icon-size) auto;
    justify-items: center;
    align-content: start;
    row-gap: 4px;
}

.modal-info-row-center .modal-wind-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-info-row-center .moon-phase-container {
    align-self: center;
}


.modal-weather-temp,
.modal-wind-speed {
    font-size: clamp(11px, 1.2vw, 14px);
    color: #475569;
    font-weight: 500;
}

@media (min-width: 768px) {
    .modal-info-row-center {
        --weather-icon-size: clamp(40px, 5vw, 76px);
    }

    .modal-weather-temp,
    .modal-wind-speed {
        font-size: clamp(11px, 1.1vw, 14px);
    }
}


.thumbnail-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    display: inline-block;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.thumbnail-button:focus {
    outline: none;
    box-shadow: none;
}

.thumbnail-button img {
    display: block;
}

.thumbnail-button--review-needed > img {
    outline: 4px solid #dc2626;
    outline-offset: -4px;
}

/* Observation kill link overlay (binoculars icon) */

.observation-kill-link {
    position: absolute;
    top: 15px;
    right: 18px;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    box-shadow: none;
    outline: none;
}

/* Table cards (mobile overview) - icon positioning */
/* Mobile cards use div instead of button to avoid nested button issues */
/* Icon is positioned inside thumbnail-button, so use right positioning relative to thumbnail */
.table-card-top .thumbnail-button .observation-kill-link {
    position: absolute;
    top: 0px;
    right: 0px;
    z-index: 10;
}

.observation-kill-link:hover {
    transform: scale(1.1);
}

.observation-kill-link:focus {
    outline: none;
    border: none;
}

#listTable tbody td.list-table-image .observation-kill-link {
    top: 16px;
    right: 11px;
}

#killsTable tbody td.list-table-image .observation-kill-link {
    top: 11px;
    right: 14px;
}

#secacamTable tbody td.image-col .thumbnail-overlay-wrap .observation-kill-link {
    position: absolute;
    top: -1px;
    right: -1px;
    left: auto;
    width: auto;
    min-width: auto;
    height: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.observation-kill-icon {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}


.list-card {
    background: #fefcf7;
    border-radius: 12px;
    padding: clamp(8px, 1.2vw, 10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    overflow-y: visible;
}

#listTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#listTable thead th {
    background: #fefcf7;
    color: #475649;
    font-weight: 600;
    font-size: var(--fs-table-header);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--pad-table-cell) var(--pad-table-cell);
    border-bottom: 2px solid #d7d0c2;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

#listTable tbody td {
    padding: var(--pad-table-cell) var(--pad-table-cell);
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: var(--fs-table-cell);
}

#listTable tbody tr:nth-child(odd) {
    background: #f8f6f1;
}

#listTable tbody tr:nth-child(even) {
    background: #f1ede3;
}

#listTable tbody tr:hover {
    background: #f8fafc;
}

#listTable tbody tr:last-child td {
    border-bottom: none;
}

#listTable thead th.list-table-count,
#listTable thead th.list-table-prob,
#listTable thead th.list-table-location,
#listTable thead th.list-table-time {
    text-align: center;
    white-space: nowrap;
}

/* Kills table - same styling as list table */
#killsTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

#killsTable thead th {
    background: #fefcf7;
    color: #475649;
    font-weight: 600;
    font-size: var(--fs-table-header);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--pad-table-cell) var(--pad-table-cell);
    border-bottom: 2px solid #d7d0c2;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

#killsTable tbody td {
    padding: var(--pad-table-cell) var(--pad-table-cell);
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: var(--fs-table-cell);
}

#killsTable tbody tr:nth-child(odd) {
    background: #f8f6f1;
}

#killsTable tbody tr:nth-child(even) {
    background: #f1ede3;
}

#killsTable tbody tr:hover {
    background: #f8fafc;
}

#killsTable tbody tr:last-child td {
    border-bottom: none;
}

#killsTable thead th.list-table-count,
#killsTable thead th.list-table-prob,
#killsTable thead th.list-table-location,
#killsTable thead th.list-table-time {
    text-align: center;
    white-space: nowrap;
}

#killsTable thead th.list-table-image {
    text-align: center;
}

#killsTable tbody td.list-table-prob img.gender-icon {
    max-width: 20px;
    max-height: 26px;
    object-fit: contain;
    vertical-align: middle;
}

.kills-pagination {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid #e8e3d8;
}

.kills-pagination-controls {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.kills-pagination-controls .btn {
    justify-content: center;
    text-align: center;
}

.kills-pagination-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 13px;
    color: #3f4f3f;
    text-align: right;
}

.kills-pagination-scope {
    font-size: 12px;
    color: #6b7280;
}

.kill-species-button {
    cursor: pointer;
    color: inherit;
}

.kill-location-button {
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.kill-location-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.kill-delete-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.kill-delete-button:hover {
    opacity: 1;
}

.kill-delete-button .btn-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.list-table-actions {
    text-align: center;
    white-space: nowrap;
}

.kill-location-tooltip {
    position: absolute;
    background: #f8f4eb;
    color: #27302a;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #dcd2c4;
    font-family: 'Courier New', monospace;
}

.kill-location-tooltip.show {
    display: block;
}

#listTable thead th.list-table-image,
#listTable thead th.list-table-weather-icon,
#listTable thead th.list-table-moon,
#listTable thead th.list-table-weather-wind-speed {
    text-align: center;
}

#listTable tbody td.list-table-moon {
    text-align: center;
}

/* Hide wind gusts column on desktop (merged into wind speed column) */
#listTable thead th.list-table-weather-wind-gusts,
#listTable tbody td.list-table-weather-wind-gusts {
    display: none;
}

#listTable tbody tr:last-child td {
    border-bottom: none;
}

.list-image-cell {
    width: 80px;
}

/* SETTINGS */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 15, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1900;
    padding: 2vh 2vw;
}

@media (min-width: 768px) {
    .settings-overlay {
        padding: 24px;
    }
}

.settings-card {
    background: white;
    border-radius: 18px;
    padding: 3vh 4vw;
    width: 95vw;
    max-height: 90vh;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid #dcd2c4;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .settings-card {
        padding: 28px;
        width: 800px;
        max-height: 80vh;
    }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.settings-title {
    font-size: 22px;
    font-weight: 700;
    color: #2f3a33;
}

.settings-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #46524a;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
}

.settings-general-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 12px;
}

.settings-general-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e0d8c8;
    border-radius: 12px;
    background: #f8f5ed;
}

.settings-general-box-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #2f3a33;
}

.settings-general-box .settings-group {
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    padding-bottom: 0;
}

.settings-general-box .settings-group .settings-label {
    width: 190px;
    flex: 0 0 190px;
    min-width: 190px;
    padding-right: 0;
}

.settings-general-box .settings-select,
.settings-general-box .settings-time-input,
.settings-general-box .settings-language-select-wrap,
.settings-general-box .settings-language-trigger,
.settings-general-box .settings-group--date-style .settings-select,
.settings-general-box .settings-group--hour-cycle .settings-select {
    width: min(320px, 48%);
    min-width: 190px;
    max-width: 320px;
}

.settings-general-box .settings-label--nowrap {
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .settings-general-box {
        gap: 10px;
    }

    .settings-general-sections {
        grid-template-columns: 1fr;
    }
}

/* General settings groups: horizontal layout (label left, input right) */
.settings-group--switch-time,
.settings-group--wind-unit,
.settings-group--temperature-unit,
.settings-group--probability-threshold,
.settings-group--sound-preference,
.settings-group--show-all-images,
.settings-group--skip-empty-days,
.settings-group--help-tooltips,
.settings-group--ui-language,
.settings-group--date-style,
.settings-group--hour-cycle {
    flex-direction: row;
    align-items: center;
    gap: 0;
    padding-top: 0;
}

.settings-group--switch-time .settings-label,
.settings-group--wind-unit .settings-label,
.settings-group--temperature-unit .settings-label,
.settings-group--probability-threshold .settings-label,
.settings-group--sound-preference .settings-label,
.settings-group--show-all-images .settings-label,
.settings-group--skip-empty-days .settings-label,
.settings-group--help-tooltips .settings-label,
.settings-group--ui-language .settings-label,
.settings-group--date-style .settings-label,
.settings-group--hour-cycle .settings-label {
    width: 150px;
    flex-shrink: 0;
    padding-right: 16px;
    box-sizing: border-box;
}

/* Settings Group: Switch Time */
.settings-group--switch-time {
    border: none;
}

/* Settings Group: Logs/Administration */
.settings-group--logs {
    padding-top: 25px;
}

/* Settings Group: Species */
.settings-group--species {
    border: none;
}

.settings-group--species-admin {
    display: flex;
    flex-direction: row;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.settings-group--species-admin .settings-button--auto-width {
    width: auto;
}

/* Settings Group: Cameras Table */
.settings-group--cameras-table {
    border: none;
}

/* Settings Group: Cameras Actions */
.settings-group--cameras-actions {
    border: none;
}

.settings-tabs {
    display: flex;
    gap: 18px;
    border-bottom: 1px solid #dfd6c6; /* subtle baseline like "Modern Underline" */
    position: relative;
}

.settings-tab {
    padding: 12px 2px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #6b776a;
    cursor: pointer;
    border-radius: 0;
    margin-right: 0;
    position: relative;
}

.settings-tab:hover:not(.settings-tab--active) {
    color: #3f4d42;
}

.settings-tab--active {
    background: transparent;
    color: #27302a;
    z-index: 1;
}

.settings-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px; /* overlap baseline */
    height: 3px;
    background: transparent;
    border-radius: 3px 3px 0 0;
}

.settings-tab--active::after {
    background: #4f6f52; /* theme green */
}

/* Mobile notice - hidden by default, shown on mobile */
.settings-mobile-notice {
    display: none;
    font-size: 12px;
    color: #6b776a;
    text-align: center;
    padding: 8px 0;
}

.settings-tab-panels {
    margin-top: 0;
    position: relative;
    top: -1px;
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel--active {
    display: block;
}

.settings-label {
    font-size: 14px;
    font-weight: 600;
    color: #3f4d42;
}

.settings-label--nowrap {
    white-space: nowrap;
}

.settings-help-tooltips-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    flex: 0 0 auto;
}

.settings-help-tooltip-delay-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.settings-help-tooltip-delay-inline.settings-help-tooltip-delay-inline--disabled {
    opacity: 0.6;
}

.settings-help-tooltip-delay-label {
    width: auto !important;
    padding-right: 0 !important;
    font-size: 13px;
    font-weight: 500;
    color: #4d5a50;
}

.settings-help-tooltip-delay-input {
    width: 72px;
}

.settings-time-input {
    width: 120px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: 14px;
}

.settings-time-input[readonly] {
    background: #f5f5f5;
    color: #6b7280;
    cursor: default;
}

.settings-time-input:disabled,
.settings-input--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e8e5df;
}

.settings-label--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Themed tooltip for disabled settings fields (probability threshold when "Vis alle bilder" is enabled) */
.settings-group--has-disabled-tooltip {
    position: relative;
}

.settings-group--has-disabled-tooltip .settings-disabled-tooltip {
    display: none;
    position: fixed; /* positioned near cursor via JS */
    left: 0;
    top: 0;
    z-index: 10000;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f7f3ea;           /* match .confirm-dialog-card */
    border: 1px solid #dfd6c6;     /* match .confirm-dialog-card */
    color: #2f3a33;                /* match .confirm-dialog-message */
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25); /* match .confirm-dialog-card */
    font-size: 13px;
    line-height: 1.35;
    pointer-events: none;
}

.settings-group--has-disabled-tooltip .settings-disabled-tooltip.show {
    display: block;
}


.settings-radio-group {
    display: flex;
    gap: 20px;
}

.settings-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #27302a;
}

.settings-radio {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4f6f52;
}

.settings-radio-label:hover {
    color: #4f6f52;
}

.settings-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #3f4d42;
}

.settings-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4f6f52;
}

.settings-species-view,
.settings-species-highlight,
.settings-species-alert {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4f6f52;
}

.settings-species-color {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    cursor: pointer;
}

.settings-species-color:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-checkbox-label:hover {
    color: #4f6f52;
}

.settings-description {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
    line-height: 1.5;
}

/* ============================================================================
   Weather jobs (settings → admin)
   ========================================================================== */

.weather-jobs-status {
    margin-top: 10px;
}

.weather-jobs-inline-status {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.weather-jobs-inline-status.weather-jobs-error {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.08);
    color: #7f1d1d;
    line-height: 1.35;
    font-weight: 700;
}

.weather-jobs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Container-query driven layout so we break based on actual available width,
       not the global viewport. */
    container-type: inline-size;
    container-name: weather-jobs;
}

.weather-jobs-row {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e0d8c8;
    background: #fbf9f4;
}

.weather-jobs-cell {
    min-width: 0;
}

.weather-jobs-cell--left {
    font-weight: 700;
    color: #27302a;
}

.weather-jobs-range {
    font-weight: 700;
    color: #27302a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.weather-jobs-type {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.weather-jobs-status-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #d7d0c2;
    background: #ece7dc;
    color: #3f4d42;
    text-align: center;
}

.weather-jobs-status-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.weather-jobs-status-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.weather-jobs-status-pill.is-queued {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.weather-jobs-status-pill.is-running {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.weather-jobs-status-pill.is-done {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.weather-jobs-status-pill.is-failed {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.weather-jobs-status-pill.is-cancelled {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #374151;
}

.weather-jobs-not-before {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.weather-jobs-eta {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.weather-jobs-error {
    font-size: 12px;
    color: #991b1b;
    margin-top: 4px;
}

.weather-jobs-cancel-btn {
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
}

.weather-jobs-empty {
    padding: 10px 0;
    color: #666;
}

/* Break only when the job list container is truly narrow. */
@container weather-jobs (max-width: 320px) {
    .weather-jobs-row {
        grid-template-columns: 56px 1fr;
        grid-auto-rows: auto;
        row-gap: 8px;
    }

    .weather-jobs-cell--status {
        grid-column: 1 / -1;
    }

    .weather-jobs-not-before {
        margin-top: 0;
    }

    .weather-jobs-eta {
        margin-top: 0;
    }
}

/* ============================================================================
   Failed OCR observations view
   ========================================================================== */

.failed-observations-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    container-type: inline-size;
    container-name: failed-observations;
}

.failed-observations-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.failed-observations-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e0d8c8;
    background: #fbf9f4;
}

.failed-observations-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.failed-observations-thumb-wrap {
    width: 72px;
    height: 54px;
    border-radius: 8px;
    overflow: hidden;
    background: #ece6d9;
    border: 1px solid #d9cfbb;
    flex-shrink: 0;
    padding: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.failed-observations-thumb-wrap:focus-visible {
    outline: 2px solid #4f6f52;
    outline-offset: 2px;
}

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

.failed-observations-main {
    min-width: 0;
}

.failed-observations-title {
    font-size: 14px;
    font-weight: 700;
    color: #27302a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.failed-observations-meta {
    margin-top: 2px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.failed-observations-detail {
    margin-top: 4px;
    font-size: 12px;
    color: #3f4d42;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.failed-observations-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.failed-observations-action-btn {
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
}

.failed-observations-empty {
    padding: 12px 0;
    color: #3f4d42;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.failed-observations-status--error {
    color: #991b1b;
}

.camera-share-invitation-status {
    min-height: 20px;
    margin: 10px 0;
    color: #3f4d42;
}

.camera-share-invitation-status--error {
    color: #991b1b;
}

.camera-share-invitation-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.camera-share-invitation-card {
    background: #fff;
    border: 1px solid rgba(63, 77, 66, 0.14);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.camera-share-invitation-meta {
    display: grid;
    gap: 6px;
    color: #3f4d42;
    font-size: 13px;
}

.camera-share-invitation-subject {
    margin: 14px 0 10px;
    color: #233529;
    font-size: 18px;
}

.camera-share-invitation-body {
    color: #233529;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: normal;
}

.camera-share-invitation-links {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    overflow-wrap: anywhere;
}

.failed-observation-image-modal-content {
    max-width: min(95vw, 1200px);
    width: fit-content;
}

.failed-observation-image-modal-body {
    padding-top: 0;
}

/* Keep failed-image modal tight to image size to avoid side blank bars on low-res frames. */
.failed-observation-image-modal-body .modal-image-wrapper {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.failed-observation-image-modal-body .modal-image-inner {
    width: auto;
    max-width: 100%;
}

.failed-observation-modal-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.failed-observation-modal-subtitle {
    font-size: 13px;
    line-height: 1.35;
    color: #5e6a61;
    font-weight: 500;
}

#failedObservationImageModalImg {
    max-width: 100%;
    max-height: 75vh;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.failed-observation-remediate-form {
    margin-top: 14px;
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 10px 12px;
    align-items: end;
    justify-content: end;
    justify-items: end;
}

.failed-observation-remediate-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    align-items: flex-end;
}

.failed-observation-remediate-field--compact {
    width: max-content;
}

#failedObservationDateInput,
#failedObservationTimeInput {
    width: 132px;
    max-width: 132px;
    padding: 12px;
    border: 1px solid #dfd6c6;
    border-radius: 8px;
    background: #fbf9f4;
    color: #27302a;
    font-size: 14px;
    cursor: pointer;
}

#failedObservationTimeInput {
    width: 108px;
    max-width: 108px;
}

.failed-observation-remediate-label {
    font-size: 12px;
    color: #3f4d42;
    font-weight: 600;
    text-align: left;
    width: 100%;
}

.failed-observation-remediate-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

#failedObservationImageModalStatus {
    grid-column: 1 / -1;
    width: 100%;
    text-align: right;
}

.failed-observation-modal-status--error {
    color: #991b1b;
}

@media (max-width: 900px) {
    .failed-observation-remediate-form {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .failed-observation-remediate-field--compact {
        width: 100%;
    }

    .failed-observation-remediate-field {
        align-items: flex-start;
    }

    .failed-observation-remediate-label {
        text-align: left;
    }

    #failedObservationDateInput,
    #failedObservationTimeInput {
        width: 100%;
        max-width: none;
    }

    .failed-observation-remediate-actions {
        justify-content: flex-start;
    }

    #failedObservationImageModalStatus {
        text-align: left;
    }
}

@container failed-observations (max-width: 460px) {
    .failed-observations-row {
        grid-template-columns: 1fr;
    }

    .failed-observations-actions {
        justify-content: flex-start;
    }

    .failed-observations-content {
        grid-template-columns: 1fr;
    }

    .failed-observations-thumb-wrap {
        width: 100%;
        height: 92px;
    }
}

.settings-select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: 14px;
    min-width: 180px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    accent-color: #4f6f52;
}

.settings-select--language {
    min-width: 150px;
    width: auto;
    max-width: 220px;
    font-size: 13px;
    padding: 8px 10px;
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.settings-language-select-wrap {
    position: relative;
    display: inline-block;
    min-width: 150px;
    max-width: 220px;
    width: auto;
}

.settings-language-trigger {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
}

.settings-group--date-style .settings-select,
.settings-group--hour-cycle .settings-select {
    width: auto;
    min-width: 150px;
    max-width: 220px;
}

.settings-language-trigger:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.25);
}

.settings-language-flag-img {
    width: 18px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(39, 48, 42, 0.15);
    object-fit: cover;
    flex-shrink: 0;
}

.settings-language-trigger-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-language-trigger-caret {
    margin-left: auto;
    color: #6b776f;
    font-size: 11px;
}

.settings-language-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1400;
    background: #fbf9f4;
    border: 1px solid #d7d0c2;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(22, 28, 24, 0.14);
    padding: 6px;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}

.settings-language-select-wrap--open .settings-language-menu {
    display: block;
}

.settings-language-option {
    width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: #27302a;
    border-radius: 8px;
    padding: 7px 8px;
    cursor: pointer;
    text-align: left;
}

.settings-language-option:hover,
.settings-language-option:focus {
    outline: none;
    background: rgba(79, 111, 82, 0.12);
}

.settings-language-option--active {
    background: rgba(79, 111, 82, 0.18);
}

.settings-select:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.25);
}

.settings-species-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-species-table {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e0d8c8;
}

.settings-species-row {
    display: grid;
    grid-template-columns: 1.8fr 0.65fr 0.65fr 0.65fr 0.65fr;
    gap: 8px;
    font-size: 14px;
    color: #39463d;
}

.settings-species-row--header {
    background: #ebe4d4;
    font-weight: 600;
    text-align: center;
}

.settings-species-row:not(.settings-species-row--header):nth-child(odd) {
    background: #f4f1e8;
}

.settings-species-row--reclassified-source {
    background: #f0eee7;
}

.settings-species-col {
    padding: 4px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-species-name {
    font-weight: 500;
    text-align: left;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-species-reclass-target {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    min-width: 0;
}

.settings-species-reclass-arrow {
    width: 12px;
    height: 12px;
    opacity: 0.85;
    flex: 0 0 auto;
}

.settings-species-reclass-name {
    font-size: inherit;
    font-weight: 500;
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.settings-species-icon-wrapper {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
}

.settings-species-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.settings-species-header-icon {
    width: 20px;
    height: 20px;
    display: block;
    margin: 0 auto;
}

/* Cameras tab */
.settings-cameras-table {
    border-radius: 10px;
    overflow: hidden;
    border: none;
    /* Fluid scaling model aligned with overview table behavior */
    --settings-cam-fs-row: clamp(10px, 1.1vw, 14px);
    --settings-cam-pad-cell-y: clamp(5px, 0.7vw, 8px);
    --settings-cam-pad-cell-x: clamp(5px, 0.7vw, 8px);
    --settings-cam-input-fs: clamp(10px, 1vw, 13px);
    --settings-cam-input-pad-y: clamp(4px, 0.45vw, 6px);
    --settings-cam-input-pad-x: clamp(5px, 0.55vw, 6px);
    --settings-cam-readonly-fs: clamp(10px, 0.95vw, 13px);
    --settings-cam-email-fs: clamp(9px, 0.85vw, 11px);
    --settings-cam-btn-fs: clamp(10px, 0.95vw, 12px);
    --settings-cam-btn-pad-y: clamp(3px, 0.45vw, 4px);
    --settings-cam-btn-pad-x: clamp(6px, 0.8vw, 8px);
    --settings-cam-btn-big-fs: clamp(11px, 1vw, 13px);
    --settings-cam-btn-big-pad-y: clamp(7px, 0.95vw, 8px);
    --settings-cam-btn-big-pad-x: clamp(9px, 1vw, 12px);
    --settings-cam-icon-size: clamp(12px, 1vw, 14px);
    --settings-cam-pill-fs: clamp(10px, 0.9vw, 11px);
    --settings-cam-pill-pad-x: clamp(6px, 0.7vw, 8px);
}

.settings-cameras-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

#settingsManageCameraPlacementButton {
    margin-left: auto;
}

.settings-cameras-show-disabled {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.settings-cameras-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-cameras-row-hint {
    margin-top: 10px;
}

.settings-cameras-row {
    display: grid;
    grid-template-columns: minmax(0, 0.2fr) minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 2.5fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    font-size: var(--settings-cam-fs-row);
    color: #39463d;
}

.settings-cameras-row--header {
    background: #ebe4d4;
    font-weight: 600;
}

.settings-cameras-entry {
    border: 1px solid #e3dbc8;
    border-top: 0;
    background: #f8f4ea;
}

.settings-cameras-entry:first-child {
    border-top: 1px solid #e3dbc8;
}

.settings-cameras-entry:nth-child(odd) {
    background: #f4f1e8;
}

.settings-cameras-entry--open {
    background: #efe9db;
}

.settings-cameras-row--summary {
    cursor: pointer;
}

.settings-cameras-row--summary:hover {
    background: rgba(79, 111, 82, 0.06);
}

.settings-cameras-row--summary .settings-cameras-col::before,
.settings-cameras-row--create .settings-cameras-col::before {
    display: none;
}

.settings-cameras-row--inactive {
    opacity: 0.65;
}

.settings-cameras-row--create {
    background: #f4f1e8;
}

.settings-cameras-col {
    padding: var(--settings-cam-pad-cell-y) var(--settings-cam-pad-cell-x);
    display: flex;
    align-items: center;
}

.settings-cameras-details {
    border-top: 1px dashed #d7d0c2;
    padding: 10px 12px 12px;
    display: block;
}

.settings-cameras-details-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.settings-cameras-detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.settings-cameras-detail-label {
    font-size: 11px;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
}

.settings-cameras-detail-value {
    font-size: 13px;
    line-height: 1.2;
    color: #27302a;
    font-weight: 600;
    word-break: break-word;
}

.settings-cameras-detail-value--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.settings-cameras-details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-cameras-action-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: var(--settings-cam-btn-pad-y) var(--settings-cam-btn-pad-x);
    border-radius: 6px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: var(--settings-cam-btn-fs);
    cursor: pointer;
}

.settings-cameras-details .settings-cameras-action-button,
.settings-cameras-col--create-actions .settings-cameras-action-button {
    padding: var(--settings-cam-btn-big-pad-y) var(--settings-cam-btn-big-pad-x);
    border-radius: 8px;
    font-size: var(--settings-cam-btn-big-fs);
}

.settings-cameras-action-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.settings-cameras-action-button--primary {
    background: #e7f1e7;
    border-color: #b8d0b8;
    color: #2f4b2f;
}

.settings-cameras-action-button--secondary {
    background: #fbf9f4;
}

.settings-cameras-action-button--danger {
    background: #fdf0f0;
    border-color: #e8b4b4;
    color: #8a1f1f;
}

.settings-cameras-action-button--ocr-missing {
    background: #fdf0f0;
    border-color: #ef9a9a;
    color: #9b1c1c;
}

.settings-cameras-action-button--ocr-processing {
    background: #fff8e1;
    border-color: #f2cf66;
    color: #7a5a00;
}

.settings-cameras-action-button--ocr-configured {
    background: #e7f1e7;
    border-color: #b8d0b8;
    color: #2f4b2f;
}

.settings-cameras-action-icon {
    width: var(--settings-cam-icon-size);
    height: var(--settings-cam-icon-size);
    object-fit: contain;
    flex-shrink: 0;
}

.settings-cameras-action-label {
    white-space: nowrap;
}

.settings-cameras-col--number {
    justify-content: flex-start;
}

.settings-cameras-col--name {
    justify-content: flex-start;
}

.settings-cameras-col--identifier,
.settings-cameras-col--email,
.settings-cameras-col--shared,
.settings-cameras-col--quick-action {
    justify-content: flex-start;
}

.settings-cameras-email-value {
    font-size: var(--settings-cam-email-fs);
    line-height: 1.2;
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-cameras-summary-action {
    padding: var(--settings-cam-btn-pad-y) calc(var(--settings-cam-btn-pad-x) + 2px);
    font-size: var(--settings-cam-btn-fs);
}

.settings-cameras-col--create-actions {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-cameras-row input[type="text"],
.settings-cameras-row input[type="number"] {
    width: 100%;
    padding: var(--settings-cam-input-pad-y) var(--settings-cam-input-pad-x);
    border-radius: 6px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: var(--settings-cam-input-fs);
}

.settings-cameras-readonly-value {
    display: inline-flex;
    align-items: center;
    min-height: clamp(20px, 2vw, 24px);
    font-size: var(--settings-cam-readonly-fs);
    color: #27302a;
}

.settings-cameras-readonly-value--muted {
    color: #7a857d;
}

.settings-cameras-readonly-value--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    letter-spacing: 0.02em;
}

.settings-cameras-shared-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px var(--settings-cam-pill-pad-x);
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: var(--settings-cam-pill-fs);
    font-weight: 700;
    white-space: nowrap;
}

.settings-cameras-shared-pill--ready {
    color: #2f4b2f;
    background: #e7f1e7;
    border-color: #b8d0b8;
}

.settings-cameras-shared-pill--blocked {
    color: #7a5a00;
    background: #fff8e1;
    border-color: #f2cf66;
}

.settings-cameras-shared-pill--inactive {
    color: #5f6a62;
    background: #ecebe6;
    border-color: #d3d1c8;
}

.settings-status-text {
    font-size: 13px;
    color: #566158;
}

.settings-cameras-mobile-message {
    display: none;
    padding: 40px 20px;
    text-align: center;
    font-size: 16px;
    color: #566158;
    font-weight: 500;
}

.settings-cameras-desktop {
    display: block;
}

.settings-users-mobile-message {
    display: none;
    padding: 40px 20px;
    text-align: center;
    font-size: 16px;
    color: #566158;
    font-weight: 500;
}

.settings-users-desktop {
    display: block;
}

@media (max-width: 767px) {
    .settings-cameras-mobile-message {
        display: block;
    }

    .settings-cameras-desktop {
        display: none;
    }

    .settings-cameras-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .settings-cameras-actions .settings-button {
        width: 100%;
        justify-content: center;
    }

    #settingsManageCameraPlacementButton {
        margin-left: 0;
    }

    .settings-cameras-table {
        overflow: visible;
        /* Reset fluid scaling once we switch to cards */
        --settings-cam-fs-row: 14px;
        --settings-cam-pad-cell-y: 0px;
        --settings-cam-pad-cell-x: 0px;
        --settings-cam-input-fs: 14px;
        --settings-cam-input-pad-y: 8px;
        --settings-cam-input-pad-x: 10px;
        --settings-cam-readonly-fs: 14px;
        --settings-cam-email-fs: 13px;
        --settings-cam-btn-fs: 13px;
        --settings-cam-btn-pad-y: 8px;
        --settings-cam-btn-pad-x: 10px;
        --settings-cam-btn-big-fs: 13px;
        --settings-cam-btn-big-pad-y: 9px;
        --settings-cam-btn-big-pad-x: 10px;
        --settings-cam-icon-size: 14px;
        --settings-cam-pill-fs: 12px;
        --settings-cam-pill-pad-x: 8px;
    }

    .settings-cameras-row--header {
        display: none;
    }

    .settings-cameras-list {
        gap: 12px;
    }

    .settings-cameras-entry,
    .settings-cameras-entry:first-child {
        border: 1px solid #d7d0c2;
        border-radius: 12px;
        background: #fefcf7;
    }

    .settings-cameras-entry:nth-child(odd) {
        background: #fefcf7;
    }

    .settings-cameras-entry--open {
        background: #fbf8ef;
    }

    .settings-cameras-row--summary,
    .settings-cameras-row--create {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "number identifier"
            "name name"
            "email shared"
            "action action";
        gap: 10px 12px;
        align-items: start;
        padding: 12px;
    }

    .settings-cameras-row--summary .settings-cameras-col,
    .settings-cameras-row--create .settings-cameras-col {
        padding: 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .settings-cameras-row--summary .settings-cameras-col::before,
    .settings-cameras-row--create .settings-cameras-col::before {
        display: block;
        content: attr(data-label);
        font-size: 11px;
        line-height: 1.1;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #64748b;
        font-weight: 700;
    }

    .settings-cameras-row--summary .settings-cameras-col--quick-action::before,
    .settings-cameras-row--create .settings-cameras-col--quick-action::before {
        display: none;
        content: none;
    }

    .settings-cameras-row--summary .settings-cameras-col--name,
    .settings-cameras-row--create .settings-cameras-col--name {
        grid-area: name;
    }

    .settings-cameras-row--summary .settings-cameras-col--number,
    .settings-cameras-row--create .settings-cameras-col--number {
        grid-area: number;
        align-items: flex-start;
    }

    .settings-cameras-row--summary .settings-cameras-col--identifier,
    .settings-cameras-row--create .settings-cameras-col--identifier {
        grid-area: identifier;
        align-items: flex-end;
        text-align: right;
    }

    .settings-cameras-row--summary .settings-cameras-col--email,
    .settings-cameras-row--create .settings-cameras-col--email {
        grid-area: email;
        align-items: flex-start;
    }

    .settings-cameras-row--summary .settings-cameras-col--shared,
    .settings-cameras-row--create .settings-cameras-col--shared {
        grid-area: shared;
        align-items: flex-end;
        text-align: right;
    }

    .settings-cameras-row--summary .settings-cameras-col--quick-action,
    .settings-cameras-row--create .settings-cameras-col--quick-action {
        grid-area: action;
        justify-content: flex-start;
        align-self: start;
    }

    .settings-cameras-row--summary .settings-cameras-col--quick-action::before,
    .settings-cameras-row--create .settings-cameras-col--quick-action::before {
        display: none;
    }

    .settings-cameras-row--summary .settings-cameras-col--quick-action .settings-cameras-action-button,
    .settings-cameras-row--create .settings-cameras-col--quick-action .settings-cameras-action-button {
        width: 100%;
        min-height: 36px;
        justify-content: center;
        padding: 8px 10px;
        font-size: 13px;
    }

    .settings-cameras-row--summary .settings-cameras-col--shared .settings-cameras-shared-pill,
    .settings-cameras-row--create .settings-cameras-col--shared .settings-cameras-shared-pill {
        min-height: 24px;
    }

    .settings-cameras-row--summary input[type="text"],
    .settings-cameras-row--create input[type="text"] {
        width: 100%;
        padding: 8px 10px;
        font-size: 14px;
    }

    .settings-cameras-email-value {
        white-space: normal;
        word-break: break-word;
        text-overflow: unset;
    }

    .settings-cameras-details {
        padding: 12px;
        border-top: 1px dashed #d7d0c2;
    }

    .settings-cameras-details-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .settings-cameras-details .settings-cameras-action-button {
        width: 100%;
        justify-content: center;
        padding: 9px 10px;
        font-size: 13px;
    }

    /* Brukere: keep consistent behavior; desktop UI remains available. */
    .settings-users-mobile-message {
        display: none;
    }

    .settings-users-desktop {
        display: block;
    }
}

.settings-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.settings-actions-left,
.settings-actions-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.settings-button {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.settings-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.settings-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.settings-button--secondary {
    background: #ece7dc;
    color: #3f4d42;
    border: 1px solid #d7d0c2;
}

.settings-button--secondary:hover {
    background: #e2dacc;
}

.settings-button .btn-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

.settings-button .btn-label {
    vertical-align: middle;
}

.settings-button--primary {
    background: #4f6f52;
    color: #f2f5f1;
}

.settings-button--primary:hover:not(:disabled) {
    background: #405a44;
}

.settings-button--primary:disabled {
    background: #9ca3af;
    color: #f3f4f6;
}

.settings-button--danger {
    background: #dc2626;
    color: #fef2f2;
}

.settings-button--danger:hover {
    background: #b91c1c;
}

.settings-button--auto-width {
    width: auto;
    display: inline-block;
    align-self: flex-start;
}

/* Settings button spacing (avoid inline styles) */
.settings-button--spaced {
    margin-top: 10px;
}

/* ============================================================================
   Logs (superuser) - in-app view
   ========================================================================== */

.logs-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.logs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logs-title {
    font-size: 18px;
    font-weight: 700;
    color: #3f4f3f;
}

.logs-controls {
    padding: 16px;
}

.logs-controls-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.logs-controls-row--actions {
    margin-top: 12px;
    grid-template-columns: 1fr auto;
    align-items: end;
}

.logs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.logs-field--search {
    min-width: 0;
}

.logs-label {
    font-size: 12px;
    font-weight: 600;
    color: #3f4f3f;
}

.logs-input,
.logs-select {
    width: 100%;
    border: 1px solid #d7d0c2;
    background: #ffffff;
    color: #27302a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.logs-select--compact {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
}

/* ============================================================================
   Map search (used when area bounds are missing)
   ========================================================================== */

.map-search {
    border: 1px solid #d7d0c2;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 12px;
    margin-bottom: 12px;
}

/* Boundary tools: add a bit of top spacing so the search block doesn't stick to tabs */
#boundaryToolsSearchBar.map-search {
    margin-top: 12px;
}

.map-search-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #3f4f3f;
    margin-bottom: 6px;
}

.map-search-input {
    width: 100%;
    border: 1px solid #d7d0c2;
    background: #ffffff;
    color: #27302a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.map-search-results {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-search-result {
    text-align: left;
    border: 1px solid #e7e0d3;
    background: #f7f3ea;
    color: #27302a;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 600;
}

.map-search-result:hover {
    background: #efe7d7;
}

.map-search-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #526057;
}

.logs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.logs-status {
    margin-top: 10px;
    font-size: 13px;
    color: #3f4f3f;
}

.logs-status--error {
    color: #9b1c1c;
}

.logs-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.logs-summary-card {
    padding: 14px 16px;
}

.logs-summary-title {
    font-size: 12px;
    font-weight: 700;
    color: #3f4f3f;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.logs-summary-value {
    margin-top: 6px;
    font-size: 22px;
    font-weight: 800;
    color: #27302a;
}

.monitoring-summary-card--ok .logs-summary-value {
    color: #2f6f3e;
}

.monitoring-summary-card--warn .logs-summary-value {
    color: #9a5a00;
}

.monitoring-section--problem {
    border-left: 4px solid #b45309;
}

.monitoring-section--ok {
    border-left: 4px solid #2f6f3e;
}

.monitoring-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.monitoring-section {
    padding: 14px 16px;
}

.monitoring-section-header {
    margin-bottom: 10px;
}

.monitoring-problem-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.monitoring-problem {
    border: 1px solid #e7e0d3;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fffaf1;
}

.monitoring-problem--problem {
    border-color: #f1b35f;
    background: #fff7e8;
}

.monitoring-problem--attention {
    border-color: #f3d58d;
    background: #fffbea;
}

.monitoring-problem--ok {
    border-color: #b9d7bd;
    background: #f2fbf3;
}

.monitoring-problem-title {
    font-size: 14px;
    font-weight: 800;
    color: #27302a;
    margin-bottom: 4px;
}

.monitoring-table-wrap {
    overflow-x: auto;
}

.monitoring-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.monitoring-table th,
.monitoring-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e7e0d3;
    text-align: left;
    white-space: nowrap;
}

.monitoring-table th {
    color: #3f4f3f;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.monitoring-table .monitoring-row--problem td {
    background: #fff7e8;
    font-weight: 700;
}

.monitoring-table .monitoring-row--attention td {
    background: #fffbea;
}

.monitoring-table .monitoring-row--muted td {
    color: #7a827c;
    background: #faf8f3;
}

.monitoring-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid #d7d0c2;
    background: #f7f3ea;
    color: #3f4f3f;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.monitoring-badge--problem {
    border-color: #e29a3b;
    background: #fff0d7;
    color: #8a3f00;
}

.monitoring-badge--attention {
    border-color: #ead181;
    background: #fff8d8;
    color: #725100;
}

.monitoring-badge--muted {
    border-color: #ddd7cc;
    background: #f3f0ea;
    color: #6f766f;
}

.logs-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logs-item {
    border: 1px solid #e7e0d3;
    background: #fff;
    border-radius: 12px;
    padding: 12px 12px;
}

.logs-item-header {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: flex-start;
}

.logs-item-main {
    min-width: 0;
    flex: 1;
}

.logs-item-title {
    font-size: 14px;
    font-weight: 700;
    color: #27302a;
    margin-bottom: 4px;
}

.logs-item-subtitle {
    font-size: 12px;
    color: #526057;
    word-break: break-word;
}

.logs-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.logs-item-time {
    font-size: 12px;
    color: #526057;
    white-space: nowrap;
}

.logs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.logs-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #d7d0c2;
    background: #f7f3ea;
    color: #3f4f3f;
    font-size: 12px;
    font-weight: 600;
}

.logs-details-toggle {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: #3f4f3f;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 0;
}

.logs-details {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed #d7d0c2;
    background: #faf7f1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    display: none;
}

.logs-details--open {
    display: block;
}

.logs-pagination {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.logs-pagination-controls {
    display: flex;
    gap: 10px;
}

.logs-pagination-info {
    font-size: 13px;
    color: #3f4f3f;
}

.logs-pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 900px) {
    .logs-controls-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .logs-summary-grid {
        grid-template-columns: 1fr;
    }

    .monitoring-problem-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .logs-body {
        padding: 12px;
    }

    .logs-controls-row--actions {
        grid-template-columns: 1fr;
    }

    .logs-actions {
        justify-content: stretch;
    }

    .logs-actions .btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    /* Settings container and card */
    .settings-page-container {
        padding: 12px;
    }

    .settings-page-container .settings-card {
        padding: 16px;
        border-radius: 12px;
    }

    /* Settings tabs - scrollable on mobile */
    .settings-tabs {
        gap: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        flex-wrap: nowrap;
    }

    .settings-tab {
        padding: 10px 2px 10px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Settings groups - stack vertically on mobile */
    .settings-group--switch-time,
    .settings-group--wind-unit,
    .settings-group--temperature-unit,
    .settings-group--probability-threshold,
    .settings-group--sound-preference,
    .settings-group--show-all-images,
    .settings-group--skip-empty-days,
    .settings-group--help-tooltips,
    .settings-group--ui-language,
    .settings-group--date-style,
    .settings-group--hour-cycle {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .settings-group--switch-time .settings-label,
    .settings-group--wind-unit .settings-label,
    .settings-group--temperature-unit .settings-label,
    .settings-group--probability-threshold .settings-label,
    .settings-group--sound-preference .settings-label,
    .settings-group--show-all-images .settings-label,
    .settings-group--skip-empty-days .settings-label,
    .settings-group--help-tooltips .settings-label,
    .settings-group--ui-language .settings-label,
    .settings-group--date-style .settings-label,
    .settings-group--hour-cycle .settings-label {
        width: auto;
        padding-right: 0;
    }

    .settings-general-box {
        padding: 10px 12px;
    }

    .settings-general-box-title {
        font-size: 13px;
    }

    .settings-general-box .settings-group {
        gap: 8px;
        align-items: stretch;
    }

    .settings-general-box .settings-group .settings-label {
        width: auto;
        flex: 0 0 auto;
        min-width: 0;
    }

    .settings-general-box .settings-label--nowrap {
        white-space: normal;
    }

    .settings-general-box .settings-select,
    .settings-general-box .settings-time-input,
    .settings-general-box .settings-language-select-wrap,
    .settings-general-box .settings-language-trigger,
    .settings-general-box .settings-group--date-style .settings-select,
    .settings-general-box .settings-group--hour-cycle .settings-select {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .settings-radio-group {
        gap: 16px;
    }

    .settings-time-input {
        width: 100%;
    }

    /* Settings species table */
    .settings-species-row {
        font-size: 13px;
        grid-template-columns: 1.45fr 0.55fr 0.55fr 0.55fr 0.55fr;
        gap: 6px;
    }

    .settings-species-row--header {
        font-size: 11px;
    }

    /* Settings actions */
    .settings-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 12px 0 0 0;
    }

    .settings-actions-left,
    .settings-actions-right {
        width: 100%;
        justify-content: center;
    }

    .settings-actions-right {
        justify-content: space-between;
    }

    .settings-actions .settings-button {
        width: 100%;
    }

    .settings-button--auto-width {
        width: 100%;
    }

    .settings-group--species-admin .settings-button--auto-width {
        width: auto;
    }

    /* Mobile: keep settings tabs consistent with desktop (do not hide any tabs by CSS). */
    .settings-mobile-notice {
        display: none;
    }
}

#listTable thead th.sorted-asc::after,
#listTable thead th.sorted-desc::after {
    content: '';
    display: inline-block;
    margin-left: 6px;
    border: 4px solid transparent;
}

#listTable thead th.sorted-asc::after {
    border-bottom-color: #4f6f52;
}

#listTable thead th.sorted-desc::after {
    border-top-color: #4f6f52;
}

.observation-dot.disabled-hover {
    pointer-events: none;
}

.timeline-container.zoom-active .timeline-inner .observation-dot,
.timeline-track.zooming .timeline-inner .observation-dot {
    pointer-events: none;
}

.timeline-container.zoom-active .zoom-overlay .observation-dot,
.timeline-track.zooming .zoom-overlay .observation-dot {
    pointer-events: auto;
}

.map-modal-body {
    padding: 0 24px 24px;
    position: relative;
}

/* Mapbox body in modals: no padding (overrides modal padding) */
.map-modal-body.mapbox-body {
    padding: 0;
}

/* Mapbox body in page views */
.page-view-body.mapbox-body {
    padding: 24px;
    min-height: auto;
}

.mapbox-wrapper {
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.mapbox-container {
    width: 100%;
    height: 100%;
}

/* Hide map visually while keeping layout (used to avoid "camera jump" on first render) */
.mapbox-preload-hidden {
    opacity: 0;
    pointer-events: none;
}

.mapbox-wrapper .mapboxgl-ctrl-bottom-left,
.mapbox-wrapper .mapboxgl-ctrl-bottom-right {
    display: none !important;
}

/* Mapbox modal controls (under the map) */
.mapbox-modal-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: center;
    padding: 14px 24px 18px;
    border-top: 1px solid #dfd6c6;
    background: #f7f3ea;
}

.mapbox-camera-details-card {
    width: min(560px, calc(100vw - 32px));
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #f7f3ea;
}

.mapbox-camera-details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.mapbox-camera-details-header h2 {
    margin: 2px 0 0;
    color: #27302a;
    font-size: 16px;
    line-height: 1.15;
}

.mapbox-camera-details-eyebrow,
.mapbox-camera-details-kicker {
    color: #4f6f52;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mapbox-camera-details-close {
    flex: 0 0 auto;
    color: #2f3d31;
}

.mapbox-camera-details-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.mapbox-camera-details-image {
    position: relative;
    height: 260px;
    border-radius: 16px;
    overflow: hidden;
    background: #1b241d;
    border: 1px solid rgba(79, 111, 82, 0.28);
}

.mapbox-camera-details-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.mapbox-camera-details-image--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f2a22, #3a4b3d);
}

.mapbox-camera-details-image--empty img {
    width: 96px;
    height: 96px;
    min-height: 0;
    object-fit: contain;
    opacity: 0.72;
}

.mapbox-camera-details-image-caption {
    position: absolute;
    left: 12px;
    bottom: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 15, 0.76);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.mapbox-camera-details-content {
    display: flex;
    flex-direction: column;
}

.mapbox-camera-details-subtitle {
    color: #667267;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
}

.mapbox-camera-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mapbox-camera-details-metric {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(79, 111, 82, 0.16);
}

.mapbox-camera-details-metric-label {
    margin-bottom: 4px;
    color: #6b756d;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mapbox-camera-details-metric-value {
    color: #27302a;
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

@media (max-width: 767px) {
    .mapbox-camera-details-card {
        padding: 20px;
    }

    .mapbox-camera-details-layout {
        grid-template-columns: 1fr;
    }

    .mapbox-camera-details-image,
    .mapbox-camera-details-image img {
        height: 220px;
    }

    .mapbox-camera-details-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Boundary tools view (admin) */
.boundary-tools-body {
    /* Match "Kart" mapbox-body framing: white page-view-body padding around map content */
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

.boundary-tools-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    /* Keep header full-bleed despite body padding */
    margin: -24px -24px 0;
    border-bottom: 1px solid #dfd6c6;
    background: #f7f3ea;
}

.boundary-tools-title {
    font-size: 16px;
    font-weight: 700;
    color: #27302a;
}

.boundary-tools-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 18px;
    /* Keep tabs full-bleed despite body padding */
    margin: 0 -24px;
    border-bottom: 1px solid #dfd6c6;
    background: #f7f3ea;
}

.boundary-tools-mapbox-wrapper {
    /* Center like .mapbox-wrapper and leave a white frame around it */
    margin: 24px auto;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.boundary-tools-mapbox-container {
    width: 100%;
    height: 100%;
}

/* Hide Mapbox corner overlays (same intent as other mapbox-wrapper usage) */
.boundary-tools-mapbox-wrapper .mapboxgl-ctrl-bottom-left,
.boundary-tools-mapbox-wrapper .mapboxgl-ctrl-bottom-right,
.boundary-tools-mapbox-wrapper .mapboxgl-ctrl-logo,
.boundary-tools-mapbox-wrapper .mapboxgl-ctrl-attrib {
    display: none !important;
}

.boundary-tools-mapbox-wrapper .mapboxgl-canvas-container.tc-cursor-grab {
    cursor: grab !important;
}
.boundary-tools-mapbox-wrapper .mapboxgl-canvas-container.tc-cursor-grabbing {
    cursor: grabbing !important;
}
.boundary-tools-mapbox-wrapper .mapboxgl-canvas-container.tc-cursor-pointer {
    cursor: pointer !important;
}

.boundary-tools-controls {
    /* Match mapbox controls padding style */
    padding: 16px 24px 18px;
    background: #f7f3ea;
}

.boundary-tools-panel-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.boundary-tools-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.boundary-tools-actions .settings-checkbox-label {
    margin-left: auto;
}

.boundary-tools-area-coordinates {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Boundary Tools (Områdegrense): keep the 4 coordinate inputs compact (2x2 grid),
   then let it stack naturally on narrow viewports. */
.boundary-tools-area-coordinates .area-admin-coordinates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.boundary-tools-area-coordinates .area-admin-coordinates .settings-time-input {
    width: 100%;
    min-width: 0;
}

@media (max-width: 480px) {
    .boundary-tools-area-coordinates .area-admin-coordinates {
        grid-template-columns: 1fr;
    }
}

.boundary-tools-area-coordinates-actions {
    display: flex;
    justify-content: flex-end;
}

.boundary-tools-area-coordinates-actions .btn {
    min-width: 0;
}

.boundary-tools-label {
    font-size: 13px;
    font-weight: 700;
    color: #2f3d31;
}

.boundary-tools-tool-panel {
    padding-top: 8px;
}

.boundary-tools-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #2f3a33;
    opacity: 0.85;
    line-height: 1.35;
}

.boundary-tools-inline-hint {
    margin-top: 0;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
    font-size: 13px;
    font-weight: 800;
    opacity: 1;
    line-height: 1.35;
    text-align: center;
}

.boundary-tools-status {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #dfd6c6;
    background: #fbf9f4;
    color: #27302a;
    font-size: 13px;
    font-weight: 600;
}

.boundary-tools-status.is-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.boundary-tools-status.is-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(79, 111, 82, 0.25);
    border-top-color: rgba(79, 111, 82, 0.95);
    animation: trailcam-spin 0.9s linear infinite;
    flex: 0 0 auto;
}

@keyframes trailcam-spin {
    to { transform: rotate(360deg); }
}

.boundary-tools-status.error {
    border-color: rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
}

.boundary-tools-path-banner {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.boundary-tools-path-banner-text {
    font-size: 13px;
    font-weight: 700;
}

/* Boundary tools: OCR modal (Phase 1) */
.settings-camera-ocr-result-modal-card {
    width: min(980px, calc(100vw - 32px));
    max-width: 980px; /* override .confirm-dialog-card max-width:400px */
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.settings-camera-ocr-modal-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.settings-camera-ocr-modal-header .settings-camera-ocr-result-modal-title {
    margin-bottom: 0;
}

.settings-camera-ocr-modal-header .settings-camera-ocr-setup-modal-meta {
    margin-bottom: 0;
    margin-left: auto;
    text-align: right;
}

.settings-camera-ocr-result-modal-card .confirm-dialog-buttons {
    margin-top: 14px;
    justify-content: flex-end;
}

.settings-camera-ocr-result-modal-title {
    font-size: 16px;
    font-weight: 800;
    color: #27302a;
    margin-bottom: 6px;
}

.settings-camera-ocr-setup-modal-meta {
    font-size: 13px;
    font-weight: 700;
    color: #2f3d31;
    opacity: 0.9;
    margin-bottom: 12px;
}

.settings-camera-ocr-setup-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.settings-camera-ocr-file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* On mobile, the global `.btn` rule makes buttons icon-only.
   For OCR setup/result modals we keep readable text buttons at all widths. */
@media (max-width: 767px) {
    .settings-camera-ocr-result-modal-card .btn {
        flex: 0 0 auto;
        width: auto;
        min-width: initial;
        padding: 8px 16px;
        gap: 8px;
        height: 38px;
    }
}

.settings-camera-ocr-file-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.settings-camera-ocr-file-chosen {
    font-size: 13px;
    font-weight: 700;
    color: #27302a;
    opacity: 0.9;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(520px, 100%);
    overflow: hidden;
}

.settings-camera-ocr-file-placeholder {
    width: 54px;
    height: 38px;
    border-radius: 8px;
    background:
      linear-gradient(45deg, transparent 49.6%, rgba(0, 0, 0, 0.9) 49.8%, rgba(0, 0, 0, 0.9) 50.2%, transparent 50.4%),
      linear-gradient(-45deg, transparent 49.6%, rgba(0, 0, 0, 0.9) 49.8%, rgba(0, 0, 0, 0.9) 50.2%, transparent 50.4%);
    flex: 0 0 auto;
}

.settings-camera-ocr-file-placeholder.hidden {
    display: none;
}

.settings-camera-ocr-file-chosen-text {
    font-size: 13px;
    font-weight: 700;
    color: #27302a;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-camera-ocr-file-thumb {
    width: 54px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 auto;
}

.settings-camera-ocr-file-thumb.hidden {
    display: none;
}

.settings-camera-ocr-latest-job-bar {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    margin-bottom: 2px;
}

.settings-camera-ocr-modal-header .settings-camera-ocr-latest-job-bar {
    margin: 0;
    justify-content: flex-start;
}

.settings-camera-ocr-status-pill--idle {
    background: #f3efe8;
    color: #6d665a;
    border: 1px solid #ddd3c2;
}

.settings-camera-ocr-result-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.settings-camera-ocr-result-image-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dfd6c6;
    background: #000;
}

.settings-camera-ocr-result-image {
    display: block;
    width: 100%;
    height: auto;
}

.settings-camera-ocr-result-overlay {
    position: absolute;
    inset: 0;
    pointer-events: auto;
}

.settings-camera-ocr-context-menu {
    position: absolute;
    z-index: 50;
    min-width: 240px;
    max-width: 320px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(223, 214, 198, 0.95);
    background: rgba(255, 253, 248, 0.98);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-camera-ocr-context-menu-item {
    text-align: left;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.settings-camera-ocr-context-menu-item:hover:not(:disabled) {
    background: #f3efe8;
}

.settings-camera-ocr-context-menu-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.settings-camera-ocr-color-0 { --ocr-line-color: rgba(220, 53, 69, 0.95);  --ocr-line-glow: rgba(220, 53, 69, 0.45);  --ocr-line-bg: rgba(220, 53, 69, 0.10); }  /* red */
.settings-camera-ocr-color-1 { --ocr-line-color: rgba(34, 197, 94, 0.95);  --ocr-line-glow: rgba(34, 197, 94, 0.45);  --ocr-line-bg: rgba(34, 197, 94, 0.10); }  /* green */
.settings-camera-ocr-color-2 { --ocr-line-color: rgba(251, 191, 36, 0.95); --ocr-line-glow: rgba(251, 191, 36, 0.40); --ocr-line-bg: rgba(251, 191, 36, 0.12); } /* yellow */
.settings-camera-ocr-color-3 { --ocr-line-color: rgba(59, 130, 246, 0.95); --ocr-line-glow: rgba(59, 130, 246, 0.45); --ocr-line-bg: rgba(59, 130, 246, 0.10); } /* blue */
.settings-camera-ocr-color-4 { --ocr-line-color: rgba(251, 146, 60, 0.95); --ocr-line-glow: rgba(251, 146, 60, 0.42); --ocr-line-bg: rgba(251, 146, 60, 0.11); } /* orange */
.settings-camera-ocr-color-5 { --ocr-line-color: rgba(168, 85, 247, 0.95); --ocr-line-glow: rgba(168, 85, 247, 0.42); --ocr-line-bg: rgba(168, 85, 247, 0.10); } /* purple */

.settings-camera-ocr-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid var(--ocr-line-color, rgba(39, 48, 42, 0.55));
    border-radius: 4px;
    background: transparent;
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.settings-camera-ocr-box:hover {
    box-shadow: 0 0 0 3px var(--ocr-line-glow, rgba(56, 189, 248, 0.6));
    transform: translateY(-1px);
}

.settings-camera-ocr-box.is-selected {
    border-width: 2px;
    box-shadow: 0 0 0 3px var(--ocr-line-glow, rgba(56, 189, 248, 0.6));
    transform: translateY(-1px);
}

.settings-camera-ocr-box.is-multi-selected {
    /* Match the bright green used in the detection editor overlay. */
    border-color: rgba(0, 255, 0, 0.9);
    box-shadow: 0 0 0 3px rgba(0, 255, 0, 0.55);
}

.settings-camera-ocr-box.is-manual-source {
    border-style: dashed;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.45);
}

.settings-camera-ocr-box.is-role-ignore {
    opacity: 0.55;
}

.settings-camera-ocr-box.is-role-timestamp {
    opacity: 0.98;
}

.settings-camera-ocr-box.is-role-camera {
    opacity: 0.98;
}

.settings-camera-ocr-box.is-role-brand {
    opacity: 0.98;
}

.settings-camera-ocr-split-guide {
    position: absolute;
    pointer-events: none;
    background: rgba(220, 38, 38, 0.98);
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35), 0 0 10px rgba(220, 38, 38, 0.75);
    z-index: 2;
}

.settings-camera-ocr-result-lines {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #dfd6c6;
    background: #fbf9f4;
}

.settings-camera-ocr-format {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(223, 214, 198, 0.9);
    background: #fffdf8;
    margin-bottom: 10px;
}

.settings-camera-ocr-format-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 42%);
    column-gap: 12px;
    align-items: start;
}

.settings-camera-ocr-format-main {
    min-width: 0;
}

.settings-camera-ocr-format-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.settings-camera-ocr-format-row--needs-selection {
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
}

.settings-camera-ocr-camera-toggle-row {
    align-items: flex-start;
    margin-top: 10px;
}

.settings-camera-ocr-camera-toggle-control {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #2f3a33;
    line-height: 1.3;
}

.settings-camera-ocr-camera-toggle-input {
    margin-top: 1px;
    width: 16px;
    height: 16px;
    accent-color: #4f6f52;
}

.settings-camera-ocr-camera-toggle-text {
    display: inline-block;
}

.settings-camera-ocr-camera-toggle-hint {
    color: rgba(39, 48, 42, 0.75);
}

.settings-camera-ocr-format-label {
    font-size: 12px;
    font-weight: 900;
    color: #2f3a33;
    min-width: 86px;
}

.settings-camera-ocr-format-label--needs-selection {
    color: #b02a37;
    font-weight: 900;
}

.settings-camera-ocr-format-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #2f3a33;
    opacity: 0.92;
}

.settings-camera-ocr-format-preview-row {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-camera-ocr-inline-warning {
    margin: 8px 0 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.08);
    color: #7f1d1d;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 700;
}

.settings-camera-ocr-inline-warning--compact {
    margin: 0;
    padding: 8px 10px;
    font-size: 11.5px;
    line-height: 1.35;
}

.settings-camera-ocr-inline-warning-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-camera-ocr-inline-warning-actions .confirm-dialog-button {
    padding: 7px 12px;
    font-size: 12px;
}

.settings-camera-ocr-manual-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 10px 0;
}

.settings-camera-ocr-manual-token {
    border: 1px solid #d7d0c2;
    background: #f7f3ea;
    color: #2f3a33;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.settings-camera-ocr-manual-token.is-active {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.14);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.18);
}

.settings-camera-ocr-manual-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-camera-ocr-manual-fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-camera-ocr-manual-field-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    max-width: 420px;
}

.settings-camera-ocr-manual-field-item .settings-camera-ocr-format-label {
    min-width: 72px;
    width: 72px;
    font-size: 12px;
    text-align: right;
    margin-right: 0;
}

.settings-camera-ocr-manual-field-select {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    font-size: 12px;
}


.settings-camera-ocr-inline-token {
    border-radius: 4px;
    padding: 0 2px;
}

.settings-camera-ocr-inline-token.is-mapped {
    background: rgba(245, 158, 11, 0.22);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.42);
    margin-right: 4px;
}

.settings-camera-ocr-inline-token-label {
    display: inline-block;
    margin-left: 4px;
    padding: 0 4px;
    border-radius: 4px;
    background: rgba(47, 61, 49, 0.16);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.3;
}

.settings-camera-ocr-manual-map-badge {
    position: absolute;
    left: 4px;
    top: 4px;
    max-width: calc(100% - 8px);
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.settings-camera-ocr-manual-map-badge.is-active-field {
    background: rgba(22, 101, 52, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.settings-camera-ocr-line {
    font-size: 13px;
    font-weight: 700;
    color: #27302a;
    padding: 6px 0;
    border-bottom: 1px solid rgba(223, 214, 198, 0.8);
}

.settings-camera-ocr-line:last-child {
    border-bottom: none;
}

.settings-camera-ocr-line-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 6px 12px;
    border-bottom: 1px solid rgba(223, 214, 198, 0.8);
    position: relative;
}

.settings-camera-ocr-line-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 6px;
    border-radius: 6px;
    background: var(--ocr-line-color, rgba(39, 48, 42, 0.25));
    opacity: 0.95;
}

.settings-camera-ocr-line-row:last-child {
    border-bottom: none;
}

.settings-camera-ocr-line-row.is-selected {
    background: var(--ocr-line-bg, rgba(79, 111, 82, 0.10));
    border-radius: 8px;
    padding: 6px 8px 6px 20px;
    margin: 0 -8px;
}

.settings-camera-ocr-line-row.is-selected::before {
    left: 8px;
}

.settings-camera-ocr-line-row.is-multi-selected {
    /* Multi-select highlight is shown on the boxes (overlay), not the rows. */
    background: transparent;
}

.settings-camera-ocr-line-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 800;
    color: #27302a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-camera-ocr-line-select {
    flex: 0 0 auto;
    min-width: 180px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: 13px;
    font-weight: 700;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    accent-color: #4f6f52;
}

.settings-camera-ocr-line-select:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.25);
}

.settings-camera-ocr-format-select--needs-selection {
    border-color: #b02a37;
    background: #fff7f7;
}

.settings-camera-ocr-format-select--needs-selection:focus {
    border-color: #b02a37;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.28);
}

@media (max-width: 480px) {
    .settings-camera-ocr-result-modal-card {
        padding: 18px;
    }
}

/* Activity (Bevegelser): paths missing banner */
.activity-path-banner {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.activity-path-banner-text {
    font-size: 13px;
    font-weight: 700;
}

.boundary-tools-zones-list {
    margin-top: 12px;
    max-height: 320px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.boundary-tools-zone-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 10px;
    border-radius: 10px;
    border: 1px solid #dfd6c6;
    background: #fbf9f4;
}

.boundary-tools-zone-item.active {
    box-shadow: 0 0 0 2px rgba(251, 176, 59, 0.45);
}

.boundary-tools-zone-item-title {
    font-size: 13px;
    font-weight: 700;
    color: #27302a;
}

.boundary-tools-zone-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    max-width: 100%;
}

.boundary-tools-zone-hole-list {
    flex: 1 0 100%;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(223, 214, 198, 0.8);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.boundary-tools-zone-hole-list-title {
    font-size: 12px;
    font-weight: 800;
    color: #2f3a33;
}

.boundary-tools-zone-hole-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.boundary-tools-zone-hole-label {
    font-size: 12px;
    font-weight: 700;
    color: #27302a;
}

/* Boundary tools — Cameras tab */
.boundary-tools-cameras-toolbar {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.boundary-tools-cameras-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.boundary-tools-cameras-inline-hint {
    flex: 1 1 320px;
    min-width: 220px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(220, 53, 69, 0.35);
    background: rgba(220, 53, 69, 0.08);
    color: #b02a37;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.boundary-tools-cameras-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.boundary-tools-camera-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid #dfd6c6;
    background: #ffffff;
}

.boundary-tools-camera-item--hovered {
    box-shadow: 0 0 0 2px rgba(79, 111, 82, 0.35);
}

.boundary-tools-camera-item--ocr-ready {
    border-color: rgba(251, 176, 59, 0.85);
    box-shadow: 0 0 0 2px rgba(251, 176, 59, 0.22);
}

.boundary-tools-camera-item-ocr-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(251, 176, 59, 0.75);
    background: rgba(251, 176, 59, 0.16);
    color: #7a4c00;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.2px;
    vertical-align: middle;
}

.boundary-tools-camera-item--inactive {
    opacity: 1;
}

.boundary-tools-camera-item--inactive .boundary-tools-camera-item-main {
    opacity: 0.65;
}

.boundary-tools-camera-item-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.boundary-tools-camera-item-title {
    font-size: 14px;
    font-weight: 800;
    color: #27302a;
}

.boundary-tools-camera-item-sub {
    font-size: 12px;
    color: #2f3a33;
    opacity: 0.9;
    word-break: break-word;
}

.boundary-tools-camera-item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

/* Vertex context menu (boundary tools) */
.vertex-context-menu {
    position: fixed;
    background: #f7f3ea;
    border: 1px solid #dfd6c6;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
    z-index: 6000;
    min-width: 160px;
    padding: 4px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.vertex-context-menu.hidden {
    display: none !important;
}

.vertex-context-menu-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    background: transparent;
    border: none;
    color: #b02a37;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.vertex-context-menu-item:hover {
    background: rgba(220, 53, 69, 0.10);
}

@media (max-width: 980px) {
    .boundary-tools-mapbox-wrapper {
        margin: 18px auto;
    }
    .boundary-tools-mapbox-container {
        height: 100%;
    }
    .boundary-tools-controls {
        padding: 14px 16px 16px;
    }
}

.heatmap-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.heatmap-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    padding: 0px 24px 0;
}

.heatmap-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.heatmap-field--range {
    /* Place this whole field on the RIGHT side */
    margin-left: auto;
    min-width: 260px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.heatmap-field label {
    font-size: 13px;
    font-weight: 600;
    color: #2f3d31;
}

.heatmap-field--range label {
    margin: 0;
    white-space: nowrap;
}

.heatmap-field--range input {
    flex: 1 1 auto;
}

.heatmap-field select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: 14px;
    min-width: 180px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    accent-color: #4f6f52;
}

.heatmap-field input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: 14px;
    min-width: 180px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.heatmap-field input:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.25);
}

.heatmap-field select:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.25);
}

.heatmap-summary {
    font-size: 14px;
    color: #334155;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    min-height: 38px;
}

.heatmap-summary .heatmap-summary-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}

.heatmap-summary .heatmap-summary-main {
    white-space: nowrap;
}

#comparisonSummary {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
}

#comparisonSummary .comparison-summary-warning {
    color: #dc2626;
    font-weight: 700;
}

.heatmap-summary .heatmap-summary-cameras {
    white-space: nowrap;
}

/* Desktop: keep it a single line with a visual separator before camera count. */
.heatmap-summary .heatmap-summary-cameras::before {
    content: " - ";
}

.heatmap-summary strong {
    font-weight: 600;
    color: #1f2937;
}

/* NOTE: We intentionally do NOT force a special tablet wrap layout.
   Tablet should behave like desktop (summary left, picker right).
   Only mobile stacks. */

/* Mobile: allow the summary and the picker row to stack and wrap naturally. */
@media (max-width: 767px) {
    .heatmap-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 0 16px;
        gap: 12px;
    }

    .heatmap-field--range {
        margin-left: 0;
        justify-content: flex-start;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        min-width: 0;
    }

    .heatmap-summary span {
        white-space: normal;
    }

    /* Mobile: if it breaks, break between main summary and camera count cleanly. */
    .heatmap-summary .heatmap-summary-cameras {
        flex-basis: 100%;
    }

    .heatmap-summary .heatmap-summary-cameras::before {
        content: "";
    }
}

.heatmap-wrapper {
    position: relative;
    width: 100%;
}

.heatmap-empty {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    padding: 16px 22px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
    pointer-events: none;
    text-align: center;
}

.insights-modal-content {
    max-width: 980px;
    position: relative;
}

.insights-body {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 24px 28px 32px;
    position: relative;
}

.insights-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px;
}

/* Hyppighet: make "Tidsspenn" drop earlier (around 860px) */
@media (max-width: 860px) {
    #comparisonView .insights-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    #comparisonView .insights-field {
        min-width: 220px;
    }
}

.insights-controls>* {
    flex: 0 0 auto;
}

#weatherView .weather-insights-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

#weatherView .weather-insights-header-row>.weather-temp-header {
    flex: 1 1 320px;
    min-width: 240px;
    margin: 0;
}

#weatherView .weather-insights-header-row>.insights-controls.heatmap-controls {
    flex: 0 1 auto;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 14px;
    padding: 0;
}

#weatherView .weather-insights-header-row .heatmap-summary {
    display: none;
}

#weatherView .weather-insights-header-row .heatmap-field--range {
    margin-left: 0;
    min-width: 240px;
}

#weatherView #weatherChartContainer .weather-temp-header {
    display: none;
}

.insights-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}

.insights-field label {
    font-size: 13px;
    font-weight: 600;
    color: #2f3d31;
}

.insights-select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d7d0c2;
    background: #fbf9f4;
    color: #27302a;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    accent-color: #4f6f52;
}

.insights-select:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.25);
}

.insights-summary {
    font-size: 13px;
    color: #334155;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.insights-summary span,
.insights-summary div {
    background: rgba(79, 111, 82, 0.12);
    color: #1f2937;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
}

.insights-summary span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.insights-empty {
    font-size: 14px;
    color: #64748b;
    padding: 18px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.18);
    text-align: center;
}

.insights-empty strong {
    display: block;
    margin-bottom: 8px;
    color: #1f2937;
}

.comparison-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 350px));
    gap: 16px;
    justify-content: center;
}

.comparison-item {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(79, 111, 82, 0.16);
    padding: 14px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 11px;
    width: 350px;
    max-width: 100%;
    justify-self: center;
}

.comparison-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.comparison-item-title-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.comparison-item-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comparison-rank {
    font-size: 13px;
    font-weight: 600;
    color: #4f6f52;
}

.comparison-name {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.comparison-camera-number {
    font-size: 15px;
    line-height: 1;
    color: #334155;
    font-weight: 700;
    min-width: 40px;
    text-align: right;
}

.comparison-camera-image-wrap,
.comparison-camera-image-row {
    border-radius: 14px;
}

.comparison-camera-image-wrap {
    border: 1px solid rgba(79, 111, 82, 0.14);
    background: linear-gradient(180deg, #f8fbf8 0%, #f2f7f3 100%);
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px;
}

.comparison-camera-image-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.comparison-camera-image-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.comparison-observation-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.comparison-image-label {
    font-size: 10px;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
    text-align: center;
}

.comparison-camera-image {
    width: auto;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0.94;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
}

.comparison-camera-image-button {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-camera-image-button:hover .comparison-camera-image {
    opacity: 1;
}

.comparison-observation-media {
    width: 100%;
    aspect-ratio: var(--comparison-observation-ratio, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
    background: transparent;
}

.comparison-camera-thumb-button {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.16s ease;
}

.comparison-camera-thumb-button:hover {
    opacity: 0.92;
}

.comparison-camera-thumb {
    width: auto;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
}

.comparison-camera-thumb--placeholder {
    width: auto;
    height: 70%;
    max-width: 70%;
    max-height: 70%;
}

.comparison-map-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comparison-inline-map {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 3;
    border-radius: 10px;
    border: 1px solid rgba(79, 111, 82, 0.16);
    overflow: hidden;
    background: #f7faf7;
}

.comparison-inline-map-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.comparison-inline-map-button {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    display: block;
    cursor: pointer;
}

.comparison-inline-map-button:hover .comparison-inline-map {
    border-color: rgba(79, 111, 82, 0.3);
}

.comparison-inline-map--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
}

.comparison-item-info {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.comparison-item-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.comparison-info-label {
    font-size: 11px;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
}

.comparison-info-value {
    font-size: 13px;
    line-height: 1.2;
    color: #1f2937;
    font-weight: 600;
    text-align: right;
}

.comparison-info-value--email {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    word-break: break-word;
}

.comparison-total {
    font-size: 12px;
    color: #475569;
}

.comparison-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: rgba(79, 111, 82, 0.16);
    border-radius: 999px;
    overflow: hidden;
}

.comparison-bar-fill {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #31543b 0%, #4f6f52 100%);
}

.comparison-item .highlight-footer {
    font-size: 12px;
    color: #64748b;
}

.comparison-item .highlight-footer--overdue {
    color: #dc2626;
    font-weight: 700;
}

@media (max-width: 767px) {
    .insights-body {
        padding: 16px 18px 22px;
        gap: 16px;
        align-items: stretch;
    }

    .insights-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .insights-field {
        min-width: unset;
        width: 100%;
    }

    .insights-summary {
        gap: 8px;
        flex-direction: column;
    }

    .insights-summary span,
    .insights-summary div {
        width: 100%;
        justify-content: center;
    }

    #weatherView .weather-insights-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    #weatherView .weather-insights-header-row>.weather-temp-header {
        flex: 1 1 auto;
        min-width: 0;
    }

    #weatherView .weather-insights-header-row>.insights-controls.heatmap-controls {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        align-items: flex-start;
    }

    .trends-chart-list {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .comparison-item {
        padding: 14px;
        gap: 11px;
    }

    .comparison-name {
        font-size: 18px;
    }

    .comparison-camera-number {
        font-size: 14px;
    }

    .comparison-camera-image-wrap {
        min-height: 140px;
    }

    .comparison-camera-image {
        width: auto;
        max-width: 100%;
        height: 100%;
    }

    .comparison-item-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .comparison-info-value {
        text-align: left;
    }
}

.trends-modal-content {
    max-width: 960px;
}


.trends-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.trends-summary {
    font-size: 13px;
    color: #334155;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.trends-summary strong {
    color: #1f2937;
}

.trends-empty {
    font-size: 14px;
    color: #64748b;
    padding: 18px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.12);
    text-align: center;
}

.trends-chart-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.trend-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(79, 111, 82, 0.16);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.trend-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.trend-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d2a22;
}

.trend-card-total {
    font-size: 12px;
    color: #475569;
}

.trend-chart {
    width: 100%;
    height: 60px;
}

/* Weather charts (non-scatter): avoid sparkline height */
.weather-chart {
    height: 280px;
}

@media (max-width: 767px) {
    .weather-chart {
        height: 220px;
    }
}

/* Weather scatter chart: keep a stable aspect ratio (prevents circle distortion) */
.weather-scatter {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-rows: 1fr 26px;
    column-gap: 10px;
    row-gap: 6px;
    align-items: stretch;
}

.weather-scatter-frame {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    aspect-ratio: 4 / 3;
}

.weather-scatter-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.weather-scatter-ylabels {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    padding: 8px 0 18px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.weather-scatter-xlabels {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 6px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

/* Temperature dashboard (mockup-inspired) */
.weather-temp-dashboard {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.weather-temp-header {
    padding: 4px 2px;
}

.weather-temp-title {
    font-size: 20px;
    font-weight: 700;
    color: #1d2a22;
    margin-bottom: 4px;
}

.weather-temp-subtitle {
    font-size: 13px;
    color: #64748b;
}

.weather-temp-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.weather-temp-stat {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    padding: 12px 14px;
}

.weather-temp-stat-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 2px;
}

.weather-temp-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.weather-temp-tabs {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    padding: 6px;
    display: flex;
    gap: 6px;
}

.weather-temp-tab {
    flex: 1;
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 10px;
    border-radius: 12px;
    cursor: pointer;
}

.weather-temp-tab:hover {
    background: rgba(148, 163, 184, 0.16);
}

.weather-temp-tab.active {
    background: #4f6f52;
    color: #ffffff;
}

.weather-temp-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    padding: 16px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.weather-temp-card-header {
    margin-bottom: 10px;
}

.weather-temp-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.weather-temp-card-desc {
    font-size: 12px;
    color: #64748b;
}

.weather-temp-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weather-temp-axislabel {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    margin-left: 2px;
}

.weather-temp-chart-frame {
    width: 100%;
    position: relative;
}

.weather-temp-hover-rect,
.weather-temp-hover-line {
    pointer-events: none;
}

.weather-temp-svg {
    width: 100%;
    height: 340px;
    display: block;
}

.weather-temp-tooltip {
    position: absolute;
    min-width: 260px;
    max-width: 320px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
    padding: 14px 16px;
    z-index: 3;
    pointer-events: none; /* prevents hover-flicker when tooltip overlaps SVG */
}

.weather-temp-tooltip--floating {
    position: fixed;
    z-index: 20000;
}

.weather-temp-tooltip--green .weather-temp-tooltip-value { color: #16a34a; }
.weather-temp-tooltip--blue .weather-temp-tooltip-value { color: #2563eb; }
.weather-temp-tooltip--purple .weather-temp-tooltip-value { color: #7c3aed; }

.weather-temp-tooltip.hidden {
    display: none;
}

.weather-temp-tooltip-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
}

.weather-temp-tooltip-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 6px;
}

.weather-temp-tooltip-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.weather-temp-tooltip-sub {
    font-size: 13px;
    color: #64748b;
}

.weather-temp-heatmap {
    padding: 6px 0 0;
    position: relative;
}

.weather-temp-heatmap-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.air-datepicker.activity-range-datepicker .air-datepicker-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.air-datepicker.activity-range-datepicker .air-datepicker-button.heatmap-range-btn--active-period {
    grid-column: 1 / -1;
}

.weather-wind-controls {
    display: flex;
    justify-content: flex-end;
    margin: 6px 0 10px;
}

.weather-wind-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.weather-wind-toggle--spaced {
    margin-left: 14px;
}

.weather-wind-toggle-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    accent-color: #22c55e;
}

.weather-winddir-matrix {
    padding-top: 6px;
}

.weather-winddir-matrix-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.weather-winddir-matrix-yaxis-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 12px;
    padding-right: 4px;
}

.weather-winddir-matrix-ylabels {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    width: 40px;
    color: #64748b;
    font-size: 12px;
}

.weather-winddir-matrix-ylabels > div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 26px;
    padding-right: 6px;
}

.weather-winddir-matrix-center {
    flex: 1;
    min-width: 0; /* Allow shrinking */
}

.weather-winddir-matrix-grid {
    display: grid;
    gap: 6px;
}

.weather-winddir-matrix-xlabels {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12px;
}

.weather-winddir-matrix-xlabels > div {
    text-align: center;
}

.weather-winddir-axislabels {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    color: #64748b;
    font-size: 12px;
}

.weather-winddir-axislabels-y {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    justify-self: center;
}

.weather-winddir-axislabels-x {
    text-align: center;
}

.weather-winddir-bars {
    display: grid;
    gap: 10px;
}

.weather-winddir-bars-xlabels {
    display: grid;
    gap: 6px;
    color: #64748b;
    font-size: 12px;
}

.weather-winddir-arrow-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-temp-heatmap-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.weather-temp-heatmap-toggle--spaced {
    margin-left: 14px;
}

.weather-foreignobject-center {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.weather-temp-heatmap-toggle-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    accent-color: #22c55e;
}

.weather-temp-heatmap-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.weather-temp-heatmap-center {
    flex: 1;
    overflow-x: auto;
    padding-bottom: 4px;
}

.weather-temp-heatmap-ytitle {
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #64748b;
    transform: rotate(-90deg);
    white-space: nowrap;
}

.weather-temp-heatmap-grid {
    flex: 1;
    display: grid;
    gap: 3px;
}

.weather-temp-heatmap-cell {
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.75);
}

.weather-temp-heatmap-x {
    display: grid;
    gap: 3px;
    margin-top: 10px;
    color: #64748b;
    font-size: 11px;
    text-align: center;
}

.weather-temp-heatmap-y {
    width: 28px;
    display: grid;
    gap: 3px;
    color: #64748b;
    font-size: 11px;
    text-align: right;
    padding: 0 0 0 2px;
}

.weather-temp-heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 11px;
    color: #64748b;
}

.weather-temp-heatmap-gradient {
    display: flex;
    height: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.weather-temp-heatmap-gradient > div {
    width: 34px;
}

.weather-temp-heatmap-gradient-stop--0 { background: #f1f5f9; }
.weather-temp-heatmap-gradient-stop--25 { background: #bde9d2; }
.weather-temp-heatmap-gradient-stop--50 { background: #8addac; }
.weather-temp-heatmap-gradient-stop--75 { background: #56d185; }
.weather-temp-heatmap-gradient-stop--100 { background: #22c55e; }

.weather-temp-info {
    background: rgba(79, 111, 82, 0.10);
    border: 1px solid rgba(79, 111, 82, 0.22);
    border-radius: 16px;
    padding: 14px 16px;
}

.weather-temp-info-title {
    font-size: 13px;
    font-weight: 700;
    color: #1d2a22;
    margin-bottom: 8px;
}

.weather-temp-info-list {
    margin: 0;
    padding-left: 18px;
    color: #2f3d31;
    font-size: 12px;
    display: grid;
    gap: 6px;
}

@media (max-width: 900px) {
    .weather-temp-stats {
        grid-template-columns: 1fr;
    }
    .weather-temp-svg {
        height: 300px;
    }
}

@media (max-width: 767px) {
    .weather-scatter {
        grid-template-columns: 38px 1fr;
        grid-template-rows: 1fr 24px;
        column-gap: 8px;
    }
    .weather-scatter-ylabels,
    .weather-scatter-xlabels {
        font-size: 11px;
    }
}

.trend-chart path {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.trend-chart-area {
    fill-opacity: 0.12;
    stroke: none;
}

.trend-chart-axis {
    stroke: rgba(148, 163, 184, 0.5);
    stroke-width: 1;
}

.trend-chart-zero {
    stroke-dasharray: 4 4;
}

.camera-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(33, 102, 172, 0.9);
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.camera-target-marker {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #ffffff 0 10%, transparent 11% 100%),
        radial-gradient(circle at center, transparent 0 42%, rgba(249, 115, 22, 0.92) 43% 53%, transparent 54% 100%),
        radial-gradient(circle at center, transparent 0 69%, rgba(255, 255, 255, 0.92) 70% 80%, transparent 81% 100%);
    border: 2px solid rgba(249, 115, 22, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
    pointer-events: none;
}

.camera-target-marker span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.camera-marker.moving {
    background: rgba(79, 111, 82, 0.9);
    border-color: #4f6f52;
    box-shadow: 0 2px 8px rgba(79, 111, 82, 0.5);
}

.camera-context-menu {
    position: fixed;
    background: #f7f3ea;
    border: 1px solid #dfd6c6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    min-width: 160px;
    padding: 4px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.camera-context-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: transparent;
    border: none;
    color: #27302a;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.camera-context-menu-item:hover {
    background: #e8e3d8;
}

.camera-context-menu-item:first-child {
    margin-bottom: 4px;
}

.camera-temp-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(33, 102, 172, 0.9);
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.camera-temp-marker-target {
    width: 32px;
    height: 32px;
    position: relative;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-temp-marker-target-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-weight: 800;
    font-size: 11px;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

.camera-temp-marker-target svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.mapbox-container.camera-move-mode {
    cursor: crosshair !important;
}

.mapbox-container.camera-move-mode canvas {
    cursor: crosshair !important;
}

.mapbox-container.camera-move-mode .mapboxgl-canvas-container {
    cursor: crosshair !important;
}

.timeline-map-controls {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.timeline-progress-container {
    position: relative;
    width: 100%;
    height: 8px;
    background: #d7dce2;
    border-radius: 999px;
    cursor: pointer;
    overflow: visible;
    /* Changed from hidden to allow markers to extend outside */
}

.timeline-progress-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(90deg, #31543b 0%, #4f6f52 100%);
    transition: width 0.18s ease-out;
}

.timeline-progress-handle {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #4f6f52;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 3;
    /* Above markers */
}

.timeline-activity-markers-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    /* Above fill, below handle */
}

.timeline-activity-marker {
    position: absolute;
    width: 3px;
    top: -6px;
    bottom: -6px;
    border-radius: 1.5px;
    transform: translateX(-50%);
    opacity: 0.85;
    pointer-events: none;
}

.timeline-map-status {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #475569;
}

.timeline-map-status span {
    line-height: 1.3;
}

.timeline-map-wrapper {
    position: relative;
}

.activity-weather-icons {
    --activity-weather-icon-size: clamp(30px, 3.6vw, 48px);
    --activity-weather-moon-scale: 0.8;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
}

.activity-weather-icons .weather-icon {
    width: var(--activity-weather-icon-size);
    height: var(--activity-weather-icon-size);
    filter: saturate(2.2) contrast(0.85);
}

.activity-weather-icons .moon-phase-container {
    --moon-icon-size: calc(var(--activity-weather-icon-size) * var(--activity-weather-moon-scale));
}

.activity-weather-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--activity-weather-icon-size);
    height: var(--activity-weather-icon-size);
}

.activity-weather-tint {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    background: rgba(0, 0, 0, 0.4);
    transition: opacity 0.25s ease-out;
}

.activity-weather-tint.is-visible {
    opacity: 1;
}

/* Ensure Mapbox elements appear above light cone overlay */
.timeline-map-wrapper .mapboxgl-marker,
.timeline-map-wrapper .mapboxgl-popup,
.timeline-map-wrapper .mapboxgl-ctrl-group,
.timeline-map-wrapper .mapboxgl-ctrl {
    z-index: 5 !important;
}


.timeline-map-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.88);
    color: #6b7280;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    padding: 24px;
}

.timeline-event-marker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.75);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.4);
    backdrop-filter: blur(4px);
    transform: scale(0.92);
    opacity: 0;
    transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}

.timeline-event-marker.show {
    opacity: 1;
    transform: scale(1);
}

.timeline-event-icon {
    position: relative;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-map-activity-marker-root {
    position: relative;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-event-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.timeline-event-icon--activity {
    width: 46px;
    height: 46px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.timeline-event-icon--activity::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 1.0);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
    z-index: 1;
}

.timeline-event-icon--activity.show-icon {
    opacity: 1;
    transform: scale(1);
}

.timeline-event-icon--activity img {
    position: relative;
    z-index: 2;
    width: 88%;
    height: 88%;
}

.timeline-event-count {
    position: absolute;
    top: -18px;
    right: -18px;
    background: #4f6f52;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.35);
    white-space: nowrap;
    z-index: 4;
}

.timeline-event-info {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    color: #0f172a;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.0);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
    font-size: 12px;
    line-height: 1.35;
    min-width: 132px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.38s ease-out, transform 0.18s ease-out;
    z-index: 3;
}

.timeline-event-info.show-tooltip {
    opacity: 1;
    transform: translateY(-50%);
}

.timeline-event-info::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
}

.timeline-event-info--left {
    right: calc(100% + 20px);
}

.timeline-event-info--left::after {
    right: -12px;
    border-width: 8px 0 8px 12px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.7);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}

.timeline-event-info--right {
    left: calc(100% + 20px);
}

.timeline-event-info--right::after {
    left: -12px;
    border-width: 8px 12px 8px 0;
    border-style: solid;
    border-color: transparent rgba(255, 255, 255, 0.7) transparent transparent;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}

.timeline-event-info-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
}

.timeline-event-info-line {
    display: block;
    font-size: 12px;
    opacity: 0.7;
}

.timeline-event-info-line+.timeline-event-info-line {
    margin-top: 2px;
}

.timeline-map-controls .btn {
    min-width: 0;
}

.activity-icon {
    display: inline-block;
    font-size: 18px;
    line-height: 1;
}

.mapboxgl-ctrl-top-left,
.mapboxgl-ctrl-top-right {
    display: none !important;
}

@media (max-width: 900px) and (min-width: 769px) {
    .date-display {
        min-width: 180px;
    }

    .nav-btn {
        padding: 8px 12px;
    }
}

@media (max-width: 1024px) {
    .header-content {
        flex-wrap: wrap;
        gap: 16px;
    }

    .header-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .view-toggle {
        flex: 1 1 260px;
    }

    .view-toggle button {
        flex: 1;
        min-width: 110px;
    }

    .stats-grid {
        display: grid;
        grid-template-columns: repeat(8, minmax(140px, 1fr)); /* Will be overridden by JS */
        gap: 8px;
    }

    .stat-card {
        flex: initial;
        padding: 12px;
        gap: 8px;
    }

    .night-grid {
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
        gap: 18px;
    }
}

@media (max-width: 767px) {
    /* ===== MOBILE HEADER - SINGLE ROW ===== */
    .stat-card {
        gap: 6px;
        min-width: 120px;
    }

    /* Mobile: avoid clamp()-based scaling for date navigation + span controls. */
    .date-navigation {
        padding: 12px;
        gap: 8px;
    }

    .nav-group {
        gap: 8px;
    }

    .date-display {
        font-size: 16px;
        min-width: auto;
    }

    .nav-btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    .span-toggle {
        gap: 6px;
        padding: 4px;
    }

    .span-btn {
        font-size: 13px;
        padding: 6px 12px;
    }

    /* ===== SETTINGS (MOBILE) ===== */
    /* Mobile global CSS makes `.btn` icon-only and hides `.btn-label`.
       For settings (especially Superbruker), we want readable text buttons. */
    #settingsView .settings-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    #settingsView .settings-button .btn-label {
        display: inline !important;
    }

    #settingsView .settings-tab-panel[data-tab="superuser"] .user-management-actions {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 12px;
    }

    #settingsView .settings-tab-panel[data-tab="superuser"] .user-management-actions .btn {
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        padding: 12px 16px;
        justify-content: center;
        gap: 8px;
        height: auto;
    }

    /* Settings → Brukere (area admins): ensure "Opprett ny bruker" isn't shrunk to icon-only sizing on mobile. */
    #settingsView .settings-tab-panel[data-tab="users"] .user-management-actions {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 12px;
    }

    #settingsView .settings-tab-panel[data-tab="users"] .user-management-actions .btn {
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        padding: 12px 16px;
        justify-content: center;
        gap: 8px;
        height: auto;
        white-space: normal;
    }

    #settingsView .settings-tab-panel[data-tab="superuser"] .settings-group--area-filter {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
    }

    #settingsView .settings-tab-panel[data-tab="superuser"] .settings-group--area-filter .settings-select {
        width: 100%;
        min-width: 0;
    }

    #settingsView .user-management-list {
        overflow-x: auto;
    }

    #settingsView .user-management-table th {
        font-size: var(--fs-table-header);
        padding: 8px;
        white-space: nowrap;
    }

    #settingsView .user-management-table td {
        font-size: var(--fs-table-cell);
        padding: 8px;
        word-break: break-word;
    }

    .header {
        padding: 8px 0;
    }

    .header-content {
        padding: 0 10px;
        gap: 8px;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        max-width: 100%;
    }

    .header-left-rail {
        width: auto;
        border-right: none;
        padding-left: 0;
        padding-right: 0;
        gap: 8px;
    }

    .header-main {
        padding-left: 0;
        padding-right: 0;
        gap: 8px;
    }

    .hamburger-menu-btn {
        flex-shrink: 0;
        order: 1;
        width: 32px;
        height: 32px;
    }

    .logo {
        flex-shrink: 1;
        min-width: 0;
        font-size: clamp(14px, 4vw, 18px);
        gap: 6px;
        order: 2;
        overflow: hidden;
        padding-top: 3px;
    }

    .logo-icon {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }

    .logo-icon-img {
        width: 24px;
        height: 24px;
    }

    #areaName {
        font-size: clamp(12px, 3.5vw, 14px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .page-title {
        font-size: clamp(12px, 3.5vw, 14px);
        flex: 1;
        text-align: right;
        padding-right: 0;
        order: 3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        padding-top: 3px;
    }

    .header-controls {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 4px;
        flex-wrap: nowrap;
    }

    /* ===== MOBILE SIDEBAR MENU FIXES ===== */
    .sidebar-menu {
        width: 220px;
        left: -220px;
        z-index: 250;
        transition: left 0.3s ease;
    }

    /* Reduce top padding on mobile - no header to clear */
    .sidebar-menu-content {
        padding-top: 16px;
    }

    .sidebar-menu.open {
        left: 0;
        width: 220px;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Area selector: on mobile it lives inside the sidebar and should slide with it */
    .sidebar-menu .header-area-selector {
        display: block;
        flex: 0 0 auto;
        width: 100%;
        padding: 0 16px;
        margin-bottom: 12px;
    }

    /* Sidebar overlay for mobile - show when menu is open */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 140;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    #appContent.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* Don't push content on mobile - use overlay instead */
    #appContent.sidebar-open .header {
        margin-left: 0;
    }

    #appContent.sidebar-open .container {
        margin-left: 0;
    }

    /* Show button labels in sidebar menu on mobile */
    .sidebar-menu .btn-label,
    .sidebar-menu-btn .btn-label,
    .sidebar-view-toggle .btn-label {
        display: inline !important;
    }

    .sidebar-menu-btn {
        padding: 4px 16px;
    }

    .sidebar-view-toggle .view-toggle-btn {
        padding: 4px 16px !important;
    }

    /* ===== MOBILE MAP VIEW FIXES (Bevegelser & Kart) ===== */
    #activityMapView .mapbox-body {
        padding: 24px;
    }

    #mapboxView .mapbox-body {
        padding: 24px;
    }

    .view-toggle {
        border-radius: 12px;
        overflow: hidden;
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        height: 38px;
    }

    .view-toggle button {
        flex: 1;
        min-width: 0;
        font-size: 12px;
        padding: 0;
        height: 38px;
    }


    /* NOTE: Removed the global "icon-only buttons" mobile override.
       It made all `.btn` 36x36 and hid `.btn-label`, which caused poor UX across the app. */

    /* Hide desktop buttons, show mobile buttons below content */
    .action-buttons-desktop {
        display: none;
    }

    .action-buttons-mobile {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons-wrapper .btn {
        width: 100%;
        min-width: unset;
        flex: 1 1 auto;
        padding: 12px 16px;
        justify-content: flex-start;
        gap: 8px;
    }

    .action-buttons-wrapper .btn-label {
        display: inline !important;
    }

    .action-buttons-wrapper .btn-icon {
        margin-right: 8px;
        width: 20px;
        height: 20px;
    }

    .btn-icon {
        width: 18px;
        height: 18px;
        margin: 0;
    }

    .stats-grid {
        display: grid;
        gap: 6px;
    }

    .action-buttons-container {
        margin-top: 16px;
        margin-bottom: 16px;
    }

    .table-card,
    .list-card {
        padding: 10px;
    }

    .night-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .night-card {
        width: 100%;
    }

    .timeline-hours {
        padding: 0 20px;
    }

    /* Hide every other hour label on mobile to reduce clutter */
    .hour-label:nth-child(odd) {
        visibility: hidden;
    }

    .timeline-track {
        margin: 8px 20px;
    }

    .btn-label {
        display: none;
    }

    /* Always show location button label on mobile so coordinates are visible */
    #killedAnimalsLocationButton {
        flex-wrap: wrap;
        min-height: auto;
        white-space: normal;
        width: 100%;
        justify-content: flex-start;
        padding-left: 16px;
        padding-right: 16px;
    }

    #killedAnimalsLocationButton .btn-label {
        display: inline !important;
        white-space: normal;
        word-break: break-word;
        line-height: 1.3;
        text-align: left;
        padding-left: 10px;
    }

    .btn-icon {
        width: 18px;
        height: 18px;
    }

    .date-navigation {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: center;
    }

    .nav-group {
        justify-content: center;
        flex-wrap: wrap;
    }

    .span-toggle {
        justify-content: center;
    }

    #listTable thead {
        display: none;
    }

    #listTable tbody tr {
        display: flex;
        flex-direction: column;
        background: #fefcf7;
        margin-bottom: 16px;
        border: 1px solid #d7d0c2;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        transition: box-shadow 0.2s ease, transform 0.2s ease;
    }

    #listTable tbody tr:active {
        transform: scale(0.98);
    }

    #listTable tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        border-bottom: 1px solid #e8e3d8;
        font-size: 14px;
    }

    #listTable tbody td:last-child {
        border-bottom: none;
    }

    #listTable tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475649;
        margin-right: 12px;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
    }

    #listTable tbody td.list-table-image {
        position: relative;
        justify-content: center;
        padding: 0 !important;
        background: #f8f6f1;
        border-bottom: 2px solid #d7d0c2;
        width: 100%;
    }

    #listTable tbody td.list-table-image::before {
        display: none;
    }

    #listTable tbody td.list-table-image button.thumbnail-button {
        width: 100%;
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
        padding: 0;
        display: inline-block;
        touch-action: pan-x pan-y pinch-zoom;
    }

    #listTable tbody td.list-table-image .thumbnail {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 60vh;
        display: block;
        object-fit: contain;
        touch-action: pan-x pan-y pinch-zoom;
    }

    /* Row 1: Combine Animal + per-species count/confidence on one line (multi-line rows) */
    #listTable tbody td.list-table-animal {
        font-weight: 600;
        color: #2d3748;
        font-size: 15px;
        border-bottom: 1px solid #e8e3d8;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    #listTable tbody td.list-table-animal .list-multiline-list {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    #listTable tbody td.list-table-animal .list-multiline-item {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
    }

    #listTable tbody td.list-table-animal .list-multiline-right {
        margin-left: auto;
        white-space: nowrap;
        font-weight: 600;
    }

    #listTable tbody td.list-table-animal::before {
        display: none;
    }

    #listTable tbody td.list-table-count {
        display: none;
    }

    #listTable tbody td.list-table-prob {
        display: none;
    }

    /* Row 2: Combine Time and Location */
    #listTable tbody td.list-table-time {
        color: #5e6b63;
        font-size: 13px;
        line-height: 1.4;
        flex: 0 0 auto;
        width: auto;
        border-bottom: none;
        margin-left: auto;
        text-align: right;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    #listTable tbody td.list-table-time::before {
        display: none;
    }

    /* On mobile: hide camera column, show location column with camera+location combined */
    #listTable tbody td.list-table-camera {
        display: none;
    }

    #listTable thead th.list-table-location,
    #listTable tbody td.list-table-location {
        display: flex;
    }

    #listTable tbody td.list-table-location {
        color: #5e6b63;
        white-space: nowrap;
        border-bottom: 1px solid #e8e3d8;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        width: 100%;
        flex: 0 0 100%;
        font-size: 13px;
    }

    #listTable tbody td.list-table-location::before {
        display: none;
    }

    /* On mobile, show location (camera) on left and time on right */
    .list-location-name {
        flex: 0 0 auto;
        text-align: left;
    }

    .list-time-text {
        flex: 0 0 auto;
        margin-left: auto;
        text-align: right;
    }

    /* Other cells take full width */
    #listTable tbody td:not(.list-table-animal):not(.list-table-time):not(.list-table-location):not(.list-table-image) {
        width: 100%;
        flex: 0 0 100%;
    }

    #listTable tbody td.list-table-location {
        color: #5e6b63;
        white-space: nowrap;
    }

    #listTable tbody td.list-table-time {
        color: #5e6b63;
        font-size: 13px;
        line-height: 1.4;
    }

    /* Weather icon with temperature below on mobile - restructured */
    /* Weather row: Weather icon+temp, Moon, Wind arrow+speed, Precipitation - all same icon size */
    #listTable tbody td.list-table-weather-icon {
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        gap: 12px;
        padding: 12px 16px 16px;
        flex-wrap: wrap;
    }

    #listTable tbody td.list-table-weather-icon::before {
        display: none;
    }

    #listTable tbody td.list-table-weather-icon {
        --mobile-weather-icon-row: 48px;
    }

    .weather-mobile-combined {
        display: grid;
        grid-template-rows: var(--mobile-weather-icon-row) auto;
        justify-items: center;
        align-content: start;
        row-gap: 4px;
        flex: 0 1 auto;
        margin-top: -3px;
    }

    .weather-mobile-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        height: var(--mobile-weather-icon-row);
    }

    .weather-mobile-combined .weather-icon {
        width: 42px !important;
        height: 42px !important;
        object-fit: contain;
    }

    .weather-temp-mobile {
        font-size: 13px;
        color: #64748b;
        font-weight: 500;
        line-height: 1.2;
        margin-bottom: 2px;
    }

    /* Hide moon, temperature, precipitation, wind cells on mobile (all combined in weather-icon cell) */
    #listTable tbody td.list-table-moon,
    #listTable tbody td.list-table-weather-temp,
    #listTable tbody td.list-table-weather-precip,
    #listTable tbody td.list-table-weather-wind-speed,
    #listTable tbody td.list-table-weather-wind-gusts {
        display: none;
    }

    /* Mobile weather row sections - individual classes for styling */
    .moon-mobile,
    .weather-mobile,
    .wind-mobile,
    .rain-mobile {
        display: grid;
        grid-template-rows: var(--mobile-weather-icon-row) auto;
        justify-items: center;
        align-content: start;
        row-gap: 4px;
        flex: 0 1 auto;
    }

    .rain-mobile .precip-value {
        font-size: 13px;
        color: #64748b;
        font-weight: 500;
        line-height: 1.2;
        margin-bottom: 2px;
    }

    .weather-mobile-icon .wind__arrow {
        width: 30px !important;
        height: 30px !important;
    }

    .weather-mobile-icon .wind-arrow__arrow {
        width: 30px !important;
        height: 30px !important;
    }

    .weather-mobile-icon .wind-arrow__arrow svg {
        width: 30px !important;
        height: 30px !important;
    }

    .wind-value-mobile {
        font-size: 13px;
        color: #64748b;
        line-height: 1.2;
        margin-top: -1px;
        margin-bottom: 2px;
    }

    /* Moon phase in mobile weather row */
    .moon-mobile .moon-phase-container {
        width: 30px !important;
        height: 30px !important;
        align-self: center;
        margin-top: -2px;
    }

    .moon-mobile .weather-mobile-combined {
        margin-top: 0;
    }

    /* Precipitation in mobile weather row */
    .rain-mobile .precipitation-gauge-svg,
    .rain-mobile .precip-icon {
        width: 48px !important;
        height: 48px !important;
        object-fit: contain;
        align-self: center;
    }

    #listTable tbody tr .no-data {
        text-align: center;
        padding: 24px;
        color: #64748b;
        font-size: 14px;
    }

    /* Kills Table Mobile - EXACT same pattern as listTable details view */
    #killsTable thead {
        display: none;
    }

    #killsTable tbody tr {
        display: flex;
        flex-direction: column;
        background: #fefcf7;
        margin-bottom: 16px;
        border: 1px solid #d7d0c2;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        transition: box-shadow 0.2s ease, transform 0.2s ease;
    }

    #killsTable tbody tr:active {
        transform: scale(0.98);
    }

    #killsTable tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        border-bottom: 1px solid #e8e3d8;
        font-size: 14px;
    }

    #killsTable tbody td:last-child {
        border-bottom: none;
    }

    #killsTable tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475649;
        margin-right: 12px;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
    }

    #killsTable tbody td.list-table-image {
        position: relative;
        justify-content: center;
        padding: 0 !important;
        background: #f8f6f1;
        border-bottom: 2px solid #d7d0c2;
        width: 100%;
    }

    #killsTable tbody td.list-table-image::before {
        display: none;
    }

    #killsTable tbody td.list-table-image button {
        width: 100%;
        border-radius: 0;
        overflow: hidden;
        box-shadow: none;
        padding: 0;
        display: block;
    }

    #killsTable tbody td.list-table-image .thumbnail {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 60vh;
        display: block;
        object-fit: contain;
        touch-action: pan-x pan-y pinch-zoom;
    }

    #killsTable tbody td.list-table-image button {
        touch-action: pan-x pan-y pinch-zoom;
    }

    #listTable tbody td.list-table-image .observation-kill-link {
        top: 0px;
        right: 0px;
    }

    #killsTable tbody td.list-table-image .observation-kill-link {
        position: absolute;
        top: 0px;
        right: 4px;
        left: auto;
        width: auto;
        min-width: auto;
        height: auto;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: none;
    }

    /* Disable hover scale effect on mobile to prevent unwanted zoom */
    #killsTable tbody td.list-table-image .observation-kill-link:hover {
        transform: none;
    }

    /* Mobile: larger icon size for better touch targets */
    #listTable tbody td.list-table-image .observation-kill-link .observation-kill-icon,
    #killsTable tbody td.list-table-image .observation-kill-link .observation-kill-icon {
        width: 30px;
        height: 30px;
    }

    /* Row 1: Species (left) + Date/Time (right) */
    #killsTable tbody td.list-table-animal {
        font-weight: 600;
        color: #2d3748;
        font-size: 15px;
        border-bottom: 1px solid #e8e3d8;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    #killsTable tbody td.list-table-animal::before {
        display: none;
    }

    /* Hide separate date and time cells - they'll be combined in species cell */
    #killsTable tbody tr td.list-table-time[data-label="Dato"],
    #killsTable tbody tr td.list-table-time[data-label="Tid"] {
        display: none;
    }

    /* Row 2: Weight (left) + Gender (right) - EXACT same as list-table-location */
    #killsTable tbody td.list-table-count {
        color: #5e6b63;
        white-space: nowrap;
        border-bottom: 1px solid #e8e3d8;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        width: 100%;
        flex: 0 0 100%;
        font-size: 13px;
    }

    #killsTable tbody td.list-table-count::before {
        display: none;
    }

    /* Hide gender cell - it'll be combined in weight cell */
    #killsTable tbody td.list-table-prob {
        display: none;
    }

    /* Row 3: Shooter (left) + Location (right) - EXACT same as list-table-location */
    #killsTable tbody td.list-table-camera {
        color: #5e6b63;
        white-space: nowrap;
        border-bottom: 1px solid #e8e3d8;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        width: 100%;
        flex: 0 0 100%;
        font-size: 13px;
    }

    #killsTable tbody td.list-table-camera::before {
        display: none;
    }

    /* Hide location cell - it'll be combined in shooter cell */
    #killsTable tbody td.list-table-location {
        display: none;
    }

    /* Hide actions column on mobile */
    #killsTable tbody td.list-table-actions {
        display: none;
    }

    /* Style for label + icon structure in combined cells - separate label and icon */
    /* Keep right-alignment properties while making it a flex container */
    #killsTable tbody td .list-time-text {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
        margin-left: auto;
        text-align: right;
    }

    /* Icon wrapper - separate container for icons, 40px width */
    .kills-icon-wrapper {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    /* Gender icon in mobile kills view - 40px */
    #killsTable tbody td .kills-icon-wrapper img.gender-icon {
        width: 30px;
        height: auto;
        max-height: 30px;
        object-fit: contain;
        display: block;
    }

    /* Location button/icon in mobile kills view - 40px */
    #killsTable tbody td .kills-icon-wrapper .kill-location-button {
        width: 30px;
        max-height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    #killsTable tbody td .kills-icon-wrapper .kill-location-button img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    #killsTable tbody tr .no-data {
        text-align: center;
        padding: 24px;
        color: #64748b;
        font-size: 14px;
    }

    .kills-view-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0;
    }

    .kills-view-header .btn {
        width: auto;
        min-width: auto;
        flex: 0 0 auto;
        flex-shrink: 0;
        justify-content: center;
        padding: 10px 16px;
        white-space: nowrap;
    }

    .kills-pagination {
        padding: 12px 0 0;
        border-top: none;
        justify-content: flex-end;
        gap: 8px;
    }

    .kills-pagination-controls {
        width: auto;
    }

    .kills-pagination-controls .btn {
        flex: 0 0 auto;
        justify-content: center;
        text-align: center;
    }

    .kills-pagination-info {
        width: auto;
        align-items: flex-end;
        text-align: right;
    }

    .map-modal-content {
        padding: 16px;
    }

    #secacamTable_wrapper {
        display: none;
    }

    .table-cards {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

}

@media (max-width: 480px) {
    .stats-grid {
        gap: 6px;
    }

    /* On very small screens, show only every 4th hour (00, 04, 08, 12, 16, 20) */
    .hour-label {
        visibility: hidden;
    }
    .hour-label:nth-child(4n+1) {
        visibility: visible;
    }

    .header-controls {
        flex-wrap: wrap;
    }

    /* On very small screens, sidebar takes more of the screen */
    .sidebar-menu {
        width: 260px;
        left: -260px;
    }

    .sidebar-menu.open {
        width: 260px;
    }

    /* Use overlay approach, don't push content */
    #appContent.sidebar-open .container {
        margin-left: 0;
    }
}

@media (min-width: 769px) {
    #secacamTable_wrapper {
        display: block !important;
    }

    .table-cards {
        display: none !important;
    }
}

.btn-label {
    display: inline;
}

.table-card-item {
    background: #fefefe;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.table-card-top {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
}

.table-card-top .thumbnail-button {
    border: none;
    padding: 0;
    background: none;
    display: inline-block;
    flex-shrink: 0;
    position: relative;
}

.table-card-top img {
    width: 140px;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* Ensure kill icon image doesn't get affected by .table-card-top img rule */
.table-card-top .observation-kill-link .observation-kill-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border: none;
    border-radius: 0;
}

.table-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #475569;
}

.table-card-meta strong {
    font-size: 16px;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.table-card-meta span {
    display: block;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-card-date-time {
    color: #1e293b;
}

/* ===== KILLED ANIMALS REGISTRATION ===== */

#killedAnimalsModal .map-modal-content {
    max-width: 600px;
}

#killedAnimalsForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.killed-animals-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .killed-animals-form-grid {
        grid-template-columns: 1fr;
    }
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row label {
    font-weight: 500;
    color: #27302a;
}

.form-row input,
.form-row select,
.form-row textarea {
    padding: 12px;
    border: 1px solid #dfd6c6;
    border-radius: 8px;
    background: #fbf9f4;
    font-size: 14px;
}

.form-row select {
    accent-color: #4f6f52;
}

/* Date picker styling */
#killedAnimalsDate {
    font-family: inherit;
    color: #27302a;
}

#killedAnimalsDate::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
}

#killedAnimalsDate::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Date and Time picker inputs */
#killedAnimalsDate,
#killedAnimalsTime {
    cursor: pointer;
    background: #fbf9f4;
}

/* Location button specific styling */
#killedAnimalsLocationButton {
    padding-left: 16px;
    padding-right: 16px;
}

#killedAnimalsLocationButton .btn-label {
    padding-left: 10px;
}

/* File input styling */
.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-input-button {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #dfd6c6;
    border-radius: 6px;
    background: #f4f1ea;
    color: #27302a;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.file-input-button:hover {
    background: #e8e3d8;
    border-color: #c9d1c5;
}

.file-input-text {
    color: #6b6b6b;
    font-size: 14px;
    margin-left: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Image source selection modal */
.image-source-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
}

.image-source-modal.hidden {
    display: none;
}

.image-source-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.image-source-content {
    position: relative;
    background: #f7f3ea;
    border-radius: 16px 16px 0 0;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.image-source-content h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #27302a;
    text-align: center;
}

.image-source-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.image-source-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid #dfd6c6;
    border-radius: 8px;
    background: white;
    color: #27302a;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.image-source-button:hover {
    background: #f4f1ea;
    border-color: #c9d1c5;
}

.image-source-icon {
    font-size: 24px;
    width: 32px;
    text-align: center;
}

.image-source-cancel {
    width: 100%;
    padding: 12px;
    border: 1px solid #dfd6c6;
    border-radius: 8px;
    background: white;
    color: #27302a;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.image-source-cancel:hover {
    background: #f4f1ea;
    border-color: #c9d1c5;
}

#killedAnimalsPicture {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #4f6f52;
    box-shadow: 0 0 0 3px rgba(79, 111, 82, 0.1);
}

#killedAnimalsMap {
    border-radius: 8px;
    overflow: hidden;
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin: 0;
}

.image-preview {
    margin-top: 8px;
}

.image-preview-container {
    position: relative;
    display: inline-block;
}

.image-preview img,
.preview-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.observation-link-display {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.observation-link-display #killedAnimalsObservationText {
    flex: 1;
    color: #27302a;
    font-size: 0.9em;
}

.observation-link-display .image-remove-btn {
    position: static;
    flex-shrink: 0;
}

.image-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    padding: 0;
    margin: 0;
}

/* User Management Table */
.user-management-table {
    width: 100%;
    border-collapse: collapse;
    position: relative;
}

.user-management-table thead tr {
    border-bottom: 2px solid #ddd;
    text-align: left;
}

.user-management-table th {
    padding: 10px;
}

.user-management-table tbody tr {
    border-bottom: 1px solid #eee;
}

.user-management-table td {
    padding: 10px;
}

#settingsView .settings-tab-panel[data-tab="users"] .user-management-table td,
#settingsView .settings-tab-panel[data-tab="superuser"] .user-management-table td {
    font-size: 14px;
}

.user-edit-btn {
    margin-right: 5px;
}

.user-management-message {
    text-align: center;
    padding: 20px;
    color: #666;
}

.user-management-error {
    text-align: center;
    padding: 20px;
    color: #d00;
}

.user-management-info {
    color: #666;
}

.area-checkbox-wrapper {
    margin-bottom: 8px;
}

.role-assignment-item {
    margin-bottom: 12px;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.role-assignment-area-label {
    display: block;
    margin-bottom: 6px;
}

.role-checkbox-label {
    margin-right: 12px;
}

.role-checkbox-label.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.probability-text {
    font-size: 13px;
    color: #5e6b63;
}

.type-label-new {
    color: #22c55e;
}

.type-label-manual {
    color: #3b82f6;
}

.type-label-ai {
    color: #94a3b8;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    margin-top: 8px;
}

.form-actions-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-actions-right {
    margin-left: auto;
}

#userManagementDeleteButton {
    margin-left: 0;
}

.btn-primary,
.btn-secondary {
    padding: 12px 12px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #4f6f52;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #3e5741;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 111, 82, 0.25);
}

.btn-primary:disabled {
    background: #9ca3af;
    color: #f3f4f6;
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-secondary {
    background: #f4f1ea;
    color: #27302a;
    border: 1px solid #dfd6c6;
}

.btn-secondary:hover:not(:disabled) {
    background: #e8e3d8;
    border-color: #c9d1c5;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Success Notification */
.success-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5000;
    animation: fadeInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-notification-content {
    background: #4f6f52;
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-weight: 500;
    font-size: 15px;
    border: none;
}

.success-notification.error .success-notification-content {
    background: #dc3545;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.table-card-location {
    color: #334155;
}

/* Kills View Header */
.kills-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 16px;
}

.kills-view-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* Hunter Stats Modal */
.hunter-name-button {
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

.hunter-name-button:hover {
    opacity: 0.7;
}

.hunter-stats-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hunter-stats-content {
    min-height: 200px;
}

.hunter-stats-loading {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.hunter-stats-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.hunter-stat-card {
    min-width: 0;
    gap: 30px;
}

.hunter-stat-card .stat-icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.hunter-stat-card .stat-content {
    gap: 0px;
    flex: 1;
    min-width: 0;
    padding-left: 20px;
}

.hunter-stat-card .stat-value {
    font-size: 28px;
}

.hunter-stat-card .stat-label {
    font-size: 18px;
    font-weight: 600;
}

.hunter-stat-weights {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(79, 111, 82, 0.15);
}

.hunter-weight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    line-height: 1.4;
}

.hunter-weight-label {
    color: #5e6b63;
    font-weight: 500;
}

.hunter-weight-value {
    color: #27302a;
    font-weight: 600;
}

.hunter-stats-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

@media (max-width: 767px) {
    .hunter-stats-controls {
        flex-direction: column;
        gap: 12px;
    }

    .hunter-stats-list {
        grid-template-columns: 1fr;
    }

    .hunter-stat-card {
        min-width: auto;
    }

    .hunter-stat-card .stat-content {
        padding-left: 0px;
    }
}

#hunterStatsModal .map-modal-header h3 {
    font-size: 18px;
}

@media (max-width: 767px) {
    #hunterStatsModal .map-modal-header h3 {
        font-size: 16px;
    }
}

/* Form Helper Text */
.form-helper-text {
    display: block;
    color: #666;
    margin-top: 4px;
}

/* User Management Styles */
.user-management-error {
    margin-bottom: 15px;
}

.user-management-actions {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.settings-group--area-filter {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding-bottom: 0;
    /* Keep normal stacking context; must never overlay app modals (e.g. user management). */
}

.settings-group--area-filter .settings-label {
    margin: 0;
    white-space: nowrap;
}

.settings-group--area-filter .settings-select {
    min-width: 180px;
}

.user-management-list {
    margin-bottom: 20px;
}

/* Keep settings controls accessible even with many rows */
.settings-card .user-management-list {
    max-height: clamp(240px, 45vh, 520px);
    overflow-y: auto;
    padding-right: 4px;
}

/* Mobile: render user lists as cards (Users tab + Superbruker) */
@media (max-width: 767px) {
    #settingsView .user-management-list-controls {
        margin-bottom: 12px;
    }

    #settingsView .user-management-list-controls .btn {
        width: 100%;
        justify-content: center;
    }

    #settingsView .user-management-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #settingsView .user-management-card {
        background: #fefcf7;
        border: 1px solid #d7d0c2;
        border-radius: 12px;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    #settingsView .user-management-card-header {
        display: flex;
        flex-direction: column;
        gap: 2px;
        margin-bottom: 10px;
    }

    #settingsView .user-management-card-name {
        font-size: 15px;
        font-weight: 700;
        color: #2f3a33;
        line-height: 1.2;
        word-break: break-word;
    }

    #settingsView .user-management-card-email {
        font-size: 13px;
        color: #5e6b63;
        word-break: break-word;
    }

    #settingsView .user-management-card-meta {
        display: flex;
        gap: 10px;
        align-items: baseline;
        margin-bottom: 10px;
    }

    #settingsView .user-management-card-meta-label {
        font-size: 12px;
        font-weight: 700;
        color: #475649;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        white-space: nowrap;
    }

    #settingsView .user-management-card-meta-value {
        font-size: 13px;
        color: #2f3a33;
        line-height: 1.3;
        word-break: break-word;
    }

    #settingsView .user-management-card-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #settingsView .user-management-card-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

.user-management-areas {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
}

.user-management-roles {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
}

/* Modal Content Sizes */
.map-modal-content-large {
    max-width: 900px;
    min-width: 600px;
    width: 90vw;
    max-height: 90vh;
}

@media (max-width: 767px) {
    .map-modal-content-large {
        min-width: auto;
        width: 95vw;
    }
}

.map-modal-content-medium {
    max-width: 800px;
    width: 90vw;
}

/* Debug Content */
.debug-content {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Create Area Modal */
.create-area-coordinates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.coordinate-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.coordinate-group label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
}

.coordinate-label {
    font-size: 14px;
    font-weight: 500;
    color: #27302a;
    margin-bottom: 4px;
}

.create-area-country-picker {
    position: relative;
}

.create-area-country-picker input {
    width: 100%;
}

.create-area-country-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1500;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #d7d0c2;
    border-radius: 10px;
    background: #fbf9f4;
    box-shadow: 0 8px 20px rgba(22, 28, 24, 0.14);
}

.create-area-country-picker--open .create-area-country-menu {
    display: block;
}

.create-area-country-option {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    padding: 8px;
    background: transparent;
    color: #27302a;
    cursor: pointer;
    text-align: left;
}

.create-area-country-option:hover,
.create-area-country-option:focus {
    outline: none;
    background: rgba(79, 111, 82, 0.12);
}

.create-area-country-option--empty {
    display: block;
    color: #6b776f;
    cursor: default;
}

.create-area-country-flag {
    width: 18px;
    height: 12px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(39, 48, 42, 0.15);
}

.create-area-country-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.create-area-country-code {
    color: #6b776f;
    font-size: 12px;
}

/* Area Admin form layout */
.settings-group--area-admin-main-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.settings-area-admin-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-area-admin-field .settings-time-input {
    width: 100%;
    min-width: 0;
}

.settings-area-admin-code-email-grid {
    display: contents;
}

.area-admin-value-box {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    width: 100%;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(39, 48, 42, 0.12);
    background: rgba(251, 249, 244, 0.85);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #27302a;
    box-sizing: border-box;
}

.settings-group--area-admin-coordinates-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

/* Area Admin Coordinates */
.area-admin-coordinates {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.area-admin-coordinates--inline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: none;
}

.area-admin-coordinates-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(39, 48, 42, 0.12);
    background: rgba(251, 249, 244, 0.85);
}

.area-admin-coordinates-name {
    font-size: 13px;
    font-weight: 700;
    color: #27302a;
}

.area-admin-coordinates-pair {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    color: #27302a;
    white-space: nowrap;
}

.area-admin-coordinate-value {
    font-variant-numeric: tabular-nums;
}

.area-admin-coordinate-sep {
    margin-right: 6px;
    opacity: 0.6;
}

@media (max-width: 480px) {
    .area-admin-coordinates-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .area-admin-coordinates-pair {
        white-space: normal;
    }
}

@media (max-width: 900px) {
    .settings-group--area-admin-main-row {
        grid-template-columns: 1fr;
    }

    .settings-area-admin-code-email-grid {
        display: contents;
    }

    .area-admin-coordinates--inline {
        grid-template-columns: 1fr;
    }
}

/* Responsive camera display */
.camera-location-text {
    display: none;
}

.camera-number-only {
    display: inline;
}

@media (min-width: 1024px) {
    .camera-location-text {
        display: inline;
    }

    .camera-number-only {
        display: none;
    }
}

/* Tablet: shorten Detaljer headers and center camera values (location is hidden <1024 anyway). */
@media (max-width: 1023px) and (min-width: 768px) {
    /* Header abbreviations */
    #listTable thead th.list-table-count,
    #listTable thead th.list-table-camera,
    #listTable thead th.list-table-weather-precip {
        text-align: center;
        text-transform: none;
    }

    #listTable thead th.list-table-count {
        font-size: 0;
    }
    #listTable thead th.list-table-count::after {
        content: "ANT.";
        font-size: var(--fs-table-header);
        font-weight: 600;
        letter-spacing: 0.5px;
    }

    #listTable thead th.list-table-camera {
        font-size: 0;
    }
    #listTable thead th.list-table-camera::after {
        content: "KAM.";
        font-size: var(--fs-table-header);
        font-weight: 600;
        letter-spacing: 0.5px;
    }

    #listTable thead th.list-table-weather-precip {
        font-size: 0;
    }
    #listTable thead th.list-table-weather-precip::after {
        content: "NEDB";
        font-size: var(--fs-table-header);
        font-weight: 600;
        letter-spacing: 0.5px;
    }

    html[lang="en"] #listTable thead th.list-table-count::after {
        content: "CNT.";
    }

    html[lang="en"] #listTable thead th.list-table-camera::after {
        content: "CAM.";
    }

    html[lang="en"] #listTable thead th.list-table-weather-precip::after {
        content: "PREC.";
    }

    /* Camera column: center values and avoid wasting width */
    #listTable tbody td.list-table-camera {
        text-align: center;
        white-space: nowrap;
    }

    #listTable tbody td.list-table-camera .camera-name-link {
        display: block;
        text-align: center;
    }

    #listTable thead th.list-table-camera,
    #listTable tbody td.list-table-camera {
        width: clamp(76px, 10vw, 120px);
    }
}