:root{
  --glass:rgba(35,31,28,.66);--glass2:rgba(25,23,22,.78);--line:rgba(255,255,255,.28);--line-soft:rgba(255,255,255,.14);
  --text:#f8f7f5;--muted:#d0cbc6;--green:#49d479;--amber:#ffb33f;--red:#ff7169;--blue:#339cff;
}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--text);background:#1a120d}body{background-image:linear-gradient(rgba(17,9,5,.27),rgba(15,9,6,.42)),url('/static/sunset-background.jpg');background-size:cover;background-position:center;background-attachment:fixed}button,input,select{font:inherit}button{color:#fff;cursor:pointer}.hidden{display:none!important}
.app-shell{min-height:100vh}.content{width:min(1320px,100%);margin:0 auto;padding:10px 24px 28px}.page{display:none}.page.active{display:block}
.device-statusbar{height:46px;display:flex;align-items:center;justify-content:space-between;padding:0 4px 0 2px;margin-bottom:12px}.status-clock{font-size:18px;font-weight:800;font-variant-numeric:tabular-nums;text-shadow:0 1px 5px #000}.status-icons{display:flex;align-items:center;gap:7px}.status-icon{position:relative;width:40px;height:40px;border:0;background:transparent;border-radius:50%;display:grid;place-items:center;color:#fff;font-size:24px;padding:0;text-shadow:0 1px 5px #000}.status-icon:hover,.status-icon.active{background:rgba(255,255,255,.14)}.status-icon.good .status-dot{background:var(--green)}.status-icon.bad .status-dot{background:var(--red)}.status-icon.off .status-dot{background:#8b8b8b}.status-dot{position:absolute;right:4px;bottom:4px;width:8px;height:8px;border-radius:50%;background:#888;border:1px solid rgba(0,0,0,.45)}.status-count{position:absolute;right:1px;bottom:1px;min-width:16px;height:16px;border-radius:10px;background:#1386ef;font-size:10px;display:grid;place-items:center;font-weight:800}.passive{pointer-events:none}.battery-badge{height:40px;display:flex;align-items:center;gap:6px;font-size:12px;font-weight:800}.battery-shell{position:relative;width:28px;height:14px;border:2px solid #fff;border-radius:3px;padding:2px}.battery-shell::after{content:"";position:absolute;width:3px;height:7px;background:#fff;right:-5px;top:1.5px;border-radius:1px}.battery-shell span{display:block;height:100%;width:70%;background:#fff;border-radius:1px}
.hero-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin:6px 20px 20px}.brand-row{display:flex;align-items:center;gap:12px}.brand-icon{font-size:38px}.brand-title{font-size:28px;font-weight:800}.brand-sub{font-size:14px;color:#f1e8df}.hero-head h1{font-size:52px;line-height:1;margin:28px 0 8px;text-shadow:0 2px 12px rgba(0,0,0,.45)}.hero-sub{font-size:25px;text-shadow:0 2px 12px rgba(0,0,0,.45)}.live-status{margin-top:8px;display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:12px;background:rgba(28,25,22,.48);border:1px solid var(--line-soft);backdrop-filter:blur(14px);font-size:12px}.refresh-status{width:32px;height:32px;border:1px solid var(--line);border-radius:50%;background:rgba(255,255,255,.08);font-size:18px}
.install-banner{display:flex;align-items:center;gap:12px;margin:0 18px 14px;padding:12px 14px;background:rgba(26,47,66,.82);border:1px solid rgba(125,195,255,.45);border-radius:15px;backdrop-filter:blur(16px)}.install-banner>div{display:flex;flex-direction:column;flex:1}.install-banner span{font-size:13px;color:#d7e7f3}.install-close{border:0;background:transparent;font-size:25px}
.blind-card-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;margin:0 20px 14px}.blind-card{min-width:0;padding:16px 14px 14px;border-radius:18px;background:linear-gradient(180deg,rgba(76,63,54,.66),rgba(37,35,34,.78));border:1px solid rgba(255,255,255,.34);backdrop-filter:blur(18px) saturate(1.08);box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 12px 28px rgba(0,0,0,.28)}.blind-card-title{font-size:17px;font-weight:800;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.blind-room{display:none}.blind-window{position:relative;height:150px;margin:10px auto 8px;width:90%;overflow:hidden;border:5px solid rgba(224,224,222,.88);background:#4f6570;box-shadow:inset 0 0 0 2px rgba(0,0,0,.28),0 3px 8px rgba(0,0,0,.28)}.blind-scene{position:absolute;z-index:0;inset:0;background-image:linear-gradient(rgba(255,185,96,.05),rgba(4,22,30,.08)),url('/static/sunset-background.jpg');background-size:310% auto;background-position:var(--scene-pos,50% 58%);filter:saturate(1.08) contrast(1.03);transform:scale(1.03)}.blind-window::after{content:"";position:absolute;z-index:3;inset:0;background:linear-gradient(180deg,rgba(255,230,191,.10),rgba(14,35,47,.05));box-shadow:inset 0 0 12px rgba(0,0,0,.18);pointer-events:none}.blind-shade{position:absolute;z-index:2;left:0;right:0;top:0;height:50%;min-height:0;background:repeating-linear-gradient(to bottom,#e7e8e8 0 7px,#bfc2c4 7px 9px);border-bottom:3px solid #8b8e91;box-shadow:0 2px 5px rgba(0,0,0,.28);transition:height .4s ease}.blind-unknown{position:absolute;z-index:4;inset:0;display:grid;place-items:center;background:rgba(15,15,15,.42);font-size:34px;font-weight:800}.blind-value{text-align:center;font-size:24px;font-weight:850;line-height:1.05}.blind-state{text-align:center;font-size:14px;color:#efe8e2;margin-top:4px}.blind-state-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px;background:#999}.blind-state-dot.open{background:var(--green)}.blind-state-dot.partial{background:var(--amber)}.blind-state-dot.closed{background:#b4c0ca}.blind-state-dot.error{background:var(--red)}.blind-buttons{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:14px}.blind-buttons button{aspect-ratio:1;border-radius:50%;border:1px solid rgba(255,255,255,.58);background:rgba(70,65,62,.42);font-size:22px;display:grid;place-items:center;box-shadow:inset 0 1px 0 rgba(255,255,255,.12)}.blind-buttons button:hover{background:rgba(255,255,255,.16)}
.glass-strip,.glass-card,.panel,.home-nav-card{background:rgba(38,34,31,.70);border:1px solid var(--line);backdrop-filter:blur(18px);box-shadow:0 10px 25px rgba(0,0,0,.22)}.all-control{display:grid;grid-template-columns:1.2fr repeat(3,1fr);align-items:center;gap:20px;margin:0 20px 14px;padding:10px 14px;border-radius:15px}.strip-title{display:flex;align-items:center;gap:14px;font-size:18px}.stack-icon{font-size:28px}.all-control button{height:46px;border-radius:24px;border:1px solid rgba(255,255,255,.42);background:rgba(75,70,66,.42);font-size:14px;display:flex;align-items:center;justify-content:center;gap:12px}.all-control button span{font-size:18px}.all-control button:hover{background:rgba(255,255,255,.14)}
.home-panels{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:0 20px 14px}.home-panel{border-radius:16px;padding:0 14px 8px;overflow:hidden}.panel-title{height:46px;display:flex;align-items:center;gap:12px;border-bottom:1px solid var(--line-soft);font-size:17px;font-weight:800}.panel-title span{font-size:23px}.home-row{display:grid;grid-template-columns:minmax(0,1.4fr) auto auto;align-items:center;gap:12px;min-height:46px;border-bottom:1px solid var(--line-soft);font-size:13px}.home-row:last-child{border-bottom:0}.home-row .name{display:flex;align-items:center;gap:10px;font-weight:700}.home-row .symbol{font-size:22px}.home-row .when{color:#eee7df;white-space:nowrap}.home-row .ok{color:var(--green);font-size:21px}.home-row .fail{color:var(--red);font-size:19px}.home-row .target{color:#d6d0ca;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.home-row .switch{position:relative;width:42px;height:24px;border-radius:15px;border:0;background:#666;padding:0}.home-row .switch::after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:left .18s}.home-row .switch.on{background:#31c66c}.home-row .switch.on::after{left:21px}.home-nav-card{width:calc(100% - 40px);margin:0 20px 10px;height:52px;border-radius:14px;padding:0 16px;display:grid;grid-template-columns:32px 1fr 30px;align-items:center;text-align:left;font-size:17px}.home-nav-card>span:first-child{font-size:23px}.home-nav-card .chev{text-align:right;font-size:22px}.home-nav-card:hover{background:rgba(56,51,47,.82)}
.subpage-head{display:flex;align-items:center;gap:12px;margin:18px 20px 16px}.subpage-head h2{font-size:30px;margin:0}.subpage-head p{margin:2px 0 0;color:#e2d8cf}.back{width:42px;height:42px;border:1px solid var(--line);border-radius:50%;background:rgba(30,27,25,.66);font-size:22px}.panel{margin:10px 20px;border-radius:15px;padding:0 14px 14px;background:rgba(31,28,26,.78)}.panel summary{cursor:pointer;padding:14px 2px;font-size:17px;font-weight:800}.formgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:8px}label{display:block;color:#d8d1ca;font-size:12px}input,select{width:100%;margin-top:4px;min-height:40px;padding:8px 10px;border-radius:9px;border:1px solid rgba(255,255,255,.24);background:rgba(12,12,12,.66);color:#fff}.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:9px}.actions button,.panel>button,.row button,.schedule-buttons button,.user-row button,.user-create button,.install-banner button{border-radius:9px;padding:9px 13px}.primary{border:1px solid #74bdff;background:linear-gradient(180deg,#1687f6,#0752a2);font-weight:800}.secondary{border:1px solid rgba(255,255,255,.38);background:linear-gradient(180deg,#6f767d,#3b4147);font-weight:750}.danger{border:1px solid #ff9a9a;background:linear-gradient(180deg,#e65e5e,#9e3030);font-weight:800}.hint{color:#c9c2bb;font-size:12px}.row{display:grid;grid-template-columns:1fr 1fr auto auto;gap:6px;margin-top:7px;align-items:center}.schedule{background:rgba(10,10,10,.38);border:1px solid var(--line-soft);border-radius:11px;padding:10px;margin-top:9px}.schedule-grid{display:grid;grid-template-columns:1.25fr repeat(6,minmax(74px,1fr));gap:6px;align-items:end}.schedule label{font-size:11px}.schedule-subgrid{display:contents}.days{display:flex;flex-wrap:wrap;gap:4px;margin-top:7px}.day{display:flex;align-items:center;gap:3px;background:rgba(255,255,255,.06);border:1px solid var(--line-soft);padding:5px 7px;border-radius:7px;color:#fff}.day input{width:auto;min-height:auto;margin:0}.schedule-footer{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:8px}.schedule-footer p{margin:0;color:#cfc6bf;font-size:12px}.schedule-buttons{display:flex;gap:8px}.user-create{display:grid;grid-template-columns:1fr 1fr auto auto;gap:7px;align-items:center;margin-bottom:8px}.inline-check{display:flex;align-items:center;gap:5px;color:#fff}.inline-check input{width:auto;min-height:auto;margin:0}.user-row{display:grid;grid-template-columns:1.1fr auto auto 1fr auto;gap:7px;align-items:center;padding:8px 0;border-top:1px solid var(--line-soft)}.history-title{font-weight:800;margin:14px 0 5px}.log-row{display:grid;grid-template-columns:145px 1fr 90px 2fr;gap:7px;padding:6px 3px;border-top:1px solid var(--line-soft);font-size:12px}.oktxt{color:#65e890}.errtxt{color:#ff7e76}
#toast{position:fixed;left:50%;bottom:18px;transform:translate(-50%,20px);background:#fff;color:#111;border-radius:10px;padding:10px 14px;opacity:0;transition:.18s;z-index:99}#toast.show{opacity:1;transform:translate(-50%,0)}
.auth-body{min-height:100vh;display:grid;place-items:center;padding:20px;background:linear-gradient(rgba(4,8,12,.35),rgba(4,8,12,.55)),url('/static/sunset-background.jpg') center/cover fixed}.auth-card{width:min(420px,100%);padding:26px;border-radius:18px;background:rgba(31,27,24,.78);backdrop-filter:blur(18px);border:1px solid var(--line);box-shadow:0 24px 70px rgba(0,0,0,.40)}.auth-title{font-size:32px;font-weight:800}.auth-sub{color:#ddd2c8;margin:4px 0 18px}.auth-card label{margin-top:10px}.auth-button{width:100%;margin-top:16px;min-height:46px;border:1px solid #74bdff;border-radius:10px;background:linear-gradient(180deg,#1687f6,#0752a2);font-weight:700}.auth-msg{min-height:20px;color:#ffb0a8}
@media(max-width:1050px){.blind-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.blind-window{height:170px}.home-panels{grid-template-columns:1fr}.schedule-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:720px){body{background-attachment:scroll;background-position:center top}.content{padding:6px 8px 20px}.device-statusbar{position:sticky;top:0;z-index:30;margin:0 -2px 10px;padding:0 4px;background:rgba(25,18,14,.54);backdrop-filter:blur(18px);border-radius:0 0 12px 12px}.status-clock{font-size:16px}.status-icons{gap:2px}.status-icon{width:36px;height:36px;font-size:21px}.battery-badge{display:none}.hero-head{margin:8px 6px 14px}.brand-row{display:none}.hero-head h1{font-size:38px;margin:8px 0 4px}.hero-sub{font-size:18px}.live-status{font-size:11px}.blind-card-grid{grid-template-columns:1fr;margin:0 6px 10px;gap:10px}.blind-card{display:grid;grid-template-columns:105px 1fr;grid-template-areas:"title title" "window info" "window buttons";column-gap:14px;align-items:center;padding:12px}.blind-card-title{grid-area:title;text-align:left}.blind-room{text-align:left}.blind-window{grid-area:window;width:100px;height:95px;margin:6px 0}.blind-info{grid-area:info;align-self:end}.blind-value,.blind-state{text-align:left}.blind-buttons{grid-area:buttons;margin-top:8px;align-self:start}.blind-buttons button{aspect-ratio:1;max-width:54px}.all-control{grid-template-columns:1fr 1fr 1fr;margin:0 6px 10px;gap:6px;padding:8px}.strip-title{grid-column:1/-1}.all-control button{height:44px;font-size:12px;gap:5px}.home-panels{margin:0 6px 10px;gap:10px}.home-nav-card{width:calc(100% - 12px);margin:0 6px 8px}.subpage-head,.panel{margin-left:6px;margin-right:6px}.subpage-head h2{font-size:26px}.schedule-grid{grid-template-columns:1fr 1fr}.schedule-footer{align-items:flex-start;flex-direction:column}.row{grid-template-columns:1fr auto}.row select{grid-column:1}.user-create,.user-row{grid-template-columns:1fr 1fr}.user-row>div:first-child{grid-column:1/-1}.log-row{grid-template-columns:1fr auto}.log-row span:last-child{grid-column:1/-1}.install-banner{margin:0 6px 10px;align-items:flex-start;flex-wrap:wrap}.install-banner>div{min-width:200px}.install-banner .primary{white-space:nowrap}}
@media(max-width:430px){.status-icons .nav-icon[data-page="home"]{display:none}.status-icon{width:34px;height:34px}.hero-head{align-items:flex-start}.hero-head h1{font-size:34px}.blind-card{grid-template-columns:90px 1fr}.blind-window{width:86px;height:88px}.blind-buttons{gap:8px}.blind-buttons button{font-size:18px}.home-row{grid-template-columns:minmax(0,1fr) auto}.home-row .target{display:none}.all-control button span{font-size:15px}.all-control button{padding:0 6px}}

/* v1.4.2 recent-actions layout: concise rows, no long monitor text on dashboard */
.recent-row{grid-template-columns:minmax(0,1fr) auto 28px;min-height:58px}
.recent-row .name{min-width:0}
.recent-main{display:flex;min-width:0;flex-direction:column;line-height:1.15}
.recent-main b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.recent-main small{margin-top:4px;color:var(--muted);font-size:11px;font-weight:500}
.recent-result{font-weight:700;max-width:110px}
@media(max-width:430px){.recent-row{grid-template-columns:minmax(0,1fr) auto 24px}.recent-row .target{display:block}.recent-result{font-size:12px;max-width:80px}}

/* v1.4.3: real nature view behind the dynamically positioned roller blind */
.blind-window::before{content:"";position:absolute;z-index:1;left:49.4%;top:0;bottom:0;width:1px;background:rgba(255,255,255,.10);pointer-events:none}
@media(max-width:720px){.blind-scene{background-size:340% auto}.blind-card-title{margin-bottom:2px}}

/* v1.4.4: robust mobile layout for dashboard schedule panel */
@media(max-width:720px){
  .home-panels{display:flex;flex-direction:column;align-items:stretch}
  .home-panel{height:auto!important;min-height:0!important;align-self:stretch}
  #homeSchedules,#homeRecent{display:block;width:100%}
  #homeSchedules .home-row{
    display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;
    column-gap:10px;row-gap:2px;min-height:58px;padding:7px 0;align-items:center
  }
  #homeSchedules .home-row .name{grid-column:1;grid-row:1;min-width:0}
  #homeSchedules .home-row .when{grid-column:1;grid-row:2;white-space:normal;color:#ddd5ce;font-size:12px;padding-left:32px}
  #homeSchedules .home-row .switch{grid-column:2;grid-row:1 / span 2;align-self:center}
}
@media(max-width:430px){
  #homeSchedules .home-row{grid-template-columns:minmax(0,1fr) 44px}
  #homeSchedules .home-row .name{font-size:13px}
  #homeSchedules .home-row .symbol{font-size:20px}
}

/* v1.4.5: Android/Samsung mobile compositor fix.
   backdrop-filter on dynamically populated dashboard cards could temporarily
   paint an oversized translucent layer until the next reflow. Keep the same
   glass appearance on mobile, but without the problematic live backdrop blur. */
@media(max-width:720px){
  .home-panel{
    -webkit-backdrop-filter:none!important;
    backdrop-filter:none!important;
    background:rgba(38,34,31,.88)!important;
    overflow:hidden;
    contain:layout paint;
    isolation:isolate;
  }
  .home-panels{position:relative;z-index:1}
  #homeSchedules,#homeRecent{position:relative;z-index:1}
}


/* v1.4.12: per-blind battery display */
:root{--battery-good:#2eb866;--battery-warn:#e2ad31;--battery-low:#e8534f}
.battery-settings-grid{display:grid;grid-template-columns:repeat(3,minmax(180px,1fr));gap:10px;margin-bottom:8px}
.blind-visual-row{height:168px;display:grid;grid-template-columns:minmax(0,1fr) 48px;column-gap:10px;align-items:end;margin:4px 2px 2px 10px}
.blind-visual-row .blind-window{width:100%;height:150px;margin:0;align-self:end}
.blind-battery{height:150px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;padding-bottom:0}
.blind-battery-icon{position:relative;width:24px;height:43px;border:2px solid rgba(245,247,248,.94);border-radius:5px;padding:3px;display:flex;align-items:flex-end;box-shadow:0 2px 6px rgba(0,0,0,.28)}
.blind-battery-icon::before{content:"";position:absolute;top:-6px;left:7px;width:7px;height:5px;background:rgba(245,247,248,.94);border-radius:2px 2px 0 0}
.blind-battery-icon span{display:block;width:100%;min-height:2px;border-radius:2px;background:var(--battery-good);transition:height .25s ease}
.blind-battery-text{margin-top:5px;height:20px;line-height:20px;font-size:13px;font-weight:850;white-space:nowrap;color:var(--battery-good);font-variant-numeric:tabular-nums}
.blind-battery.warn .blind-battery-icon span{background:var(--battery-warn)}.blind-battery.warn .blind-battery-text{color:var(--battery-warn)}
.blind-battery.low .blind-battery-icon span{background:var(--battery-low)}.blind-battery.low .blind-battery-text{color:var(--battery-low)}
.blind-battery.unknown .blind-battery-icon span{background:#8f969b}.blind-battery.unknown .blind-battery-text{color:#c2c6c9}
@media(max-width:1050px){.blind-visual-row{height:188px}.blind-visual-row .blind-window{height:170px}.blind-battery{height:170px}}
@media(max-width:720px){
 .battery-settings-grid{grid-template-columns:1fr}
 .blind-card{grid-template-columns:119px 1fr;grid-template-areas:"title title" "visual info" "visual buttons"}
 .blind-visual-row{grid-area:visual;width:119px;height:95px;grid-template-columns:86px 28px;column-gap:5px;margin:6px 0 0 5px;align-items:end}
 .blind-visual-row .blind-window{grid-area:auto;width:86px;height:95px;margin:0}
 .blind-battery{height:95px}
 .blind-battery-icon{width:18px;height:32px;border-width:2px;padding:2px}
 .blind-battery-icon::before{top:-5px;left:5px;width:6px;height:4px}
 .blind-battery-text{font-size:10px;height:16px;line-height:16px;margin-top:3px}
}
@media(max-width:430px){.blind-card{grid-template-columns:108px 1fr}.blind-visual-row{width:108px;grid-template-columns:78px 25px}.blind-visual-row .blind-window{width:78px;height:88px}.blind-battery{height:88px}.blind-battery-text{font-size:9px}}

/* v1.4.15 administration layout */
.mail-alert-options{grid-column:1/-1;display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-top:2px}
.mail-alert-options .inline-check{justify-content:flex-start;text-align:left}
.user-actions{display:flex;gap:7px;justify-content:flex-end;flex-wrap:wrap}
@media(max-width:720px){.mail-alert-options{grid-column:1/-1}.user-actions{justify-content:flex-start}}
