@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');
/* Base stylesheets */

/* === base/reset.css === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--ground);
    color: var(--text-main);
    max-width: 860px;
    margin: 0 auto;
}

/* Header ==================================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-width: 860px;
    margin: 0 auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 10px 10px 40px;
    gap: 15px;
    background: linear-gradient(to bottom, var(--ground) 65%, transparent);
}

/* Header actions ==================================================== */

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-inline: 10px;
}

.header-actions .lh {
    flex: 1 1 0;
    display: flex;
    justify-content: flex-start;
}

.header-actions .middle {
    flex: 1 1 0;
    display: flex;
    justify-content: center;
}

.header-actions .rh {
    flex: 1 1 0;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

/* ====== */

#patrol-blocks {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Content ==================================================== */

.content {
    display: flex;
    flex-direction: column;
    padding-inline: var(--padding-lg);
    padding-block: var(--padding-lg);
    gap: 40px;
    overflow-y: auto;
    height: 100vh;
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 860px;
    margin: 0 auto;
    min-height: 100px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 0px 10px 40px;
    gap: 10px;
    background: linear-gradient(to top, var(--ground) 1%, transparent);


}

.footer:empty {
    pointer-events: none;
}

/* Header content padding */
.content::before {
    content: '';
    display: block;
    flex-shrink: 0;
    min-height: 100px;
    max-height: 100px;
    /* background: red; */
}

/* Footer content padding */
.content::after {
    content: '';
    display: block;
    flex-shrink: 0;
    min-height: 100px;
    max-height: 100px;
    /* background: red; */
}

@media (min-width: 768px) {
    .header {
        padding: 40px 10px 40px;
    }
    .content {
        /* padding-top: calc(40px + 20px + 100px); */
        /* padding-bottom: 300px; */
    }
}

/* ── Skeleton loading ──────────────────────────────────────────────────────── */

@keyframes skeleton-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--skeleton-base) 25%,
        var(--skeleton-shine) 50%,
        var(--skeleton-base) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

/* === base/tokens.css === */
/* ── Static tokens (never theme-dependent) ───────────────────────────────── */

:root {
    /* Accent Colors */
    --accent-red:   #e03e3e;
    --accent-green: #2cb67d;
    --accent-blue:  #0087DF;
    --accent-white: #ffffff;

    /* Radius */
    --radius-xxs:  8px;
    --radius-xs:   12px;
    --radius-sm:   16px;
    --radius-md:   20px;
    --radius-lg:   24px;
    --radius-xl:   28px;
    --radius-xxl:  36px;
    --radius-full: 50%;

    /* Padding */
    --padding-xs:  4px;
    --padding-sm:  8px;
    --padding-md:  10px;
    --padding-lg:  14px;
    --padding-xl:  28px;
    --padding-xxl: 32px;
}

/* ── Dark tokens ──────────────────────────────────────────────────────────────
   Applied as the default on :root AND as an explicit override so that a user
   who picks Dark while their OS is in light mode wins over the media query.
   ─────────────────────────────────────────────────────────────────────────── */

:root,
html[data-theme="dark"] {
    --overlay-hover:  rgba(255, 255, 255, 0.07);
    --overlay-active: rgba(255, 255, 255, 0.13);
    --ground:                   #000000;
    --ground-elevated:          #090909;
    --surface-lowest:           #0f0f0f;
    --surface-low:              #0e0e0e;
    --surface-high:             #131313;
    --border-main:              #202020;
    --border-subtle:            #181818;
    --text-main:                #f0f0f0;
    --text-subtle:              #a1a1a1;
    --text-placeholder:         #5a5a5a;
    --text-inverse-main:        #000000;
    --text-inverse-subtle:      #111111;
    --text-inverse-placeholder: #222222;
    --accent-amber:             #d98a1a;
    --skeleton-base:            #1a1a1a;
    --skeleton-shine:           #222222;
    --overlay-scrim:            rgba(0, 0, 0, 0.8);
    --overlay-shadow-mobile:    0 -4px 24px rgba(0, 0, 0, 0.2);
    --overlay-shadow-desktop:   0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── Light tokens ─────────────────────────────────────────────────────────────
   The @media block handles Automatic mode; the [data-theme] selector handles
   the explicit override. Their values are identical — this duplication is an
   unavoidable CSS limitation (two different selector types, one block each).
   ─────────────────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: light) {
    :root {
        --overlay-hover:  rgba(0, 0, 0, 0.05);
        --overlay-active: rgba(0, 0, 0, 0.10);
        --ground:                   #f4f4f4;
        --ground-elevated:          #f9f9f9;
        --surface-lowest:           #edebeb;
        --surface-low:              #f9f9f9;
        --surface-high:             #ffffff;
        --border-main:              #ffffff;
        --border-subtle:            rgba(255, 255, 255, 0.6);
        --text-main:                #111111;
        --text-subtle:              #555555;
        --text-placeholder:         #999999;
        --text-inverse-main:        #ffffff;
        --text-inverse-subtle:      #f0f0f0;
        --text-inverse-placeholder: #d0d0d0;
        --accent-amber:             #b8720e;
        --skeleton-base:            #e2e2e2;
        --skeleton-shine:           #ebebeb;
        --overlay-scrim:            rgba(0, 0, 0, 0.35);
        --overlay-shadow-mobile:    0 -4px 24px rgba(255, 255, 255, 0.25);
        --overlay-shadow-desktop:   0 8px 32px rgba(255, 255, 255, 0.2);
    }
}

