:root {
    --bg: #eef3f7;
    --panel: rgba(255, 255, 255, .88);
    --panel-solid: #ffffff;
    --ink: #101722;
    --muted: #647386;
    --line: rgba(108, 125, 148, .18);
    --accent: #00a878;
    --accent-2: #246bfe;
    --cyan: #00a3ff;
    --warn: #f59e0b;
    --danger: #ef4444;
    --violet: #7c3aed;
    --sidebar: #edf3f8;
    --shadow: 0 24px 70px rgba(16, 23, 34, .13);
    --glow: 0 0 32px rgba(0, 168, 120, .28);
}

body[data-theme="dark"] {
    --bg: #0b111c;
    --panel: rgba(18, 27, 42, .88);
    --panel-solid: #121b2a;
    --ink: #eef5ff;
    --muted: #9aaabe;
    --line: rgba(154, 170, 190, .18);
    --accent: #27d8a1;
    --accent-2: #6aa2ff;
    --cyan: #38c7ff;
    --warn: #fbbf24;
    --danger: #fb7185;
    --violet: #a78bfa;
    --sidebar: #050914;
    --shadow: 0 24px 70px rgba(0, 0, 0, .34);
    --glow: 0 0 32px rgba(39, 216, 161, .24);
}

html[data-accent-theme="blue-purple"] body {
    --accent: #246bfe;
    --accent-2: #7c3aed;
    --cyan: #5aa8ff;
    --violet: #8b5cf6;
    --glow: 0 0 32px rgba(36, 107, 254, .26);
}
html[data-accent-theme="blue-purple"] body[data-theme="dark"] {
    --accent: #6aa2ff;
    --accent-2: #a78bfa;
    --cyan: #7dd3fc;
    --violet: #c4b5fd;
    --glow: 0 0 32px rgba(106, 162, 255, .24);
}
html[data-accent-theme="red-yellow"] body {
    --accent: #ef4444;
    --accent-2: #f59e0b;
    --cyan: #fbbf24;
    --violet: #fb7185;
    --glow: 0 0 32px rgba(239, 68, 68, .22);
}
html[data-accent-theme="red-yellow"] body[data-theme="dark"] {
    --accent: #fb7185;
    --accent-2: #fbbf24;
    --cyan: #fde68a;
    --violet: #fda4af;
    --glow: 0 0 32px rgba(251, 113, 133, .22);
}
html[data-accent-theme="deep-blue"] body {
    --accent: #1d4ed8;
    --accent-2: #0f2f78;
    --cyan: #2563eb;
    --violet: #1e40af;
    --glow: 0 0 32px rgba(29, 78, 216, .24);
}
html[data-accent-theme="deep-blue"] body[data-theme="dark"] {
    --accent: #60a5fa;
    --accent-2: #1d4ed8;
    --cyan: #93c5fd;
    --violet: #3b82f6;
    --glow: 0 0 32px rgba(96, 165, 250, .22);
}
html[data-accent-theme="light-blue"] body {
    --accent: #0ea5e9;
    --accent-2: #38bdf8;
    --cyan: #7dd3fc;
    --violet: #60a5fa;
    --glow: 0 0 32px rgba(14, 165, 233, .22);
}
html[data-accent-theme="light-blue"] body[data-theme="dark"] {
    --accent: #38bdf8;
    --accent-2: #7dd3fc;
    --cyan: #bae6fd;
    --violet: #60a5fa;
    --glow: 0 0 32px rgba(56, 189, 248, .22);
}
html[data-accent-theme="deep-purple"] body {
    --accent: #6d28d9;
    --accent-2: #4c1d95;
    --cyan: #8b5cf6;
    --violet: #7c3aed;
    --glow: 0 0 32px rgba(109, 40, 217, .24);
}
html[data-accent-theme="deep-purple"] body[data-theme="dark"] {
    --accent: #a78bfa;
    --accent-2: #7c3aed;
    --cyan: #c4b5fd;
    --violet: #ddd6fe;
    --glow: 0 0 32px rgba(167, 139, 250, .22);
}
html[data-accent-theme="light-purple"] body {
    --accent: #a855f7;
    --accent-2: #c084fc;
    --cyan: #d8b4fe;
    --violet: #9333ea;
    --glow: 0 0 32px rgba(168, 85, 247, .22);
}
html[data-accent-theme="light-purple"] body[data-theme="dark"] {
    --accent: #c084fc;
    --accent-2: #e9d5ff;
    --cyan: #f0abfc;
    --violet: #d8b4fe;
    --glow: 0 0 32px rgba(192, 132, 252, .22);
}
html[data-accent-theme="deep-orange"] body {
    --accent: #ea580c;
    --accent-2: #9a3412;
    --cyan: #f97316;
    --violet: #c2410c;
    --glow: 0 0 32px rgba(234, 88, 12, .23);
}
html[data-accent-theme="deep-orange"] body[data-theme="dark"] {
    --accent: #fb923c;
    --accent-2: #ea580c;
    --cyan: #fdba74;
    --violet: #f97316;
    --glow: 0 0 32px rgba(251, 146, 60, .22);
}
html[data-accent-theme="light-orange"] body {
    --accent: #f97316;
    --accent-2: #fbbf24;
    --cyan: #fed7aa;
    --violet: #fb923c;
    --glow: 0 0 32px rgba(249, 115, 22, .2);
}
html[data-accent-theme="light-orange"] body[data-theme="dark"] {
    --accent: #fdba74;
    --accent-2: #fbbf24;
    --cyan: #ffedd5;
    --violet: #fb923c;
    --glow: 0 0 32px rgba(253, 186, 116, .2);
}
html[data-accent-theme="teal-coral"] body {
    --accent: #0f766e;
    --accent-2: #fb7185;
    --cyan: #14b8a6;
    --violet: #f43f5e;
    --glow: 0 0 32px rgba(20, 184, 166, .22);
}
html[data-accent-theme="teal-coral"] body[data-theme="dark"] {
    --accent: #2dd4bf;
    --accent-2: #fb7185;
    --cyan: #5eead4;
    --violet: #fda4af;
    --glow: 0 0 32px rgba(45, 212, 191, .2);
}
html[data-accent-theme="slate-gold"] body {
    --accent: #64748b;
    --accent-2: #d97706;
    --cyan: #94a3b8;
    --violet: #f59e0b;
    --glow: 0 0 32px rgba(217, 119, 6, .18);
}
html[data-accent-theme="slate-gold"] body[data-theme="dark"] {
    --accent: #cbd5e1;
    --accent-2: #fbbf24;
    --cyan: #94a3b8;
    --violet: #f59e0b;
    --glow: 0 0 32px rgba(251, 191, 36, .18);
}

* { box-sizing: border-box; }
html.sidebar-collapsed-preset body {
    visibility: hidden;
}
html.sidebar-ready body {
    visibility: visible;
}

body {
    margin: 0;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 28rem),
        radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--cyan) 22%, transparent), transparent 24rem),
        radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--violet) 14%, transparent), transparent 28rem),
        radial-gradient(circle at 72% 82%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 24rem),
        var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
}
body[data-theme="dark"] {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 26rem),
        radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--cyan) 18%, transparent), transparent 23rem),
        radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--violet) 12%, transparent), transparent 26rem),
        radial-gradient(circle at 72% 82%, color-mix(in srgb, var(--accent-2) 8%, transparent), transparent 23rem),
        var(--bg);
}
html[data-gradients="off"] body,
html[data-gradients="off"] body[data-theme="dark"] {
    background: var(--bg);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px 1fr;
    transition: grid-template-columns .18s ease;
    overflow-x: hidden;
    background: linear-gradient(90deg, var(--sidebar) 0 248px, transparent 248px);
}
.app-shell-tablet {
    grid-template-columns: 1fr;
    background: transparent;
}
body.sidebar-collapsed .app-shell,
html.sidebar-collapsed-preset .app-shell {
    grid-template-columns: 0 1fr;
    background: transparent;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: start;
    padding: 22px;
    background:
        radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 16rem),
        radial-gradient(circle at 100% 65%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 18rem),
        linear-gradient(180deg, rgba(249,251,253,.96), rgba(238,244,249,.94) 58%, rgba(226,235,244,.96)),
        var(--sidebar);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 28px;
    box-shadow: inset -1px 0 0 rgba(100,115,134,.16), 18px 0 60px rgba(16,23,34,.07);
    transform: translateX(0);
    opacity: 1;
    overflow-y: auto;
    transition: transform .18s ease, opacity .18s ease, padding .18s ease;
}
html[data-gradients="off"] .app-sidebar {
    background:
        linear-gradient(180deg, rgba(249,251,253,.96), rgba(238,244,249,.94) 58%, rgba(226,235,244,.96)),
        var(--sidebar);
}
body[data-theme="dark"] .app-sidebar {
    background:
        linear-gradient(180deg, rgba(255,255,255,.07), transparent 28%),
        radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 16rem),
        radial-gradient(circle at 100% 65%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 18rem),
        var(--sidebar);
    color: #fff;
    box-shadow: inset -1px 0 0 rgba(255,255,255,.08), 18px 0 60px rgba(7,17,31,.08);
}
html[data-gradients="off"] body[data-theme="dark"] .app-sidebar {
    background:
        linear-gradient(180deg, rgba(255,255,255,.07), transparent 28%),
        var(--sidebar);
}
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .app-sidebar {
    background:
        radial-gradient(circle at 16% 6%, rgba(100,116,139,.16), transparent 15rem),
        radial-gradient(circle at 100% 64%, rgba(217,119,6,.16), transparent 18rem),
        linear-gradient(180deg, rgba(249,251,253,.97), rgba(238,244,249,.94) 52%, rgba(232,237,243,.96)),
        var(--sidebar);
}
html[data-accent-theme="slate-gold"] .brand span,
html[data-accent-theme="slate-gold"] .brand-mark {
    background: linear-gradient(135deg, #64748b, #d97706);
}
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .brand span,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .brand-mark {
    background: linear-gradient(135deg, #cbd5e1, #fbbf24);
}
html[data-accent-theme="slate-gold"][data-gradients="off"] body:not([data-theme="dark"]) .app-sidebar {
    background:
        linear-gradient(180deg, rgba(249,251,253,.97), rgba(238,244,249,.94) 52%, rgba(232,237,243,.96)),
        var(--sidebar);
}
body.sidebar-collapsed .app-sidebar,
html.sidebar-collapsed-preset .app-sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
    min-height: 48px;
}
body[data-theme="dark"] .brand {
    color: #fff;
}
.brand strong,
.nav-stack span,
.nav-section-title span,
.sidebar-foot small {
    transition: opacity .14s ease, width .14s ease;
}
.brand span,
.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    color: #fff;
    font-weight: 800;
    box-shadow: 0 16px 32px color-mix(in srgb, var(--accent) 28%, transparent);
}
.brand strong {
    font-size: 1.08rem;
    letter-spacing: .01em;
}

