/* Nurify Monitor — clean light theme with a fixed sidebar.
   Bootstrap 5 itself is loaded via CDN in the layout <head> — see
   resources/views/layouts/app.blade.php and resources/views/auth/login.blade.php.
   This file only holds the custom design system layered on top of it. */

:root {
    --nrf-bg: #f6f5f3;
    --nrf-surface: #ffffff;
    --nrf-sidebar: #17130f;      /* warm near-black sidebar for contrast */
    --nrf-sidebar-2: #241d16;
    --nrf-border: #ece6dd;
    --nrf-text: #241a10;
    --nrf-muted: #8a7c6c;
    --nrf-primary: #f97316;      /* orange 500 — brand accent */
    --nrf-primary-2: #fb923c;    /* orange 400 — gradient light end */
    --nrf-primary-dark: #c2410c; /* orange 700 — gradient dark end / hover */
    --nrf-teal: #0891b2;
    --nrf-pink: #db2777;
    --nrf-violet: #7c3aed;
    --nrf-green: #059669;
    --nrf-amber: #d97706;
    --nrf-red: #dc2626;
    --nrf-sidebar-w: 248px;
}

* { scrollbar-color: #cbd5e1 transparent; }

body {
    background: var(--nrf-bg);
    color: var(--nrf-text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* ===== Shell layout ===== */
.nrf-shell { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.nrf-sidebar {
    width: var(--nrf-sidebar-w);
    flex: 0 0 var(--nrf-sidebar-w);
    background: var(--nrf-sidebar);
    color: #cbd5e1;
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    z-index: 40;
}
.nrf-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.nrf-logo {
    width: 38px; height: 38px; border-radius: 11px; flex: none;
    display: grid; place-items: center; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--nrf-primary-2), var(--nrf-primary-dark));
    box-shadow: 0 6px 18px rgba(249,115,22,.4);
}
.nrf-logo { overflow: hidden; }
.nrf-logo-mark { width: 100%; height: 100%; display: block; }
.nrf-brand-text { font-weight: 800; letter-spacing: .5px; color: #fff; line-height: 1.1; }
.nrf-brand-text small { display: block; font-weight: 500; font-size: .68rem; color: #94a3b8; letter-spacing: 1px; text-transform: uppercase; }

.nrf-nav { padding: 14px 12px; flex: 1 1 auto; overflow-y: auto; }
.nrf-nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: 1.5px; color: #64748b; padding: 14px 12px 6px; }
.nrf-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 2px; border-radius: 10px;
    color: #cbd5e1; text-decoration: none; font-weight: 600; font-size: .93rem;
    transition: background .15s, color .15s;
}
.nrf-nav-item .ic { width: 20px; text-align: center; opacity: .85; }
.nrf-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nrf-nav-item.active {
    background: linear-gradient(90deg, rgba(249,115,22,.95), rgba(194,65,12,.9));
    color: #fff; box-shadow: 0 6px 16px rgba(249,115,22,.35);
}
.nrf-nav-item.disabled { color: #5b6b86; cursor: not-allowed; }
.nrf-nav-item.disabled:hover { background: transparent; color: #5b6b86; }
.nrf-sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.06); color: #64748b; }

/* ===== Main column ===== */
.nrf-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.nrf-topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--nrf-border);
    padding: 12px 22px;
}
.nrf-burger { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--nrf-text); }
.nrf-page-title { font-weight: 700; font-size: 1.05rem; margin-right: auto; }
.nrf-topbar-right { display: flex; align-items: center; gap: 16px; }
.nrf-avatar {
    width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 700; font-size: .8rem; color: #fff;
    background: linear-gradient(135deg, var(--nrf-primary-2), var(--nrf-primary));
}
.nrf-content { padding: 24px 22px; }

/* ===== Panels / cards ===== */
.nrf-panel {
    background: var(--nrf-surface);
    border: 1px solid var(--nrf-border);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.04);
}
.nrf-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--nrf-border);
}
.nrf-panel-title { font-weight: 700; letter-spacing: .3px; }