html[data-theme="light"] {
    --overlay-hover:  rgba(0, 0, 0, 0.05);
    --overlay-active: rgba(0, 0, 0, 0.10);
    --ground:                   #f4f4f4;
    --ground-elevated:          #f9f9f9;
    --surface-lowest:           #edebeb;
    --surface-low:              #f9f9f9;
    --surface-high:             #ffffff;
    --border-main:              #ffffff;
    --border-subtle:            rgba(255, 255, 255, 0.6);
    --text-main:                #111111;
    --text-subtle:              #555555;
    --text-placeholder:         #999999;
    --text-inverse-main:        #ffffff;
    --text-inverse-subtle:      #f0f0f0;
    --text-inverse-placeholder: #d0d0d0;
    --accent-amber:             #b8720e;
    --skeleton-base:            #e2e2e2;
    --skeleton-shine:           #ebebeb;
    --overlay-scrim:            rgba(0, 0, 0, 0.35);
    --overlay-shadow-mobile:    0 -4px 24px rgba(255, 255, 255, 0.25);
    --overlay-shadow-desktop:   0 8px 32px rgba(255, 255, 255, 0.2);
}


/* === base/typography.css === */
:root {
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-med: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;

    --font-weight-regular: 400;
    --font-weight-bold: 500;
    --font-weight-heavy: 600;

    --line-height-sm: 1.2;
    --line-height-md: 1.4;
    --line-height-lg: 1.6;
    --line-height-xl: 1.8;

}

/* headers / titles ================================================== */

.title-small {
    font-size: var(--font-size-med);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-md);
}

.title-large {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-xl);
}

/* body text ================================================== */
.body-regular {
    font-size: var(--font-size-med);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-md);
}

.body-bold {
    font-size: var(--font-size-med);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-md);
}

/* caption text ================================================== */
.caption-regular {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-md);
}

.caption-bold {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-md);
}


/* Material Symbols ================================================== */
/* Make the material symbol look and behave like a clickable link */

.m-icon {
    font-family: 'Material Symbols Outlined';
    font-size: inherit;
    line-height: inherit;
    vertical-align: middle;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-style: normal;
    font-weight: normal;
    font-feature-settings: 'liga';
    display: inline-block;
    color: inherit;
}


/* Components */

/* === components/timeline.css === */
/* ── Matrix wrapper ──────────────────────────────────────────────────────── */

.timeline-matrix {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Single timeline row ─────────────────────────────────────────────────── */

.timeline {
    display: flex;
    flex-direction: row;
    gap: 2px;
    height: 50px;
    /* border-radius: 12px; */
    overflow: hidden;
}

/* Compact route rows — short height lets the existing segment border-radius appear circular */
.timeline.compact {
    height: 20px;
}

/* The segment piece */
.timeline-segment {
    height: 100%;
    width: 100%;
    flex: 1;
    border-radius: 20px;
    transition: background 0.1s ease-in-out, transform 0.1s ease-in-out;
}

/* Segment states */

.timeline-segment.idle {
    /* gray fill */
    background: var(--surface-lowest);
    /* background-color: #fffff08; */
}

.timeline-segment.idle:hover {
    background: var(--surface-high);
    /* transform: translateY(-2px); */
    transform: scaleY(1.05);
}

/* Prediction range */


.timeline-segment.prediction-range {
    /* subtle orange fill */
    background: var(--accent-blue);
    opacity: 0.2;
}

.timeline-segment.prediction-range:hover {
    background: var(--accent-blue);
    opacity: 0.3;
    transform: scaleY(1.05);
}


/* Prediction precise */

.timeline-segment.prediction-precise {
    /* orange fill */
    background: var(--accent-blue);
}

.timeline-segment.prediction-precise:hover {
    background: var(--accent-blue);
    opacity: 0.7;
    transform: scaleY(1.05);
}

/* Captured */


.timeline-segment.captured {
    /* red fill */
    background: var(--accent-blue);
}

.timeline-segment.captured:hover {
    background: var(--accent-blue);
    opacity: 0.7;
    transform: scaleY(1.05);
}


/* Current time indicator */

.timeline-now {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transform: translateX(-50%);
    pointer-events: none;
}

/* Time labels */

.time-labels {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    padding-inline: var(--padding-xs);
    p {
        font-size: var(--font-size-sm);
        font-weight: var(--font-weight-regular);
        line-height: var(--line-height-lg);
        color: var(--text-placeholder);
    }
}

/* === components/sighting-card.css === */
.sighting-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: var(--padding-md);
    background: var(--surface-high);
    border-radius: var(--radius-lg);
    /* border: 1px solid var(--border-subtle); */
    width: 100%;
    /* aspect-ratio: 16 / 9; */
    height: 200px;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.1s ease-in-out;
}