.nav-stack {
    display: grid;
    gap: 6px;
}
.nav-section {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(100,115,134,.16);
}
body[data-theme="dark"] .nav-section {
    border-top-color: rgba(255,255,255,.1);
}
.nav-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 2px 13px 5px;
    border: 0;
    background: transparent;
    color: color-mix(in srgb, var(--accent) 28%, #647386);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
}
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .nav-section-title {
    color: color-mix(in srgb, #d97706 34%, #647386);
}
body[data-theme="dark"] .nav-section-title {
    color: rgba(255,255,255,.74);
}
.nav-section-title i {
    width: 20px;
    text-align: center;
    flex: 0 0 20px;
    color: var(--accent);
}
.nav-section-title span {
    flex: 1;
    text-align: left;
}
.nav-section-chevron {
    margin-left: auto;
    transform: rotate(0deg);
    transition: transform .16s ease;
    color: rgba(71,85,105,.64) !important;
}
body[data-theme="dark"] .nav-section-chevron {
    color: rgba(255,255,255,.58) !important;
}
.nav-section-links {
    display: grid;
    gap: 6px;
    overflow: hidden;
    max-height: 520px;
    opacity: 1;
    padding-bottom: 2px;
    transition: max-height .18s ease, opacity .18s ease, padding-bottom .18s ease;
}
.nav-section.is-collapsed .nav-section-links {
    max-height: 0;
    opacity: 0;
    padding-bottom: 0;
    pointer-events: none;
}
.nav-section.is-collapsed .nav-section-chevron {
    transform: rotate(-90deg);
}
.nav-stack a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: color-mix(in srgb, var(--accent) 24%, #405063);
    text-decoration: none;
    padding: 12px 13px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .nav-stack a {
    color: color-mix(in srgb, #64748b 68%, #405063);
}
.nav-stack i {
    width: 20px;
    text-align: center;
    flex: 0 0 20px;
    color: color-mix(in srgb, var(--accent) 46%, #6a788b);
}
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .nav-stack i {
    color: color-mix(in srgb, #d97706 58%, #64748b);
}
.nav-stack a.active,
.nav-stack a:hover {
    color: color-mix(in srgb, var(--accent) 34%, var(--ink));
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    border-color: color-mix(in srgb, var(--accent) 18%, transparent);
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 72%, transparent), 0 10px 26px rgba(16,23,34,.06);
}
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .nav-stack a.active,
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .nav-stack a:hover {
    color: #1f2937;
    background: linear-gradient(135deg, rgba(100,116,139,.10), rgba(217,119,6,.12));
    border-color: rgba(217,119,6,.24);
    box-shadow: inset 3px 0 0 rgba(217,119,6,.74), 0 10px 26px rgba(16,23,34,.06);
}
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .nav-stack a.active i,
html[data-accent-theme="slate-gold"] body:not([data-theme="dark"]) .nav-stack a:hover i {
    color: #d97706;
}
.nav-stack a.active i,
.nav-stack a:hover i {
    color: var(--accent);
}
body[data-theme="dark"] .nav-stack a {
    color: color-mix(in srgb, var(--accent) 26%, rgba(255,255,255,.68));
}
body[data-theme="dark"] .nav-stack i {
    color: color-mix(in srgb, var(--accent) 54%, rgba(255,255,255,.72));
}
body[data-theme="dark"] .nav-stack a.active,
body[data-theme="dark"] .nav-stack a:hover {
    color: color-mix(in srgb, var(--accent) 34%, #fff);
    background: color-mix(in srgb, var(--accent) 15%, rgba(255,255,255,.08));
    border-color: color-mix(in srgb, var(--accent) 22%, rgba(255,255,255,.12));
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 72%, transparent), inset 0 1px 0 rgba(255,255,255,.08);
}
body[data-theme="dark"] .nav-stack a.active i,
body[data-theme="dark"] .nav-stack a:hover i {
    color: var(--accent);
}
.nav-stack a:hover {
    transform: translateX(2px);
}
.nav-stack a[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.sidebar-foot {
    margin-top: auto;
    color: #647386;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(100,115,134,.16);
    box-shadow: 0 12px 28px rgba(16,23,34,.06);
}
body[data-theme="dark"] .sidebar-foot {
    color: rgba(255,255,255,.58);
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.08);
    box-shadow: none;
}

.app-main { min-width: 0; }
.topbar {
    height: 62px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,.55);
    background: rgba(255,255,255,.66);
    backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 5;
}
body[data-theme="dark"] .topbar {
    border-bottom-color: rgba(154,170,190,.14);
    background: rgba(11,17,28,.78);
}
.topbar-title {
    flex: 1;
    display: grid;
}
.topbar-title span {
    font-weight: 800;
    font-size: 1.02rem;
}
.topbar-title small { color: var(--muted); }

.icon-button {
    display: grid;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 12px;
    background: rgba(255,255,255,.78);
    place-items: center;
    padding: 10px;
    box-shadow: 0 12px 28px rgba(16,23,34,.08);
}
body[data-theme="dark"] .icon-button {
    border-color: rgba(154,170,190,.18);
    background: rgba(18,27,42,.82);
    box-shadow: 0 12px 28px rgba(0,0,0,.22);
}
.icon-button i { color: var(--ink); }
[data-sidebar-toggle] { display: none; }
.collapse-button { display: grid; }
body.sidebar-collapsed .collapse-button i,
html.sidebar-collapsed-preset .collapse-button i { transform: rotate(180deg); }
body[data-tablet-mode="true"] [data-sidebar-toggle],
body[data-tablet-mode="true"] [data-sidebar-collapse] {
    display: none;
}

.theme-picker {
    position: relative;
}
.theme-picker-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 30;
    width: min(360px, calc(100vw - 28px));
    padding: 16px;
    border: 1px solid rgba(100,115,134,.16);
    border-radius: 18px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 24px 70px rgba(16,23,34,.18);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
}
body[data-theme="dark"] .theme-picker-panel {
    border-color: rgba(154,170,190,.18);
    background: rgba(18,27,42,.96);
    box-shadow: 0 24px 70px rgba(0,0,0,.36);
}
.theme-picker.is-open .theme-picker-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.theme-picker-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.theme-picker-head strong {
    font-size: .95rem;
}
.theme-picker-head small,
.theme-gradient-toggle small {
    color: var(--muted);
    font-weight: 700;
}
.theme-swatch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.theme-swatch-grid button {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid rgba(100,115,134,.16);
    border-radius: 12px;
    background: rgba(248,250,252,.78);
    color: var(--ink);
    font-size: .8rem;
    font-weight: 800;
    text-align: left;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
body[data-theme="dark"] .theme-swatch-grid button {
    border-color: rgba(154,170,190,.16);
    background: rgba(11,17,28,.68);
}
.theme-swatch-grid button:hover,
.theme-swatch-grid button.is-active {
    border-color: color-mix(in srgb, var(--accent) 48%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, rgba(255,255,255,.78));
    transform: translateY(-1px);
}
body[data-theme="dark"] .theme-swatch-grid button:hover,
body[data-theme="dark"] .theme-swatch-grid button.is-active {
    background: color-mix(in srgb, var(--accent) 16%, rgba(18,27,42,.9));
}
.theme-swatch-grid i {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--swatch-a), var(--swatch-b));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), 0 8px 18px color-mix(in srgb, var(--swatch-a) 25%, transparent);
}
.theme-swatch-grid [data-accent-theme="green-blue"] { --swatch-a: #00a878; --swatch-b: #00a3ff; }
.theme-swatch-grid [data-accent-theme="blue-purple"] { --swatch-a: #246bfe; --swatch-b: #7c3aed; }
.theme-swatch-grid [data-accent-theme="red-yellow"] { --swatch-a: #ef4444; --swatch-b: #f59e0b; }
.theme-swatch-grid [data-accent-theme="deep-blue"] { --swatch-a: #0f2f78; --swatch-b: #1d4ed8; }
.theme-swatch-grid [data-accent-theme="light-blue"] { --swatch-a: #38bdf8; --swatch-b: #7dd3fc; }
.theme-swatch-grid [data-accent-theme="deep-purple"] { --swatch-a: #4c1d95; --swatch-b: #7c3aed; }
.theme-swatch-grid [data-accent-theme="light-purple"] { --swatch-a: #c084fc; --swatch-b: #e9d5ff; }
.theme-swatch-grid [data-accent-theme="deep-orange"] { --swatch-a: #9a3412; --swatch-b: #ea580c; }
.theme-swatch-grid [data-accent-theme="light-orange"] { --swatch-a: #f97316; --swatch-b: #fed7aa; }
.theme-swatch-grid [data-accent-theme="teal-coral"] { --swatch-a: #0f766e; --swatch-b: #fb7185; }
.theme-swatch-grid [data-accent-theme="slate-gold"] { --swatch-a: #334155; --swatch-b: #f59e0b; }
.theme-gradient-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(100,115,134,.14);
    background: rgba(248,250,252,.74);
}
body[data-theme="dark"] .theme-gradient-toggle {
    border-color: rgba(154,170,190,.14);
    background: rgba(11,17,28,.62);
}
.theme-gradient-toggle span {
    display: grid;
    gap: 2px;
}
.theme-text-toggle {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(100,115,134,.14);
    background: rgba(248,250,252,.74);
}
body[data-theme="dark"] .theme-text-toggle {
    border-color: rgba(154,170,190,.14);
    background: rgba(11,17,28,.62);
}
.theme-text-toggle > span {
    display: grid;
    gap: 2px;
}
.theme-text-toggle small {
    color: var(--muted);
    font-weight: 700;
}
.theme-text-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}
.theme-text-options button {
    min-height: 34px;
    border: 1px solid rgba(100,115,134,.16);
    border-radius: 10px;
    background: rgba(255,255,255,.72);
    color: var(--ink);
    font-size: .76rem;
    font-weight: 850;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}
body[data-theme="dark"] .theme-text-options button {
    border-color: rgba(154,170,190,.16);
    background: rgba(18,27,42,.78);
}
.theme-text-options button.is-active,
.theme-text-options button:hover {
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    background: color-mix(in srgb, var(--accent) 13%, rgba(255,255,255,.72));
}
body[data-theme="dark"] .theme-text-options button.is-active,
body[data-theme="dark"] .theme-text-options button:hover {
    background: color-mix(in srgb, var(--accent) 18%, rgba(18,27,42,.78));
}
.theme-gradient-toggle input {
    appearance: none;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(100,115,134,.18);
    background: #cbd5e1;
    position: relative;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}
.theme-gradient-toggle input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 6px 14px rgba(16,23,34,.18);
    transition: transform .16s ease;
}
.theme-gradient-toggle input:checked {
    border-color: color-mix(in srgb, var(--accent) 44%, transparent);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.theme-gradient-toggle input:checked::after {
    transform: translateX(20px);
}

.content-wrap {
    padding: 20px 28px 28px;
    max-width: 1440px;
    margin: 0 auto;
}
.flash-stack {
    position: fixed;
    top: 74px;
    right: 18px;
    z-index: 1080;
    display: grid;
    gap: 10px;
    width: min(420px, calc(100vw - 36px));
    pointer-events: none;
}
.flash-stack .alert {
    margin: 0;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .18);
    border: 1px solid rgba(255,255,255,.72);
    overflow-wrap: anywhere;
    pointer-events: auto;
}
.page-head {
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,.62);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,255,255,.58)),
        linear-gradient(135deg, rgba(0,168,120,.08), rgba(36,107,254,.08));
    box-shadow: var(--shadow);
}
body[data-theme="dark"] .page-head {
    border-color: rgba(154,170,190,.16);
    background:
        linear-gradient(135deg, rgba(18,27,42,.86), rgba(18,27,42,.70)),
        linear-gradient(135deg, rgba(39,216,161,.10), rgba(106,162,255,.10));
}
.section-title,
.device-row,
.device-actions,
.topbar-live,
.live-tools,
.live-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.eyebrow {
    margin: 0 0 4px;
    color: var(--accent-2);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 {
    font-size: clamp(2rem, 4vw, 3.1rem);
    font-weight: 850;
    line-height: 1;
}
h2 {
    font-size: 1.1rem;
    font-weight: 800;
}

.btn {
    border-radius: 12px;
    font-weight: 750;
    letter-spacing: 0;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn-primary,
.btn-success {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--accent) 88%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--accent) 82%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--accent) 82%, #000);
    --bs-btn-focus-shadow-rgb: 0, 0, 0;
}
.btn-info {
    --bs-btn-bg: var(--cyan);
    --bs-btn-border-color: var(--cyan);
    --bs-btn-hover-bg: color-mix(in srgb, var(--cyan) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--cyan) 88%, #000);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}
.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 25%, transparent);
}
.btn-success,
.btn-info {
    color: #fff;
    box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 18%, transparent);
}
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    color: #fff;
}
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-primary,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-primary:hover,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-primary:focus,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-primary:active,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-primary,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-primary:hover,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-primary:focus,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-primary:active,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-primary,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-primary:hover,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-primary:focus,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-primary:active,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-primary,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-primary:hover,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-primary:focus,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-primary:active,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-primary,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-primary:hover,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-primary:focus,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-primary:active {
    color: #07111f;
}
body[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: color-mix(in srgb, var(--accent) 28%, transparent);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 24%, transparent);
}
body[data-theme="dark"] .btn-primary:hover,
body[data-theme="dark"] .btn-primary:focus,
body[data-theme="dark"] .btn-primary:active {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, #fff), color-mix(in srgb, var(--accent-2) 88%, #fff));
    border-color: color-mix(in srgb, var(--accent) 34%, transparent);
    filter: none;
}
.btn-primary:hover {
    border-color: transparent;
    filter: brightness(.96);
}
.btn-dark {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 86%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--accent) 86%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--accent) 80%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--accent) 80%, #000);
    border-color: transparent;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 74%, #162033), color-mix(in srgb, var(--accent-2) 68%, #243b63));
    box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 18%, transparent);
    color: #fff;
}
.btn-dark:hover,
.btn-dark:focus,
.btn-dark:active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, #162033), color-mix(in srgb, var(--accent-2) 74%, #243b63));
}
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-dark,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-dark:hover,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-dark:focus,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-dark:active,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-dark,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-dark:hover,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-dark:focus,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-dark:active,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-dark,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-dark:hover,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-dark:focus,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-dark:active,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-dark,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-dark:hover,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-dark:focus,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-dark:active,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-dark,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-dark:hover,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-dark:focus,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-dark:active,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-success,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-success,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-success,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-success,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-success,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .btn-info,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .btn-info,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .btn-info,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .btn-info,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .btn-info {
    color: #07111f;
}
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .brand span,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .brand-mark,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .brand span,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .brand-mark,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .brand span,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .brand-mark,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .brand span,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .brand-mark,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .brand span,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .brand-mark {
    color: #07111f;
}
html[data-button-text="black"] .btn-primary,
html[data-button-text="black"] .btn-primary:hover,
html[data-button-text="black"] .btn-primary:focus,
html[data-button-text="black"] .btn-primary:active,
html[data-button-text="black"] .btn-dark,
html[data-button-text="black"] .btn-dark:hover,
html[data-button-text="black"] .btn-dark:focus,
html[data-button-text="black"] .btn-dark:active,
html[data-button-text="black"] .btn-success,
html[data-button-text="black"] .btn-info,
html[data-button-text="black"] .brand span,
html[data-button-text="black"] .brand-mark,
html[data-button-text="black"] body[data-theme="dark"] .control-card .btn-dark,
html[data-button-text="black"] body[data-theme="dark"] .device-actions .btn-dark {
    color: #07111f !important;
}
html[data-button-text="white"] .btn-primary,
html[data-button-text="white"] .btn-primary:hover,
html[data-button-text="white"] .btn-primary:focus,
html[data-button-text="white"] .btn-primary:active,
html[data-button-text="white"] .btn-dark,
html[data-button-text="white"] .btn-dark:hover,
html[data-button-text="white"] .btn-dark:focus,
html[data-button-text="white"] .btn-dark:active,
html[data-button-text="white"] .btn-success,
html[data-button-text="white"] .btn-info,
html[data-button-text="white"] .brand span,
html[data-button-text="white"] .brand-mark,
html[data-button-text="white"] body[data-theme="dark"] .control-card .btn-dark,
html[data-button-text="white"] body[data-theme="dark"] .device-actions .btn-dark {
    color: #fff !important;
}
body[data-theme="dark"] .control-card .btn-dark,
body[data-theme="dark"] .device-actions .btn-dark {
    --bs-btn-focus-shadow-rgb: 0, 0, 0;
    border-color: transparent;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 54%, #253d68), color-mix(in srgb, var(--accent-2) 42%, #17243c));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 18%, transparent);
    color: #f8fbff;
}
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .control-card .btn-dark,
html[data-accent-theme="slate-gold"] body[data-theme="dark"] .device-actions .btn-dark,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .control-card .btn-dark,
html[data-accent-theme="light-purple"] body[data-theme="dark"] .device-actions .btn-dark,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .control-card .btn-dark,
html[data-accent-theme="light-blue"] body[data-theme="dark"] .device-actions .btn-dark,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .control-card .btn-dark,
html[data-accent-theme="light-orange"] body[data-theme="dark"] .device-actions .btn-dark,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .control-card .btn-dark,
html[data-accent-theme="teal-coral"] body[data-theme="dark"] .device-actions .btn-dark {
    color: #07111f;
}
body[data-theme="dark"] .control-card .btn-dark:hover,
body[data-theme="dark"] .device-actions .btn-dark:hover,
body[data-theme="dark"] .control-card .btn-dark:focus,
body[data-theme="dark"] .device-actions .btn-dark:focus,
body[data-theme="dark"] .control-card .btn-dark:focus-visible,
body[data-theme="dark"] .device-actions .btn-dark:focus-visible,
body[data-theme="dark"] .control-card .btn-dark:active,
body[data-theme="dark"] .device-actions .btn-dark:active {
    border-color: transparent;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 60%, #2b4778), color-mix(in srgb, var(--accent-2) 48%, #1b2c49));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 16%, transparent);
    outline: none;
}
body[data-theme="dark"] .control-card .btn-dark::before,
body[data-theme="dark"] .device-actions .btn-dark::before {
    display: none;
}
.btn-outline-dark,
.btn-outline-secondary {
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    border-color: rgba(100,115,134,.26);
    background: rgba(255,255,255,.62);
    color: var(--ink);
}
body[data-theme="dark"] .btn-outline-dark,
body[data-theme="dark"] .btn-outline-secondary {
    border-color: rgba(154,170,190,.24);
    background: rgba(18,27,42,.76);
    color: var(--ink);
}
.btn-outline-dark:hover,
.btn-outline-secondary:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 16%, transparent);
}
body[data-theme="dark"] .btn-outline-dark:hover,
body[data-theme="dark"] .btn-outline-secondary:hover {
    color: #fff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 42%, rgba(238,245,255,.12)), color-mix(in srgb, var(--accent-2) 34%, rgba(238,245,255,.12)));
    border-color: color-mix(in srgb, var(--accent) 34%, rgba(238,245,255,.22));
}
html[data-button-glow="off"] .btn,
html[data-button-glow="off"] .icon-button,
html[data-button-glow="off"] .brand span,
html[data-button-glow="off"] .brand-mark,
html[data-button-glow="off"] .nav-stack a.active,
html[data-button-glow="off"] .nav-stack a:hover,
html[data-button-glow="off"] .theme-swatch-grid i,
html[data-button-glow="off"] .theme-picker-panel,
html[data-button-glow="off"] .theme-gradient-toggle input::after,
html[data-button-glow="off"] .form-control:focus,
html[data-button-glow="off"] .form-select:focus,
html[data-button-glow="off"] .form-check-input:focus,
html[data-button-glow="off"] .sticky-save .btn {
    box-shadow: none !important;
}
.form-control,
.form-select {
    border-radius: 12px;
    border-color: rgba(100,115,134,.22);
    background-color: rgba(255,255,255,.78);
    min-height: 42px;
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.54);
}
body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select {
    border-color: rgba(154,170,190,.22);
    background-color: rgba(15,23,37,.92);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
body[data-theme="dark"] .form-control::placeholder {
    color: rgba(154,170,190,.68);
}
body[data-theme="dark"] .table {
    --bs-table-color: var(--ink);
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(154,170,190,.12);
    --bs-table-striped-color: var(--ink);
    --bs-table-hover-color: var(--ink);
}
.form-control:focus,
.form-select:focus {
    border-color: rgba(0,163,255,.62);
    box-shadow: 0 0 0 .22rem rgba(0,163,255,.14);
}

.topbar-live,
.live-tools {
    justify-content: flex-end;
    flex-wrap: wrap;
}
.topbar-live {
    gap: 10px;
}
.topbar-live form {
    margin: 0;
}
.topbar > form {
    margin: 0;
}
.theme-toggle {
    width: 38px;
    height: 38px;
}
.live-pill {
    justify-content: flex-start;
    gap: 8px;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid rgba(0,168,120,.18);
    border-radius: 999px;
    background: rgba(255,255,255,.78);
    color: var(--muted);
}
body[data-theme="dark"] .live-pill {
    border-color: rgba(39,216,161,.22);
    background: rgba(18,27,42,.78);
}
.live-pill i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(0,168,120,.12), 0 0 18px rgba(0,168,120,.6);
}
.live-pill b {
    color: var(--ink);
    font-size: .86rem;
}
.live-pill small {
    font-size: .78rem;
}
.live-pill[data-state="error"] i {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(180,35,24,.12);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}
.dashboard-section {
    min-width: 0;
}
.dashboard-section.width-full { grid-column: span 12; }
.dashboard-section.width-three-quarter,
.dashboard-section.width-wide { grid-column: span 9; }
.dashboard-section.width-half { grid-column: span 6; }
.dashboard-section.width-quarter { grid-column: span 3; }
.dashboard-section.width-third { grid-column: span 4; }
.dashboard-section .metric-grid,
.dashboard-section .safety-band {
    margin-bottom: 0;
}
.metric,
.device-list,
.sensor-tile,
.login-card,
.settings-panel,
.safety-band {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
body[data-theme="dark"] .metric,
body[data-theme="dark"] .device-list,
body[data-theme="dark"] .sensor-tile,
body[data-theme="dark"] .login-card,
body[data-theme="dark"] .settings-panel,
body[data-theme="dark"] .safety-band {
    border-color: rgba(154,170,190,.16);
}
.control-box {
    padding: 16px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,255,255,.70)),
        linear-gradient(135deg, rgba(36,107,254,.10), rgba(0,168,120,.08));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
