/* v1.4 premium revision: original glassmorphism additions and responsive utility views. */
.topbar-actions{margin-left:auto;display:flex;align-items:center;gap:10px}.install-btn{border:1px solid rgba(151,247,171,.28);color:var(--text);border-radius:999px;padding:9px 13px;font-size:11px;background:rgba(7,55,36,.65);white-space:nowrap}.install-btn:hover{border-color:var(--green);transform:translateY(-1px)}.dialog-head-actions{display:flex;align-items:center;gap:8px}.mini-btn{border:1px solid var(--line);background:rgba(3,27,19,.6);color:var(--muted);border-radius:10px;padding:6px 9px;font-size:12px}.mini-btn:hover{color:var(--text);border-color:var(--green)}
.hero-copy{z-index:2}.ai-recommendation-card{width:min(345px,calc(100vw - 72px));margin-top:16px;border-radius:18px;padding:12px 14px;background:linear-gradient(135deg,rgba(4,50,31,.78),rgba(5,27,19,.75));border-color:rgba(98,237,121,.24)}.recommendation-heading{display:flex;align-items:center;gap:8px}.recommendation-heading>div{display:flex;flex-direction:column;flex:1}.recommendation-heading b{font-size:12px;font-weight:650}.recommendation-heading small{font-size:10px;color:var(--muted);margin-top:2px}.ai-avatar.mini{width:25px;height:25px;font-size:13px}.ai-recommendation-card p{font-size:12px;line-height:1.45;color:#dff8e4;margin:9px 0 0}.recommendation-action{border:0;background:rgba(57,228,97,.13);border-radius:8px;color:var(--green2);padding:7px 9px;margin-top:9px;font-size:10px}.device-meta{justify-content:space-between;font-size:10px;color:var(--muted)}.device-meta span{white-space:nowrap}.hero-facts{grid-template-columns:repeat(4,minmax(0,1fr))}.weather{grid-template-columns:1.55fr repeat(5,1fr);position:relative}.weather-sun{border-right:0}.weather-location{color:#88b795!important;margin-top:4px}.weather-source{position:absolute;right:16px;bottom:4px;font-size:9px;color:#7eaa8c}.sensor-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.chart-wrap{position:relative}.chart-wrap canvas{display:block;width:100%;max-height:190px}.metric-tabs{display:flex;gap:7px;overflow:auto;padding:1px 0 9px;scrollbar-width:none}.metric-tabs::-webkit-scrollbar{display:none}.metric-tab{border:1px solid var(--line);background:rgba(2,30,19,.4);color:var(--muted);border-radius:9px;padding:7px 10px;font-size:10px;white-space:nowrap}.metric-tab.active{border-color:rgba(57,228,97,.65);color:var(--green2);background:rgba(46,177,77,.13)}.chart-actions{flex-wrap:wrap}.chart-actions select{border:1px solid var(--line);background:rgba(2,28,18,.7);color:var(--text);border-radius:9px;padding:7px 9px;font-size:11px;max-width:230px}.bottom-nav{left:50%;transform:translateX(-50%);width:min(680px,calc(100% - 30px));display:grid;grid-template-columns:1fr 1fr 74px 1fr 1fr;align-items:center;gap:3px;padding:7px 9px calc(7px + env(safe-area-inset-bottom));z-index:20}.bottom-nav .nav-item{min-height:56px}.home-fab{width:68px;height:68px;margin:-26px auto 0;border-radius:50%;border:4px solid rgba(3,29,20,.8);background:linear-gradient(145deg,#4cf36d,#0bc55e);color:#effff1;font-size:31px;box-shadow:0 12px 28px rgba(0,0,0,.38),0 0 24px rgba(57,228,97,.28)}.home-fab.active{box-shadow:0 12px 28px rgba(0,0,0,.38),0 0 28px rgba(57,228,97,.6)}.bottom-nav .nav-item span{font-size:21px}.bottom-nav .nav-item small{font-size:10px}.ai-fab{z-index:25}.settings-dialog,.schedule-dialog,.utility-dialog{width:min(760px,calc(100% - 20px));max-height:calc(100dvh - 20px);padding:0;border:1px solid rgba(161,247,177,.2);border-radius:24px;background:linear-gradient(160deg,#0d3928,#041c15);color:var(--text);box-shadow:0 24px 100px #000;overflow:hidden}.settings-dialog::backdrop,.schedule-dialog::backdrop,.utility-dialog::backdrop{background:rgba(0,5,3,.72);backdrop-filter:blur(5px)}.settings-dialog[open],.utility-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto}.settings-dialog>.ai-head,.schedule-dialog>.ai-head,.utility-dialog>.ai-head{position:relative;z-index:4;background:rgba(7,43,30,.96);padding:18px 20px}.settings-scroll,.schedule-scroll,.utility-content{min-height:0;overflow:auto;-webkit-overflow-scrolling:touch}.settings-section{padding:16px 20px;border-bottom:1px solid var(--line)}.settings-section h3{font-size:14px;margin:0 0 12px;font-weight:600}.settings-hint{color:var(--muted);font-size:10px;font-weight:400;margin-left:4px}.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.settings-grid label,.settings-section>label{display:block;color:#b5d2bc;font-size:11px}.settings-grid label.wide{grid-column:1/-1}.settings-grid input,.settings-grid select,.settings-section>label input,.settings-section>label select{width:100%;margin-top:6px;border:1px solid var(--line);border-radius:10px;background:rgba(2,25,17,.8);color:white;padding:10px;outline:none}.settings-grid select option,.settings-section select option,.schedule-form select option{background:#08271d;color:white}.check-row{display:flex!important;align-items:center;gap:7px;padding:10px 0;color:#c8e6cd!important}.check-row input{width:auto!important;margin:0!important;accent-color:var(--green)}.settings-preview{margin:10px 0 0;color:var(--green2);font-size:11px;line-height:1.45}.relay-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:11px}.relay-setting{display:grid;grid-template-columns:28px 1fr;align-items:center;gap:8px;border:1px solid var(--line);border-radius:10px;padding:7px 9px;background:rgba(2,28,18,.45)}.relay-setting span{color:var(--green);font-weight:700;font-size:12px}.relay-setting input{width:100%;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--text);padding:5px 2px;outline:none;font-size:11px}.settings-actions{padding:12px 20px;margin:0;justify-content:space-between;background:rgba(3,28,20,.6)}.utility-dialog{width:min(650px,calc(100% - 20px))}.utility-content{padding:18px 20px}.automation-rule,.history-item{display:flex;align-items:flex-start;gap:10px;border-bottom:1px solid var(--line);padding:12px 0}.automation-rule:last-child,.history-item:last-child{border-bottom:0}.automation-rule .rule-dot{width:9px;height:9px;background:var(--green);border-radius:50%;margin-top:5px;box-shadow:0 0 10px var(--green)}.automation-rule b,.history-item b{display:block;font-size:12px}.automation-rule small,.history-item small{display:block;color:var(--muted);font-size:10px;margin-top:3px;line-height:1.4}.history-empty{color:var(--muted);font-size:12px;padding:20px 0}.csv-btn{border:1px solid var(--line);border-radius:9px;background:rgba(2,30,19,.5);color:var(--text);padding:8px 10px;font-size:11px}.duration-unit-field{}.schedule-form{grid-template-columns:repeat(2,minmax(0,1fr))}.schedule-form label{min-width:0}.schedule-form input,.schedule-form select{font-size:12px}.schedule-form label[hidden]{display:none!important}
body.theme-light{--bg:#e9f3ed;--bg2:#d8ebe0;--panel:rgba(255,255,255,.76);--panel2:rgba(242,255,246,.86);--line:rgba(17,91,43,.18);--text:#10301c;--muted:#52715b;background:linear-gradient(160deg,#e5f3e8,#cfe8d6)}body.theme-light .glass{background:linear-gradient(135deg,rgba(255,255,255,.84),rgba(227,247,232,.78));box-shadow:0 18px 54px rgba(38,88,52,.14)}body.theme-light .hero-shade{background:linear-gradient(90deg,rgba(232,251,235,.86),rgba(223,248,228,.3),rgba(1,30,15,.22)),linear-gradient(0deg,rgba(227,248,231,.7),transparent 50%)}body.theme-light .settings-dialog,body.theme-light .schedule-dialog,body.theme-light .utility-dialog{background:linear-gradient(160deg,#e9fff0,#cfe9d7);color:var(--text)}body.theme-light .ai-head{background:rgba(224,248,229,.92)}body.theme-light input,body.theme-light select,body.theme-light textarea{color:var(--text)!important;background:rgba(255,255,255,.68)!important}
@media(max-width:1100px){.sensor-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.weather{grid-template-columns:1.4fr repeat(3,1fr)}.weather-sun{border-right:0}.hero-facts{grid-template-columns:repeat(4,1fr)}}
@media(max-width:760px){.app-shell{padding:10px 10px 110px}.topbar{height:65px;gap:10px}.project-name{font-size:22px}.eyebrow{font-size:8px}.install-btn{padding:8px 9px;font-size:10px}.hero{height:650px;border-radius:23px}.hero-copy{left:23px;top:48px}.hero-copy h1{font-size:34px}.health-ring{width:138px;height:138px}.health-ring strong{font-size:42px}.ai-recommendation-card{width:min(330px,calc(100vw - 50px));margin-top:11px}.device-card{right:16px;top:44px;min-width:155px;padding:11px 13px}.device-row{font-size:11px;padding:7px 0}.hero-facts{left:14px;right:14px;bottom:14px;grid-template-columns:repeat(2,1fr);gap:8px}.fact{padding:10px 11px;border-radius:14px}.fact span{font-size:19px}.fact b{font-size:13px}.weather{grid-template-columns:1.25fr 1fr 1fr;gap:3px;padding:12px;margin-top:10px}.weather-main,.weather-item{padding:4px 7px;gap:7px;min-height:54px}.weather-icon{font-size:29px}.weather-main b{font-size:22px}.weather-main small,.weather-item small{font-size:9px}.weather-item b{font-size:12px}.weather-item span{font-size:21px}.weather-sun{grid-column:2/-1;border-top:1px solid var(--line);padding-top:8px}.weather-source{right:9px;bottom:2px;font-size:8px}.sensor-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.sensor-card{min-height:132px;padding:12px 7px}.sensor-card .sensor-value{font-size:20px}.dashboard-grid{grid-template-columns:1fr;gap:10px}.relay-grid{gap:7px}.relay-card{padding:10px;grid-template-columns:28px 1fr auto}.relay-icon{font-size:22px}.relay-card b{font-size:11px}.section-pad{padding:13px}.section-heading h2{font-size:16px}.chart-actions{gap:5px}.chart-actions select{flex:1;min-width:180px}.bottom-nav{width:calc(100% - 18px);grid-template-columns:1fr 1fr 68px 1fr 1fr;padding-left:4px;padding-right:4px}.bottom-nav .nav-item small{font-size:9px}.home-fab{width:62px;height:62px;font-size:28px}.settings-grid,.schedule-form{grid-template-columns:1fr}.settings-grid label.wide{grid-column:auto}.relay-settings-grid{grid-template-columns:1fr}.settings-section{padding:14px}.settings-dialog>.ai-head,.schedule-dialog>.ai-head,.utility-dialog>.ai-head{padding:15px}.settings-actions{padding:10px 14px}.schedule-form-actions{align-items:stretch;flex-direction:column}.schedule-form-actions>.dialog-actions{display:grid;grid-template-columns:1fr 1.35fr}.schedule-form-actions button{min-height:44px}.ai-dialog{width:calc(100% - 12px);max-height:calc(100dvh - 12px)}}
@media(max-width:390px){.install-btn{display:none}.hero{height:680px}.device-card{top:42px;right:10px}.hero-copy{left:17px}.ai-recommendation-card{width:calc(100vw - 36px)}.weather{grid-template-columns:1fr 1fr}.weather-main{grid-column:1/-1}.weather-sun{grid-column:1/-1}.bottom-nav .nav-item span{font-size:18px}}

/* v1.5 — editable brand, generated/uploaded hero, audit, automation, and icon editors */
.topbar{align-items:center}.brand-logo{width:52px;height:52px;flex:0 0 52px;border-radius:17px;display:grid;place-items:center;padding:0;color:var(--text);font-size:27px;overflow:hidden}.brand-logo img{width:100%;height:100%;object-fit:cover}.app-name{font-size:22px;line-height:1;color:var(--text);letter-spacing:-.02em}.project-select{gap:4px}.project-name{font-size:13px;color:var(--muted);font-weight:500}.project-name span{display:none}.plant-chip{padding:4px 10px;font-size:11px}.topbar-actions{margin-left:auto;display:flex;align-items:center;gap:9px}

.ai-recommendation-inline{width:min(370px,calc(100vw - 70px));margin-top:12px;color:#e8ffeb;text-shadow:0 2px 10px rgba(0,0,0,.76)}.ai-recommendation-inline p{margin:0;font-size:12px;line-height:1.55;font-weight:500}.recommendation-tools{display:flex;align-items:center;gap:5px;margin-top:3px;color:#9cc7a5}.recommendation-tools small{font-size:9px}.mini-btn.plain{width:24px;height:24px;border:0;background:transparent;box-shadow:none}.ai-recommendation-inline .recommendation-action{margin-top:6px;background:rgba(3,29,20,.56);border:1px solid rgba(98,237,121,.2);backdrop-filter:blur(8px)}
.hero.is-generating:after{content:"Hero lokal sedang disiapkan…";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:4;background:rgba(1,24,15,.76);border:1px solid var(--line);border-radius:99px;padding:10px 15px;font-size:11px;backdrop-filter:blur(12px)}

.hero-setting-actions{display:flex;align-items:center;gap:12px;margin-top:11px}.hero-setting-actions small{color:var(--muted);font-size:10px;line-height:1.4}.relay-setting{grid-template-columns:28px minmax(0,1fr) 74px}.relay-setting .icon-editor,.sensor-setting .icon-editor{text-align:center}.sensor-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.sensor-setting{display:grid;grid-template-columns:minmax(0,1fr) 74px;gap:8px;border:1px solid var(--line);border-radius:11px;padding:8px;background:rgba(2,28,18,.45)}.sensor-setting input{min-width:0;width:100%;border:0;border-bottom:1px solid var(--line);background:transparent;color:var(--text);padding:6px 2px;outline:none;font-size:11px}

.classic-scheduler{width:min(760px,calc(100% - 20px))}.classic-scheduler .schedule-manager{padding:15px 18px;border-bottom:1px solid var(--line)}.classic-scheduler .schedule-form{padding:17px 18px}.classic-scheduler .schedule-manager-row{display:grid;grid-template-columns:32px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 0;border-bottom:1px solid var(--line)}.classic-scheduler .schedule-manager-row:last-child{border-bottom:0}.classic-scheduler .schedule-manager-row b{font-size:12px}.classic-scheduler .schedule-manager-row small{display:block;color:var(--muted);font-size:10px;margin-top:4px;line-height:1.4}

.automation-dialog{width:min(820px,calc(100% - 20px))}.automation-form{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;border-top:1px solid var(--line);padding-top:17px;margin-top:8px}.automation-form label{display:block;color:#b5d2bc;font-size:11px}.automation-form label.wide,.automation-form .wide{grid-column:1/-1}.automation-form input,.automation-form select{width:100%;margin-top:6px;border:1px solid var(--line);border-radius:10px;background:rgba(2,25,17,.8);color:white;padding:10px;outline:none}.automation-list-row{display:grid;grid-template-columns:12px minmax(0,1fr) auto;gap:10px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}.automation-list-row:last-child{border-bottom:0}.automation-list-row b{display:block;font-size:12px}.automation-list-row small{display:block;color:var(--muted);font-size:10px;line-height:1.4;margin-top:4px}.automation-list-row .rule-dot.off{background:#698079;box-shadow:none}.automation-list-actions{display:flex;gap:6px}

.history-dialog{width:min(850px,calc(100% - 20px))}.history-toolbar{display:grid;grid-template-columns:1fr 1.4fr 1fr auto;gap:8px;padding:12px 18px;border-bottom:1px solid var(--line);background:rgba(2,25,17,.45)}.history-toolbar label{font-size:9px;color:var(--muted)}.history-toolbar select{display:block;width:100%;margin-top:4px;border:1px solid var(--line);border-radius:9px;background:rgba(2,25,17,.86);color:var(--text);padding:8px;font-size:10px}.history-toolbar .csv-btn{align-self:end;min-height:35px}.history-item{display:grid;grid-template-columns:28px minmax(0,1fr) auto;width:100%}.history-item .history-icon{width:27px;height:27px;border-radius:9px;background:rgba(57,228,97,.1);display:grid;place-items:center}.history-item .history-meta{text-align:right}.history-item .source-chip{display:inline-block;border:1px solid var(--line);border-radius:99px;padding:3px 7px;color:var(--muted);font-size:9px}.history-table{width:100%;border-collapse:collapse;font-size:10px}.history-table th,.history-table td{text-align:left;border-bottom:1px solid var(--line);padding:8px 6px}.history-table th{color:var(--muted);font-weight:500;position:sticky;top:0;background:#08271d}.audit-change{color:#d8f4df}.audit-before{color:#ffb7b7}.audit-after{color:#a4ffb1}

body.compact-mode .sensor-card{min-height:110px}.settings-dialog input[type=file]{padding:8px}.field-error{border-color:var(--danger)!important}.hidden{display:none!important}

@media(max-width:760px){.brand-logo{width:46px;height:46px;flex-basis:46px;border-radius:14px}.app-name{font-size:19px}.project-name{font-size:11px}.hero-copy{top:42px}.ai-recommendation-inline{width:min(315px,calc(100vw - 48px))}.sensor-settings-grid{grid-template-columns:1fr}.relay-setting{grid-template-columns:26px minmax(0,1fr) 65px}.automation-form{grid-template-columns:1fr}.automation-form label.wide,.automation-form .wide{grid-column:auto}.history-toolbar{grid-template-columns:1fr 1fr}.history-toolbar .csv-btn{grid-column:1/-1}.history-item{grid-template-columns:28px minmax(0,1fr)}.history-item .history-meta{grid-column:2;text-align:left;margin-top:5px}.hero-setting-actions{align-items:flex-start;flex-direction:column}.classic-scheduler .schedule-manager-row{grid-template-columns:27px minmax(0,1fr) auto}}
@media(max-width:430px){.topbar{gap:8px}.plant-chip{max-width:145px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-recommendation-inline{width:calc(100vw - 38px)}.device-card{min-width:150px}.hero{height:690px}}

/* Riwayat revisi — RSSI nyata, histori yang dapat dipilih, dan scheduler klasik yang tidak terpotong. */
.wifi-row{gap:7px;white-space:normal}.wifi-glyph{color:var(--green2);font-size:18px;line-height:1}.wifi-row #wifiText{font-variant-numeric:tabular-nums;line-height:1.25}
.history-dialog{overflow:hidden;grid-template-rows:auto auto auto minmax(0,1fr)}
.history-dialog[open]{display:grid;grid-template-rows:auto auto auto minmax(0,1fr)}
.history-type-tabs{display:flex;gap:7px;padding:10px 18px 0;background:rgba(2,25,17,.45);border-bottom:1px solid var(--line)}
.history-view-btn{border:1px solid var(--line);border-bottom:0;border-radius:10px 10px 0 0;background:rgba(2,30,19,.45);color:var(--muted);padding:8px 12px;font-size:10px;cursor:pointer}
.history-view-btn:hover,.history-view-btn.active{color:var(--green2);border-color:rgba(57,228,97,.55);background:rgba(46,177,77,.13)}
.history-toolbar{min-width:0;overflow:visible}
.history-toolbar label{min-width:0}.history-toolbar select{cursor:pointer;pointer-events:auto;position:relative;z-index:2}
.history-item{min-width:0;align-items:start}.history-item>div:nth-child(2){min-width:0}.history-item b,.history-item small,.history-item .audit-change{overflow-wrap:anywhere;word-break:break-word}.history-item .history-meta{min-width:145px;max-width:230px;white-space:normal;overflow-wrap:anywhere}.history-table{table-layout:fixed}.history-table th,.history-table td{overflow-wrap:anywhere;word-break:break-word}.history-table th:first-child,.history-table td:first-child{width:23%}.history-table th:nth-child(2),.history-table td:nth-child(2){width:25%}
.classic-scheduler[open]{display:grid;grid-template-rows:auto minmax(0,1fr)}.classic-scheduler .schedule-scroll{min-height:0;overflow-x:hidden;overflow-y:auto;scroll-padding-bottom:90px}.classic-scheduler .schedule-form{background:rgba(3,29,20,.18);color:var(--text)}.classic-scheduler .schedule-form input,.classic-scheduler .schedule-form select{background:rgba(2,25,17,.82);color:var(--text);border-color:rgba(151,247,171,.2);box-shadow:none}.classic-scheduler .schedule-form input:focus,.classic-scheduler .schedule-form select:focus{border-color:rgba(83,240,107,.75);outline:none}.classic-scheduler .schedule-form-actions{position:sticky;bottom:0;z-index:3;margin:8px -18px -17px;padding:12px 18px calc(12px + env(safe-area-inset-bottom));background:linear-gradient(180deg,rgba(4,28,20,.78),rgba(4,28,20,.98) 32%);border-top:1px solid var(--line);box-shadow:0 -10px 22px rgba(0,0,0,.18)}.classic-scheduler .schedule-form-actions .dialog-actions{margin-left:auto}.classic-scheduler .schedule-form-actions button{white-space:nowrap}
@media(max-width:760px){.history-dialog[open]{grid-template-rows:auto auto auto minmax(0,1fr)}.history-type-tabs{padding-left:14px;padding-right:14px}.history-toolbar{grid-template-columns:1fr 1fr;padding:10px 14px}.history-toolbar .csv-btn{grid-column:1/-1}.history-item .history-meta{min-width:0;max-width:none}.classic-scheduler .schedule-form-actions{margin-left:-14px;margin-right:-14px;margin-bottom:-14px;padding-left:14px;padding-right:14px}.classic-scheduler .schedule-form-actions>.dialog-actions{grid-template-columns:1fr 1.35fr}}

/* v1.8 — formulir scheduler/otomasi lebih lapang dan selalu memakai field gelap. */
.classic-scheduler .schedule-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px;align-items:start}.classic-scheduler .schedule-form>label{display:block;min-width:0;color:#b5d2bc;font-size:11px;line-height:1.25}.classic-scheduler .schedule-form>label.wide{grid-column:1/-1}.classic-scheduler .schedule-form input,.classic-scheduler .schedule-form select{display:block;width:100%;min-height:40px;margin-top:6px;padding:10px 11px;border-radius:11px;background:rgba(1,22,15,.92)!important;color:#effff2!important;color-scheme:dark}.classic-scheduler .schedule-form input::placeholder,.automation-form input::placeholder{color:#6d9580}.classic-scheduler .schedule-days{display:flex;flex-wrap:wrap;gap:7px;margin-top:6px;padding:9px;border:1px solid var(--line);border-radius:11px;background:rgba(1,22,15,.58)}.classic-scheduler .schedule-days label{display:flex;align-items:center;gap:4px;padding:5px 7px;border:1px solid rgba(151,247,171,.14);border-radius:8px;color:var(--muted);font-size:10px}.classic-scheduler .schedule-days input{display:inline-block;width:auto;min-height:0;margin:0;padding:0;accent-color:var(--green)}.classic-scheduler .schedule-form-actions{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px}.classic-scheduler .schedule-form-actions>.dialog-actions{display:flex;align-items:center;gap:9px}.automation-mode-hint{display:block;color:var(--green2);font-size:10px;line-height:1.45;padding:9px 11px;border:1px solid rgba(83,240,107,.18);border-radius:10px;background:rgba(35,126,63,.09)}.automation-form input,.automation-form select{color-scheme:dark}.automation-form label{line-height:1.25}.automation-form .schedule-form-actions{margin-top:2px}
@media(max-width:760px){.classic-scheduler .schedule-form{grid-template-columns:1fr;gap:12px}.classic-scheduler .schedule-form>label.wide{grid-column:auto}.classic-scheduler .schedule-form-actions{grid-column:auto;align-items:stretch}.classic-scheduler .schedule-form-actions>.dialog-actions{width:100%}.automation-mode-hint.wide{grid-column:auto}}
.automation-form .schedule-form-actions{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:2px;padding-top:10px;border-top:1px solid var(--line)}.automation-form .schedule-form-actions>.dialog-actions{display:flex;align-items:center;gap:9px;margin-top:0}.automation-form .schedule-form-actions button{white-space:nowrap}
@media(max-width:760px){.automation-form .schedule-form-actions{grid-column:auto;align-items:stretch;flex-direction:column}.automation-form .schedule-form-actions>.dialog-actions{width:100%;justify-content:stretch}.automation-form .schedule-form-actions>.dialog-actions button{flex:1;min-height:42px}}


/* v2.3 — hero nama bebas, relay tersembunyi tetap operasional, Healthy ringkas */
.hero-copy{top:48px}
.ai-recommendation-inline{margin-top:6px;width:min(350px,calc(100vw - 70px))}
.ai-recommendation-inline p{font-size:12px;line-height:1.35;max-width:100%;min-height:17px}
.relay-setting{grid-template-columns:28px minmax(0,1fr) 74px;align-items:center}
.relay-setting small{grid-column:2/-1;color:var(--muted);font-size:8px;line-height:1.25;margin-top:-2px}
.relay-setting-hidden{opacity:.72;border-style:dashed}
.relay-setting-hidden span{color:#9ab6a1}
@media(max-width:760px){.hero-copy{top:30px}.ai-recommendation-inline{margin-top:4px}.relay-setting{grid-template-columns:26px minmax(0,1fr) 65px}}
@media(max-width:390px){.hero-copy{top:24px}}


/* v2.4 — foto hero natural, rekomendasi lengkap, dan ruang hero adaptif */
.hero{height:610px;background-image:url("./assets/hero-photo-fallback.webp");background-position:center center;transition:height .2s ease,background-image .25s ease}
.hero-copy{top:38px;max-width:min(470px,calc(100% - 520px))}
.ai-recommendation-inline{width:min(440px,calc(100vw - 70px));margin-top:10px;padding:10px 12px;border:1px solid rgba(151,247,171,.16);border-radius:13px;background:linear-gradient(135deg,rgba(2,28,19,.66),rgba(2,21,15,.38));backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px)}
.ai-recommendation-inline p{font-size:12px;line-height:1.48;white-space:normal;overflow:visible;overflow-wrap:anywhere;display:block;max-height:none;margin:0}
.ai-recommendation-inline .recommendation-tools{margin-top:5px}
.primary-btn:disabled{opacity:.65;cursor:wait}
.hero.is-generating:after{content:"Memuat foto hero…"}
@media(max-width:900px){.hero-copy{max-width:calc(100% - 330px)}}
@media(max-width:760px){.hero{height:730px}.hero-copy{top:28px;left:20px;max-width:calc(100% - 40px)}.ai-recommendation-inline{width:min(330px,calc(100vw - 42px));padding:9px 10px}.ai-recommendation-inline p{font-size:11px;line-height:1.45}.device-card{top:38px}.hero-facts{bottom:14px}}
@media(max-width:430px){.hero{height:760px}.ai-recommendation-inline{width:calc(100vw - 34px)}}

/* v2.5 healthy text: no frame, more elegant */
.ai-recommendation-inline{
  width:min(460px,calc(100vw - 72px));
  margin-top:10px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
.ai-recommendation-inline p{
  margin:0;
  font-size:12px;
  line-height:1.58;
  color:#f2fff4;
  text-shadow:0 3px 12px rgba(0,0,0,.72);
}
.ai-recommendation-inline .recommendation-tools{
  margin-top:6px;
  display:flex;
  align-items:center;
  gap:6px;
  color:#a6ceb0;
}
.ai-recommendation-inline .recommendation-action{
  margin-top:6px;
  padding:0;
  border:0;
  background:transparent;
  color:var(--green2);
  box-shadow:none;
}
@media(max-width:760px){
  .ai-recommendation-inline{width:min(340px,calc(100vw - 40px));}
  .ai-recommendation-inline p{font-size:11px;line-height:1.55}
}

/* v2.6: recommendation without frame, more aesthetic */
.ai-recommendation-inline{
  width:min(460px,calc(100vw - 70px));
  margin-top:10px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  box-shadow:none;
}
.ai-recommendation-inline p{
  font-size:12px;
  line-height:1.58;
  white-space:normal;
  overflow:visible;
  overflow-wrap:anywhere;
  text-shadow:0 2px 12px rgba(0,0,0,.76);
}
.ai-recommendation-inline .recommendation-tools{
  margin-top:6px;
}
.ai-recommendation-inline .recommendation-action{
  background:transparent;
  border:0;
  padding:0;
}
@media(max-width:760px){
  .ai-recommendation-inline{width:min(340px,calc(100vw - 38px));}
  .ai-recommendation-inline p{font-size:11px;line-height:1.55}
}

/* =========================================================
   v2.9 — Layout PC/HP terpisah, dashboard mobile stabil,
   grafik komunikatif, dan dialog AI ramah keyboard mobile.
   Fungsi schedule, otomasi, histori, relay dan Firebase tidak diubah.
   ========================================================= */
.field-note{display:block;margin-top:6px;color:var(--muted);font-size:9px;line-height:1.45}
.chart-communicative{display:grid;grid-template-columns:150px minmax(0,1fr);gap:14px;padding:14px;min-height:270px}
.chart-kpis{display:grid;grid-template-columns:1fr 1fr;gap:8px;align-content:start}
.chart-pv{grid-column:1/-1;border:1px solid rgba(83,240,107,.32);border-radius:15px;padding:14px 12px;background:linear-gradient(145deg,rgba(25,105,57,.25),rgba(2,27,18,.38))}
.chart-pv>span,.chart-kpi>span{display:block;color:#79e58d;font-size:9px;font-weight:700;letter-spacing:.14em}
.chart-pv>b{display:block;margin-top:5px;font-size:26px;line-height:1.05;color:#effff1;overflow-wrap:anywhere}
.chart-pv>small{display:block;margin-top:6px;color:#a9c8b3;font-size:10px;line-height:1.35}
.chart-kpi{min-width:0;border:1px solid rgba(160,235,181,.12);border-radius:12px;padding:10px;background:rgba(2,29,20,.36)}
.chart-kpi b{display:block;margin-top:5px;color:#eaffed;font-size:12px;line-height:1.25;overflow-wrap:anywhere}
.chart-kpi-wide{grid-column:1/-1}
.chart-plot{position:relative;min-width:0;min-height:230px;display:grid;grid-template-rows:minmax(190px,1fr) auto}
.chart-plot canvas{width:100%!important;height:100%!important;min-height:190px}
.chart-plot .chart-foot{gap:10px;padding:8px 3px 0;border-top:1px solid rgba(160,235,181,.08)}
.chart-plot .chart-foot span:last-child{text-align:right}

/* Mode PC paksa menjaga komposisi desktop meski jendela menyempit. */
body.layout-desktop .app-shell{min-width:980px}
body.layout-desktop{overflow-x:auto}

/* Mode HP juga dapat dipilih pada tablet/desktop untuk pratinjau. */
body.layout-mobile .app-shell{width:min(100%,760px);padding:8px 10px 112px}
body.layout-mobile .topbar{height:68px;gap:9px}
body.layout-mobile .brand-logo{width:48px;height:48px;flex:0 0 48px;border-radius:15px}
body.layout-mobile .app-name{font-size:20px}
body.layout-mobile .project-name{font-size:11px}
body.layout-mobile .plant-chip{max-width:190px;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.layout-mobile .install-btn{padding:8px 10px;font-size:10px}
body.layout-mobile .hero{height:570px;border-radius:24px;background-position:center center}
body.layout-mobile .hero-shade{background:linear-gradient(180deg,rgba(2,23,15,.48) 0%,rgba(2,24,16,.2) 34%,rgba(2,20,13,.66) 75%,rgba(2,18,12,.94) 100%),linear-gradient(90deg,rgba(2,24,16,.75),transparent 72%)}
body.layout-mobile .hero-copy{left:20px;right:20px;top:38px;max-width:none;z-index:3}
body.layout-mobile .hero-copy h1{font-size:34px;margin:4px 0 8px;max-width:45%;line-height:1.02;overflow-wrap:anywhere}
body.layout-mobile .health-ring{width:132px;height:132px}
body.layout-mobile .health-ring strong{font-size:42px}
body.layout-mobile .device-card{top:36px;right:15px;width:45%;min-width:0;max-width:190px;padding:10px 12px;border-radius:17px;z-index:4;background:rgba(3,38,25,.74);backdrop-filter:blur(14px)}
body.layout-mobile .device-row{padding:6px 0;font-size:10px;gap:7px}
body.layout-mobile .device-picker-row select{width:100%;min-width:0;font-size:10px}
body.layout-mobile .device-meta{display:flex;gap:5px;justify-content:space-between;flex-wrap:wrap}
body.layout-mobile .ai-recommendation-inline{width:min(94%,430px);margin-top:9px;padding:0;background:transparent;border:0;border-radius:0;backdrop-filter:none;text-shadow:0 2px 8px rgba(0,0,0,.9)}
body.layout-mobile .ai-recommendation-inline p{font-size:11px;line-height:1.5;font-weight:600;max-width:100%}
body.layout-mobile .recommendation-tools{margin-top:5px;color:#c2dfc8}
body.layout-mobile .hero-facts{left:14px;right:14px;bottom:14px;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body.layout-mobile .fact{display:grid;grid-template-columns:30px minmax(0,1fr);grid-template-rows:auto auto;text-align:left;padding:10px 11px;min-height:66px;border-radius:16px}
body.layout-mobile .fact span{grid-row:1/3;font-size:22px;align-self:center;margin:0}
body.layout-mobile .fact small{font-size:9px;margin:0;color:#bcd5c2}
body.layout-mobile .fact b{font-size:13px;margin:2px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.layout-mobile .weather{grid-template-columns:1.25fr repeat(2,1fr);gap:0;padding:10px 10px 17px;margin-top:10px;border-radius:20px}
body.layout-mobile .weather-main{grid-column:1;grid-row:1/3;border-right:1px solid var(--line);padding:5px 8px}
body.layout-mobile .weather-item{min-height:49px;padding:5px 8px;border-right:1px solid var(--line)}
body.layout-mobile .weather-item:nth-child(3),body.layout-mobile .weather-item:nth-child(5){border-right:0}
body.layout-mobile .weather-sun{grid-column:2/4;border-top:1px solid var(--line);border-right:0;padding-top:7px}
body.layout-mobile .weather-icon{font-size:30px}
body.layout-mobile .weather-main b{font-size:23px}
body.layout-mobile .weather-main small,body.layout-mobile .weather-item small{font-size:8px}
body.layout-mobile .weather-item b{font-size:11px}
body.layout-mobile .weather-item span{font-size:18px}
body.layout-mobile .sensor-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin-top:10px}
body.layout-mobile .sensor-card{min-height:104px;padding:9px 5px;border-radius:15px}
body.layout-mobile .sensor-card .sensor-icon{font-size:24px;margin-bottom:5px}
body.layout-mobile .sensor-card .sensor-value{font-size:15px;max-width:100%;overflow:hidden;text-overflow:ellipsis}
body.layout-mobile .sensor-card .sensor-label{font-size:8px;line-height:1.2;min-height:20px}
body.layout-mobile .sensor-card .sensor-state{font-size:9px;margin-top:5px}
body.layout-mobile .dashboard-grid{grid-template-columns:1fr;gap:10px;margin-top:10px}
body.layout-mobile .section-pad{padding:13px}
body.layout-mobile .relay-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body.layout-mobile .relay-card{grid-template-columns:27px minmax(0,1fr) auto;padding:10px 8px}
body.layout-mobile .relay-card b{font-size:10px}
body.layout-mobile .relay-card small{font-size:8px}
body.layout-mobile .relay-icon{font-size:22px}
body.layout-mobile .monitoring{margin-top:10px}
body.layout-mobile .monitoring>.section-heading{align-items:flex-start;flex-direction:column;margin-bottom:9px}
body.layout-mobile .chart-actions{width:100%;display:grid;grid-template-columns:auto auto 1fr;gap:6px}
body.layout-mobile .chart-actions select{grid-column:1/-1;width:100%;min-width:0}
body.layout-mobile .metric-tabs{gap:6px;margin-left:-2px;margin-right:-2px}
body.layout-mobile .metric-tab{flex:0 0 auto;font-size:9px;padding:7px 9px}
body.layout-mobile .chart-communicative{grid-template-columns:88px minmax(0,1fr);gap:8px;min-height:250px;padding:9px}
body.layout-mobile .chart-kpis{display:flex;flex-direction:column;gap:6px}
body.layout-mobile .chart-pv{padding:10px 8px;border-radius:12px}
body.layout-mobile .chart-pv>b{font-size:18px}
body.layout-mobile .chart-pv>small{font-size:8px}
body.layout-mobile .chart-kpi{padding:7px 6px;border-radius:10px}
body.layout-mobile .chart-kpi>span{font-size:7px}
body.layout-mobile .chart-kpi b{font-size:9px;margin-top:3px}
body.layout-mobile .chart-plot{min-height:230px;grid-template-rows:minmax(198px,1fr) auto}
body.layout-mobile .chart-plot canvas{min-height:198px}
body.layout-mobile .chart-plot .chart-foot{font-size:8px;align-items:flex-start}
body.layout-mobile .system-strip{display:grid;grid-template-columns:1fr;gap:11px}
body.layout-mobile .system-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
body.layout-mobile .bottom-nav{width:calc(100% - 18px);height:68px;bottom:max(8px,env(safe-area-inset-bottom));border-radius:26px;padding:4px 6px;grid-template-columns:1fr 1fr 70px 1fr 1fr}
body.layout-mobile .home-fab{width:64px;height:64px;font-size:29px}
body.layout-mobile .ai-fab{right:16px;bottom:92px;width:58px;height:58px;z-index:30}

/* AI mobile: modal benar-benar usable, composer tidak tertutup keyboard/nav. */
body.layout-mobile .ai-dialog[open]{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto auto;box-sizing:border-box;width:calc(100% - 12px)!important;max-width:calc(100% - 12px)!important;height:min(720px,calc(100dvh - 18px));max-height:calc(100dvh - 18px);margin:auto;border-radius:20px}
body.layout-mobile .ai-dialog .ai-head{padding:12px 14px}
body.layout-mobile .ai-context{padding:9px 13px;font-size:9px;line-height:1.4;max-height:72px;overflow:auto}
body.layout-mobile .chat-list{height:auto;min-height:0;padding:11px 12px;overscroll-behavior:contain}
body.layout-mobile .chat-bubble{max-width:89%;font-size:11px;line-height:1.45}
body.layout-mobile .ai-composer{display:grid;grid-template-columns:minmax(0,1fr) 44px 58px;padding:9px;gap:6px;background:#06251a;position:relative;z-index:2}
body.layout-mobile .ai-composer textarea{min-width:0;width:100%;min-height:44px;max-height:110px;font-size:16px;padding:10px}
body.layout-mobile .ai-composer .send-btn,body.layout-mobile .ai-composer .ptt-btn{width:100%;min-width:0;min-height:44px;padding:0 6px;font-size:11px}
body.layout-mobile .ai-note{padding:0 12px 10px;font-size:8px;background:#06251a}
body.layout-mobile .ai-dialog:focus-within{transform:translateY(0)}

@media(max-width:430px){
  body.layout-mobile .install-btn{display:none}
  body.layout-mobile .topbar-actions{margin-left:auto}
  body.layout-mobile .hero{height:590px}
  body.layout-mobile .hero-copy h1{font-size:31px;max-width:46%}
  body.layout-mobile .device-card{width:47%;right:10px}
  body.layout-mobile .health-ring{width:122px;height:122px}
  body.layout-mobile .health-ring strong{font-size:38px}
  body.layout-mobile .sensor-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  body.layout-mobile .sensor-card .sensor-value{font-size:14px}
  body.layout-mobile .relay-card{padding:9px 7px}
}

@media(max-width:360px){
  body.layout-mobile .hero-copy{left:14px;right:14px}
  body.layout-mobile .device-card{right:8px;width:48%;padding:9px}
  body.layout-mobile .hero-copy h1{font-size:28px}
  body.layout-mobile .ai-recommendation-inline p{font-size:10px}
  body.layout-mobile .weather{padding-left:6px;padding-right:6px}
  body.layout-mobile .sensor-grid{gap:5px}
  body.layout-mobile .sensor-card{min-height:98px;padding:7px 3px}
  body.layout-mobile .chart-communicative{grid-template-columns:80px minmax(0,1fr)}
}