.sighting-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--border-main) 50%, transparent);
    pointer-events: none;
    z-index: 10;
}

.sighting-card-map {
    position: absolute;
    inset: 0;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

}

/* ======= */


.sighting-card-content {
    position: relative;
    width: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    background: linear-gradient(to top, var(--surface-high), var(--surface-high) 50%, transparent);
    padding: var(--padding-lg);
    gap: var(--padding-md);
}

.sighting-card-info {
    display: flex;
    flex-direction: column;
    gap: var(--padding-xs);
    .time {
        font-size: var(--font-size-md);
        font-weight: var(--font-weight-regular);
        color: var(--text-main);
    }
    .summary {
        font-size: var(--font-size-sm);
        font-weight: var(--font-weight-regular);
        color: var(--text-subtle);
    }
}


.sighting-card-thumbnail {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    width: 70px;
    min-height: 70px;
    height: 70px;
    font-size: 40px;
    display: none;
    /* Icon  */
    font-weight: var(--font-weight-regular);
    color: var(--text-subtle);

    /* Frame */
    background: var(--surface-low);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);

    /* Image */
    img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
} 

/* === components/button.css === */
/* ── Base ──────────────────────────────────────────────────────────────── */

.button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--padding-sm);

    /* Mobile-first: 44px min touch target */
    min-height: 44px;
    padding: 0 var(--padding-lg);

    font-size: var(--font-size-med);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;

    border-radius: 50px;
    border: 1px solid transparent;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;

    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

    transform: scale(1);
    transition:
        background   0.30s ease,
        color        0.30s ease,
        border-color 0.30s ease,
        box-shadow   0.30s ease,
        opacity      0.30s ease,
        transform    0.30s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Avatar (replaces icon in icon-only buttons) ────────────────────────── */

.header-settings-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    pointer-events: none;
}

/* ── Icons ─────────────────────────────────────────────────────────────── */

.button .m-icon {
    font-size: 22px;
    flex-shrink: 0;
    pointer-events: none;
}

/* ── Icon-only ─────────────────────────────────────────────────────────── */

.button.icon-only {
    padding: 0;
    width: 44px;
    min-width: 44px;
}

.button.icon-only .m-icon {
    font-size: 22px;
}

/* ── Disabled ──────────────────────────────────────────────────────────── */

.button:disabled,
.button.disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Loading ───────────────────────────────────────────────────────────── */
/*
    Spinner is injected as .button-spinner via JS.
    Children are made invisible (but still occupy space) to hold the button width.
*/

.button.loading {
    cursor: not-allowed;
    pointer-events: none;
}

.button.loading > :not(.button-spinner) {
    visibility: hidden;
}

.button-spinner {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    border: 2px solid currentColor;
    border-top-color: transparent;
    opacity: 0.7;
    animation: _button-spin 0.55s linear infinite;
    pointer-events: none;
}

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


/* ════════════════════════════════════════════════════════════════════════
   PRIMARY  (surface fill → blue text)
   ════════════════════════════════════════════════════════════════════════ */

.button.primary {
    background: color-mix(in srgb, var(--surface-high) 70%, transparent);
    backdrop-filter: blur(5px);
    border-color: var(--border-main);
    color: var(--accent-blue);
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.08);
}

.button.primary:hover {
    background: var(--surface-low);
}

.button.primary:not(.plain):not(.outlined):active,
.button.primary:not(.plain):not(.outlined).is-pressed {
    background: var(--ground-elevated);
    transform: scale(1.1);
}

/* primary · outlined */

.button.primary.outlined {
    background: transparent;
    border-color: var(--accent-white);
    color: var(--accent-white);
    box-shadow: none;
}