body[data-theme="dark"] .control-box {
    border-color: rgba(154,170,190,.16);
    background:
        linear-gradient(135deg, rgba(18,27,42,.92), rgba(18,27,42,.78)),
        linear-gradient(135deg, rgba(106,162,255,.12), rgba(39,216,161,.08));
}
.control-box-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-flow: dense;
    grid-auto-rows: 8px;
    gap: 10px;
    align-items: start;
    contain: layout;
}
.control-box-grid > * {
    grid-column: span 3;
    min-width: 0;
}
.dashboard-section.width-three-quarter .control-box-grid > *,
.dashboard-section.width-wide .control-box-grid > * {
    grid-column: span 4;
}
.dashboard-section.width-half .control-box-grid > * {
    grid-column: span 6;
}
.dashboard-section.width-quarter .control-box-grid > *,
.dashboard-section.width-third .control-box-grid > *,
.control-box-grid > .empty-state {
    grid-column: 1 / -1;
}
.control-box-grid > :only-child {
    grid-column: 1 / -1;
}
.dashboard-section.width-full .control-box-grid > :last-child:nth-child(4n + 1):not(.app-security-card),
.dashboard-section.width-three-quarter .control-box-grid > :last-child:nth-child(3n + 1):not(.app-security-card),
.dashboard-section.width-wide .control-box-grid > :last-child:nth-child(3n + 1):not(.app-security-card),
.dashboard-section.width-half .control-box-grid > :last-child:nth-child(2n + 1):not(.app-security-card) {
    grid-column: 1 / -1;
}
.dashboard-section.width-full .control-box-grid > :nth-last-child(2):nth-child(4n + 1):not(.app-security-card),
.dashboard-section.width-full .control-box-grid > :nth-last-child(2):nth-child(4n + 1):not(.app-security-card) + :not(.app-security-card),
.dashboard-section.width-three-quarter .control-box-grid > :nth-last-child(2):nth-child(3n + 1):not(.app-security-card),
.dashboard-section.width-three-quarter .control-box-grid > :nth-last-child(2):nth-child(3n + 1):not(.app-security-card) + :not(.app-security-card),
.dashboard-section.width-wide .control-box-grid > :nth-last-child(2):nth-child(3n + 1):not(.app-security-card),
.dashboard-section.width-wide .control-box-grid > :nth-last-child(2):nth-child(3n + 1):not(.app-security-card) + :not(.app-security-card) {
    grid-column: span 6;
}
.dashboard-section.width-full .control-box-grid > .app-security-card {
    grid-column: span 3;
}
.dashboard-section.width-three-quarter .control-box-grid > .app-security-card,
.dashboard-section.width-wide .control-box-grid > .app-security-card {
    grid-column: span 4;
}
.dashboard-section.width-half .control-box-grid > .app-security-card {
    grid-column: span 6;
}
.dashboard-section.width-full .control-box-grid > .widget-span-1 {
    grid-column: span 3 !important;
}
.dashboard-section.width-full .control-box-grid > .widget-span-2 {
    grid-column: span 6 !important;
}
.dashboard-section.width-full .control-box-grid > .widget-span-3 {
    grid-column: span 9 !important;
}
.dashboard-section.width-full .control-box-grid > .widget-span-4,
.dashboard-section.width-full .control-box-grid > .widget-span-4:only-child {
    grid-column: 1 / -1 !important;
}
.dashboard-section.width-three-quarter .control-box-grid > .widget-span-1,
.dashboard-section.width-wide .control-box-grid > .widget-span-1 {
    grid-column: span 4 !important;
}
.dashboard-section.width-three-quarter .control-box-grid > .widget-span-2,
.dashboard-section.width-wide .control-box-grid > .widget-span-2 {
    grid-column: span 8 !important;
}
.dashboard-section.width-three-quarter .control-box-grid > .widget-span-3,
.dashboard-section.width-three-quarter .control-box-grid > .widget-span-4,
.dashboard-section.width-wide .control-box-grid > .widget-span-3,
.dashboard-section.width-wide .control-box-grid > .widget-span-4 {
    grid-column: 1 / -1 !important;
}
.dashboard-section.width-half .control-box-grid > .widget-span-1 {
    grid-column: span 6 !important;
}
.dashboard-section.width-half .control-box-grid > .widget-span-2,
.dashboard-section.width-half .control-box-grid > .widget-span-3,
.dashboard-section.width-half .control-box-grid > .widget-span-4,
.dashboard-section.width-quarter .control-box-grid > .widget-span-1,
.dashboard-section.width-quarter .control-box-grid > .widget-span-2,
.dashboard-section.width-quarter .control-box-grid > .widget-span-3,
.dashboard-section.width-quarter .control-box-grid > .widget-span-4,
.dashboard-section.width-third .control-box-grid > .widget-span-1,
.dashboard-section.width-third .control-box-grid > .widget-span-2,
.dashboard-section.width-third .control-box-grid > .widget-span-3,
.dashboard-section.width-third .control-box-grid > .widget-span-4 {
    grid-column: 1 / -1 !important;
}
.control-box-grid .thermostat-card {
    border: 0;
    border-radius: 16px;
    height: auto;
}
.control-box-grid .control-card,
.control-box-grid .sensor-tile {
    height: auto;
}
.control-card {
    position: relative;
    container-type: inline-size;
    display: grid;
    gap: 12px;
    padding: 13px 10px;
    border: 1px solid rgba(255,255,255,.70);
    border-radius: 14px;
    background: rgba(255,255,255,.68);
}
body[data-theme="dark"] .control-card {
    border-color: rgba(154,170,190,.15);
    background: rgba(15,23,37,.72);
}
.control-card.is-jammed,
.device-row.is-jammed {
    border-color: rgba(239,68,68,.42);
    background:
        linear-gradient(135deg, rgba(255,255,255,.78), rgba(255,255,255,.64)),
        linear-gradient(135deg, rgba(239,68,68,.18), rgba(245,158,11,.08));
}
body[data-theme="dark"] .control-card.is-jammed,
body[data-theme="dark"] .device-row.is-jammed {
    border-color: rgba(251,113,133,.42);
    background:
        linear-gradient(135deg, rgba(18,27,42,.86), rgba(18,27,42,.72)),
        linear-gradient(135deg, rgba(251,113,133,.22), rgba(251,191,36,.08));
}
.control-card.is-jammed {
    box-shadow: 0 16px 36px rgba(239,68,68,.14);
}
.app-security-card {
    gap: 9px;
    padding-block: 11px;
    border-color: rgba(36,107,254,.20);
    background:
        linear-gradient(135deg, rgba(255,255,255,.80), rgba(255,255,255,.68)),
        linear-gradient(135deg, rgba(36,107,254,.12), rgba(0,168,120,.08));
}
body[data-theme="dark"] .app-security-card {
    border-color: rgba(106,162,255,.24);
    background:
        linear-gradient(135deg, rgba(18,27,42,.86), rgba(18,27,42,.74)),
        linear-gradient(135deg, rgba(106,162,255,.14), rgba(39,216,161,.08));
}
.app-security-card.security-arm.is-active {
    border-color: rgba(239,68,68,.34);
    background:
        linear-gradient(135deg, rgba(255,255,255,.80), rgba(255,255,255,.66)),
        linear-gradient(135deg, rgba(239,68,68,.18), rgba(245,158,11,.08));
}
.app-security-card.security-disarm.is-active {
    border-color: rgba(16,185,129,.34);
}
.app-security-card .control-state-icon {
    color: #246bfe;
    background: rgba(36,107,254,.10);
}
.app-security-card.security-arm.is-active .control-state-icon {
    color: #ef4444;
    background: rgba(239,68,68,.12);
}
.security-mode-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(15,23,42,.06);
    font-size: .72rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}
