html:not(.theme-light) {
    --ice-bg: #0a192f;
    --ice-panel: #10243d;
    --ice-line: #1c3a5a;
    --ice-text: #f4f8fc;
    --ice-muted: #8aa4bc;
    --ice-cyan: #00aeef;
    --ice-blue: #007bff;
    --ice-royal: #0054a6;
    --ice-ok: #3ddc97;
    --ice-warn: #f0b429;
    --ice-alert: #ff5a5f;
    --ice-radius: 16px;
    --ice-sidebar: rgba(10, 25, 47, 0.94);
    --ice-card: rgba(16, 36, 61, 0.92);
    --ice-link-hover: #7ad8f7;
    --ice-on-accent: #041525;
    --ice-wash: radial-gradient(1200px 600px at 8% -8%, #123a5c 0%, transparent 52%),
                radial-gradient(900px 500px at 110% 0%, #06304a 0%, transparent 46%),
                #0a192f;
    --ice-brand-bg: transparent;
    --ice-brand-pad: 0;
}

html.theme-light,
html[data-theme="light"] {
    --ice-bg: #eef4fa;
    --ice-panel: #ffffff;
    --ice-line: #c5d4e3;
    --ice-text: #0a192f;
    --ice-muted: #5a738c;
    --ice-sidebar: #ffffff;
    --ice-card: #ffffff;
    --ice-link-hover: #0054a6;
    --ice-on-accent: #041525;
    --ice-wash: linear-gradient(180deg, #f7fbff 0%, #e4eef6 100%);
    --ice-brand-bg: transparent;
    --ice-brand-pad: 0;
}

html, body {
    background: var(--ice-wash);
    color: var(--ice-text);
    min-height: 100%;
}

body.app-body {
    min-height: 100vh;
}

.ice-shell {
    display: flex;
    min-height: 100vh;
}

.ice-sidebar {
    width: 268px;
    flex-shrink: 0;
    background: var(--ice-sidebar);
    border-right: 1px solid var(--ice-line);
    padding: 1.15rem 1rem;
}

.ice-brand {
    display: block;
    margin-bottom: 1.25rem;
    text-decoration: none;
    background: transparent;
    padding: 0;
}

.ice-brand img.ice-logo {
    display: block;
    width: 100%;
    height: auto;
}

.ice-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--ice-muted);
    text-decoration: none;
    padding: 0.55rem 0.8rem;
    border-radius: 12px;
    margin-bottom: 0.2rem;
}

.ice-nav a:hover,
.ice-nav a.active {
    color: var(--ice-text);
    background: linear-gradient(90deg, rgba(0, 174, 239, 0.22), rgba(0, 84, 166, 0.16));
    box-shadow: 0 0 24px rgba(0, 174, 239, 0.18);
}

.ice-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ice-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.ice-search {
    flex: 1;
    max-width: 520px;
    margin: 0 auto;
    background: var(--ice-panel);
    border: 1px solid var(--ice-line);
    border-radius: 999px;
    color: var(--ice-text);
    padding: 0.55rem 1.1rem;
}

.ice-search:focus {
    outline: none;
    border-color: var(--ice-cyan);
    box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.18);
}

.ice-top-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.ice-unit {
    display: inline-flex;
    border: 1px solid var(--ice-line);
    border-radius: 999px;
    overflow: hidden;
}

.ice-unit button {
    background: transparent;
    color: var(--ice-muted);
    border: 0;
    padding: 0.25rem 0.55rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
}

.ice-unit button.active {
    background: var(--ice-cyan);
    color: var(--ice-on-accent);
}

.ice-bell {
    position: relative;
    color: var(--ice-text);
    text-decoration: none;
}

.ice-bell .badge-dot {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--ice-alert);
    color: #fff;
    border-radius: 999px;
    font-size: 0.65rem;
    padding: 0 5px;
}

.ice-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ice-blue);
    display: grid;
    place-items: center;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}

a.ice-avatar:hover {
    color: #fff;
    filter: brightness(1.08);
}

.ice-content {
    padding: 0 1.5rem 2rem;
}

.ice-content a {
    color: var(--ice-cyan);
}