.button.primary.outlined:hover {
    background: var(--overlay-hover);
}

.button.primary.outlined:active {
    background: var(--overlay-active);
}

/* primary · plain */

.button.primary.plain {
    background: transparent;
    border-color: transparent;
    color: var(--accent-white);
    box-shadow: none;
}

.button.primary.plain:hover {
    background: var(--overlay-hover);
}

.button.primary.plain:active {
    background: var(--overlay-active);
}


/* ════════════════════════════════════════════════════════════════════════
   SECONDARY  (surface fill → main text)
   ════════════════════════════════════════════════════════════════════════ */

.button.secondary {
    background: color-mix(in srgb, var(--surface-high) 70%, transparent);
    border-color: var(--border-main);
    color: var(--text-main);
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.08);
}

.button.secondary:hover {
    background: var(--surface-low);
}

.button.secondary:not(.plain):not(.outlined):active,
.button.secondary:not(.plain):not(.outlined).is-pressed {
    background: var(--ground-elevated);
    transform: scale(1.1);
}

/* secondary · outlined */

.button.secondary.outlined {
    background: transparent;
    border-color: var(--border-main);
    color: var(--text-main);
    box-shadow: none;
}

.button.secondary.outlined:hover {
    background: var(--overlay-hover);
}

.button.secondary.outlined:active {
    background: var(--overlay-active);
}

/* secondary · plain */

.button.secondary.plain {
    background: transparent;
    border-color: transparent;
    color: var(--text-subtle);
    box-shadow: none;
}

.button.secondary.plain:hover {
    background: var(--overlay-hover);
    color: var(--text-main);
}

.button.secondary.plain:active {
    background: var(--overlay-active);
    color: var(--text-main);
}


/* ════════════════════════════════════════════════════════════════════════
   DANGER  (surface fill → red text)
   ════════════════════════════════════════════════════════════════════════ */

.button.danger {
    background: color-mix(in srgb, var(--surface-high) 70%, transparent);
    border-color: var(--border-main);
    color: var(--accent-red);
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.08);
}

.button.danger:hover {
    background: var(--surface-low);
}

.button.danger:not(.plain):not(.outlined):active,
.button.danger:not(.plain):not(.outlined).is-pressed {
    background: var(--ground-elevated);
    transform: scale(1.1);
}

/* danger · outlined */

.button.danger.outlined {
    background: transparent;
    border-color: var(--accent-red);
    color: var(--accent-red);
    box-shadow: none;
}

.button.danger.outlined:hover {
    background: rgba(224, 62, 62, 0.10);
}

.button.danger.outlined:active {
    background: rgba(224, 62, 62, 0.18);
}

/* danger · plain */

.button.danger.plain {
    background: transparent;
    border-color: transparent;
    color: var(--accent-red);
    box-shadow: none;
}

.button.danger.plain:hover {
    background: rgba(224, 62, 62, 0.10);
}

.button.danger.plain:active {
    background: rgba(224, 62, 62, 0.18);
}




/* === components/calendar.css === */
.calendar {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    position: relative;
}

.calendar-track {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    &::-webkit-scrollbar {
        display: none;
    }

    & > * {
        scroll-snap-align: center;
    }
}

.calendar-edge-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        var(--ground) 0%,
        transparent 20%,
        transparent 80%,
        var(--ground) 100%
    );
    z-index: 1;
    pointer-events: none;
    /* opacity: 0; */
}

/* The options */

.calendar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 50px;
    min-width: 40px;
    border-radius: 12px;
    padding: 6px 2px;
    opacity: 0.8;
    color: var(--text);
    text-align: center;
    cursor: pointer;
}

.calendar-day-num {
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.calendar-day-name {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
    line-height: 1;
}

.calendar-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.calendar-dot--sighting {
    background: var(--accent-blue);
}

.calendar-option.selected .calendar-dot--sighting {
    background: currentColor;
    opacity: 0.5;
}


/* Type variations */


.calendar-option.today {
    opacity: 1;

    .calendar-day-num {
        color: var(--accent-blue);
    }
}

.calendar-option.upcoming {
    opacity: 0.3;
}

.calendar-option.previous {
    opacity: 0.5;
}

/* Selection states */

.calendar-option.selected {
    background: var(--text-main);
    color: var(--text-inverse-main);
    opacity: 1;
    font-weight: 700;

    .calendar-day-num {
        color: inherit;
    }
}

.calendar-option.today.selected {
    background: var(--accent-blue);
    color: var(--accent-white);
    opacity: 1;
    font-weight: 700;

    .calendar-day-num {
        color: inherit;
    }
}


/* === components/list-card.css === */
.list-card {
    display: flex;
    align-items: center;
    /* gap: var(--padding-md); */
    background: var(--surface-high);
    border-radius: var(--radius-xxl);
    padding: var(--padding-md);
    /* border: 1px solid var(--border-main); */
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.1s ease-in-out;
}

.list-card-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    font-size: 20px;
    font-weight: var(--font-weight-regular);
    color: var(--text-subtle);
    border-radius: var(--radius-full);
    /* border: 1px solid var(--border-subtle); */
    background: var(--surface-low);
}