.device-row.is-jammed {
    box-shadow: inset 4px 0 0 rgba(239,68,68,.62);
}
.control-card > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}
.control-icon-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
}
.control-icon-line.title-lock {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    row-gap: 8px;
    column-gap: 8px;
}
.control-icon-line.title-lock > .door-state-badge {
    justify-self: center;
    margin-inline: 0;
}
.control-icon-line.title-lock > .control-status-wrap {
    justify-self: end;
    margin-left: auto;
}
.control-icon-line.title-switch {
    display: flex;
    row-gap: 8px;
}
.control-icon-stack {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
}
.control-card .control-state-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--accent-2);
    background: rgba(36,107,254,.10);
}
.control-card strong,
.control-card small {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.control-card small {
    color: var(--muted);
}
.metric {
    min-height: 82px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas:
        "icon label"
        "icon value";
    column-gap: 13px;
    row-gap: 3px;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.metric.metric-alerts {
    overflow: visible;
    z-index: 2;
}
.metric.metric-alerts.is-open {
    z-index: 20;
}
.metric::after {
    display: none;
}
.metric > i,
.metric-icon-button {
    grid-area: icon;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    align-self: center;
    border-radius: 13px;
    color: var(--accent);
    background: linear-gradient(135deg, rgba(0,168,120,.16), rgba(0,163,255,.13));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
body[data-theme="dark"] .metric > i,
body[data-theme="dark"] .metric-icon-button {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.metric-icon-button {
    border: 0;
    padding: 0;
    cursor: pointer;
}
.metric-icon-button i {
    pointer-events: none;
}
.metric-icon-button:focus-visible {
    outline: 2px solid rgba(49, 130, 206, .38);
    outline-offset: 4px;
}
.metric span,
.section-title span,
.device-row small,
.sensor-tile span,
.sensor-tile small {
    color: var(--muted);
}
.metric span {
    grid-area: label;
    align-self: end;
    font-size: .82rem;
    font-weight: 750;
}
.metric strong {
    grid-area: value;
    align-self: start;
    font-size: 1.72rem;
    line-height: 1;
    font-weight: 850;
}
.metric.is-warn strong { color: var(--warn); }
.metric.is-danger strong { color: var(--danger); }
.metric.is-warn > i { color: var(--warn); background: rgba(245,158,11,.14); }
.metric.is-danger > i { color: var(--danger); background: rgba(239,68,68,.13); }
.metric.is-warn .metric-icon-button { color: var(--warn); background: rgba(245,158,11,.14); }
.metric.is-danger .metric-icon-button { color: var(--danger); background: rgba(239,68,68,.13); }
.alert-summary-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 50;
    width: min(360px, calc(100vw - 36px));
    padding: 12px;
    border: 1px solid rgba(239,68,68,.20);
    border-radius: 14px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 22px 54px rgba(15,23,42,.20);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
}
body[data-theme="dark"] .alert-summary-popover {
    border-color: rgba(251,113,133,.24);
    background: rgba(18,27,42,.98);
    box-shadow: 0 22px 54px rgba(0,0,0,.40);
}
.metric-alerts.is-open .alert-summary-popover {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.alert-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 2px 9px;
    border-bottom: 1px solid rgba(100,115,134,.14);
}
body[data-theme="dark"] .alert-summary-head {
    border-bottom-color: rgba(154,170,190,.14);
}
.alert-summary-head span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.alert-summary-head strong {
    color: var(--danger);
    font-size: .82rem;
    line-height: 1;
}
.alert-summary-list {
    display: grid;
    gap: 7px;
    padding-top: 9px;
}
.alert-summary-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(239,68,68,.07);
}
body[data-theme="dark"] .alert-summary-item {
    background: rgba(251,113,133,.10);
}
.alert-summary-item > i,
.alert-summary-empty > i {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--danger);
    background: rgba(239,68,68,.12);
}
.alert-summary-item strong,
.alert-summary-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alert-summary-item strong {
    font-size: .86rem;
    line-height: 1.15;
}
.alert-summary-item small,
.alert-summary-more,
.alert-summary-empty span {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 700;
}
.alert-summary-more {
    padding: 3px 8px 0;
}
.alert-summary-empty {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-top: 11px;
}
.control-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(7, 17, 31, .46);
    backdrop-filter: blur(10px);
}
.control-confirm-backdrop.is-open {
    display: flex;
}
.control-confirm-card {
    width: min(360px, 100%);
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 18px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 24px 70px rgba(7,17,31,.28);
    color: var(--ink);
}
body[data-theme="dark"] .control-confirm-card {
    border-color: rgba(154,170,190,.18);
    background: rgba(18,27,42,.98);
}
.control-confirm-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--accent-2);
    background: rgba(36,107,254,.12);
}
.control-confirm-card strong {
    display: block;
    font-size: 1.05rem;
}
.control-confirm-card p {
    margin: 4px 0 0;
    color: var(--muted);
    line-height: 1.35;
}
.control-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 2px;
}

.cloud-key-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(7, 17, 31, .54);
    backdrop-filter: blur(10px);
}
.cloud-key-modal-backdrop.is-open {
    display: flex;
}
.cloud-key-modal-card {
    width: min(620px, 100%);
    display: grid;
    gap: 18px;
    padding: 24px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 18px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 24px 70px rgba(7,17,31,.30);
    color: var(--ink);
}
body[data-theme="dark"] .cloud-key-modal-card {
    border-color: rgba(154,170,190,.18);
    background: rgba(18,27,42,.98);
}
.cloud-key-modal-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: var(--accent);
    background: rgba(0,168,120,.14);
    font-size: 1.35rem;
}
.cloud-key-modal-copy {
    display: grid;
    gap: 8px;
}
.cloud-key-modal-copy h2,
.cloud-key-modal-copy p {
    margin: 0;
}
.cloud-key-modal-copy p {
    color: var(--muted);
}
.cloud-key-modal-copy code {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    overflow-wrap: anywhere;
    background: rgba(15,23,42,.08);
    border: 1px solid var(--line);
    color: var(--ink);
}
.cloud-key-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}
.control-confirm-actions .btn {
    min-height: 44px;
}

