/* Optional tactile dashboard. All rules are scoped to its mode or root. */
body.touch-dashboard-mode {
  --touch-background:#2e3a47; --touch-surface:#20282f; --touch-surface-raised:#26323d;
  --touch-text:#f4f7fa; --touch-muted:#adc0d3; --touch-accent:#9fc9ff;
  --touch-active:#e2cd35; --touch-active-rgb:226,205,53; --touch-active-text:#fffbea; --touch-line:#425365;
  --touch-radius:22px; --touch-gap:12px;
}
body.touch-dashboard-mode:not(.editing-dashboard) { background:var(--touch-background); color:var(--touch-text); color-scheme:dark; }
body.touch-dashboard-mode:not(.editing-dashboard) .sidebar,
body.touch-dashboard-mode:not(.editing-dashboard) .sidebar-scrim,
body.touch-dashboard-mode:not(.editing-dashboard) .mobile-nav,
body.touch-dashboard-mode:not(.editing-dashboard) .topbar,
body.touch-dashboard-mode:not(.editing-dashboard) .page-footer { display:none!important; }
body.touch-dashboard-mode:not(.editing-dashboard) .app-layout { display:block; }
body.touch-dashboard-mode:not(.editing-dashboard) .main-column { margin:0; min-width:0; width:100%; }
body.touch-dashboard-mode:not(.editing-dashboard) .page-body { padding:0; margin:0; max-width:none; }
body.touch-dashboard-mode:not(.editing-dashboard) #main-content {
  max-width:1460px; margin:auto; padding:calc(18px + env(safe-area-inset-top,0px)) max(20px,env(safe-area-inset-right,0px)) calc(108px + env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px));
  min-height:100dvh; width:100%; box-sizing:border-box;
}
body.touch-dashboard-mode .toast-region { bottom:calc(100px + env(safe-area-inset-bottom,0px)); }
body.touch-dashboard-mode .offline-banner { z-index:120; }
body.touch-dashboard-mode .skip-link { color:#142c44; }
.touch-dashboard { --touch-mobile-columns:3; --touch-tablet-columns:6; width:100%; min-width:0; }
.touch-dashboard *, .touch-dashboard *::before, .touch-dashboard *::after { box-sizing:border-box; }
.touch-dashboard button,.touch-dashboard input,.touch-dashboard select,.touch-dashboard textarea { font:inherit; }
.touch-dashboard button { cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.touch-dashboard button:disabled { cursor:not-allowed; }
.touch-dashboard button:focus-visible,.touch-dashboard a:focus-visible,.touch-dashboard input:focus-visible,.touch-dashboard select:focus-visible,.touch-dashboard summary:focus-visible {
  outline:3px solid var(--touch-accent); outline-offset:4px;
}
.touch-dashboard [hidden] { display:none!important; }
.touch-topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 18px; }
.touch-heading { min-width:0; }
.touch-heading small { display:block; color:var(--touch-muted); text-transform:uppercase; letter-spacing:.12em; font-size:10px; font-weight:650; margin-bottom:5px; }
.touch-heading h1 { margin:0; font-size:clamp(22px,3.8vw,32px); line-height:1.2; letter-spacing:-.035em; color:var(--touch-text); overflow-wrap:anywhere; }
.touch-top-actions { display:flex; gap:7px; align-items:center; flex:none; }
.touch-quiet-button { width:44px; height:44px; display:inline-flex; align-items:center; justify-content:center; flex:none; border:1px solid var(--touch-line); border-radius:14px; background:rgba(25,34,43,.32); color:var(--touch-muted); text-decoration:none; }
.touch-quiet-button:hover { color:var(--touch-text); border-color:var(--touch-accent); }
.touch-quiet-button svg { width:21px; height:21px; }
.touch-live { display:inline-flex; align-items:center; gap:6px; font-size:11px; color:var(--touch-muted); white-space:nowrap; }
.touch-live::before { content:''; width:6px; height:6px; border-radius:50%; background:#9fca9b; }
.touch-live.offline::before { background:#edaa7c; }
.touch-board-chooser { display:flex; align-items:center; gap:12px; color:var(--touch-muted); font-size:12px; margin:0 0 18px; }
.touch-board-chooser .touch-select { flex:1; min-width:0; }
.touch-tabs { display:flex; overflow-x:auto; align-items:stretch; gap:9px; scrollbar-width:thin; scrollbar-color:#60758a transparent; border-bottom:1px solid var(--touch-line); margin:0 0 18px; padding:0 0 1px; overscroll-behavior-inline:contain; }
.touch-tab { display:flex; align-items:center; justify-content:center; flex:none; min-width:70px; min-height:52px; padding:9px 18px 13px; border:0; border-bottom:3px solid transparent; background:none; color:var(--touch-text); font-size:18px; font-weight:650; line-height:1.2; border-radius:0; }
.touch-tab[aria-selected=true] { color:var(--touch-accent); border-bottom-color:var(--touch-accent); }
.touch-grid { display:grid; grid-template-columns:repeat(var(--touch-mobile-columns),minmax(0,1fr)); gap:var(--touch-gap); align-items:stretch; }
.touch-card { position:relative; min-width:0; border:1px solid rgba(158,182,204,.09); border-radius:var(--touch-radius); background:var(--touch-surface); color:var(--touch-text); overflow:hidden; box-shadow:0 5px 0 rgba(161,189,217,.035),0 12px 22px rgba(8,17,26,.08); }
.touch-card.is-on { background:linear-gradient(155deg,rgba(var(--touch-active-rgb),.83),rgba(var(--touch-active-rgb),.35) 56%,#303b44); border-color:rgba(235,224,144,.12); }
.touch-card.is-on .touch-symbol { color:#fff2a0; filter:drop-shadow(0 0 15px rgba(255,229,73,.3)); }
.touch-card.is-disabled { opacity:.62; }
.touch-card.is-missing { border-style:dashed; }
.touch-card.is-pending { border-color:var(--touch-accent); }
.touch-card.is-pending::after { content:''; position:absolute; inset:0 0 auto; height:3px; background:linear-gradient(90deg,transparent,var(--touch-accent),transparent); animation:touch-progress 1.3s linear infinite; pointer-events:none; }
@keyframes touch-progress { from {transform:translateX(-100%)} to {transform:translateX(100%)} }
.touch-card-main { min-height:148px; padding:18px 13px 16px; display:flex; flex-direction:column; align-items:center; justify-content:space-between; gap:12px; text-align:center; width:100%; }
button.touch-card-main { appearance:none; border:0; border-radius:inherit; background:none; color:inherit; }
button.touch-card-main:disabled { opacity:1; }
.touch-card-title { font-size:15px; line-height:1.28; font-weight:650; color:var(--touch-text); margin:0; min-width:0; overflow-wrap:anywhere; text-wrap:balance; }
.touch-symbol { width:50px; height:50px; flex:none; color:#dae8f4; }
.touch-symbol svg { width:100%; height:100%; display:block; stroke-width:1.6; }
.touch-card-value { font-size:19px; font-weight:650; color:var(--touch-accent); line-height:1.15; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.touch-card-value small { font-size:.65em; margin-left:3px; font-weight:500; }
.touch-card-meta { display:flex; justify-content:center; align-items:center; flex-wrap:wrap; gap:5px; font-size:10px; line-height:1.35; color:var(--touch-muted); margin:0; min-height:14px; }
.touch-card-adjust { display:block; min-height:44px; width:100%; border:0; border-top:1px solid rgba(173,192,211,.14); background:rgba(10,19,27,.13); color:var(--touch-accent); font-size:12px; font-weight:600; }
.touch-card-adjust:hover { background:rgba(159,201,255,.09); }
.touch-card.is-on .touch-card-meta { color:#e7e7d3; }
.touch-card-badge { display:inline-flex; border:1px solid rgba(173,192,211,.23); border-radius:5px; padding:2px 5px; font-size:9px; line-height:1.1; }
.touch-card-inline { grid-column:1/-1; padding:18px 23px 17px; container-type:inline-size; }
.touch-inline-head { display:flex; align-items:center; gap:15px; margin-bottom:15px; }
.touch-inline-head .touch-symbol { width:43px; height:43px; }
.touch-inline-title { min-width:0; flex:1; }
.touch-inline-title .touch-card-title { font-size:22px; font-weight:550; text-align:left; }
.touch-inline-title .touch-card-meta { justify-content:flex-start; margin-top:4px; }
.touch-switch { position:relative; display:inline-flex; justify-content:center; align-items:center; flex:none; min-width:60px; min-height:44px; padding:0 5px; border:0; background:none; color:inherit; }
.touch-switch::before { content:''; position:absolute; width:43px; height:22px; border-radius:14px; background:rgba(192,204,214,.4); }
.touch-switch::after { content:''; position:absolute; width:29px; height:29px; border-radius:50%; background:#bfc9cf; transform:translateX(-12px); box-shadow:0 2px 4px rgba(0,0,0,.22); transition:transform .12s ease; }
.touch-switch[aria-checked=true]::before { background:rgba(159,201,255,.52); }
.touch-switch[aria-checked=true]::after { background:var(--touch-accent); transform:translateX(12px); }
.touch-switch:disabled { opacity:.5; }
.touch-controls { display:flex; align-items:center; gap:12px; width:100%; }
.touch-step { display:flex; align-items:center; justify-content:center; flex:none; width:44px; height:44px; padding:0; border:0; border-radius:50%; color:#152c43; background:var(--touch-accent); font-size:32px; line-height:1; font-weight:400; }
.touch-step:disabled { opacity:.45; }
.touch-range-wrap { flex:1; min-width:0; }
.touch-range { --touch-progress:0%; -webkit-appearance:none; appearance:none; display:block; width:100%; min-width:0; height:44px; margin:0; background:none; cursor:pointer; padding:0; border:0; }
.touch-range::-webkit-slider-runnable-track { height:6px; border-radius:6px; background:linear-gradient(to right,var(--touch-accent) var(--touch-progress),rgba(199,210,218,.42) var(--touch-progress)); }
.touch-range::-moz-range-track { height:6px; border-radius:6px; background:rgba(199,210,218,.42); }
.touch-range::-moz-range-progress { height:6px; border-radius:6px; background:var(--touch-accent); }
.touch-range::-webkit-slider-thumb { -webkit-appearance:none; width:24px; height:24px; margin-top:-9px; border-radius:50%; background:var(--touch-accent); border:0; box-shadow:0 2px 4px rgba(0,0,0,.15); }
.touch-range::-moz-range-thumb { width:24px; height:24px; border-radius:50%; background:var(--touch-accent); border:0; }
.touch-range:disabled { opacity:.5; cursor:not-allowed; }
.touch-range-labels { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--touch-muted); font-size:11px; line-height:1.2; }
.touch-range-labels output { color:var(--touch-text); font-weight:650; font-size:13px; font-variant-numeric:tabular-nums; }
.touch-range-labels output[data-editing=true] { color:var(--touch-accent); }
.touch-control-label { color:var(--touch-muted); font-size:12px; margin:16px 0 4px; }
.touch-color-controls { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; margin-top:14px; }
.touch-color-label { color:var(--touch-muted); font-size:12px; display:flex; align-items:center; gap:12px; min-height:48px; flex:1; }
.touch-color-label input[type=color] { appearance:none; width:58px; height:44px; border:1px solid var(--touch-line); padding:4px; background:var(--touch-surface-raised); border-radius:10px; cursor:pointer; }
.touch-color-label input[type=color]::-webkit-color-swatch-wrapper { padding:0; }
.touch-color-label input[type=color]::-webkit-color-swatch { border:0; border-radius:5px; }
.touch-color-label input[type=color]:disabled { opacity:.5; cursor:not-allowed; }
.touch-select { min-height:44px; max-width:100%; border:1px solid var(--touch-line); border-radius:10px; color:var(--touch-text); background:var(--touch-surface-raised); padding:9px 11px; }
.touch-select:disabled { opacity:.55; }
.touch-enum-label { display:flex; flex-direction:column; align-items:stretch; gap:4px; margin-bottom:14px; }
.touch-enum-label .touch-control-label { margin:14px 0 0; }
.touch-number,.touch-json { display:block; width:100%; min-width:0; min-height:44px; background:var(--touch-surface-raised); color:var(--touch-text); border:1px solid var(--touch-line); border-radius:10px; padding:9px 11px; font-size:16px; }
.touch-json { resize:vertical; font-family:ui-monospace,monospace!important; font-size:13px; }
.touch-json-label { display:flex; flex-direction:column; gap:7px; width:100%; color:var(--touch-muted); font-size:12px; }
.touch-numeric-control>.touch-action-button { margin-top:8px; }
.touch-device-controls>.touch-action-button { margin-top:6px; }
.touch-control-dialog { width:min(560px,calc(100% - 24px)); max-width:560px; max-height:calc(100dvh - 32px); overflow-y:auto; padding:calc(24px + env(safe-area-inset-top,0px)) 24px calc(24px + env(safe-area-inset-bottom,0px)); border:1px solid var(--touch-line); border-radius:var(--touch-radius); background:var(--touch-surface); color:var(--touch-text); color-scheme:dark; box-shadow:0 25px 90px #0008; }
.touch-control-dialog::backdrop { background:rgba(11,20,28,.72); backdrop-filter:blur(5px); }
.touch-control-dialog .touch-inline-head>.touch-card-title { flex:1; font-size:23px; }
.touch-control-dialog>.touch-state-label { padding-top:12px; border-top:1px solid var(--touch-line); }
.touch-control-dialog .touch-error { margin-top:12px; }
.touch-thermostat-readings { display:flex; justify-content:space-between; align-items:baseline; gap:12px; margin:18px 0 8px; }
.touch-thermostat-readings strong { font-size:35px; line-height:1; font-weight:500; color:var(--touch-text); letter-spacing:-.03em; }
.touch-thermostat-readings span { color:var(--touch-muted); font-size:12px; }
.touch-action-button { min-height:44px; border:1px solid var(--touch-line); background:var(--touch-surface-raised); color:var(--touch-accent); border-radius:10px; padding:9px 14px; display:inline-flex; align-items:center; justify-content:center; gap:9px; font-weight:600; }
.touch-action-button svg { width:18px; height:18px; }
.touch-action-button:disabled { opacity:.5; }
.touch-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:12px; }
.touch-state-label { margin:10px 0 0; font-size:12px; color:var(--touch-muted); line-height:1.45; overflow-wrap:anywhere; }
.touch-error { color:#ffd0b3; background:rgba(108,47,36,.45); border:1px solid rgba(234,153,116,.22); padding:9px 12px; border-radius:10px; margin:0; font-size:12px; line-height:1.45; }
.touch-empty { padding:42px 24px; border:1px dashed var(--touch-line); border-radius:22px; color:var(--touch-muted); text-align:center; line-height:1.65; grid-column:1/-1; }
.touch-empty h2 { font-size:20px; color:var(--touch-text); margin:0 0 8px; }
.touch-empty p { margin:0; }
.touch-note { padding:20px; min-height:145px; }
.touch-note .touch-card-title { text-align:left; }
.touch-note p { white-space:pre-wrap; color:var(--touch-muted); font-size:14px; line-height:1.6; overflow-wrap:anywhere; margin:12px 0 0; }
.touch-bottom-nav { position:fixed; inset:auto 0 0; z-index:75; display:flex; align-items:stretch; justify-content:flex-start; gap:1px; padding:7px max(8px,env(safe-area-inset-left,0px)) calc(7px + env(safe-area-inset-bottom,0px)); border-top:1px solid #3a4a5a; background:rgba(30,41,51,.97); box-shadow:0 -8px 24px rgba(15,25,35,.13); backdrop-filter:blur(16px); overflow-x:auto; overscroll-behavior-inline:contain; scrollbar-width:none; }
.touch-bottom-nav>:first-child { margin-left:auto; }
.touch-bottom-nav>:last-child { margin-right:auto; }
.touch-bottom-nav a,.touch-bottom-nav button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; color:#e2ebf2; background:none; border:0; padding:5px 11px; min-height:64px; min-width:66px; max-width:150px; flex:1; text-decoration:none; border-radius:12px; font-size:12px; font-weight:600; line-height:1.2; text-align:center; }
.touch-bottom-nav .touch-symbol { width:28px; height:28px; }
.touch-bottom-nav [aria-current=page] { color:var(--touch-accent); background:rgba(143,189,244,.09); }
.touch-bottom-nav [aria-current=page] .touch-symbol { color:var(--touch-accent); }
.touch-bottom-nav a:hover { background:rgba(143,189,244,.08); }
body.touch-dashboard-mode:not(.editing-dashboard) [data-standard-dashboard] { display:none!important; }
body.editing-dashboard #touch-dashboard { display:none!important; }
body.editing-dashboard .touch-bottom-nav { display:none!important; }
@container (max-width:220px) {
  .touch-inline-head { flex-wrap:wrap; gap:8px; }
  .touch-inline-title { flex-basis:100%; }
  .touch-inline-title .touch-card-title { font-size:18px; }
  .touch-inline-head .touch-switch { min-width:44px; width:44px; margin-left:auto; }
  .touch-inline-head .touch-switch::after { width:24px; height:24px; transform:translateX(-10px); }
  .touch-inline-head .touch-switch[aria-checked=true]::after { transform:translateX(10px); }
  .touch-controls { flex-wrap:wrap; justify-content:space-between; gap:6px; }
  .touch-range-wrap { order:-1; flex-basis:100%; }
  .touch-range-labels { flex-wrap:wrap; gap:4px; }
  .touch-range-labels output { order:-1; flex-basis:100%; text-align:center; overflow-wrap:anywhere; }
  .touch-thermostat-readings { flex-wrap:wrap; }
  .touch-thermostat-readings strong { font-size:26px; min-width:0; overflow-wrap:anywhere; }
  .touch-color-label { flex-wrap:wrap; }
  .touch-color-label input[type=color] { max-width:100%; }
  .touch-action-button { min-width:0; max-width:100%; padding-inline:8px; overflow-wrap:anywhere; }
}
@media(min-width:760px) {
  body.touch-dashboard-mode { --touch-gap:16px; }
  body.touch-dashboard-mode:not(.editing-dashboard) #main-content { padding:calc(26px + env(safe-area-inset-top,0px)) max(32px,env(safe-area-inset-right,0px)) calc(118px + env(safe-area-inset-bottom,0px)) max(32px,env(safe-area-inset-left,0px)); }
  .touch-grid { grid-template-columns:repeat(var(--touch-tablet-columns),minmax(0,1fr)); }
  .touch-card { grid-column:span var(--touch-tablet-span,1); }
  .touch-card-main { min-height:170px; padding:21px 15px 19px; }
  .touch-card-title { font-size:16px; }
  .touch-symbol { width:57px; height:57px; }
  .touch-card-inline { grid-column:span var(--touch-tablet-span,3); padding:22px 24px; }
  .touch-inline-title .touch-card-title { font-size:24px; }
  .touch-bottom-nav a,.touch-bottom-nav button { flex:0 1 145px; font-size:13px; }
  .touch-bottom-nav .touch-symbol { width:31px; height:31px; }
  .touch-topbar { margin-bottom:24px; }
  .touch-tabs { margin-bottom:24px; }
}
@media(max-width:759px) {
  .touch-card { grid-column:span var(--touch-mobile-span,1); }
  .touch-card-inline { grid-column:1/-1; }
}
@media(max-width:420px) {
  body.touch-dashboard-mode { --touch-gap:9px; --touch-radius:18px; }
  body.touch-dashboard-mode:not(.editing-dashboard) #main-content { padding:calc(14px + env(safe-area-inset-top,0px)) max(10px,env(safe-area-inset-right,0px)) calc(101px + env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-left,0px)); }
  .touch-card-main { min-height:139px; padding:15px 8px 12px; gap:10px; }
  .touch-card-title { font-size:13px; }
  .touch-symbol { width:43px; height:43px; }
  .touch-card-value { font-size:17px; }
  .touch-card-inline { padding:17px 16px; }
  .touch-inline-title .touch-card-title { font-size:21px; }
  .touch-controls { gap:8px; }
  .touch-bottom-nav { justify-content:flex-start; padding-inline:3px; }
  .touch-bottom-nav a,.touch-bottom-nav button { min-width:61px; padding-inline:5px; font-size:10px; }
  .touch-bottom-nav .touch-symbol { width:25px; height:25px; }
  .touch-tab { font-size:17px; min-width:68px; padding-inline:13px; }
  .touch-live { display:none; }
}
@media(prefers-reduced-motion:reduce) { .touch-dashboard *, .touch-dashboard *::before,.touch-dashboard *::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