.list-card-body {
    display: flex;
    flex-direction: column;
    margin-left: var(--padding-md);
    gap: 0px;
    flex: 1;
    min-width: 0;
}

.list-card-label {
    font-size: var(--font-size-med);
    font-weight: var(--font-weight-bold);
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-card-sub {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-regular);
    color: var(--text-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* RH elements ------------------------------------------------------------ */

.list-card-rh {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--padding-sm);
    padding-inline: var(--padding-sm);
    flex-shrink: 0;
}

/* Chevron */

.list-card-chevron {
    font-size: 20px;
    color: var(--text-placeholder);
}

/* Checkmark */

.list-card-check {
    font-size: 20px;
    color: var(--accent-blue);
    transition: opacity 0.15s;
}
/* Coming soon badge  */

.list-card-coming-soon {
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    color: var(--text-placeholder);
    background: var(--surface-low);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 3px 8px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── Static (non-interactive) variant ───────────────────────────── */

.list-card.static {
    cursor: default;
    pointer-events: none;
}

/* === components/block.css === */
.block {
    display: flex;
    flex-direction: column;
    gap: var(--padding-md);
}

.block-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-lg);
    color: var(--text-subtle);
    padding-inline: var(--padding-xs);
}

/* === components/overlay.css === */
/* Underlay — base page scales behind open overlays ======================== */
/*                                                                            */
/* --overlay-depth is set on body by overlay-handler.js.                     */
/* It represents the number of open overlays (capped at 3 for CSS math).     */

.header,
.content {
    transform-origin: top center;
    transform: scale(calc(1 - clamp(0, var(--overlay-depth, 0), 3) * 0.04));
    opacity: calc(1 - clamp(0, var(--overlay-depth, 0), 1) * 0.60);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity   0.5s cubic-bezier(0.16, 1, 0.3, 1);
}


/* Base styles shared across all breakpoints ================================ */

.overlay-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    visibility: hidden;
}

.overlay-container.is-open,
.overlay-container.is-closing {
    pointer-events: auto;
    visibility: visible;
}


/* Overlay panel ============================================================ */
/*                                                                            */
/* --stack-depth is set per-overlay by overlay-handler.js.                   */
/* 0 = topmost (active), 1 = one behind, 2 = two behind, etc.                */
/* The CSS uses translate for enter/exit animation and transform for depth.   */
/* They compose independently, keeping the pull-to-close gesture clean.      */

.overlay {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: var(--ground-elevated);
    overflow: hidden;
    transform-origin: top center;
    transform: scale(calc(1 - clamp(0, var(--stack-depth, 0), 3) * 0.04))
               translateY(calc(clamp(0, var(--stack-depth, 0), 1) * -10px));
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                translate 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity   0.5s cubic-bezier(0.16, 1, 0.3, 1);
}


/* Header =================================================================== */

.overlay-title {
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.overlay-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 20px;
    padding-top: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    background: linear-gradient(to bottom, var(--ground-elevated) 50%, transparent);
}

.overlay-header .lh {
    flex: 1 1 0;
    display: flex;
    justify-content: flex-start;
    gap: var(--padding-sm);
}

.overlay-header .middle {
    flex: 1 1 0;
    display: flex;
    justify-content: center;
    gap: var(--padding-sm);
}

.overlay-header .rh {
    flex: 1 1 0;
    display: flex;
    justify-content: flex-end;
    gap: var(--padding-sm);
}


/* Content ================================================================== */

.overlay-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-inline: var(--padding-lg);
    /* padding-bottom: 200px; */
    /* padding-top: calc(30px + 30px + 25px); */
    gap: var(--padding-xl);
}

/* Header content padding */
.overlay-content::before {
    content: '';
    display: block;
    flex-shrink: 0;
    min-height: 80px;
    max-height: 80px;
    /* background: red; */
}

/* Footer content padding */
.overlay-content::after {
    content: '';
    display: block;
    flex-shrink: 0;
    min-height: 100px;
    max-height: 100px;
    /* background: red; */
}


/* Footer =================================================================== */