.safety-band {
    padding: 16px;
    margin-bottom: 16px;
}
.safety-band.clear {
    border-color: rgba(0,168,120,.24);
    background:
        linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,255,255,.70)),
        linear-gradient(135deg, rgba(0,168,120,.10), rgba(0,163,255,.08));
}
body[data-theme="dark"] .safety-band.clear {
    border-color: rgba(39,216,161,.22);
    background:
        linear-gradient(135deg, rgba(18,27,42,.90), rgba(18,27,42,.72)),
        linear-gradient(135deg, rgba(39,216,161,.10), rgba(56,199,255,.08));
}
.safety-band.danger {
    border-color: rgba(239,68,68,.45);
    background:
        linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,255,255,.70)),
        linear-gradient(135deg, rgba(239,68,68,.16), rgba(245,158,11,.10));
    box-shadow: 0 22px 64px rgba(239,68,68,.18);
}
body[data-theme="dark"] .safety-band.danger {
    border-color: rgba(251,113,133,.42);
    background:
        linear-gradient(135deg, rgba(18,27,42,.90), rgba(18,27,42,.72)),
        linear-gradient(135deg, rgba(251,113,133,.16), rgba(251,191,36,.08));
}
.safety-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.safety-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dashboard-section.width-quarter .safety-head,
.dashboard-section.width-third .safety-head {
    display: grid;
    gap: 7px;
}
.dashboard-section.width-quarter .safety-head h2,
.dashboard-section.width-third .safety-head h2 {
    font-size: .98rem;
}
.dashboard-section.width-quarter .safety-head .eyebrow,
.dashboard-section.width-third .safety-head .eyebrow {
    display: none;
}
.safety-head h2 i { color: var(--accent); }
.safety-band.danger .safety-head h2 i { color: var(--danger); }
.safety-head > span {
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(0,168,120,.12);
    color: var(--accent);
    font-weight: 800;
    font-size: .78rem;
    white-space: nowrap;
}
.safety-band.danger .safety-head > span {
    background: rgba(239,68,68,.12);
    color: var(--danger);
}
.safety-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.safety-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.70);
    border-radius: 14px;
    background: rgba(255,255,255,.66);
}
body[data-theme="dark"] .safety-card {
    border-color: rgba(154,170,190,.15);
    background: rgba(15,23,37,.72);
}
.safety-card-compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 9px 10px;
}
.safety-card-compact strong {
    align-self: center;
    min-width: 0;
    font-size: .88rem;
    overflow-wrap: anywhere;
    white-space: normal;
}
.safety-icons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.safety-status {
    display: inline-grid;
    justify-items: center;
    gap: 3px;
    min-width: 30px;
}
.safety-status small {
    color: var(--muted);
    font-size: .56rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .04em;
}
.safety-icons i {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(0,168,120,.12);
    color: var(--accent);
    font-size: .82rem;
}
.safety-icons .safety-state-on {
    background: rgba(239,68,68,.13);
    color: var(--danger);
    box-shadow: 0 10px 22px rgba(239,68,68,.13);
}
.safety-icons .safety-state-missing {
    background: rgba(100,115,134,.10);
    color: rgba(100,115,134,.48);
}
.safety-card > i {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(0,168,120,.12);
    color: var(--accent);
    flex: 0 0 42px;
}
.safety-card.active {
    border-color: rgba(239,68,68,.45);
    background: rgba(255,248,247,.78);
}
body[data-theme="dark"] .safety-card.active {
    background: rgba(251,113,133,.12);
}
.safety-card.active > i {
    background: rgba(239,68,68,.12);
    color: var(--danger);
}
.safety-card div {
    min-width: 0;
    display: grid;
}
.safety-card strong,
.safety-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.safety-card-compact strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}
.safety-card small { color: var(--muted); }

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
    gap: 26px;
}
.section-title {
    margin-bottom: 12px;
    padding-inline: 4px;
}
.device-list {
    overflow: hidden;
    padding: 16px;
}
.thermostat-card {
    position: relative;
    isolation: isolate;
    container-type: inline-size;
    padding: 0;
    border-bottom: 0;
    overflow: visible;
    background: transparent;
    color: #f8fbff;
}
.battery-pill {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 24px;
    background: transparent;
    border: 2px solid currentColor;
    border-radius: 5px;
    filter: drop-shadow(0 7px 12px rgba(16,23,34,.16));
    vertical-align: middle;
    line-height: 1;
}
.battery-pill::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 7px;
    width: 4px;
    height: 8px;
    border-radius: 0 3px 3px 0;
    background: currentColor;
}
.battery-pill b {
    display: block;
    position: static;
    z-index: 1;
    color: currentColor;
    font-size: 9.5px;
    font-weight: 950;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: none;
    transform: translateY(0.5px);
}
.battery-pill.battery-good { color: #10b981; }
.battery-pill.battery-warn { color: #f59e0b; }
.battery-pill.battery-low { color: #ef4444; }
.device-row {
    position: relative;
}
.device-row.has-battery {
    padding-right: 17px;
}
.control-card.has-battery {
    padding-top: 13px;
}
.thermostat-card.has-battery {
    padding-bottom: 0;
}
.thermostat-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}
.thermostat-glow {
    display: none;
}
.thermostat-summary,
.thermostat-actions,
.thermostat-actions form,
.thermostat-meta,
.linked-sensors {
    display: flex;
    align-items: center;
    gap: 10px;
}
.thermostat-summary {
    justify-content: space-between;
    position: relative;
    z-index: 1;
    gap: 18px;
}
.thermostat-summary > div:first-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.thermostat-summary strong {
    display: flex;
    align-items: center;
    gap: 9px;
}
.thermostat-summary strong i {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #7dd3fc;
    background: rgba(255,255,255,.12);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.thermostat-summary small,
.thermostat-meta,
.linked-sensors {
    color: rgba(232,240,252,.72);
}
.thermostat-temp {
    text-align: right;
    min-width: 120px;
}
.thermostat-temp-main {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    white-space: nowrap;
}
.thermostat-current-temp {
    display: block;
    color: #ffffff;
    font-size: 2.7rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 12px 30px rgba(0,0,0,.25);
}
.thermostat-temp-main .battery-pill {
    flex: 0 0 auto;
}
.thermostat-temp small {
    display: block;
    margin-top: 4px;
    color: rgba(232,240,252,.78);
    font-weight: 700;
}
.thermostat-meta {
    flex-wrap: wrap;
    margin-top: 16px;
    font-size: .88rem;
    position: relative;
    z-index: 1;
}
.thermostat-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border-radius: 999px;
    color: rgba(248,251,255,.88);
    background: rgba(255,255,255,.10);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
    backdrop-filter: blur(8px);
}
.thermostat-chip i {
    color: #67e8f9;
}
.thermostat-chip.chip-action {
    background: rgba(16,185,129,.18);
}
.thermostat-chip.chip-action i {
    color: #86efac;
}
.thermostat-chip.action-heating,
.thermostat-chip.action-heat {
    color: #fff7ed;
    background: rgba(239,68,68,.24);
    box-shadow: inset 0 0 0 1px rgba(252,165,165,.28), 0 10px 26px rgba(239,68,68,.16);
}
.thermostat-chip.action-heating i,
.thermostat-chip.action-heat i {
    color: #fb7185;
}
.thermostat-chip.action-cooling,
.thermostat-chip.action-cool {
    color: #eff6ff;
    background: rgba(59,130,246,.22);
}
.thermostat-chip.action-cooling i,
.thermostat-chip.action-cool i {
    color: #93c5fd;
}
.thermostat-actions {
    flex-wrap: wrap;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}
.thermostat-actions form {
    flex-wrap: wrap;
    padding: 11px;
    border-radius: 16px;
    background: rgba(255,255,255,.11);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.thermostat-actions .thermostat-control-form {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(190px, auto) auto;
    align-items: center;
    justify-content: start;
    gap: 12px;
}
.thermostat-control-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr);
    gap: 10px;
    align-items: center;
    justify-items: center;
}
.thermostat-dial {
    --dial-track: rgba(255,255,255,.14);
    --dial-fill: #10b981;
    --dial-angle: 90deg;
    --arc-top: 14px;
    --arc-height: 116px;
    --arc-thickness-inner: 54%;
    --arc-thickness-outer: 82%;
    position: relative;
    width: min(100%, 270px);
    min-height: 184px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: 1fr 38px;
    align-items: center;
    justify-self: center;
    padding: 8px 12px 0;
    border-radius: 18px;
    background: rgba(17,24,39,.94);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 14px 34px rgba(0,0,0,.18);
    touch-action: none;
    user-select: none;
    overflow: hidden;
}
.thermostat-dial-arc {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 8px;
    width: calc(100% - 24px);
    height: 132px;
    overflow: visible;
    pointer-events: none;
    filter: drop-shadow(0 9px 16px rgba(0,0,0,.18));
}
.thermostat-dial-track,
.thermostat-dial-fill {
    fill: none;
    stroke-linecap: round;
    stroke-width: 16;
}
.thermostat-dial-track {
    stroke: var(--dial-track);
}
.thermostat-dial-fill {
    stroke: var(--dial-fill);
    filter: drop-shadow(0 0 9px rgba(16,185,129,.32));
}
.thermostat-dial-knob {
    fill: rgba(255,255,255,.72);
    stroke: rgba(255,255,255,.82);
    stroke-width: 1.3;
    filter:
        drop-shadow(0 0 3px rgba(17,24,39,.95))
        drop-shadow(0 0 7px rgba(16,185,129,.34))
        drop-shadow(0 5px 8px rgba(0,0,0,.34));
}
.thermostat-dial-status,
.thermostat-dial-readouts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    position: relative;
    z-index: 1;
}
.thermostat-dial-status {
    padding-top: 0;
    color: rgba(248,251,255,.88);
    font-size: .72rem;
    font-weight: 850;
}
.thermostat-dial-status i {
    color: #67e8f9;
}
.thermostat-dial-status.action-heating i,
.thermostat-dial-status.action-heat i {
    color: #fb7185;
}
.thermostat-dial-status.action-cooling i,
.thermostat-dial-status.action-cool i {
    color: #93c5fd;
}
.thermostat-dial-readouts {
    flex-wrap: wrap;
    max-width: 100%;
    justify-self: center;
    color: rgba(232,240,252,.72);
    font-size: .66rem;
    padding-top: 1px;
}
.thermostat-dial-readouts span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.thermostat-dial-readouts .battery-pill {
    width: 34px;
    height: 18px;
}
.thermostat-dial-readouts .battery-pill::after {
    top: 4px;
    height: 6px;
}
.thermostat-dial-readouts .battery-pill b {
    font-size: 7.5px;
}
.thermostat-dial-button,
.thermostat-mode-button {
    border: 0;
    color: #f8fbff;
    background: rgba(255,255,255,.12);
}
.thermostat-dial-button {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
    position: absolute;
    z-index: 2;
    top: 138px;
}
.thermostat-dial-button[data-temp-step="-1"] {
    left: 7.5%;
}
.thermostat-dial-button[data-temp-step="1"] {
    right: 7.5%;
}
.thermostat-dial-button:hover,
.thermostat-mode-button:hover {
    background: rgba(255,255,255,.20);
}
.thermostat-dial-center {
    grid-column: 1 / -1;
    grid-row: 1 / 3;
    display: grid;
    justify-items: center;
    gap: 3px;
    text-align: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-self: center;
    position: relative;
    z-index: 1;
    align-self: end;
    padding: 44px 24px 14px;
}
.thermostat-dial-label {
    color: rgba(232,240,252,.66);
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.thermostat-dial-center strong {
    color: #fff;
    font-size: 1.48rem;
    line-height: 1;
    font-weight: 850;
}
.thermostat-dial-center small {
    color: rgba(232,240,252,.72);
    font-size: .78rem;
    font-weight: 750;
}
.thermostat-mode-buttons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    max-width: 100%;
    flex-wrap: wrap;
    margin-top: 1px;
}
.thermostat-mode-button {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.thermostat-mode-button.active {
    color: #101722;
    background: #f8fbff;
}
.thermostat-mode-button.mode-heat.active {
    color: #fff7ed;
    background: #ef4444;
}
.thermostat-mode-button.mode-cool.active {
    color: #eff6ff;
    background: var(--accent-2);
}
.thermostat-mode-button.mode-off.active {
    color: #e5e7eb;
    background: #475569;
}
.thermostat-apply-button {
    width: min(176px, 100%);
    max-width: 100%;
    min-height: 30px;
    padding: 4px 10px;
    justify-self: center;
    justify-content: center;
    margin-top: 10px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 999px;
    color: #0f172a;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(225,245,239,.94));
    font-size: .74rem;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(16,185,129,.18), inset 0 1px 0 rgba(255,255,255,.9);
}
.thermostat-apply-button:hover,
.thermostat-apply-button:focus {
    color: #052e2b;
    background: linear-gradient(180deg, #ffffff, rgba(187,247,208,.96));
    border-color: rgba(187,247,208,.95);
}
@container (max-width: 430px) {
    .thermostat-control-form {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .thermostat-dial {
        width: min(280px, 100%);
    }
    .thermostat-apply-button {
        width: min(176px, 100%);
        max-width: 100%;
    }
}
@container (min-width: 260px) {
    .thermostat-dial-button[data-temp-step="-1"] {
        left: 28px;
    }
    .thermostat-dial-button[data-temp-step="1"] {
        right: 28px;
    }
}
.thermostat-actions input[type="number"] {
    width: 96px;
}
.thermostat-actions select {
    width: 148px;
}
.thermostat-actions .form-control,
.thermostat-actions .form-select {
    border-color: rgba(255,255,255,.16);
    background-color: rgba(255,255,255,.94);
    font-weight: 700;
}
.thermostat-actions .btn-dark {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    font-weight: 800;
}
.thermostat-actions .btn-outline-dark {
    color: #f8fbff;
    border-color: color-mix(in srgb, var(--accent) 38%, rgba(255,255,255,.28));
    background: color-mix(in srgb, var(--accent) 12%, rgba(255,255,255,.08));
}
.linked-sensors {
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.14);
    font-size: .86rem;
    position: relative;
    z-index: 1;
}
.linked-sensors span {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-radius: 14px;
    background: rgba(255,255,255,.10);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.linked-sensors span i {
    color: #67e8f9;
}
.linked-sensors small {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.linked-sensors b {
    color: #ffffff;
}
.device-row {
    padding: 17px;
    border-bottom: 1px solid rgba(108,125,148,.16);
    transition: background .16s ease;
}
.device-row:hover { background: rgba(36,107,254,.035); }
.device-row:last-child { border-bottom: 0; }
.device-row > div:first-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.device-row strong {
    display: block;
}
.control-title-line {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    width: 100%;
}
.control-title-line.title-lock {
    display: flex;
    flex-wrap: wrap;
    row-gap: 8px;
}
.control-title-line.title-lock > .door-state-badge {
    margin-inline: auto;
}
.control-title-line.title-switch {
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 8px;
}
.control-status-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.control-status-wrap.status-lock {
    margin-left: auto;
}
.control-status-wrap.status-switch {
    margin-left: auto;
}
@container (max-width: 205px) {
    .control-icon-line.title-lock {
        grid-template-columns: 38px minmax(0, 1fr);
    }
    .control-icon-line.title-lock > .control-icon-stack {
        grid-column: 1;
        grid-row: 1;
    }
    .control-icon-line.title-lock > .door-state-badge {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        margin-inline: 0;
    }
    .control-icon-line.title-lock > .control-status-wrap.status-lock {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
        justify-self: start;
        margin-left: 0;
    }
}
.control-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 1 1 180px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.control-title-line.title-lock .control-name-wrap {
    flex: 1 1 160px;
}
.control-title-line.title-lock > .door-state-badge,
.control-title-line.title-switch > .door-state-badge,
.control-icon-line.title-lock > .door-state-badge,
.control-icon-line.title-switch > .door-state-badge {
    flex: 0 1 auto;
}
.door-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 5px 8px;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 850;
    line-height: 1;
    flex: 0 0 auto;
}
.door-state-badge i {
    width: 18px;
    text-align: center;
}
.door-state-badge .battery-pill {
    width: 34px;
    height: 18px;
    margin-left: 1px;
}
.door-state-badge .battery-pill::after {
    right: -4px;
    top: 5px;
    width: 3px;
    height: 7px;
}
.door-state-badge .battery-pill b {
    font-size: 7.5px;
}
.door-state-badge.door-open {
    color: #b91c1c;
    background: rgba(239,68,68,.12);
}
.door-state-badge.door-jammed {
    color: #b91c1c;
    background: rgba(239,68,68,.16);
    box-shadow: 0 10px 22px rgba(239,68,68,.12);
}
.door-state-badge.door-closed {
    color: #0369a1;
    background: rgba(14,165,233,.12);
}
.door-state-badge.parent-switch.door-closed {
    color: #0369a1;
    background: rgba(14,165,233,.12);
}
.door-state-badge.parent-switch.door-open {
    color: #b91c1c;
    background: rgba(239,68,68,.12);
}
.device-row strong .battery-pill {
    flex: 0 0 auto;
}
.device-row strong .control-state-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--accent-2);
    background: rgba(36,107,254,.10);
}
.control-state-icon.control-state-locked,
.control-state-icon.control-state-off,
.control-state-icon.control-state-closed {
    color: #059669;
    background: rgba(16,185,129,.12);
}
.control-state-icon.control-state-unlocked,
.control-state-icon.control-state-on,
.control-state-icon.control-state-open {
    color: #dc2626;
    background: rgba(239,68,68,.12);
}
.control-card .control-state-icon.control-state-unlocked,
.control-card .control-state-icon.control-state-on,
.control-card .control-state-icon.control-state-open {
    box-shadow: 0 12px 28px rgba(239,68,68,.14);
}
.control-state-icon[data-last-updated] {
    cursor: pointer;
}
.control-state-icon[data-last-updated]:focus-visible {
    outline: 2px solid rgba(49, 130, 206, .38);
    outline-offset: 4px;
    border-radius: 999px;
}
.last-updated-popup {
    position: absolute;
    z-index: 9999;
    min-width: 178px;
    max-width: min(260px, calc(100vw - 20px));
    padding: 9px 11px;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 10px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 16px 38px rgba(15, 23, 42, .18);
    color: var(--ink);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .14s ease, transform .14s ease;
    pointer-events: none;
}
body[data-theme="dark"] .last-updated-popup {
    border-color: rgba(154,170,190,.18);
    background: rgba(18,27,42,.98);
    box-shadow: 0 16px 38px rgba(0,0,0,.38);
}
.last-updated-popup.show {
    opacity: 1;
    transform: translateY(0);
}
.last-updated-popup span {
    display: block;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.last-updated-popup strong {
    display: block;
    margin-top: 2px;
    font-size: .82rem;
    line-height: 1.25;
}
.device-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.state-pill {
    min-width: 84px;
    text-align: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(100,115,134,.10);
    color: #34403c;
    font-weight: 700;
    font-size: .82rem;
}
body[data-theme="dark"] .state-pill {
    color: var(--ink);
    background: rgba(154,170,190,.12);
}
.state-on,
.state-unlocked,
.state-open { background: rgba(245,158,11,.14); color: #a16207; }
.state-locked,
.state-off,
.state-closed { background: rgba(0,168,120,.12); color: #047857; }
.state-heat,
.state-cool,
.state-heat_cool,
.state-auto { background: rgba(36,107,254,.12); color: #1d4ed8; }

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.sensor-tile {
    padding: 16px;
    display: grid;
    gap: 10px;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.sensor-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 46px rgba(16,23,34,.12);
}
body[data-theme="dark"] .sensor-tile:hover {
    box-shadow: 0 18px 46px rgba(0,0,0,.24);
}
.sensor-tile strong {
    min-height: 44px;
}
.sensor-tile em {
    color: var(--muted);
    font-style: normal;
    font-size: .86rem;
}
.sensor-tile div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.sensor-tile.attention {
    border-color: rgba(245,158,11,.45);
}
.sensor-tile.type-smoke,
.sensor-tile.type-co,
.sensor-tile.type-power {
    border-color: rgba(0,168,120,.24);
}
.sensor-tile.type-smoke.attention,
.sensor-tile.type-co.attention,
.sensor-tile.type-power.attention {
    border-color: rgba(239,68,68,.52);
    background: rgba(255,248,247,.84);
}
body[data-theme="dark"] .sensor-tile.type-smoke.attention,
body[data-theme="dark"] .sensor-tile.type-co.attention,
body[data-theme="dark"] .sensor-tile.type-power.attention {
    background: rgba(251,113,133,.12);
}
.sensor-tile.type-temperature {
    position: relative;
    overflow: hidden;
    gap: 7px;
    padding: 13px 14px;
    border-color: rgba(36,107,254,.20);
    background:
        linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.78)),
        radial-gradient(circle at 18% 20%, rgba(36,107,254,.15), transparent 38%),
        radial-gradient(circle at 88% 0%, rgba(0,168,120,.13), transparent 34%);
}
body[data-theme="dark"] .sensor-tile.type-temperature {
    border-color: rgba(106,162,255,.22);
    background:
        linear-gradient(135deg, rgba(18,27,42,.94), rgba(18,27,42,.80)),
        radial-gradient(circle at 18% 20%, rgba(106,162,255,.18), transparent 38%),
        radial-gradient(circle at 88% 0%, rgba(39,216,161,.11), transparent 34%);
}
.sensor-tile.type-temperature strong {
    min-height: 0;
    margin-top: -1px;
    line-height: 1.08;
}
.temperature-card-head,
.temperature-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.temperature-card-head span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.temperature-card-head .battery-pill {
    flex: 0 0 auto;
    transform: scale(.86);
    transform-origin: right center;
}
.temperature-reading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-top: -2px;
}
.temperature-reading b {
    color: var(--text);
    font-size: clamp(2rem, 4.6vw, 2.75rem);
    font-weight: 950;
    line-height: .9;
}
.temperature-reading sup {
    top: -.65em;
    color: var(--muted);
    font-size: .36em;
    font-weight: 900;
    margin-left: 2px;
}
.temperature-reading span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(0,168,120,.11);
    color: #047857;
    font-size: .86rem;
    font-weight: 900;
}
body[data-theme="dark"] .temperature-reading span {
    background: rgba(39,216,161,.13);
    color: #7ddfbd;
}
.temperature-card-foot small {
    color: var(--muted);
    font-weight: 700;
}
.empty-state {
    margin: 0;
    padding: 18px;
    color: var(--muted);
}

.settings-panel {
    padding: 20px;
    padding-bottom: 118px;
    backdrop-filter: none;
}
.settings-panel,
.settings-panel.ha-token-card,
.settings-panel.vpn-card,
.settings-panel.vpn-progress-panel {
    background:
        linear-gradient(180deg, rgba(255,255,255,.90), rgba(255,255,255,.78)),
        var(--panel-solid);
}
body[data-theme="dark"] .settings-panel,
body[data-theme="dark"] .settings-panel.ha-token-card,
body[data-theme="dark"] .settings-panel.vpn-card,
body[data-theme="dark"] .settings-panel.vpn-progress-panel {
    background:
        linear-gradient(180deg, rgba(18,27,42,.94), rgba(15,23,37,.88)),
        var(--panel-solid);
}
.section-layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 16px 0 6px;
    overflow: hidden;
    border: 1px solid rgba(35, 42, 58, .08);
    border-radius: 14px;
    background: rgba(255,255,255,.62);
    box-shadow: 0 18px 48px rgba(29, 40, 63, .08);
}
body[data-theme="dark"] .section-layout-grid {
    border-color: rgba(154,170,190,.14);
    background: rgba(18,27,42,.72);
    box-shadow: 0 18px 48px rgba(0,0,0,.22);
}
.section-layout-head,
.layout-card {
    display: grid;
    grid-template-columns: 54px minmax(180px, 1fr) minmax(180px, .9fr) 96px minmax(145px, .55fr);
    align-items: center;
    gap: 10px;
}
.section-layout-head {
    padding: 11px 14px 9px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: rgba(248,250,252,.72);
    border-bottom: 1px solid rgba(35, 42, 58, .08);
}
body[data-theme="dark"] .section-layout-head {
    background: rgba(15,23,37,.82);
    border-bottom-color: rgba(154,170,190,.12);
}
.layout-card {
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid rgba(35, 42, 58, .07);
    border-radius: 0;
    background: transparent;
}
body[data-theme="dark"] .layout-card {
    border-bottom-color: rgba(154,170,190,.10);
}
.layout-card:last-child {
    border-bottom: 0;
}
.layout-card:hover {
    background: rgba(255,255,255,.54);
}
body[data-theme="dark"] .layout-card:hover {
    background: rgba(106,162,255,.08);
}
.layout-card > div {
    min-width: 0;
    display: grid;
}
.layout-card label:not(.switch) {
    min-width: 0;
}
.layout-card label:not(.switch) .form-control,
.layout-card label:not(.switch) .form-select {
    width: 100%;
}
.layout-card .switch {
    justify-self: start;
}
.layout-card small {
   color: var(--muted);
}
.apartment-action-pill {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   min-width: 84px;
   min-height: 32px;
   padding: 7px 12px;
   border-radius: 999px;
   border: 1px solid transparent;
   font-size: .78rem;
   font-weight: 850;
   line-height: 1;
   text-decoration: none;
   white-space: nowrap;
}
.apartment-action-open {
   color: #14532d;
   border-color: rgba(22, 163, 74, .24);
   background: rgba(34, 197, 94, .16);
}
.apartment-action-open:hover {
   color: #052e16;
   border-color: rgba(22, 163, 74, .34);
   background: rgba(34, 197, 94, .24);
}
.apartment-action-disabled {
   color: #854d0e;
   border-color: rgba(217, 119, 6, .28);
   background: rgba(245, 158, 11, .18);
}
body[data-theme="dark"] .apartment-action-open {
   color: #bbf7d0;
   border-color: rgba(74, 222, 128, .28);
   background: rgba(34, 197, 94, .16);
}
body[data-theme="dark"] .apartment-action-open:hover {
   color: #dcfce7;
   border-color: rgba(134, 239, 172, .38);
   background: rgba(34, 197, 94, .24);
}
body[data-theme="dark"] .apartment-action-disabled {
   color: #fde68a;
   border-color: rgba(251, 191, 36, .30);
   background: rgba(245, 158, 11, .15);
}
.layout-name-empty {
   min-height: 31px;
   align-content: center;
}
.layout-card label:not(.switch) span {
    display: none;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.settings-panel.ha-token-card .ha-token-form label,
.settings-panel .vpn-app-url-form label {
   padding: 10px;
   border: 1px solid rgba(108,125,148,.12);
   border-radius: 12px;
   background: rgba(248,250,252,.58);
}
body[data-theme="dark"] .settings-panel.ha-token-card .ha-token-form label,
body[data-theme="dark"] .settings-panel .vpn-app-url-form label {
   border-color: rgba(154,170,190,.14);
   background: rgba(15,23,37,.62);
}
.settings-panel.ha-token-card .ha-token-form label:focus-within,
.settings-panel .vpn-app-url-form label:focus-within {
   border-color: rgba(36,107,254,.34);
   background: rgba(255,255,255,.82);
   box-shadow: 0 10px 26px rgba(36,107,254,.08);
}
body[data-theme="dark"] .settings-panel.ha-token-card .ha-token-form label:focus-within,
body[data-theme="dark"] .settings-panel .vpn-app-url-form label:focus-within {
   border-color: rgba(106,162,255,.34);
   background: rgba(15,23,37,.86);
   box-shadow: 0 10px 26px rgba(0,0,0,.20);
}
.settings-divider {
    margin: 22px 0;
    border-color: rgba(108,125,148,.22);
}
.settings-intro,
.entity-filter-row,
.sticky-save {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
body[data-theme="dark"] .sticky-save {
    border-top-color: rgba(154,170,190,.18);
    background:
        linear-gradient(135deg, rgba(18,27,42,.94), rgba(18,27,42,.82)),
        linear-gradient(135deg, rgba(106,162,255,.12), rgba(39,216,161,.10));
    box-shadow: 0 -14px 42px rgba(0,0,0,.26), 0 18px 44px rgba(0,0,0,.20);
}
.settings-intro p {
    margin: 6px 0 0;
    color: var(--muted);
}
.installer-intro-card .settings-intro,
.ha-token-update-card .settings-intro {
    padding-left: 2px;
}
.installer-intro-card .settings-intro h2,
.ha-token-update-card .settings-intro h2 {
    white-space: nowrap;
}
.installer-intro-card .settings-intro p {
    margin-right: -4px;
}
.apartment-tablet-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 16px 0 18px;
    padding: 14px 16px;
    border: 1px solid rgba(37,99,235,.18);
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(239,246,255,.96), rgba(240,253,250,.92));
    color: #17345f;
    box-shadow: 0 14px 30px rgba(37,99,235,.08);
}
.apartment-tablet-note i {
    margin-top: 3px;
    color: #2563eb;
    font-size: 18px;
}
.apartment-tablet-note div {
    display: grid;
    gap: 4px;
}
.apartment-tablet-note span {
    color: #405063;
    font-size: 13px;
    line-height: 1.45;
}
.apartment-tablet-note code {
    color: #17345f;
    background: rgba(255,255,255,.74);
    border: 1px solid rgba(37,99,235,.12);
    border-radius: 5px;
    padding: 1px 5px;
    white-space: nowrap;
}
body[data-theme="dark"] .apartment-tablet-note {
    border-color: rgba(96,165,250,.24);
    border-left-color: #60a5fa;
    background: linear-gradient(135deg, rgba(16,35,65,.84), rgba(13,54,49,.62));
    color: #e8f1ff;
    box-shadow: 0 14px 32px rgba(0,0,0,.22);
}
body[data-theme="dark"] .apartment-tablet-note i {
    color: #93c5fd;
}
body[data-theme="dark"] .apartment-tablet-note span {
    color: #c8d3e1;
}
body[data-theme="dark"] .apartment-tablet-note code {
    color: #e8f1ff;
    background: rgba(15,23,42,.72);
    border-color: rgba(147,197,253,.18);
}
.settings-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.apartment-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.dashboard-apartment-tabs {
    margin-bottom: 14px;
}
.vpn-setup-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid rgba(217,119,6,.26);
    border-radius: 8px;
    background: rgba(255,251,235,.92);
    color: #92400e;
    box-shadow: 0 14px 34px rgba(146,64,14,.08);
}
body[data-theme="dark"] .vpn-setup-alert {
    border-color: rgba(251,191,36,.24);
    background: rgba(69,45,12,.55);
    color: #fde68a;
}
.vpn-setup-alert i {
    margin-top: 3px;
    font-size: 18px;
}
.vpn-setup-alert div {
    display: grid;
    gap: 3px;
}
.vpn-setup-alert span {
    font-size: 13px;
    color: currentColor;
    opacity: .88;
}
.page-heading p.text-muted,
.page-heading .text-muted.mb-0,
.vpn-card .settings-intro p,
.vpn-progress-panel .settings-intro p {
    color: #405063 !important;
}
body[data-theme="dark"] .page-heading p.text-muted,
body[data-theme="dark"] .page-heading .text-muted.mb-0,
body[data-theme="dark"] .vpn-card .settings-intro p,
body[data-theme="dark"] .vpn-progress-panel .settings-intro p {
    color: #c8d3e1 !important;
}
.vpn-setup-hero .eyebrow,
.vpn-card .settings-intro h2,
.vpn-progress-panel .settings-intro h2 {
    color: var(--ink);
}
body[data-theme="dark"] .vpn-setup-hero .eyebrow,
body[data-theme="dark"] .vpn-card .settings-intro h2,
body[data-theme="dark"] .vpn-progress-panel .settings-intro h2 {
    color: #f3f7fb;
}
.vpn-setup-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid rgba(18,32,49,.09);
    border-radius: 8px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent)),
        rgba(255,255,255,.82);
    box-shadow: 0 18px 44px rgba(29,44,62,.08);
}
body[data-theme="dark"] .vpn-setup-hero {
    border-color: rgba(154,170,190,.16);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent-2) 14%, transparent)),
        rgba(18,27,42,.76);
}
html[data-gradients="off"] .vpn-setup-hero {
    background: rgba(255,255,255,.82);
}
html[data-gradients="off"] body[data-theme="dark"] .vpn-setup-hero {
    background: rgba(18,27,42,.76);
}
.vpn-hero-main {
    display: flex;
    gap: 14px;
    min-width: 0;
}
.vpn-hero-icon {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: 22px;
}
body[data-theme="dark"] .vpn-hero-icon {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
}
.vpn-hero-main h2 {
    margin: 0 0 6px;
    font-size: 24px;
    letter-spacing: 0;
}
.vpn-hero-main p:last-child {
    max-width: 720px;
    margin: 0;
    color: #405063;
}
body[data-theme="dark"] .vpn-hero-main p:last-child {
    color: #c8d3e1;
}
.vpn-hero-status {
    display: grid;
    align-content: center;
    justify-items: end;
    min-width: 188px;
    padding: 12px 14px;
    border: 1px solid rgba(126,139,155,.18);
    border-radius: 8px;
    background: rgba(255,255,255,.68);
}
body[data-theme="dark"] .vpn-hero-status {
    background: rgba(15,23,42,.52);
}
.vpn-hero-status span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.vpn-hero-status strong {
    margin-top: 4px;
    font-size: 16px;
    overflow-wrap: anywhere;
}
.vpn-hero-status.is-ready strong,
.vpn-pill.is-ready {
    color: #15803d;
}
body[data-theme="dark"] .vpn-hero-status.is-ready strong,
body[data-theme="dark"] .vpn-pill.is-ready {
    color: #86efac;
}
.vpn-hero-status.is-pending strong,
.vpn-pill.is-pending {
    color: #b45309;
}
body[data-theme="dark"] .vpn-hero-status.is-pending strong,
body[data-theme="dark"] .vpn-pill.is-pending {
    color: #fcd34d;
}
.vpn-setup-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
    gap: 18px;
    align-items: start;
}
.settings-panel.vpn-card,
.settings-panel.vpn-progress-panel {
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(18,32,49,.09);
    box-shadow: 0 14px 34px rgba(29,44,62,.07);
}
body[data-theme="dark"] .settings-panel.vpn-card,
body[data-theme="dark"] .settings-panel.vpn-progress-panel {
    border-color: rgba(154,170,190,.14);
}
.vpn-card form {
    display: grid;
    gap: 14px;
}
.vpn-app-url-card {
    margin-bottom: 18px;
}
.vpn-app-url-form {
    display: grid;
    gap: 14px;
}
.vpn-card label {
   display: grid;
   gap: 8px;
   color: var(--ink);
   font-size: .78rem;
   font-weight: 850;
   letter-spacing: .01em;
}
.vpn-card input {
   width: 100%;
   min-height: 46px;
   padding: 11px 13px;
   border: 1px solid rgba(100,115,134,.22);
   border-radius: 10px;
   background:
       linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.86)),
       #fff;
   color: var(--ink);
   font: inherit;
   font-size: .94rem;
   font-weight: 650;
   outline: none;
   box-shadow: inset 0 1px 0 rgba(255,255,255,.76), 0 1px 2px rgba(15,23,42,.04);
   transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.vpn-card input::placeholder {
   color: rgba(100,115,134,.70);
   font-weight: 600;
}
.vpn-card input:focus {
   border-color: rgba(36,107,254,.54);
   box-shadow: 0 0 0 4px rgba(36,107,254,.12), inset 0 1px 0 rgba(255,255,255,.85);
}
.vpn-card input:disabled {
   cursor: not-allowed;
   opacity: .68;
}
body[data-theme="dark"] .vpn-card label {
   color: #e8eef7;
}
body[data-theme="dark"] .vpn-card input {
   border-color: rgba(154,170,190,.20);
   background:
       linear-gradient(180deg, rgba(18,27,42,.98), rgba(15,23,37,.92)),
       #0f1725;
   color: #f3f7fb;
   box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
body[data-theme="dark"] .vpn-card input::placeholder {
   color: rgba(154,170,190,.66);
}
body[data-theme="dark"] .vpn-card input:focus {
   border-color: rgba(106,162,255,.56);
   box-shadow: 0 0 0 4px rgba(106,162,255,.16), inset 0 1px 0 rgba(255,255,255,.06);
}
.vpn-card form > small {
   display: block;
   margin-top: -7px;
   color: #5b6b7d;
   font-size: .78rem;
   line-height: 1.35;
}
body[data-theme="dark"] .vpn-card form > small {
   color: #aab7c8;
}
.vpn-url-suggestions {
   display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
}
.vpn-url-suggestions code {
    padding: 4px 7px;
    border: 1px solid rgba(126,139,155,.22);
    border-radius: 6px;
    background: rgba(248,250,252,.78);
    color: var(--ink);
}
body[data-theme="dark"] .vpn-url-suggestions code {
    background: rgba(15,23,42,.55);
    color: #f3f7fb;
}
.cloud-url-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.cloud-url-meta-row .vpn-url-suggestions {
    flex: 1 1 360px;
    min-width: 0;
}
.cloud-url-meta-row .btn {
    min-height: 42px;
}
.cloud-stored-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid rgba(0,168,120,.18);
    border-radius: 12px;
    background: rgba(0,168,120,.08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: none;
}
.cloud-stored-pill strong {
    color: #15803d;
    font-size: 13px;
    text-transform: none;
}
body[data-theme="dark"] .cloud-stored-pill {
    border-color: rgba(39,216,161,.22);
    background: rgba(39,216,161,.10);
}
body[data-theme="dark"] .cloud-stored-pill strong {
    color: #86efac;
}
.vpn-inline-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(217,119,6,.24);
    border-radius: 8px;
    background: rgba(255,251,235,.82);
    color: #92400e;
    font-size: 13px;
}
body[data-theme="dark"] .vpn-inline-warning {
    border-color: rgba(251,191,36,.24);
    background: rgba(69,45,12,.45);
    color: #fde68a;
}
.vpn-setup-submit {
    min-width: 220px;
    justify-content: center;
}
.vpn-state-list {
    display: grid;
    gap: 10px;
    margin: 0;
}
.vpn-state-list div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-bottom: 1px solid rgba(126,139,155,.18);
    border-radius: 8px;
    background: rgba(248,250,252,.78);
}
body[data-theme="dark"] .vpn-state-list div {
    background: rgba(15,23,42,.38);
}
.vpn-state-list div:last-child { border-bottom: 0; }
.vpn-state-list dt {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0;
}
.vpn-state-list dt i {
    width: 16px;
    color: var(--primary);
}
.vpn-state-list dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.vpn-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 26px;
    padding: 4px 10px;
    border: 1px solid rgba(126,139,155,.2);
    border-radius: 999px;
    background: rgba(255,255,255,.7);
}
body[data-theme="dark"] .vpn-pill {
    background: rgba(15,23,42,.5);
}
.vpn-progress-panel {
    margin-top: 18px;
}
.vpn-progress-log {
    display: grid;
    gap: 8px;
    max-height: 420px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: auto;
}
.vpn-log-row {
    display: grid;
    grid-template-columns: 86px 70px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid rgba(126,139,155,.18);
    border-left-width: 4px;
    border-radius: 8px;
    background: rgba(255,255,255,.58);
}
body[data-theme="dark"] .vpn-log-row {
    background: rgba(15,23,42,.55);
}
.vpn-log-row span {
    color: var(--muted);
    font-size: 12px;
}
.vpn-log-row strong {
    font-size: 12px;
    text-transform: uppercase;
}
.vpn-log-row p {
    margin: 0;
    overflow-wrap: anywhere;
}
.vpn-log-info {
    border-left-color: #3b82f6;
}
.vpn-log-ok {
    border-left-color: var(--accent);
}
.vpn-log-error {
    border-left-color: #dc2626;
}
.ha-token-hero {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid rgba(18,32,49,.09);
    border-radius: 8px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent)),
        rgba(255,255,255,.82);
    box-shadow: 0 18px 44px rgba(29,44,62,.08);
}
body[data-theme="dark"] .ha-token-hero {
    border-color: rgba(154,170,190,.16);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent-2) 14%, transparent)),
        rgba(18,27,42,.76);
}
html[data-gradients="off"] .ha-token-hero {
    background: rgba(255,255,255,.82);
}
html[data-gradients="off"] body[data-theme="dark"] .ha-token-hero {
    background: rgba(18,27,42,.76);
}
.ha-token-hero > div {
    display: flex;
    gap: 14px;
    min-width: 0;
}
.ha-token-icon {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: 21px;
}
body[data-theme="dark"] .ha-token-icon {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
}
.ha-token-hero h2 {
    margin: 0 0 6px;
    font-size: 24px;
    letter-spacing: 0;
}
.ha-token-hero p:last-child {
    max-width: 760px;
    margin: 0;
    color: #405063;
}
body[data-theme="dark"] .ha-token-hero p:last-child {
    color: #c8d3e1;
}
.ha-token-hero > strong {
    display: grid;
    align-content: center;
    justify-items: end;
    min-width: 170px;
    padding: 12px 14px;
    border: 1px solid rgba(126,139,155,.18);
    border-radius: 8px;
    background: rgba(255,255,255,.68);
    color: #b45309;
    font-size: 16px;
}
body[data-theme="dark"] .ha-token-hero > strong {
    background: rgba(15,23,42,.52);
}
.ha-token-hero > strong.is-ready { color: #15803d; }
.ha-token-hero > strong.is-expired { color: #dc2626; }
body[data-theme="dark"] .ha-token-hero > strong.is-ready { color: #86efac; }
body[data-theme="dark"] .ha-token-hero > strong.is-expired { color: #fca5a5; }
.ha-token-grid {
    display: grid;
    grid-template-columns: minmax(300px, .9fr) minmax(0, 1.1fr);
    gap: 18px;
    align-items: start;
}
.ha-token-grid > .cloud-url-card {
    grid-column: 1 / -1;
}
.cloud-url-card .ha-token-form {
    grid-template-columns: 1fr;
}
.cloud-pair-card {
    min-height: 100%;
}
.cloud-pair-card .settings-intro {
    padding-left: 2px;
}
.cloud-pair-card .settings-intro h2 {
    white-space: nowrap;
}
.cloud-pair-card .settings-intro p {
    margin-right: -4px;
}
.cloud-key-status-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.cloud-key-status-row div {
    align-content: center;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
body[data-theme="dark"] .cloud-key-status-row div {
    background: transparent;
}
.cloud-key-action {
    margin-top: 12px;
}
.cloud-key-action .settings-actions {
    justify-content: stretch;
}
.cloud-key-action .btn {
    width: 100%;
    min-height: 44px;
}
.settings-panel.ha-token-card {
    border-radius: 8px;
    padding: 20px;
    border: 1px solid rgba(18,32,49,.09);
    box-shadow: 0 14px 34px rgba(29,44,62,.07);
}
body[data-theme="dark"] .settings-panel.ha-token-card {
    border-color: rgba(154,170,190,.14);
}
.ha-token-card .settings-intro p {
    color: #405063;
}
body[data-theme="dark"] .ha-token-card .settings-intro p {
    color: #c8d3e1;
}
.ha-token-status-list {
    display: grid;
    gap: 10px;
    margin: 0;
}
.compact-status-list {
    gap: 0;
}
.compact-status-list div {
    grid-template-columns: minmax(90px, .4fr) minmax(0, 1fr);
    align-items: center;
}
.ha-token-status-list div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-bottom: 1px solid rgba(126,139,155,.18);
    border-radius: 8px;
    background: rgba(248,250,252,.78);
}
body[data-theme="dark"] .ha-token-status-list div {
    background: rgba(15,23,42,.38);
}
.ha-token-status-list div:last-child { border-bottom: 0; }
.ha-token-status-list dt {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0;
}
.cloud-pair-card .ha-token-status-list dt,
.cloud-public-ip-controls span {
    text-transform: none;
    letter-spacing: 0;
}
.ha-token-status-list dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.ha-token-form {
    display: grid;
    gap: 14px;
}
.ha-token-form label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}
.ha-token-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 170px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
}
.ha-token-form small {
    color: var(--muted);
}
.ha-token-update-card .ha-token-form label {
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 8px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, rgba(248,250,252,.78)), color-mix(in srgb, var(--accent-2) 7%, rgba(248,250,252,.72))),
        rgba(255,255,255,.68);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.74);
    color: var(--ink);
    font-size: .78rem;
    font-weight: 850;
    gap: 12px;
}
.ha-token-update-card .token-paste-control > span {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--accent);
    font-size: .8rem;
    font-weight: 900;
}
.ha-token-update-card .token-paste-control > span i {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}
.ha-token-update-card .ha-token-form label:focus-within {
    border-color: color-mix(in srgb, var(--accent) 34%, transparent);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, rgba(255,255,255,.98)), color-mix(in srgb, var(--accent-2) 8%, rgba(255,255,255,.86))),
        rgba(255,255,255,.82);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--accent) 10%, transparent), inset 0 1px 0 rgba(255,255,255,.80);
}
.ha-token-update-card .ha-token-form textarea {
    min-height: 148px;
    padding: 13px 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 8px;
    background: rgba(255,255,255,.86);
    color: var(--ink);
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.78);
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.ha-token-update-card .ha-token-form textarea::placeholder {
    color: rgba(100,115,134,.70);
}
.ha-token-update-card .ha-token-form textarea:focus {
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent), inset 0 1px 0 rgba(255,255,255,.85);
}
.ha-token-update-card .ha-token-form small {
    color: #5b6b7d;
    font-size: .78rem;
    line-height: 1.4;
}
body[data-theme="dark"] .ha-token-update-card .ha-token-form label {
    border-color: color-mix(in srgb, var(--accent) 18%, transparent);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, rgba(15,23,37,.78)), color-mix(in srgb, var(--accent-2) 8%, rgba(15,23,37,.78))),
        rgba(15,23,37,.72);
    color: #e8eef7;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