/* ===== Stat chips ===== */
.stat { text-align: center; padding: 12px 6px; border-radius: 14px; background: #f8fafc; border: 1px solid var(--nrf-border); }
.stat .val { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat .unit { font-size: .68rem; color: var(--nrf-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat.temp .val { color: var(--nrf-teal); }
.stat.beat .val { color: var(--nrf-pink); }
.stat.piezo .val { color: var(--nrf-violet); }
.stat.battery .val { color: var(--nrf-green); }

.chart-wrap { position: relative; height: 150px; }

/* ===== Settings tabs ===== */
.nrf-tabs { border-bottom: 1px solid var(--nrf-border); gap: 4px; }
.nrf-tabs .nav-link { color: var(--nrf-muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 16px; }
.nrf-tabs .nav-link:hover { color: var(--nrf-text); border-bottom-color: var(--nrf-border); }
.nrf-tabs .nav-link.active { color: var(--nrf-primary); background: transparent; border-bottom-color: var(--nrf-primary); }

/* ===== Radial gauges ===== */
.gauge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gauge { text-align: center; padding: 6px 4px; }
.gauge-ring { position: relative; width: 118px; height: 118px; margin: 0 auto; }
.gauge-ring svg { width: 118px; height: 118px; display: block; }
.g-track { fill: none; stroke: #eef1f6; stroke-width: 9; }
.g-val { fill: none; stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .6s ease; }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-val { font-size: 1.5rem; font-weight: 800; line-height: 1; color: var(--nrf-text); }
.gauge-unit { font-size: .66rem; color: var(--nrf-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.gauge-label { margin-top: 6px; font-size: .74rem; font-weight: 600; color: var(--nrf-muted); text-transform: uppercase; letter-spacing: .8px; }

/* ===== Movement bar ===== */
.move-row { display: flex; align-items: center; gap: 10px; }
.move-label { font-size: .74rem; font-weight: 600; color: var(--nrf-muted); text-transform: uppercase; letter-spacing: .8px; min-width: 78px; }
.move-bar { flex: 1; height: 10px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.move-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--nrf-violet), var(--nrf-primary)); transition: width .5s ease; }
.move-val { font-size: .82rem; font-weight: 700; min-width: 26px; text-align: right; }

/* ===== ESP32 device temperature row ===== */
.devtemp-row { display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--nrf-border); }
.devtemp-label { font-size: .74rem; font-weight: 600; color: var(--nrf-muted); text-transform: uppercase; letter-spacing: .8px; }
.devtemp-val { font-size: .95rem; font-weight: 700; color: var(--nrf-amber); }

.trend-row { display: flex; flex-wrap: wrap; gap: 8px; }
.trend { font-size: .74rem; color: var(--nrf-muted); background: #f8fafc; border: 1px solid var(--nrf-border); border-radius: 8px; padding: 4px 10px; }
.trend b { color: var(--nrf-text); }

/* ===== Status pills ===== */
.pill { font-size: .66rem; font-weight: 800; letter-spacing: 1.2px; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; }
.pill.online { color: var(--nrf-green); border-color: var(--nrf-green); background: rgba(5,150,105,.08); }
.pill.offline { color: var(--nrf-muted); border-color: #cbd5e1; background: #f1f5f9; }

/* ===== Notifications ===== */
.notif-btn { position: relative; background: none; border: 0; color: var(--nrf-text); font-size: 1.25rem; }
#notif-count {
    position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px;
    display: none; align-items: center; justify-content: center;
    font-size: .65rem; font-weight: 800; color: #fff; background: var(--nrf-red);
    border-radius: 999px; padding: 0 4px;
}
.notif-panel { width: 340px; max-height: 420px; overflow-y: auto; border-radius: 14px; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--nrf-border); }
.notif-item .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; }
.notif-item .msg { font-size: .88rem; }
.notif-item .meta { font-size: .72rem; color: var(--nrf-muted); }
.sev-info .dot { background: var(--nrf-teal); }
.sev-warning .dot { background: var(--nrf-amber); }
.sev-critical .dot { background: var(--nrf-red); }

/* ===== Toasts ===== */
#toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.nurify-toast {
    min-width: 260px; max-width: 360px; padding: 12px 16px; border-radius: 12px;
    background: var(--nrf-surface); border: 1px solid var(--nrf-border); color: var(--nrf-text);
    box-shadow: 0 10px 30px rgba(16,24,40,.18); opacity: 0; transform: translateX(30px);
    transition: all .3s ease;
}
.nurify-toast.show { opacity: 1; transform: translateX(0); }
.nurify-toast.sev-critical { border-left: 4px solid var(--nrf-red); }
.nurify-toast.sev-warning { border-left: 4px solid var(--nrf-amber); }
.nurify-toast.sev-info { border-left: 4px solid var(--nrf-teal); }

/* ===== Forms / buttons ===== */
.form-control, .form-select { background: #fff; border: 1px solid var(--nrf-border); color: var(--nrf-text); }
.form-control:focus { border-color: var(--nrf-primary); box-shadow: 0 0 0 .2rem rgba(249,115,22,.14); }
.btn-neon { background: linear-gradient(90deg, var(--nrf-primary), var(--nrf-primary-dark)); border: 0; color: #fff; font-weight: 700; letter-spacing: .3px; }
.btn-neon:hover { filter: brightness(1.05); color: #fff; }
.btn-ghost { background: #fff; border: 1px solid var(--nrf-border); color: var(--nrf-text); }
.btn-ghost:hover { border-color: var(--nrf-primary); color: var(--nrf-primary); }

/* ===== Key reveal ===== */
.key-box {
    font-family: 'Courier New', monospace; word-break: break-all;
    background: #fff7ed; border: 1px dashed var(--nrf-primary); color: #9a3412;
    padding: 12px 14px; border-radius: 10px;
}
.mono { font-family: 'Courier New', monospace; }
.text-muted-nrf { color: var(--nrf-muted) !important; }
.text-info { color: var(--nrf-primary) !important; }
a { color: var(--nrf-primary); }
a:hover { color: var(--nrf-primary-dark); }
.form-check-input:checked { background-color: var(--nrf-primary); border-color: var(--nrf-primary); }
.form-check-input:focus { border-color: var(--nrf-primary-2); box-shadow: 0 0 0 .25rem rgba(249,115,22,.25); }
table.nrf-table { color: var(--nrf-text); }
table.nrf-table td, table.nrf-table th { border-color: var(--nrf-border) !important; vertical-align: middle; }
table.nrf-table thead th { color: var(--nrf-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; }

/* ===== Login / auth (dark "Smart Mattress" hero theme) ===== */
.nrf-auth {
    min-height: 100vh; margin: 0; color: #e8edf6;
    background:
        radial-gradient(1100px 720px at 32% 46%, #8b929c 0%, #6b727c 34%, #4c525b 66%, #3a3f47 100%);
}
.nrf-auth-grid { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }

/* --- Hero (brand image) --- */
.nrf-hero { position: relative; display: grid; place-items: center; padding: 30px; overflow: hidden; }
.nrf-hero img { width: min(100%, 744px); height: auto; display: block; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Form column --- */
.nrf-form-col { display: grid; place-content: center; padding: 30px; }
.nrf-auth-card {
    width: 100%; max-width: 400px;
    background: rgba(17,22,32,.62); border: 1px solid rgba(140,170,220,.22); border-radius: 20px;
    padding: 34px 30px; backdrop-filter: blur(16px);
    box-shadow: 0 24px 60px rgba(6,10,20,.5), inset 0 0 0 1px rgba(255,255,255,.03);
}
.nrf-auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.nrf-auth-brand .nrf-logo { width: 44px; height: 44px; border-radius: 13px; font-size: 1.2rem;
    background: linear-gradient(135deg, #fb923c, #c2410c); box-shadow: 0 8px 22px rgba(249,115,22,.5); }
.nrf-auth-title { font-weight: 800; font-size: 1.15rem; line-height: 1; color: #fff; }
.nrf-auth-sub { font-size: .72rem; text-transform: uppercase; letter-spacing: 1.5px; color: #9fb0cc; }
.nrf-auth-muted { color: #9fb0cc; }
.nrf-auth-label { color: #c4d0e6; font-size: .85rem; }
.nrf-input { background: rgba(9,13,22,.6); border: 1px solid rgba(140,170,220,.25); color: #eaf0fb; }
.nrf-input::placeholder { color: #6b7890; }
.nrf-input:focus { background: rgba(9,13,22,.85); color: #fff; border-color: #fb923c; box-shadow: 0 0 0 .2rem rgba(249,115,22,.22); }
.nrf-auth-error {
    background: rgba(220,38,38,.15); border: 1px solid rgba(248,113,113,.5); color: #fecaca;
    padding: 10px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 18px;
}
.nrf-check { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: #9fb0cc; cursor: pointer; }
.btn-hero { background: linear-gradient(90deg, #fb923c, #c2410c); border: 0; color: #fff; font-weight: 700; letter-spacing: .4px;
    box-shadow: 0 10px 26px rgba(249,115,22,.45); }
.btn-hero:hover { filter: brightness(1.08); color: #fff; }
.nrf-auth-hint { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(140,170,220,.18);
    font-size: .82rem; color: #9fb0cc; text-align: center; }
.nrf-auth-foot { text-align: center; margin-top: 18px; font-size: .78rem; color: rgba(226,236,255,.5); }

@media (max-width: 900px) {
    .nrf-auth-grid { grid-template-columns: 1fr; }
    .nrf-hero { min-height: 200px; }
    .nrf-form-col { padding-top: 18px; padding-bottom: 44px; }
}

/* ===== User dropdown ===== */
.nrf-user-btn { background: none; border: 0; padding: 0; display: flex; align-items: center; gap: 8px; color: var(--nrf-text); }
.nrf-user-name { font-weight: 600; font-size: .9rem; }
@media (max-width: 575.98px) { .nrf-user-name { display: none; } }

/* ===== Ward overview tiles ===== */
.ward-legend { font-size: .78rem; color: var(--nrf-muted); display: flex; align-items: center; gap: 6px; }
.ward-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.ward-dot.online { background: var(--nrf-green); box-shadow: 0 0 0 3px rgba(5,150,105,.15); }
.ward-dot.offline { background: #94a3b8; }
.ward-dot.alert { background: var(--nrf-red); }
.ward-tile {
    display: block; text-decoration: none; color: var(--nrf-text);
    background: var(--nrf-surface); border: 1px solid var(--nrf-border); border-radius: 16px;
    padding: 16px; height: 100%;
    box-shadow: 0 1px 3px rgba(16,24,40,.06); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.ward-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(16,24,40,.12); color: var(--nrf-text); }
.ward-tile.has-alert { border-color: var(--nrf-red); box-shadow: 0 0 0 1px rgba(220,38,38,.25), 0 8px 22px rgba(220,38,38,.12); }
.ward-tile-head { display: flex; align-items: center; gap: 8px; }
.ward-name { font-weight: 700; }
.ward-alert-badge { margin-left: auto; background: var(--nrf-red); color: #fff; font-size: .7rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.ward-loc { color: var(--nrf-muted); font-size: .8rem; margin: 2px 0 12px; }
.ward-vitals { display: flex; justify-content: space-between; gap: 6px; padding: 10px 0; border-top: 1px solid var(--nrf-border); border-bottom: 1px solid var(--nrf-border); }
.wv { text-align: center; flex: 1; }
.wv-val { font-size: 1.35rem; font-weight: 800; display: block; line-height: 1; }
.wv-val.temp { color: var(--nrf-teal); }
.wv-val.beat { color: var(--nrf-pink); }
.wv-val.resp { color: var(--nrf-violet); }
.wv-lbl { font-size: .65rem; color: var(--nrf-muted); text-transform: uppercase; letter-spacing: 1px; }
.ward-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.ward-presence { font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.ward-presence.in { color: var(--nrf-green); background: rgba(5,150,105,.1); }
.ward-presence.out { color: var(--nrf-red); background: rgba(220,38,38,.1); }
.ward-presence.unknown { color: var(--nrf-muted); background: #f1f5f9; }
.ward-batt { font-size: .8rem; color: var(--nrf-muted); font-weight: 600; }

/* ===== Backdrop for mobile sidebar ===== */
#nrf-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
#nrf-backdrop.show { display: block; }

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .nrf-sidebar {
        position: fixed; left: 0; top: 0; transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .nrf-sidebar.open { transform: translateX(0); }
    .nrf-burger { display: inline-block; }
}

/* =========================================================================
   Live Dashboard — card grid (health-app style, orange brand accent)
   ========================================================================= */

.dash-device-head {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    margin: 30px 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--nrf-border);
}
.dash-device-head:first-child,
.d-flex + .dash-device-head { margin-top: 0; }
.dash-device-name { font-weight: 800; font-size: 1.1rem; }

.dash-card {
    position: relative;
    background: var(--nrf-surface);
    border: 1px solid var(--nrf-border);
    border-radius: 20px;
    height: 100%;
    box-shadow: 0 1px 3px rgba(16,24,40,.05), 0 10px 26px rgba(16,24,40,.04);
}
.dash-card > .card-body { padding: 20px; }
.dash-card.dark {
    background: linear-gradient(160deg, #1c1a17, #100f0d);
    border-color: #2a2723;
    color: #f4f1ec;
}
.dash-card.dark .dash-card-title { color: #fff; }
.dash-card.dark .dash-card-sub { color: rgba(244,241,236,.55); }
.dash-card.orange {
    background: linear-gradient(150deg, var(--nrf-primary-2), var(--nrf-primary) 55%, var(--nrf-primary-dark));
    border: 0; color: #fff;
}
.dash-card.orange .dash-card-sub { color: rgba(255,255,255,.8); }

.dash-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.dash-card-title { font-weight: 700; font-size: .92rem; }
.dash-card-sub { font-size: .74rem; color: var(--nrf-muted); margin-top: 2px; }

/* --- Gauge size variants (reuses partials/gauge.blade.php) --- */
.gauge.gauge-xl .gauge-ring, .gauge.gauge-xl .gauge-ring svg { width: 168px; height: 168px; }
.gauge.gauge-xl .gauge-val { font-size: 2.1rem; }
.gauge.gauge-lg .gauge-ring, .gauge.gauge-lg .gauge-ring svg { width: 136px; height: 136px; }
.gauge.gauge-lg .gauge-val { font-size: 1.7rem; }
.gauge.gauge-md .gauge-ring, .gauge.gauge-md .gauge-ring svg { width: 104px; height: 104px; }
.dash-card.dark .g-track { stroke: rgba(255,255,255,.14); }
.dash-card.dark .gauge-val { color: #fff; }
.dash-card.dark .gauge-unit, .dash-card.dark .gauge-label { color: rgba(255,255,255,.55); }

/* --- Temperature headline + segmented band bar --- */
.temp-headline { font-size: 1.9rem; font-weight: 800; line-height: 1; margin: 4px 0 12px; }
.temp-headline span { font-size: 1rem; font-weight: 600; color: var(--nrf-muted); margin-left: 4px; }
.tempband .bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #eef1f6; }
.tempband .seg { height: 100%; transition: width .5s ease; }
.tempband .seg.low { background: #38bdf8; }
.tempband .seg.normal { background: #22c55e; }
.tempband .seg.high { background: var(--nrf-primary); }
.tempband-legend { display: flex; justify-content: space-between; margin-top: 10px; font-size: .7rem; color: var(--nrf-muted); font-weight: 600; }
.tempband-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.chart-wrap.sm { height: 90px; }

/* --- Device info list --- */
.info-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.info-row { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; padding-bottom: 9px; border-bottom: 1px dashed var(--nrf-border); }
.info-row:last-child { border-bottom: 0; padding-bottom: 0; }
.info-row .k { color: var(--nrf-muted); }
.info-row .v { font-weight: 700; text-align: right; }

/* --- Sensor Status (orange) checklist --- */
.status-pct { font-size: 2.5rem; font-weight: 800; line-height: 1; margin-top: 6px; }
.status-check-list { position: relative; display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.status-check-list::before {
    content: ''; position: absolute; left: 10px; top: 4px; bottom: 4px; width: 2px;
    background: rgba(255,255,255,.3); z-index: 0;
}
.status-check { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; font-size: .82rem; font-weight: 600; }
.status-check .dot {
    width: 22px; height: 22px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-size: .72rem; background: rgba(255,255,255,.22);
}
.status-check.ok .dot { background: #fff; color: var(--nrf-primary-dark); }
.status-check.bad .dot { background: rgba(0,0,0,.28); color: #fff; }

/* --- Small stat tiles (uptime, alert-rate) --- */
.stat-mini .icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 12px; font-size: 1.15rem; }
.stat-mini .big { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-mini .lbl { font-size: .78rem; color: var(--nrf-muted); margin-top: 6px; line-height: 1.35; }

/* --- Sensor Activity sparklines (dark card) --- */
.mini-chart-row { margin-bottom: 16px; }
.mini-chart-row:last-child { margin-bottom: 0; }
.mini-chart-head {
    display: flex; justify-content: space-between; margin-bottom: 6px;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
    color: rgba(244,241,236,.55);
}
.mini-chart-head span:last-child { color: #fff; font-weight: 700; text-transform: none; letter-spacing: 0; font-size: .78rem; }
.mini-chart-wrap { position: relative; height: 42px; }

/* --- Battery ring "peek" badge --- */
.dash-card.has-peek { margin-bottom: 14px; }
.icon-peek {
    position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%);
    width: 42px; height: 42px; border-radius: 50%;
    background: linear-gradient(160deg, var(--nrf-primary-2), var(--nrf-primary-dark));
    display: grid; place-items: center; font-size: 1.1rem; color: #fff;
    box-shadow: 0 10px 20px rgba(0,0,0,.35), 0 0 0 4px #14120f;
}

/* --- Heart Beat ECG feature card --- */
.hr-card-top { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.hr-icon { width: 46px; height: 46px; border-radius: 14px; background: rgba(219,39,119,.12); color: var(--nrf-pink); display: grid; place-items: center; font-size: 1.35rem; flex: none; }
.hr-value { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.hr-unit { font-size: .8rem; font-weight: 600; color: var(--nrf-muted); margin-left: 5px; }
.hr-status { margin-top: 3px; font-size: .84rem; font-weight: 600; }
.hr-status.ok { color: var(--nrf-green); }
.hr-status.crit { color: var(--nrf-red); }

/* --- Weekly Status bars --- */
.week-bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; margin-top: 6px; }
.week-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.week-bar { width: 58%; border-radius: 8px 8px 4px 4px; min-height: 6px; transition: height .5s ease; }
.week-bar.status-normal { background: #22c55e; }
.week-bar.status-warning { background: #f59e0b; }
.week-bar.status-critical { background: #ef4444; }
.week-bar.status-none { background: #e7e2da; }
.week-bar-lbl { font-size: .68rem; color: var(--nrf-muted); margin-top: 8px; font-weight: 600; }
.week-bar-col.is-today .week-bar-lbl { color: var(--nrf-primary); font-weight: 800; }

/* --- Monitoring calendar --- */
.cal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.cal-streak { font-size: .8rem; color: var(--nrf-muted); white-space: nowrap; }
.cal-streak b { color: var(--nrf-primary); font-size: .95rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal-dow { font-size: .64rem; color: var(--nrf-muted); text-transform: uppercase; font-weight: 700; padding-bottom: 4px; }
.cal-day {
    aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
    font-size: .72rem; font-weight: 600; color: var(--nrf-muted); background: #f4f2ee;
}
.cal-day.active { background: var(--nrf-primary); color: #fff; }
.cal-day.today { outline: 2px solid var(--nrf-primary-dark); outline-offset: 2px; }
.cal-day.empty { visibility: hidden; }

/* =========================================================================
   Card headers + reworked Weekly Status / Calendar  (static file — no build)
   ========================================================================= */
.dash-card { overflow: visible; }
.dash-card > .card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: transparent; border-bottom: 1px solid var(--nrf-border);
    padding: 14px 20px; border-radius: 20px 20px 0 0;
}
.dash-card.dark > .card-header { border-bottom-color: rgba(255,255,255,.08); }
.dash-card.orange > .card-header { border-bottom-color: rgba(255,255,255,.22); }
.card-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-icon {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-size: .95rem;
    background: #fff1e6; color: var(--nrf-primary);
}
.dash-card.dark .card-icon { background: rgba(255,255,255,.08); color: var(--nrf-primary-2); }
.dash-card.orange .card-icon { background: rgba(255,255,255,.22); color: #fff; }
.card-head-title { font-weight: 700; font-size: .95rem; line-height: 1.15; }
.card-head-sub { font-size: .72rem; color: var(--nrf-muted); }
.dash-card.dark .card-head-sub { color: rgba(244,241,236,.55); }
.dash-card.orange .card-head-sub { color: rgba(255,255,255,.8); }
.card-head-chip {
    font-size: .68rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
    background: #f4f2ee; color: var(--nrf-muted); white-space: nowrap;
}
.dash-card.orange .card-head-chip { background: rgba(255,255,255,.22); color: #fff; }

/* Weekly Status */
.wk-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; height: 170px; padding-top: 6px; }
.wk-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.wk-track { flex: 1 1 auto; width: 100%; max-width: 34px; display: flex; align-items: flex-end; background: #f4f2ee; border-radius: 12px; overflow: hidden; }
.wk-bar { width: 100%; border-radius: 12px; min-height: 8px; transition: height .5s ease; }
.wk-count { font-size: .66rem; font-weight: 700; color: var(--nrf-muted); margin-bottom: 4px; }
.wk-label { font-size: .7rem; font-weight: 600; color: var(--nrf-muted); margin-top: 8px; }
.wk-col.today .wk-label { color: var(--nrf-primary); font-weight: 800; }
.wk-col.today .wk-track { outline: 2px solid var(--nrf-primary); outline-offset: 2px; }
.wk-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: .72rem; color: var(--nrf-muted); }
.wk-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* Monitoring Calendar */
.mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; text-align: center; }
.mcal-dow { font-size: .68rem; font-weight: 700; color: var(--nrf-muted); padding-bottom: 2px; }
.mcal-day {
    width: 100%; max-width: 46px; aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 600; color: var(--nrf-text); background: #f4f2ee;
}
.mcal-day.blank { background: transparent; }
.mcal-day.future { color: #c4bbb0; background: repeating-linear-gradient(135deg, #f4f2ee 0 4px, #ece8e2 4px 8px); }
.mcal-day.active { background: var(--nrf-primary); color: #fff; box-shadow: 0 4px 10px rgba(249,115,22,.35); }
.mcal-day.today { outline: 2px solid var(--nrf-primary-dark); outline-offset: 2px; }
.mcal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: .75rem; color: var(--nrf-muted); }
.mcal-foot b { color: var(--nrf-primary); font-size: .95rem; }

/* Plain card title (replaces the card header) */
.card-name { font-weight: 700; font-size: 1rem; line-height: 1.2; margin-bottom: 14px; text-align: left; color: inherit; }
.card-name.px-4 { margin-bottom: 10px; }

/* Sleep cards: compact 7-night bar chart + footnote */
.wk-chart.sm { height: 96px; gap: 6px; }
.wk-chart.sm .wk-track { max-width: 22px; border-radius: 8px; }
.wk-chart.sm .wk-bar { border-radius: 8px; }
.wk-chart.sm .wk-count { font-size: .62rem; min-height: .8rem; }
.wk-chart.sm .wk-label { font-size: .64rem; margin-top: 5px; }
.card-foot-note { margin-top: 12px; font-size: .74rem; color: var(--nrf-muted); }
.card-foot-note b { color: var(--nrf-text); }
.temp-headline strong { font-weight: 700; }

/* Battery indicator (Device Info) */
.batt { display: inline-flex; align-items: center; gap: 6px; }
.batt b { color: var(--nrf-text); }
.batt-ico { position: relative; width: 26px; height: 13px; border: 2px solid currentColor; border-radius: 4px; padding: 1px; display: inline-block; }
.batt-ico::after { content: ''; position: absolute; right: -5px; top: 3px; width: 3px; height: 5px; border-radius: 0 2px 2px 0; background: currentColor; }
.batt-fill { display: block; height: 100%; border-radius: 1px; background: currentColor; min-width: 1px; transition: width .5s ease; }
.batt-bolt { display: none; color: var(--nrf-primary); font-size: .9rem; line-height: 1; }
.batt.charging .batt-bolt { display: inline; animation: batt-pulse 1.4s ease-in-out infinite; }
@keyframes batt-pulse { 50% { opacity: .35; } }

/* Device overview: one container holding five small cards */
.overview-card > .card-body { padding: 16px; }
.overview-row > [class*="col"] { display: flex; }
.ov-sec {
    flex: 1; padding: 18px 20px; border-radius: 16px; position: relative;
    background: #fbfaf8; border: 1px solid var(--nrf-border);
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
    transition: transform .15s ease, box-shadow .15s ease;
}
.ov-sec:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16,24,40,.07); }
.ov-sec.ov-orange {
    color: #fff; border-color: transparent;
    background: linear-gradient(150deg, var(--nrf-primary-2), var(--nrf-primary) 55%, var(--nrf-primary-dark));
    box-shadow: 0 8px 20px rgba(249,115,22,.25);
}
.ov-sec.ov-orange .card-head-sub { color: rgba(255,255,255,.85); }
.ov-sec .gauge { padding-top: 0; }
.ov-sec .gauge, .ov-sec .gauge + .card-head-sub { text-align: center; }
.ov-sec .info-row { border-bottom-color: #e9e3da; }

/* Occupancy: bed illustration (occupied / empty) */
.occ-visual { text-align: center; padding-top: 4px; }
.occ-halo {
    width: 132px; height: 132px; margin: 0 auto; border-radius: 50%;
    display: grid; place-items: center; background: #f1eee9; transition: background .3s ease, box-shadow .3s ease;
}
.occ-bed { width: 100px; height: auto; overflow: visible; }
.occ-bed .frame { fill: #b9ae9f; }
.occ-bed .mattress { fill: #e2dbd1; }
.occ-bed .pillow { fill: #fff; stroke: #d6cec3; stroke-width: 1.5; }
.occ-bed .sheet { fill: #d6cec3; }
.occ-bed .head { fill: #f2b894; }
.occ-bed .blanket { fill: var(--nrf-primary); }
.occ-bed .zz { fill: var(--nrf-primary-dark); font: 700 10px system-ui, sans-serif; animation: occ-zz 2.4s ease-in-out infinite; }
.occ-bed .zz + .zz { animation-delay: .6s; }
@keyframes occ-zz { 0%,100% { opacity: .15; transform: translateY(2px); } 50% { opacity: 1; transform: translateY(-2px); } }
.occ-state { margin-top: 12px; font-size: .78rem; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.occ-state span, .occ-bed .occ-person, .occ-bed .occ-empty { display: none; }

/* Server-rendered state */
.occ-visual.is-in .occ-person, .occ-visual.is-out .occ-empty, .occ-visual.is-unknown .occ-empty { display: inline; }
.occ-visual.is-in .s-in, .occ-visual.is-out .s-out, .occ-visual.is-unknown .s-unk { display: inline; }
.occ-visual.is-in .occ-halo { background: #fff1e6; box-shadow: 0 0 0 6px rgba(249,115,22,.08); }
.occ-visual.is-in .occ-state { color: var(--nrf-primary); }
.occ-visual.is-out .occ-state, .occ-visual.is-unknown .occ-state { color: var(--nrf-muted); }

/* Live state: follows the presence pill in the device header (updated by the page's polling) */
.dash-device-head:has(.ward-presence.in) + .row .occ-visual .occ-person { display: inline; }
.dash-device-head:has(.ward-presence.in) + .row .occ-visual .occ-empty { display: none; }
.dash-device-head:has(.ward-presence.in) + .row .occ-visual .occ-state span { display: none; }
.dash-device-head:has(.ward-presence.in) + .row .occ-visual .occ-state .s-in { display: inline; }
.dash-device-head:has(.ward-presence.in) + .row .occ-visual .occ-halo { background: #fff1e6; box-shadow: 0 0 0 6px rgba(249,115,22,.08); }
.dash-device-head:has(.ward-presence.in) + .row .occ-visual .occ-state { color: var(--nrf-primary); }
.dash-device-head:has(.ward-presence.out) + .row .occ-visual .occ-person { display: none; }
.dash-device-head:has(.ward-presence.out) + .row .occ-visual .occ-empty { display: inline; }
.dash-device-head:has(.ward-presence.out) + .row .occ-visual .occ-state span { display: none; }
.dash-device-head:has(.ward-presence.out) + .row .occ-visual .occ-state .s-out { display: inline; }
.dash-device-head:has(.ward-presence.out) + .row .occ-visual .occ-halo { background: #f1eee9; box-shadow: none; }
.dash-device-head:has(.ward-presence.out) + .row .occ-visual .occ-state { color: var(--nrf-muted); }

/* Overview tiles: bed state + device info */
.ward-tile { border-radius: 20px; padding: 18px; }
.ward-bed { display: flex; align-items: center; gap: 14px; padding: 10px 0 12px; }
.ward-bed-art { width: 74px; height: 74px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #f1eee9; transition: background .3s ease; }
.ward-bed-art .occ-bed { width: 56px; }
.ward-bed-label { font-size: .68rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--nrf-muted); margin-bottom: 4px; }
.ward-bed .occ-person, .ward-bed .occ-empty { display: none; }
.ward-bed.is-in .occ-person, .ward-bed.is-out .occ-empty, .ward-bed.is-unknown .occ-empty { display: inline; }
.ward-bed.is-in .ward-bed-art { background: #fff1e6; }
/* live: follow the presence pill that the page's polling updates */
.ward-bed:has(.ward-presence.in) .occ-person { display: inline; }
.ward-bed:has(.ward-presence.in) .occ-empty { display: none; }
.ward-bed:has(.ward-presence.in) .ward-bed-art { background: #fff1e6; }
.ward-bed:has(.ward-presence.out) .occ-person, .ward-bed:has(.ward-presence.unknown) .occ-person { display: none; }
.ward-bed:has(.ward-presence.out) .occ-empty, .ward-bed:has(.ward-presence.unknown) .occ-empty { display: inline; }
.ward-bed:has(.ward-presence.out) .ward-bed-art { background: #f1eee9; }
.ward-presence.in { color: var(--nrf-primary-dark); background: #fff1e6; }

.ward-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.wi { background: #fbfaf8; border: 1px solid var(--nrf-border); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.wi-lbl { display: block; font-size: .64rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--nrf-muted); margin-bottom: 3px; white-space: nowrap; }
.wi b { font-size: .85rem; color: var(--nrf-text); white-space: nowrap; }
.wi .batt { gap: 5px; }
.wi .batt-ico { width: 22px; height: 11px; }

/* Overview: online / offline status pill (follows the live status dot) */
.ward-tile-head { flex-wrap: nowrap; }
.ward-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ward-alert-badge { margin-left: 6px; }
.ward-status {
    display: inline-flex; align-items: center; gap: 5px; flex: none;
    font-size: .68rem; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
    padding: 3px 9px; border-radius: 999px;
}
.ward-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ward-status .st-on, .ward-status .st-off { display: none; }
.ward-status.on { color: var(--nrf-green); background: rgba(5,150,105,.1); }
.ward-status.on .st-on { display: inline; }
.ward-status.on::before { animation: batt-pulse 1.6s ease-in-out infinite; }
.ward-status.off { color: #8a94a6; background: #f1f2f5; }
.ward-status.off .st-off { display: inline; }
.ward-tile-head:has(.ward-dot.online) .ward-status { color: var(--nrf-green); background: rgba(5,150,105,.1); }
.ward-tile-head:has(.ward-dot.online) .ward-status .st-on { display: inline; }
.ward-tile-head:has(.ward-dot.online) .ward-status .st-off { display: none; }
.ward-tile-head:has(.ward-dot.offline) .ward-status { color: #8a94a6; background: #f1f2f5; }
.ward-tile-head:has(.ward-dot.offline) .ward-status .st-off { display: inline; }
.ward-tile-head:has(.ward-dot.offline) .ward-status .st-on { display: none; }
.wi b { display: block; overflow: hidden; text-overflow: ellipsis; }

.ward-tile-head > .ward-dot { display: none; } /* status pill shows this; dot kept for live updates */

/* Settings: grouped form sections (Sleep tab) */
.set-group { padding: 16px 18px; border: 1px solid var(--nrf-border); border-radius: 16px; background: #fbfaf8; margin-bottom: 16px; }
.set-group-title { font-weight: 700; font-size: .82rem; letter-spacing: .4px; text-transform: uppercase; color: var(--nrf-muted); margin-bottom: 14px; }
.set-preview { font-size: .78rem; color: var(--nrf-muted); }
.sp-seg { display: inline-block; width: 26px; height: 9px; border-radius: 999px; vertical-align: middle; margin-right: 5px; }
.set-note { background: #fff; border: 1px solid var(--nrf-border); border-radius: 12px; padding: 12px 14px; font-size: .8rem; color: var(--nrf-muted); height: 100%; }
.set-note b { color: var(--nrf-text); display: block; margin-bottom: 4px; }
.grade-chip { display: inline-block; color: #fff; font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 5px; }

/* ===== Radar card: the three facts under the motion headline ===== */
.radar-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 14px 0 4px;
}
.radar-facts > div {
    background: var(--nrf-bg);
    border: 1px solid var(--nrf-border);
    border-radius: 10px;
    padding: 9px 10px;
    min-width: 0;
}
.radar-facts .rf-label {
    display: block;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--nrf-muted);
    margin-bottom: 3px;
    white-space: nowrap;
}
.radar-facts .rf-value {
    display: block;
    font-size: .95rem;
    font-weight: 600;
    color: var(--nrf-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 420px) {
    .radar-facts { grid-template-columns: repeat(2, 1fr); }
    .radar-facts > div:last-child { grid-column: 1 / -1; }
}