.overlay-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    padding-inline: var(--padding-md);
    padding-bottom: var(--padding-sm);
    padding-top: var(--padding-xl);
    gap: var(--padding-sm);
    background: linear-gradient(to top, var(--ground) 1%, transparent);
}

.overlay-footer:empty {
    pointer-events: none;
}


/* Mobile — bottom sheet ==================================================== */

.overlay-handle {
    display: none;
}

@media (max-width: 767px) {
    .overlay-handle {
        display: block;
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--border-main);
        pointer-events: none;
        z-index: 10;
    }

    .overlay {
        top: 14px;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 40px 40px 0 0;
        border-bottom: none;
        border-top: 1px solid var(--border-main);
        box-shadow: var(--overlay-shadow-mobile, 0 -4px 24px rgba(0, 0, 0, 0.2));
        translate: 0 100%; /* closed */
    }

    .overlay-container.is-open .overlay {
        translate: 0 0;
    }

    .overlay-container.is-closing .overlay {
        translate: 0 100%;
    }
}


/* Desktop — centered modal ================================================= */

@media (min-width: 768px) {
    .overlay-container {
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        transition: background 0.25s ease;
    }

    /* Only the topmost container shows the scrim */
    .overlay-container.is-open.has-backdrop {
        background: var(--overlay-scrim, rgba(0, 0, 0, 0.8));
    }

    .overlay {
        position: relative;
        top: unset;
        left: unset;
        right: unset;
        bottom: unset;
        width: 800px;
        height: 90vh;
        max-height: 90vh;
        border-radius: 30px;
        border: 1px solid var(--border-main);
        box-shadow: var(--overlay-shadow-desktop, 0 8px 32px rgba(0, 0, 0, 0.5));
        translate: 0 8px; /* closed — slight offset */
        opacity: 0;
    }

    .overlay-header {
        padding: 30px;
        padding-top: 25px;
    }

    .overlay-content {
        padding-inline: var(--padding-xl);
        /* padding-bottom: 110px; */
        /* padding-top: calc(30px + 30px + 30px); */
    }

    .overlay-footer {
        padding-inline: var(--padding-xl);
        padding-bottom: var(--padding-xl);
        padding-top: var(--padding-xl);
        background: linear-gradient(to top, var(--ground-elevated) 20%, transparent);
    }

    .overlay-container.is-open .overlay {
        translate: 0 0;
        opacity: 1;
    }

    .overlay-container.is-closing .overlay {
        translate: 0 8px;
        opacity: 0;
    }
}


/* === components/playback-card.css === */
/* ── Playback card — full-bleed media viewer with controls overlay ────────── */
/* Hosts two switchable layers: map (.playback-card-map) and                  */
/* capture image (.playback-card-image). Switching is driven by               */
/* data-mode="map" | "capture" on the card element.                           */

.playback-card {
    position: relative;
    overflow: clip; /* clip not hidden — hidden breaks aspect-ratio on flex items */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: var(--surface-lowest);
    border-radius: var(--radius-lg);
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 350px;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.1s ease-in-out;
}

.playback-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--border-main) 50%, transparent);
    pointer-events: none;
    z-index: 10;
}

/* ── Map layer ───────────────────────────────────────────────────────────── */

.playback-card-map {
    position: absolute;
    inset: 0;
    opacity: 1;
    transition: opacity 0.25s ease;
    background: var(--surface-lowest);

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

.playback-card[data-mode="capture"] .playback-card-map {
    opacity: 0;
    pointer-events: none; /* keep WebGL context alive — never display:none */
}

/* ── Camera marker ───────────────────────────────────────────────────────── */

.map-cam-marker {
    cursor: default;
    pointer-events: none;
}

/* Shared bubble styles */
.map-cam-marker-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-high);
    border: 2.5px solid #fff;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .m-icon {
        color: var(--text-main);
        cursor: default;
    }
}

/* ── Floating pin (single sighting overlay) ──────────────────────────────── */

.map-cam-marker.floating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Bubble + triangle tail rendered together so drop-shadow follows the shape */
.map-cam-marker.floating .map-cam-marker-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.6));
}

.map-cam-marker.floating .map-cam-marker-bubble {
    width: 56px;
    height: 56px;

    .m-icon { font-size: 24px; }
}

.map-cam-marker.floating .map-cam-marker-pin::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid #fff;
    margin-top: -2px;
}

.map-cam-marker-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

/* ── Flat pin (dashboard thumbnail cards) ────────────────────────────────── */

.map-cam-marker.flat .map-cam-marker-bubble {
    width: 32px;
    height: 32px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);

    .m-icon { font-size: 16px; }
}