body[data-theme="dark"] .ha-token-update-card .token-paste-control > span {
    color: color-mix(in srgb, var(--accent) 74%, #fff);
}
body[data-theme="dark"] .ha-token-update-card .token-paste-control > span i {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
}
body[data-theme="dark"] .ha-token-update-card .ha-token-form label:focus-within {
    border-color: color-mix(in srgb, var(--accent) 34%, transparent);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, rgba(15,23,37,.88)), color-mix(in srgb, var(--accent-2) 10%, rgba(15,23,37,.88))),
        rgba(15,23,37,.82);
    box-shadow: 0 14px 32px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.05);
}
body[data-theme="dark"] .ha-token-update-card .ha-token-form textarea {
    border-color: color-mix(in srgb, var(--accent) 16%, transparent);
    background: rgba(15,23,37,.78);
    color: #f3f7fb;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
body[data-theme="dark"] .ha-token-update-card .ha-token-form textarea::placeholder {
    color: rgba(154,170,190,.66);
}
body[data-theme="dark"] .ha-token-update-card .ha-token-form textarea:focus {
    border-color: color-mix(in srgb, var(--accent) 56%, transparent);
    background: rgba(15,23,37,.96);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent), inset 0 1px 0 rgba(255,255,255,.06);
}
body[data-theme="dark"] .ha-token-update-card .ha-token-form small {
    color: #aab7c8;
}
.cloud-toggle-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px !important;
    min-height: 74px;
}
.cloud-toggle-row > span {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.cloud-toggle-row strong {
    color: var(--ink);
    font-size: 14px;
}
.cloud-toggle-row small {
    color: var(--muted);
    font-weight: 600;
}
.cloud-toggle-row .form-check-input {
    flex: 0 0 auto;
    width: 54px;
    height: 30px;
    margin: 0;
    border: 1px solid rgba(100,115,134,.24);
    background-color: rgba(100,115,134,.28);
    background-size: 24px;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(15,23,42,.12);
}
.cloud-toggle-row .form-check-input:checked {
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    background-color: var(--accent);
}
.cloud-toggle-row .form-check-input:focus {
    border-color: color-mix(in srgb, var(--accent) 52%, transparent);
    box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--accent) 14%, transparent);
}
body[data-theme="dark"] .cloud-toggle-row .form-check-input {
    border-color: rgba(154,170,190,.24);
    background-color: rgba(154,170,190,.22);
}
body[data-theme="dark"] .cloud-toggle-row .form-check-input:checked {
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    background-color: var(--accent);
}
.cloud-inline-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 10px !important;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--muted) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
}
.cloud-inline-toggle .form-check-input {
    flex: 0 0 auto;
    width: 48px;
    height: 27px;
    margin: 0;
    border: 1px solid rgba(100,115,134,.24);
    background-color: rgba(100,115,134,.28);
    background-size: 22px;
    cursor: pointer;
}
.cloud-inline-toggle .form-check-input:checked {
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    background-color: var(--accent);
}
.cloud-inline-toggle .form-check-input:focus {
    border-color: color-mix(in srgb, var(--accent) 52%, transparent);
    box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--accent) 14%, transparent);
}
body[data-theme="dark"] .cloud-inline-toggle .form-check-input {
    border-color: rgba(154,170,190,.24);
    background-color: rgba(154,170,190,.22);
}
body[data-theme="dark"] .cloud-inline-toggle .form-check-input:checked {
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
    background-color: var(--accent);
}
.cloud-public-ip-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 11px 12px;
    border: 1px solid rgba(100,115,134,.18);
    border-radius: 10px;
    background: rgba(255,255,255,.58);
}
.cloud-public-ip-field {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(108,125,148,.12);
    border-radius: 12px;
    background: rgba(248,250,252,.58);
}
.cloud-public-ip-field > label {
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--muted) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}
.cloud-public-ip-controls > div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.cloud-public-ip-controls span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}
.cloud-public-ip-controls .vpn-pill {
    flex: 0 0 auto;
}
body[data-theme="dark"] .cloud-public-ip-controls {
    border-color: rgba(154,170,190,.14);
    background: rgba(15,23,37,.44);
}
body[data-theme="dark"] .cloud-public-ip-field {
    border-color: rgba(154,170,190,.14);
    background: rgba(15,23,37,.62);
}
.cloud-auth-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(36,107,254,.14);
    border-radius: 12px;
    background: rgba(36,107,254,.06);
    color: #405063;
    font-size: 13px;
    line-height: 1.45;
}
.cloud-auth-note i {
    margin-top: 2px;
    color: var(--accent-2);
}
.cloud-auth-note code {
    color: var(--ink);
    background: rgba(255,255,255,.74);
    border: 1px solid rgba(108,125,148,.16);
    border-radius: 5px;
    padding: 1px 5px;
}
body[data-theme="dark"] .cloud-auth-note {
    border-color: rgba(106,162,255,.18);
    background: rgba(37,99,235,.12);
    color: #c8d3e1;
}
body[data-theme="dark"] .cloud-auth-note code {
    background: rgba(15,23,37,.78);
    border-color: rgba(154,170,190,.16);
}
.danger-text {
    color: #dc2626;
}
body[data-theme="dark"] .danger-text {
    color: #fca5a5;
}
.entity-filter-row {
    margin: 18px 0;
    justify-content: flex-start;
}
.search-box {
    position: relative;
    width: min(520px, 100%);
}
.search-box i {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--muted);
}
.search-box input { padding-left: 40px; }
.entity-shown-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid rgba(18,32,49,.1);
    border-radius: 12px;
    background: rgba(255,255,255,.72);
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 10px 24px rgba(29,44,62,.06);
}
body[data-theme="dark"] .entity-shown-filter {
    border-color: rgba(154,170,190,.18);
    background: rgba(18,27,42,.76);
}
.entity-shown-filter input {
    width: 16px;
    height: 16px;
    margin: 0;
}
.entity-table-wrap {
    max-height: 62vh;
    overflow: auto;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 14px;
    background: rgba(255,255,255,.58);
}
body[data-theme="dark"] .entity-table-wrap {
    border-color: rgba(154,170,190,.16);
    background: rgba(18,27,42,.62);
}
.entity-table {
    margin: 0;
    min-width: 1180px;
}
.entity-table tbody tr {
    transition: background .14s ease;
}
.entity-table tbody tr:hover {
    background: rgba(36,107,254,.045);
}
body[data-theme="dark"] .entity-table tbody tr:hover {
    background: rgba(106,162,255,.08);
}
.entity-table td,
.entity-table th {
    padding: 14px 12px;
}
.entity-table thead th {
    position: sticky;
    top: 0;
    background: rgba(248,250,252,.92);
    z-index: 2;
    border-bottom: 1px solid var(--line);
    color: #455468;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
body[data-theme="dark"] .entity-table thead th {
    background: rgba(15,23,37,.96);
    color: rgba(238,245,255,.78);
}
.entity-name {
    display: grid;
    min-width: 0;
}
.entity-name small {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(100,115,134,.10);
    color: #34403c;
    font-weight: 800;
    font-size: .78rem;
}
body[data-theme="dark"] .type-badge {
    color: var(--ink);
    background: rgba(154,170,190,.13);
}
.type-smoke,
.type-co,
.type-power {
    background: rgba(239,68,68,.12);
    color: var(--danger);
}
.class-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}
.order-input {
    width: 92px;
}
.switch input { display: none; }
.switch span {
    display: inline-block;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #c8d3df;
    position: relative;
    cursor: pointer;
    transition: background .16s ease;
}
.switch span::after {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    transition: transform .16s ease;
}
.switch input:checked + span {
    background: linear-gradient(135deg, var(--accent), var(--cyan));
}
.switch input:checked + span::after {
    transform: translateX(20px);
}
.sticky-save {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1060;
    padding: 12px max(18px, calc((100vw - 1440px) / 2 + 28px));
    margin-top: 0;
    border: 0;
    border-top: 1px solid rgba(255,255,255,.78);
    border-radius: 0;
    background:
        linear-gradient(135deg, rgba(255,255,255,.94), rgba(255,255,255,.82)),
        linear-gradient(135deg, rgba(36,107,254,.12), rgba(0,168,120,.10));
    box-shadow: 0 -14px 42px rgba(16,23,34,.12), 0 18px 44px rgba(16,23,34,.10);
    backdrop-filter: blur(20px);
}
.sticky-save::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100% + 20px);
    z-index: -1;
    background: linear-gradient(180deg, rgba(238,243,247,0), rgba(238,243,247,.94) 38%, rgba(238,243,247,1));
}
body[data-theme="dark"] .sticky-save::before {
    background: linear-gradient(180deg, rgba(11,17,28,0), rgba(11,17,28,.94) 38%, rgba(11,17,28,1));
}
.sticky-save span {
    color: var(--muted);
    font-weight: 700;
}
.sticky-save span strong {
    color: var(--ink);
    font-size: 1.15rem;
}
.sticky-save .btn {
    min-height: 48px;
    padding-inline: 22px;
    border-radius: 14px;
    font-weight: 850;
    box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 24%, transparent);
}
.sticky-save .btn i {
    margin-right: 7px;
}