.ice-content a:hover {
    color: var(--ice-link-hover);
}

.ice-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.ice-chip {
    border: 1px solid var(--ice-line);
    background: transparent;
    color: var(--ice-muted);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    text-decoration: none;
    font-size: 0.85rem;
}

.ice-chip.active,
.ice-chip:hover {
    color: var(--ice-on-accent);
    background: var(--ice-cyan);
    border-color: var(--ice-cyan);
}

.ice-card {
    background: var(--ice-card);
    border: 1px solid var(--ice-line);
    border-radius: var(--ice-radius);
    padding: 1.15rem;
    min-height: 0;
    overflow-x: auto;
}

.ice-card.glow-ok { box-shadow: 0 0 28px rgba(61, 220, 151, 0.12); }
.ice-card.glow-warn { box-shadow: 0 0 28px rgba(240, 180, 41, 0.16); }
.ice-card.glow-alert { box-shadow: 0 0 32px rgba(255, 90, 95, 0.22); }

.ice-card h2, .ice-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
}

.ice-muted { color: var(--ice-muted); }
.ice-ok { color: var(--ice-ok); }
.ice-warn { color: var(--ice-warn); }
.ice-alert { color: var(--ice-alert); }
.ice-cyan { color: var(--ice-cyan); }

.ice-temp {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.ice-stat {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.ice-chart {
    height: 280px;
    position: relative;
}

.ice-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-top: 1rem;
}

.ice-acc > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
}

.ice-acc > summary::-webkit-details-marker {
    display: none;
}

.ice-acc > summary::after {
    content: '+';
    color: var(--ice-muted);
    font-weight: 500;
}

.ice-acc[open] > summary::after {
    content: '–';
}

.ice-acc[open] > summary {
    margin-bottom: 0.85rem;
}

.ice-kind {
    display: inline-block;
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--ice-line);
    color: var(--ice-muted);
}

.ice-kind-alert {
    color: var(--ice-alert);
    border-color: var(--ice-alert);
}

.ice-kind-notify {
    color: var(--ice-warn);
    border-color: var(--ice-warn);
}

.ice-kind-reading {
    color: var(--ice-cyan);
    border-color: var(--ice-cyan);
}

.ice-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.ice-swatch {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 2px;
    margin-right: 0.35rem;
    vertical-align: -1px;
}

.ice-swatch-temp { background: var(--ice-cyan); }
.ice-swatch-high { background: var(--ice-alert); }
.ice-swatch-low { background: var(--ice-cyan); box-shadow: inset 0 0 0 1px var(--ice-cyan); background: transparent; }
.ice-swatch-alert {
    width: 0;
    height: 0;
    border-left: 0.38rem solid transparent;
    border-right: 0.38rem solid transparent;
    border-bottom: 0.65rem solid var(--ice-alert);
    background: transparent;
    border-radius: 0;
}

.ice-table {
    width: 100%;
    color: var(--ice-text);
}

.ice-table th {
    color: var(--ice-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--ice-line);
}

.ice-table td {
    border-bottom: 1px solid var(--ice-line);
    padding: 0.65rem 0.4rem;
}

html:not(.theme-light) { color-scheme: dark; }
html.theme-light { color-scheme: light; }

.form-control, .form-select {
    background: var(--ice-panel);
    border-color: var(--ice-line);
    color: var(--ice-text);
}

.form-control:focus, .form-select:focus {
    background: var(--ice-panel);
    color: var(--ice-text);
    border-color: var(--ice-cyan);
    box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.16);
}