/* ── Zone marker (parking overlay) ───────────────────────────────────────── */
/* Small dot at the resolved street intersection anchoring the highlighted    */
/* zone segment. Pure visual cue — no interactivity.                          */

.map-zone-marker {
    pointer-events: none;
}

.map-zone-marker-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #0087df;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

/* ── Image layer (capture mode) ──────────────────────────────────────────── */

.playback-card-image {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: opacity 0.35s ease;
    }
}

.playback-card[data-mode="capture"] .playback-card-image {
    opacity: 1;
    pointer-events: auto;
}

/* ── Controls overlay ────────────────────────────────────────────────────── */

.playback-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    background: linear-gradient(to top, var(--surface-low), var(--surface-low) 10%, transparent);
    padding: var(--padding-md);
    gap: var(--padding-md);
}


/* === components/feed-card.css === */
.feed-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: var(--surface-high);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-main);
    width: 100%;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    box-sizing: border-box;
}

.feed-card-stream {
    position: absolute;
    inset: 0;

    img, video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* ── Draw mode — used for zone / blur setup ──────────────────────────────── */

.feed-card.draw {
    height: auto;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
}

.feed-card.draw .feed-card-stream img {
    object-fit: cover;
    opacity: 0.7;
}

.feed-card.draw .feed-card-stream canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 1;
}

/* ======= */

.feed-card-content {
    position: relative;
    width: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: linear-gradient(to top, var(--surface-high), var(--surface-high) 10%, transparent);
    padding: var(--padding-md);
    gap: var(--padding-md);
}

/* ── Live badge ────────────────────────────────────────────── */

.feed-card-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--accent-red);
    border-radius: 99px;
    padding: 4px 10px 4px 8px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-heavy);
    color: #ffffff;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.feed-card-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
    flex-shrink: 0;
    animation: _live-pulse 1.5s ease-in-out infinite;
}

@keyframes _live-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

/* ── Offline state ─────────────────────────────────────────── */

.feed-card-offline {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--padding-sm);
    color: var(--text-placeholder);

    .m-icon {
        font-size: 32px;
    }

    p {
        font-size: var(--font-size-sm);
        font-weight: var(--font-weight-regular);
    }
}


/* === components/config-card.css === */
/* ── Config card — editable zone / region cards ──────────────────────────── */

.config-card {
    display: flex;
    flex-direction: column;
    gap: var(--padding-sm);
    background: var(--surface-high);
    border-radius: var(--radius-md);
    /* border: 1px solid var(--border-main); */
    padding: var(--padding-lg);
    width: 100%;
    box-sizing: border-box;
}

.config-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
}

.config-card-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--text-subtle);
    padding-inline: 2px;
}

.config-card-fields {
    display: flex;
    flex-direction: column;
    gap: var(--padding-sm);
}

.config-card-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.config-card-field-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--text-placeholder);
    padding-inline: 2px;
}

.config-card-input {
    width: 100%;
    background: var(--surface-low);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: var(--font-size-med);
    padding: 8px var(--padding-md);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s ease;
    -webkit-appearance: none;
}

.config-card-input::placeholder {
    color: var(--text-placeholder);
}

.config-card-input:focus {
    border-color: var(--border-main);
}