.empty-dashboard {
    margin-top: 24px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px dashed rgba(108,125,148,.28);
    border-radius: 18px;
    background: rgba(255,255,255,.72);
}
body[data-theme="dark"] .empty-dashboard {
    background: rgba(18,27,42,.72);
}
.empty-dashboard > i {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(180,35,24,.1);
    color: var(--danger);
    flex: 0 0 46px;
}
.empty-dashboard p {
    margin: 4px 0 12px;
    color: var(--muted);
}

.logbook-page {
    display: grid;
    gap: 18px;
}
.logbook-hero,
.logbook-filters,
.logbook-panel,
.log-entry {
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
body[data-theme="dark"] .logbook-hero,
body[data-theme="dark"] .logbook-filters,
body[data-theme="dark"] .logbook-panel,
body[data-theme="dark"] .log-entry {
    border-color: rgba(154,170,190,.16);
}
.logbook-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, .95fr);
    gap: 20px;
    align-items: center;
    padding: 22px;
}
.logbook-hero p:last-child {
    margin: 8px 0 0;
    color: var(--muted);
}
.logbook-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.logbook-stats article {
    padding: 14px;
    border: 1px solid rgba(108,125,148,.16);
    border-radius: 14px;
    background: rgba(255,255,255,.58);
}
body[data-theme="dark"] .logbook-stats article {
    border-color: rgba(154,170,190,.22);
    background:
        linear-gradient(135deg, rgba(106,162,255,.10), rgba(39,216,161,.06)),
        rgba(15,23,37,.82);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.logbook-stats span,
.logbook-filters label span {
    display: block;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
body[data-theme="dark"] .logbook-stats span {
    color: #c8d3e1;
}
.logbook-stats strong {
    display: block;
    margin-top: 8px;
    font-size: 1.8rem;
    line-height: 1;
}
body[data-theme="dark"] .logbook-stats strong {
    color: #f8fbff;
}
.logbook-stats .warn strong { color: var(--warn); }
.logbook-stats .danger strong { color: var(--danger); }
.logbook-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.25fr) repeat(4, minmax(130px, .7fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
}
.logbook-filters label {
    display: grid;
    gap: 6px;
    min-width: 0;
}
.logbook-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.logbook-panel {
    padding: 18px;
}
.logbook-list {
    display: grid;
    gap: 10px;
}
.log-entry {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    box-shadow: none;
}
.log-entry-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--accent-2);
    background: rgba(36,107,254,.10);
}
.log-entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.log-entry-head strong,
.log-entry-body p,
.log-entry-body small {
    overflow-wrap: anywhere;
}
.log-entry-head span {
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 999px;
    color: var(--accent-2);
    background: rgba(36,107,254,.10);
    font-size: .76rem;
    font-weight: 850;
}
.log-entry-body p {
    margin: 7px 0 6px;
}
.log-entry-body small {
    color: var(--muted);
}
.log-type-warning .log-entry-icon,
.log-type-warning .log-entry-head span {
    color: var(--warn);
    background: rgba(245,158,11,.14);
}
.log-type-error .log-entry-icon,
.log-type-fatal .log-entry-icon,
.log-type-error .log-entry-head span,
.log-type-fatal .log-entry-head span {
    color: var(--danger);
    background: rgba(239,68,68,.13);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 12%, rgba(0,163,255,.22), transparent 24rem),
        radial-gradient(circle at 82% 20%, rgba(0,168,120,.18), transparent 24rem),
        var(--bg);
}
.login-panel { width: min(440px, 100%); }
.login-card { padding: 34px; }
.login-card h1 { margin-top: 18px; }
.login-choice-stack {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}
.login-change-password-copy {
    display: grid;
    gap: 4px;
    padding: 13px 14px;
    border: 1px solid rgba(36,107,254,.16);
    border-radius: 12px;
    background: rgba(36,107,254,.08);
}
.login-change-password-copy strong {
    color: var(--ink);
}
.login-change-password-copy span {
    color: var(--muted);
    font-size: .92rem;
}
.stack { display: grid; gap: 16px; }
.stack label span:not(.form-check-label) {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

@media (max-width: 980px) {
    .vpn-setup-hero,
    .ha-token-hero {
        display: grid;
    }
    .vpn-hero-status,
    .ha-token-hero > strong {
        justify-items: start;
        min-width: 0;
    }
    .vpn-setup-grid,
    .ha-token-grid {
        grid-template-columns: 1fr;
    }
    .cloud-url-card .ha-token-form {
        grid-template-columns: 1fr;
    }
    .cloud-key-status-row {
        grid-template-columns: 1fr;
    }
    .app-shell {
        grid-template-columns: 1fr;
        background: transparent;
    }
    body.sidebar-collapsed .app-shell,
    html.sidebar-collapsed-preset .app-shell {
        grid-template-columns: 1fr;
        background: transparent;
    }
    .app-sidebar {
        position: fixed;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform .2s ease;
        width: 248px;
        opacity: 1;
        pointer-events: auto;
    }
    body.sidebar-collapsed .app-sidebar,
    html.sidebar-collapsed-preset .app-sidebar {
        opacity: 1;
        pointer-events: auto;
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    [data-sidebar-toggle] { display: grid; }
    .collapse-button { display: none; }
    body.sidebar-collapsed .brand strong,
    body.sidebar-collapsed .nav-stack span,
    body.sidebar-collapsed .nav-section-title span,
    body.sidebar-collapsed .sidebar-foot small,
    html.sidebar-collapsed-preset .brand strong,
    html.sidebar-collapsed-preset .nav-stack span,
    html.sidebar-collapsed-preset .nav-section-title span,
    html.sidebar-collapsed-preset .sidebar-foot small {
        opacity: 1;
        width: auto;
    }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-grid { grid-template-columns: 1fr; }
    .dashboard-section.width-three-quarter,
    .dashboard-section.width-wide,
    .dashboard-section.width-half,
    .dashboard-section.width-quarter,
    .dashboard-section.width-third { grid-column: span 12; }
    .control-box-grid,
    .dashboard-section.width-full .control-box-grid,
    .dashboard-section.width-three-quarter .control-box-grid,
    .dashboard-section.width-wide .control-box-grid,
    .dashboard-section.width-half .control-box-grid,
    .dashboard-section.width-quarter .control-box-grid,
    .dashboard-section.width-third .control-box-grid {
        grid-template-columns: 1fr;
    }
    .control-box-grid > *,
    .dashboard-section.width-full .control-box-grid > *,
    .dashboard-section.width-three-quarter .control-box-grid > *,
    .dashboard-section.width-wide .control-box-grid > *,
    .dashboard-section.width-half .control-box-grid > *,
    .dashboard-section.width-quarter .control-box-grid > *,
    .dashboard-section.width-third .control-box-grid > * {
        grid-column: auto !important;
        grid-row: auto !important;
    }
    .control-box-grid,
    .dashboard-section.width-full .control-box-grid,
    .dashboard-section.width-three-quarter .control-box-grid,
    .dashboard-section.width-wide .control-box-grid,
    .dashboard-section.width-half .control-box-grid,
    .dashboard-section.width-quarter .control-box-grid,
    .dashboard-section.width-third .control-box-grid {
        grid-auto-rows: auto;
    }
    .section-layout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .vpn-hero-main,
    .ha-token-hero > div {
        display: grid;
    }
    .vpn-hero-main h2,
    .ha-token-hero h2 {
        font-size: 21px;
    }
    .vpn-setup-submit {
        width: 100%;
        min-width: 0;
    }
    .vpn-log-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .content-wrap { padding: 18px; }
    .topbar {
        height: auto;
        min-height: 62px;
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    .topbar-title {
        min-width: 0;
    }
    .topbar-title small {
        display: none;
    }
    .topbar-live {
        order: 5;
        width: 100%;
        justify-content: space-between;
        padding-top: 10px;
        border-top: 1px solid rgba(108,125,148,.16);
    }
    .topbar-live .live-pill {
        flex: 1 1 auto;
        min-width: 0;
    }
    .topbar-live form {
        flex: 0 0 auto;
    }
    .topbar-live .btn {
        white-space: nowrap;
    }
    .flash-stack {
        top: 78px;
        right: 12px;
        width: min(390px, calc(100vw - 24px));
    }
    .page-head,
    .settings-intro,
    .sticky-save,
    .device-row,
    .device-actions,
    .thermostat-summary,
    .thermostat-actions,
    .thermostat-actions form {
        align-items: stretch;
        flex-direction: column;
    }
    .settings-panel {
        padding-bottom: 142px;
    }
    .sticky-save {
        padding: 12px;
    }
    .thermostat-temp { text-align: left; }
    .thermostat-control-form,
    .thermostat-actions .thermostat-control-form {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .thermostat-dial {
        width: min(270px, 100%);
        min-height: 190px;
        padding: 8px 12px 0;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        grid-template-rows: 1fr 38px;
    }
    .thermostat-dial-status {
        padding-top: 0;
        font-size: .76rem;
    }
    .thermostat-dial-center {
        gap: 5px;
        padding: 46px 24px 14px;
    }
    .thermostat-dial-center strong {
        font-size: 1.65rem;
    }
    .thermostat-dial-center small {
        font-size: .72rem;
    }
    .thermostat-dial-label {
        font-size: .64rem;
    }
    .thermostat-dial-button {
        width: 28px;
        height: 28px;
    }
    .thermostat-mode-button {
        width: 28px;
        height: 28px;
        border-radius: 9px;
    }
    .thermostat-dial-readouts {
        max-width: 92%;
        gap: 6px;
        padding-top: 0;
        font-size: .66rem;
    }
    .thermostat-dial-readouts .battery-pill {
        width: 32px;
        height: 17px;
    }
    .thermostat-actions input[type="number"],
    .thermostat-actions select,
    .thermostat-actions .btn { width: 100%; }
    .metric-grid,
    .sensor-grid { grid-template-columns: 1fr; }
    .control-box-grid > *,
    .dashboard-section.width-full .control-box-grid > *,
    .dashboard-section.width-three-quarter .control-box-grid > *,
    .dashboard-section.width-wide .control-box-grid > *,
    .dashboard-section.width-half .control-box-grid > *,
    .dashboard-section.width-quarter .control-box-grid > *,
    .dashboard-section.width-third .control-box-grid > * {
        grid-column: 1 / -1;
        grid-row: auto !important;
    }
    .device-actions .btn { width: 100%; }
    .section-layout-grid {
        gap: 8px;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    .layout-card {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
        border: 1px solid rgba(35, 42, 58, .10);
        border-radius: 14px;
        background:
            linear-gradient(180deg, rgba(255,255,255,.90), rgba(248,250,252,.78)),
            rgba(255,255,255,.62);
        box-shadow: 0 12px 28px rgba(29,40,63,.08);
    }
    body[data-theme="dark"] .layout-card {
        border-color: rgba(154,170,190,.16);
        background:
            linear-gradient(180deg, rgba(18,27,42,.94), rgba(15,23,37,.84)),
            rgba(18,27,42,.72);
        box-shadow: 0 12px 28px rgba(0,0,0,.22);
    }
    .layout-card > div:first-of-type {
        padding-bottom: 2px;
    }
    .section-layout-head {
        display: none;
    }
    .layout-card label:not(.switch) span {
        display: block;
    }
    .logbook-hero,
    .logbook-filters {
        grid-template-columns: 1fr;
    }
    .logbook-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .log-entry-head {
        align-items: flex-start;
        flex-direction: column;
    }
}