.btn-ice {
    background: linear-gradient(180deg, #00aeef 0%, #0077cc 100%);
    color: #041525;
    border: 0;
    font-weight: 600;
}

.btn-ice:hover { background: linear-gradient(180deg, #3cc6f5 0%, #00aeef 100%); color: #041525; }

.btn-ghost {
    background: transparent;
    color: var(--ice-text);
    border: 1px solid var(--ice-line);
}

.login-wrap {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: min(520px, 100%);
    background: var(--ice-card);
    border: 1px solid var(--ice-line);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 0 48px rgba(0, 174, 239, 0.12);
}

.login-theme {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.login-card .ice-brand {
    margin-bottom: 0.85rem;
}

.form-control::placeholder {
    color: var(--ice-muted);
}

.disclaimer {
    font-size: 0.78rem;
    color: var(--ice-muted);
}

.offcanvas {
    background: var(--ice-bg);
    color: var(--ice-text);
}

.wiz-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wiz-step {
    border: 1px solid var(--ice-line);
    background: transparent;
    color: var(--ice-muted);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
}

.wiz-step.active {
    color: var(--ice-on-accent);
    background: var(--ice-cyan);
    border-color: var(--ice-cyan);
}

.wiz-step.done {
    color: var(--ice-ok);
    border-color: var(--ice-ok);
}

.wiz-step.done.active {
    color: var(--ice-on-accent);
    background: var(--ice-cyan);
    border-color: var(--ice-cyan);
}

.wiz-log {
    max-height: 28rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--ice-muted);
    background: var(--ice-panel);
    border: 1px solid var(--ice-line);
    border-radius: 12px;
    padding: 0.85rem;
}

.wiz-status {
    font-size: 0.9rem;
}

.ice-signal {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    vertical-align: middle;
    line-height: 1;
    color: var(--ice-muted);
}

.ice-signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.ice-signal-bar {
    display: block;
    width: 3px;
    border-radius: 1px;
    background: var(--ice-line);
}

.ice-signal-bar:nth-child(1) { height: 4px; }
.ice-signal-bar:nth-child(2) { height: 7px; }
.ice-signal-bar:nth-child(3) { height: 10px; }
.ice-signal-bar:nth-child(4) { height: 12px; }
.ice-signal-bar:nth-child(5) { height: 14px; }

.ice-signal-bar.on {
    background: currentColor;
}

.ice-signal-ok { color: var(--ice-ok); }
.ice-signal-warn { color: var(--ice-warn); }
.ice-signal-alert { color: var(--ice-alert); }
.ice-signal-muted { color: var(--ice-muted); }

.ice-signal-label {
    font-weight: 600;
}

.ice-signal-sm {
    font-size: 0.85rem;
}

.ice-signal-md {
    font-size: 1.15rem;
    font-weight: 600;
}

.ice-signal-md .ice-signal-bars {
    height: 22px;
    gap: 3px;
}

.ice-signal-md .ice-signal-bar {
    width: 4px;
}

.ice-signal-md .ice-signal-bar:nth-child(1) { height: 6px; }
.ice-signal-md .ice-signal-bar:nth-child(2) { height: 10px; }
.ice-signal-md .ice-signal-bar:nth-child(3) { height: 14px; }
.ice-signal-md .ice-signal-bar:nth-child(4) { height: 18px; }
.ice-signal-md .ice-signal-bar:nth-child(5) { height: 22px; }

.ice-stat-row > [class*="col-"] {
    min-width: 0;
}

@media (max-width: 991.98px) {
    .ice-sidebar { display: none; }
    /* Desktop toolbar and shell disclaimer are replaced by the glass bottom
       nav + its More sheet on phones. */
    .ice-top { display: none; }
    .ice-content > .disclaimer { display: none; }
    .ice-content {
        padding: 1rem 1rem calc(78px + env(safe-area-inset-bottom, 0px));
    }
}

/* =========================================================================
   Mobile "Liquid Glass" bottom navigation + no-scroll device view.
   Ported from GitHub/events go_time_bottom_nav.php (ice- prefix, LogiCool
   theme mapping: html.theme-light = bright glass, dark is the default).
   ========================================================================= */

/* Hidden on desktop; shown under the lg breakpoint. */
.ice-bottom-nav,
.ice-nav-overlay,
.ice-nav-sheet,
.ice-device-mobile { display: none; }

@media (max-width: 991.98px) {
    .ice-device-desktop { display: none; }

    /* ---- Floating glass capsule ---- */
    .ice-bottom-nav {
        position: fixed;
        left: 14px;
        right: 14px;
        bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) - 8px));
        z-index: 1040;
        height: 58px;
        padding: 0 6px;
        display: flex;
        align-items: center;
        justify-content: space-around;
        isolation: isolate;
        background: transparent;
        -webkit-backdrop-filter: saturate(240%) brightness(1.08) contrast(1.1) blur(8px);
        backdrop-filter: saturate(240%) brightness(1.08) contrast(1.1) blur(8px);
        border-radius: 999px;
        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.55),
            0 3px 10px rgba(0, 0, 0, 0.3),
            inset 0 1px 1.5px rgba(255, 255, 255, 0.28),
            inset 0 -8px 18px rgba(255, 255, 255, 0.07);
    }
    .ice-bottom-nav::before {
        content: ""; position: absolute; inset: 0; z-index: -1;
        border-radius: inherit; pointer-events: none;
        background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.14),
            rgba(255, 255, 255, 0.02) 42%,
            rgba(255, 255, 255, 0) 70%);
    }
    .ice-bottom-nav::after {
        content: ""; position: absolute; inset: 0;
        border-radius: inherit; padding: 2px; pointer-events: none;
        background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.55),
            rgba(255, 255, 255, 0.1) 28%,
            rgba(255, 255, 255, 0) 50%,
            rgba(255, 255, 255, 0.12) 72%,
            rgba(255, 255, 255, 0.4));
        -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
        -webkit-mask-composite: xor;
                mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
                mask-composite: exclude;
    }

    /* Light theme -> bright, white-rimmed glass (Events default look). */
    html.theme-light .ice-bottom-nav {
        -webkit-backdrop-filter: saturate(240%) brightness(1.2) contrast(1.1) blur(8px);
        backdrop-filter: saturate(240%) brightness(1.2) contrast(1.1) blur(8px);
        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.18),
            0 3px 10px rgba(0, 0, 0, 0.08),
            inset 0 1px 1.5px rgba(255, 255, 255, 1),
            inset 0 -8px 18px rgba(255, 255, 255, 0.22);
    }
    html.theme-light .ice-bottom-nav::before {
        background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.28),
            rgba(255, 255, 255, 0.03) 38%,
            rgba(255, 255, 255, 0) 65%);
    }
    html.theme-light .ice-bottom-nav::after {
        background: linear-gradient(135deg,
            rgba(255, 255, 255, 1),
            rgba(255, 255, 255, 0.4) 24%,
            rgba(255, 255, 255, 0.05) 48%,
            rgba(255, 255, 255, 0.5) 72%,
            rgba(255, 255, 255, 1));
    }

    @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
        .ice-bottom-nav { background: rgba(20, 34, 54, 0.94); }
        .ice-bottom-nav::before { background: none; }
        html.theme-light .ice-bottom-nav { background: rgba(255, 255, 255, 0.94); }
    }

    .ice-nav-tab {
        display: flex; align-items: center; justify-content: center;
        flex: 1; height: 100%;
        text-decoration: none; color: var(--ice-muted);
        padding: 0; position: relative;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.15s, transform 0.1s ease-out;
        background: none; border: none; cursor: pointer;
        border-radius: 999px;
    }
    .ice-nav-tab:active { transform: scale(0.92); }
    .ice-nav-tab svg { width: 25px; height: 25px; flex-shrink: 0; position: relative; stroke: var(--ice-muted); }
    .ice-nav-tab > span { display: none; }
    .ice-nav-tab.active { color: var(--ice-cyan); }
    .ice-nav-tab.active svg { stroke: var(--ice-cyan); stroke-width: 2.25; }
    .ice-nav-tab.active::before {
        content: ""; position: absolute; z-index: -1;
        width: 46px; height: 40px; border-radius: 14px;
        background: rgba(255, 255, 255, 0.14);
        box-shadow:
            inset 0 1px 1px rgba(255, 255, 255, 0.28),
            inset 0 -3px 8px rgba(255, 255, 255, 0.06),
            0 1px 3px rgba(0, 0, 0, 0.35);
        animation: iceLozengeIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    html.theme-light .ice-nav-tab.active::before {
        background: rgba(255, 255, 255, 0.22);
        box-shadow:
            inset 0 1px 1px rgba(255, 255, 255, 0.95),
            inset 0 -3px 8px rgba(255, 255, 255, 0.25),
            0 1px 3px rgba(0, 0, 0, 0.1);
    }
    .ice-nav-tab .ice-nav-count {
        position: absolute;
        top: 6px;
        right: calc(50% - 22px);
        min-width: 16px; height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--ice-alert);
        color: #fff;
        font-size: 10px; font-weight: 800;
        line-height: 16px; text-align: center;
    }

    /* ---- Bottom sheets (More + Activity) ---- */
    .ice-nav-overlay {
        display: block;
        position: fixed; inset: 0; z-index: 1050;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0; visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
    }
    .ice-nav-overlay.open { opacity: 1; visibility: visible; }

    .ice-nav-sheet {
        display: flex;
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 1051;
        flex-direction: column;
        background: var(--ice-panel);
        border-top: 1px solid var(--ice-line);
        border-radius: 18px 18px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        max-height: min(88dvh, calc(100% - env(safe-area-inset-top, 0px) - 16px));
        overflow: hidden;
        transform: translateY(100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        will-change: transform;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
    }
    .ice-nav-sheet.open { transform: translateY(0); }

    .ice-nav-sheet-handle {
        flex-shrink: 0; width: 100%; height: 22px;
        display: flex; align-items: center; justify-content: center;
    }
    .ice-nav-sheet-handle::after {
        content: ''; width: 36px; height: 4px;
        border-radius: 2px; background: var(--ice-line);
    }
    .ice-nav-sheet-body {
        flex: 1 1 auto; min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 0 0 12px;
    }

    html.ice-sheet-open, body.ice-sheet-open {
        overflow: hidden;
        overscroll-behavior: none;
    }

    .ice-nav-search {
        display: flex; align-items: center; gap: 10px;
        margin: 4px 16px 8px;
        padding: 0 14px;
        background: var(--ice-bg);
        border: 1px solid var(--ice-line);
        border-radius: 999px;
    }
    .ice-nav-search svg { width: 18px; height: 18px; stroke: var(--ice-muted); flex-shrink: 0; }
    .ice-nav-search input {
        flex: 1; border: 0; background: none; color: var(--ice-text);
        padding: 0.6rem 0; font-size: 16px; outline: none;
    }
    .ice-nav-search input::placeholder { color: var(--ice-muted); }

    .ice-nav-sheet-section {
        padding: 10px 20px 4px;
        font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
        text-transform: uppercase; color: var(--ice-muted);
    }
    .ice-nav-sheet-item {
        display: flex; align-items: center; gap: 14px;
        padding: 13px 20px;
        color: var(--ice-text); text-decoration: none;
        font-size: 15px; font-weight: 500;
        border: none; background: none; width: 100%; text-align: left;
        cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .ice-nav-sheet-item:active { background: var(--ice-bg); }
    .ice-nav-sheet-item svg { width: 22px; height: 22px; stroke: var(--ice-muted); flex-shrink: 0; }
    .ice-nav-sheet-item.active { color: var(--ice-cyan); }
    .ice-nav-sheet-item.active svg { stroke: var(--ice-cyan); }
    .ice-nav-sheet-item.danger { color: var(--ice-alert); }
    .ice-nav-sheet-item.danger svg { stroke: var(--ice-alert); }

    .ice-nav-sheet-row {
        display: flex; align-items: center; gap: 14px;
        padding: 11px 20px; font-size: 15px; font-weight: 500;
        color: var(--ice-text);
    }
    .ice-nav-sheet-row svg { width: 22px; height: 22px; stroke: var(--ice-muted); flex-shrink: 0; }
    .ice-nav-sheet-row .ice-nav-unit { margin-left: auto; }

    .ice-nav-sheet-divider {
        height: 1px; background: var(--ice-line);
        margin: 8px 20px;
    }
    .ice-nav-sheet-disclaimer {
        margin: 12px 20px 4px;
        font-size: 0.72rem; line-height: 1.4;
        color: var(--ice-muted);
    }

    /* ---- Activity sheet reuses the nav-sheet chrome ---- */
    .ice-activity-sheet-head {
        display: flex; align-items: baseline; justify-content: space-between;
        gap: 12px; padding: 2px 20px 10px;
        font-weight: 600;
    }
    .ice-activity-sheet-table { padding: 0 16px; }
    .ice-activity-sheet-table .ice-table { font-size: 0.85rem; }
    .ice-activity-sheet-table .ice-pager { padding-bottom: 8px; }

    /* ---- No-scroll device view ---- */
    body.ice-device-page,
    body.ice-device-page .ice-shell,
    body.ice-device-page .ice-main {
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }
    body.ice-device-page .ice-content {
        height: 100dvh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0;
    }

    .ice-device-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.55rem;
        flex: 1 1 auto;
        min-height: 0;
        padding: 0.75rem 1rem calc(80px + env(safe-area-inset-bottom, 0px));
    }

    .ice-dm-head {
        display: flex; align-items: center; gap: 0.6rem;
        flex-shrink: 0;
    }
    .ice-dm-back {
        display: flex; align-items: center; justify-content: center;
        width: 36px; height: 36px; flex-shrink: 0;
        border: 1px solid var(--ice-line); border-radius: 12px;
        color: var(--ice-text); text-decoration: none;
        background: var(--ice-card);
    }
    .ice-dm-back svg { width: 20px; height: 20px; }
    .ice-dm-titles { min-width: 0; flex: 1; }
    .ice-dm-name {
        font-size: 1.05rem; font-weight: 700; line-height: 1.2;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .ice-dm-sub {
        font-size: 0.78rem; line-height: 1.2;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .ice-dm-unit { flex-shrink: 0; }

    .ice-dm-hero {
        flex-shrink: 0;
        background: var(--ice-card);
        border: 1px solid var(--ice-line);
        border-radius: var(--ice-radius);
        padding: 0.7rem 1rem;
        text-align: center;
    }
    .ice-dm-hero-label {
        font-size: 0.72rem; text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    .ice-dm-hero-val {
        font-size: 2.6rem; font-weight: 700; letter-spacing: -0.03em;
        line-height: 1.05;
    }

    .ice-dm-meta {
        display: flex; flex-wrap: wrap; gap: 0.4rem 1rem;
        justify-content: center;
        flex-shrink: 0;
        font-size: 0.85rem;
    }
    .ice-dm-meta .ice-muted { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
    .ice-dm-meta .ice-signal { gap: 0.3rem; }

    .ice-dm-ranges { flex-shrink: 0; margin: 0; justify-content: center; }

    .ice-dm-chart {
        position: relative;
        flex: 0 0 auto;
        height: min(240px, 28dvh);
        min-height: 140px;
        background: var(--ice-card);
        border: 1px solid var(--ice-line);
        border-radius: var(--ice-radius);
        padding: 0.5rem;
        overflow: hidden;
    }
    /* Let Chart.js own the canvas dimensions. It absolutely fills the padded
       box; forcing width/height here breaks its device-pixel-ratio sizing and
       makes the axis labels render huge / overflow. */
    .ice-dm-chart canvas {
        position: absolute;
        inset: 0.5rem;
        display: block;
    }
    .ice-dm-empty {
        position: absolute; inset: 0;
        display: flex; align-items: center; justify-content: center;
        text-align: center; padding: 1rem; font-size: 0.85rem;
    }

    .ice-dm-stats {
        display: grid; grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem; flex-shrink: 0;
        text-align: center;
    }
    .ice-dm-stats > div {
        background: var(--ice-card);
        border: 1px solid var(--ice-line);
        border-radius: 12px;
        padding: 0.45rem 0.3rem;
    }
    .ice-dm-stats .ice-muted { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; }
    .ice-dm-stat { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }

    .ice-dm-activity {
        display: flex; align-items: center; justify-content: space-between;
        gap: 0.75rem; flex-shrink: 0;
        width: 100%;
        background: var(--ice-card);
        border: 1px solid var(--ice-line);
        border-radius: 12px;
        padding: 0.7rem 1rem;
        color: var(--ice-text);
        font-weight: 600;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .ice-dm-activity:active { background: var(--ice-bg); }
    .ice-dm-activity::after {
        content: '›'; color: var(--ice-muted); font-size: 1.2rem; margin-left: auto;
    }
}

@keyframes iceLozengeIn {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: 1; transform: scale(1); }
}