select.config-card-input {
    cursor: pointer;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23888888' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ── Colour dot (used for zone identity) ────────────────────────────────── */

.config-card-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Two-column row (e.g. lat / lng) ─────────────────────────────────────── */

.config-card-row {
    display: flex;
    gap: var(--padding-sm);
}

.config-card-row .config-card-field {
    flex: 1;
    min-width: 0;
}

/* ── Toggle row (label + sub on left, toggle on right) ───────────────────── */

.config-card-toggle-row {
    display: flex;
    align-items: center;
    gap: var(--padding-md);
}

.config-card-toggle-row .config-card-field {
    flex: 1;
    min-width: 0;
}

/* ── Divider between rows ─────────────────────────────────────────────────── */

.config-card-divider {
    height: 1px;
    background: var(--border-subtle);
}

/* ── Read-only info row (label left, value right) ────────────────────────── */

.config-card-info-row {
    display: flex;
    align-items: center;
    gap: var(--padding-md);
    min-height: 32px;
}

.config-card-info-row .config-card-field-label {
    flex: 1;
}

.config-card-info-value {
    font-size: var(--font-size-sm);
    color: var(--text-main);
    text-align: right;
}

.config-card-info-value.muted {
    color: var(--text-placeholder);
}


/* === components/segment-control.css === */
/* ── Segment control ────────────────────────────────────────────────────── */

.segment-control {
    display: inline-flex;
    align-items: center;
    /* background: var(--ground-elevated);
    border: 1px solid var(--border-subtle); */
    background: color-mix(in srgb, var(--ground-elevated) 70%, transparent);
    backdrop-filter: blur(5px);
    border: 1px solid;
    border-color: var(--border-subtle);
    border-radius: 50px;
    padding: 3px;
    gap: 2px;
}

/* Compensate for 3px track padding (top + bottom = 6px) so overall
   segment control height stays at the standard 44px touch target */
.segment-control .button {
    min-height: calc(44px - 6px);
    padding-inline: var(--padding-md);
}

.segment-control .button.icon-only {
    width: calc(44px - 6px);
    min-width: calc(44px - 6px);
    padding: 0; /* preserve icon-only zero padding */
}

/* Stretch to fill parent when needed */
.segment-control.full-width {
    display: flex;
}

.segment-control.full-width .button {
    flex: 1;
}


/* === components/button-group.css === */
/* ── Button group ────────────────────────────────────────────────────────── */
/*
    A row of independent action buttons sharing one pill-shaped container frame.
    Unlike the segment control, there is no active/selection state — each button
    is its own action. All inner buttons are always plain (text-only) so the
    outer frame is the sole visual anchor.
*/

.button-group {
    display: inline-flex;
    align-items: center;
    background: color-mix(in srgb, var(--surface-high) 70%, transparent);
    border: 1px solid var(--border-main);
    border-radius: 50px;
    padding: 3px;
    gap: 1px;
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.05);
    transform: scale(1);
    transition: transform 0.30s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.button-group:has(.button:active),
.button-group:has(.button.is-pressed) {
    transform: scale(1.05);
}

/* Divider between adjacent buttons */
.button-group .button + .button::before {
    content: '';
    position: absolute;
    left: -1px;
    transform: translateX(-50%);
    top: 30%;
    height: 40%;
    width: 1px;
    background: var(--border-main);
    box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.05);
    pointer-events: none;
}

/* Compensate for 3px track padding (top + bottom = 6px) so overall
   button group height stays at the standard 44px touch target */
.button-group .button {
    min-height: calc(44px - 6px);
    padding-inline: var(--padding-md);
    box-shadow: none;
}

.button-group .button.icon-only {
    /* width: calc(44px - 6px);
    min-width: calc(44px - 6px); */
    width: calc(48px - 6px);
    min-width: calc(48px - 6px);
    padding: 0;
}

/* Stretch to fill parent when needed */
.button-group.full-width {
    display: flex;
}

.button-group.full-width .button {
    flex: 1;
}


/* === components/toggle.css === */
/* ── Toggle switch ───────────────────────────────────────────────────────── */

.toggle {
    position: relative;
    width: 44px;
    height: 26px;
    border-radius: 13px;
    flex-shrink: 0;
    cursor: pointer;
    background: var(--border-main);
    transition: background 0.2s ease;
}

.toggle.on {
    background: var(--accent-blue);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: left 0.2s ease;
}

.toggle.on .toggle-thumb {
    left: 21px;
}


/* === components/status-flare.css === */
/* Status flare — small coloured dot used to indicate live state.
 *
 * Usage:
 *   <span class="status-flare"></span>               default (muted)
 *   <span class="status-flare is-active"></span>     blue + pulse
 *   <span class="status-flare is-live"></span>       green + pulse
 *   <span class="status-flare is-warn"></span>       amber (no pulse)
 *   <span class="status-flare is-off"></span>        red (no pulse)
 */

.status-flare {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-subtle);
    transition: background 0.2s ease;
}

/* ── Active (blue, pulsing) ─────────────────────────────────────────────── */

.status-flare.is-active {
    background: var(--accent-blue);
    animation: _flare-pulse-blue 1.8s ease-in-out infinite;
}

@keyframes _flare-pulse-blue {
    0%, 100% { box-shadow: 0 0 0 0   rgba(59, 130, 246, 0.5); }
    50%       { box-shadow: 0 0 0 5px rgba(59, 130, 246, 0);   }
}

/* ── Live (green, pulsing) ──────────────────────────────────────────────── */

.status-flare.is-live {
    background: var(--accent-green, #22c55e);
    animation: _flare-pulse-green 1.8s ease-in-out infinite;
}

@keyframes _flare-pulse-green {
    0%, 100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.5); }
    50%       { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0);   }
}

/* ── Warn (amber, static) ───────────────────────────────────────────────── */

.status-flare.is-warn {
    background: var(--accent-yellow, #eab308);
}

/* ── Off (red, static) ──────────────────────────────────────────────────── */

.status-flare.is-off {
    background: var(--accent-red);
}



