
:root{
  --bg:#101725;
  --surface:#171f2f;
  --surface2:#1e2839;
  --surface3:#243044;
  --text:#f8fafc;
  --muted:#9eabc0;
  --line:#2d3a4f;
  --blue:#1681ff;
  --blue2:#28a9ff;
  --green:#76e041;
  --lime:#b8ff1a;
  --orange:#f16a22;
  --red:#ff4b4b;
  --cyan:#d9f3ff;
  --shadow:0 12px 32px rgba(0,0,0,.22);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  background:linear-gradient(180deg,#101725 0%,#0d1420 100%);
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
button,a{-webkit-tap-highlight-color:transparent}
button{font:inherit}
.topbar{
  position:sticky;top:0;z-index:50;
  display:flex;align-items:center;justify-content:space-between;
  background:linear-gradient(135deg,#0877ff,#1790ff);
  padding:14px max(16px,calc((100% - 880px)/2));
  box-shadow:0 5px 22px rgba(0,0,0,.28)
}
.brand-wrap{display:flex;align-items:center;gap:11px}
.logo{
  display:grid;place-items:center;width:40px;height:40px;border-radius:12px;
  background:#0e1728;color:#c9ff32;font-size:21px;font-weight:900
}
.brand-line{display:flex;align-items:center;gap:9px}
.brand-line h1{font-size:22px;margin:0;letter-spacing:-.02em}
.brand-wrap p{margin:2px 0 0;font-size:12px;color:#d6e8ff}
.online-dot{width:9px;height:9px;border-radius:50%;background:#94a3b8}
.online-dot.on{background:#9cff35;box-shadow:0 0 0 5px rgba(156,255,53,.15)}
.header-actions{display:flex;gap:8px}
.icon-btn{
  width:39px;height:39px;border:0;border-radius:10px;background:#111827;color:#fff;
  display:grid;place-items:center;text-decoration:none;font-size:20px;cursor:pointer
}
.icon-btn:active{transform:scale(.97)}
.page{max-width:880px;margin:auto;padding:16px 14px 32px}
.notice{border-radius:13px;padding:11px 13px;font-size:13px;margin-bottom:14px}
.notice.info{background:#152c4f;color:#cae4ff}
.notice.ok{background:#163923;color:#b9fbc8}
.notice.warn{background:#483713;color:#ffe2a3}
.notice.error{background:#4b1f25;color:#ffc1c8}
.hidden{display:none!important}

.gauge-grid{display:grid;gap:12px;margin-bottom:14px}
.gauge-grid-top{grid-template-columns:1fr 1fr}
.single-gauge{grid-template-columns:minmax(0,430px);justify-content:center}
.gauge-card{
  background:var(--surface);border:1px solid var(--line);
  border-radius:22px;padding:14px 14px 6px;box-shadow:var(--shadow)
}
.gauge-title{text-align:center;color:#c5cfdd;font-size:15px;margin-bottom:3px}
.gauge{position:relative;max-width:300px;margin:auto}
.gauge svg{display:block;width:100%;height:auto;overflow:visible}
.gauge-bg,.gauge-arc{fill:none;stroke-width:18;stroke-linecap:round}
.gauge-bg{stroke:#394454}
.gauge-arc{
  stroke-dasharray:251.33;
  stroke-dashoffset:251.33;
  transition:stroke-dashoffset .45s ease;
}
.gauge-arc.temp{stroke:var(--orange)}
.gauge-arc.humidity{stroke:var(--lime)}
.gauge-arc.pressure{stroke:#2d6cdf}
.gauge-arc.wifi{stroke:#31b7ff}
.gauge-center{
  position:absolute;left:50%;top:60%;transform:translate(-50%,-50%);
  white-space:nowrap
}
.gauge-value{font-size:38px;font-weight:500;letter-spacing:-.04em}
.gauge-unit{font-size:18px;color:#cbd5e1;margin-left:3px}
.gauge-scale{
  position:absolute;left:18%;right:18%;bottom:6px;
  display:flex;justify-content:space-between;color:#707d91;font-size:11px
}

.control-card,.data-section,.alert-card{
  background:var(--surface);border:1px solid var(--line);
  border-radius:22px;padding:17px;box-shadow:var(--shadow);margin-bottom:14px
}
.control-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
.section-kicker{font-size:10px;letter-spacing:.15em;font-weight:850;color:#77869c}
.control-head h2{margin:3px 0 0;font-size:22px}
.status-pill{border-radius:999px;padding:7px 10px;font-size:10px;font-weight:900;letter-spacing:.05em}
.status-pill.neutral{background:#29364a;color:#cbd5e1}
.status-pill.live{background:#163f25;color:#a7f3b7}
.status-pill.offline{background:#4d2227;color:#ffc2c7}
.runtime-row{
  display:flex;justify-content:space-between;align-items:center;
  background:var(--surface2);border-radius:14px;padding:11px 13px;margin:14px 0
}
.runtime-row span{color:var(--muted);font-size:13px}
.runtime-row strong{font-size:20px;color:#ff6161;font-variant-numeric:tabular-nums}
.control-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.control-label{display:block;color:#c5cfdd;font-size:13px;margin-bottom:8px}
.big-toggle{
  width:100%;min-height:88px;border:0;border-radius:28px;
  color:#0f172a;font-size:34px;font-weight:800;cursor:pointer;
  transition:.15s ease
}
.big-toggle small{display:block;font-size:11px;font-weight:650;margin-top:2px}
.big-toggle:disabled{opacity:.45;cursor:not-allowed}
.big-toggle.pump-on{background:#cdeeff}
.big-toggle.pump-off{background:#354155;color:#e2e8f0}
.big-toggle.pending{background:#ffeaa5;color:#352b06}
.valve-switch{display:grid;gap:8px}
.valve-switch button{
  min-height:40px;border:1px solid #57708f;background:#172235;color:#d8edff;
  border-radius:18px;font-weight:800;cursor:pointer
}
.valve-switch button.active{background:#d8f2ff;color:#142033;border-color:#d8f2ff}
.valve-switch button:disabled{opacity:.45;cursor:not-allowed}
.command-bar{
  margin-top:14px;border-radius:14px;background:#1d2f49;padding:11px 12px;
  display:flex;align-items:center;gap:10px
}
.command-bar strong,.command-bar small{display:block}
.command-bar small{color:#9eb2cc;margin-top:2px}
.mini-spinner{
  width:18px;height:18px;border-radius:50%;border:3px solid #49617f;border-top-color:#64b7ff;
  animation:spin .7s linear infinite
}
@keyframes spin{to{transform:rotate(360deg)}}

.section-title{font-size:15px;color:#c7d0dc;margin-bottom:10px;font-weight:750}
.data-grid{display:grid;gap:10px;margin-bottom:10px}
.data-grid:last-child{margin-bottom:0}
.data-grid.three{grid-template-columns:repeat(3,1fr)}
.data-grid.two{grid-template-columns:repeat(2,1fr)}
.data-card{
  background:var(--surface2);border-radius:16px;padding:13px 12px;text-align:center;
  border:1px solid rgba(71,85,105,.45)
}
.data-card>span{display:block;color:#a7b1c0;font-size:12px;margin-bottom:5px}
.data-card b{font-size:29px;font-weight:500;letter-spacing:-.04em;color:#d8f3ff}
.data-card small{font-size:15px;color:#d8f3ff;margin-left:3px}
.water .data-card b,.water .data-card small{color:var(--lime)}

.alert-card{text-align:center;padding-top:20px;padding-bottom:20px}
.warning-text{
  margin:16px 0 15px;font-size:clamp(21px,5vw,34px);font-weight:650;
  color:#2cff47;letter-spacing:-.02em
}
.warning-text.warn{color:#ffcf45}
.warning-text.danger{color:#ff5a5a}
.alert-meta{display:flex;justify-content:center;gap:24px;color:#8795a8;font-size:11px}
.alert-meta b{color:#cbd5e1}
.wifi-section{margin-top:2px}
footer{display:flex;justify-content:space-between;color:#637087;font-size:10px;padding:5px 2px}

@media(max-width:600px){
  .page{padding:12px 10px 28px}
  .topbar{padding:12px 11px}
  .gauge-grid{gap:8px}
  .gauge-card{padding:11px 8px 3px;border-radius:18px}
  .gauge-title{font-size:13px}
  .gauge-value{font-size:31px}
  .gauge-unit{font-size:15px}
  .control-card,.data-section,.alert-card{padding:14px;border-radius:18px}
  .control-grid{gap:10px}
  .big-toggle{min-height:76px;font-size:29px}
  .data-card{padding:11px 7px}
  .data-card b{font-size:25px}
}
@media(max-width:390px){
  .brand-wrap p{display:none}
  .brand-line h1{font-size:19px}
  .control-grid{grid-template-columns:1fr}
  .data-grid.three{grid-template-columns:repeat(3,1fr)}
  .data-card b{font-size:22px}
  .data-card small{font-size:12px}
}


/* v4 */
.control-card + .control-card{margin-top:0}
.control-item{width:100%}
.valve-switch.standalone{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:14px
}
.valve-switch.standalone button{
  min-height:68px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  font-size:16px;
  border-radius:22px
}
.button-content{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px
}
.button-main{display:block}
.button-spinner{
  width:22px;height:22px;border-radius:50%;
  border:3px solid rgba(255,255,255,.38);
  border-top-color:currentColor;
  animation:spin .7s linear infinite;
  flex:0 0 auto
}
.button-spinner.small{width:16px;height:16px;border-width:2px}
.last-data-card{
  background:#121a28;
  border:1px solid #29364a;
  border-radius:16px;
  padding:12px;
  margin:4px 0 14px;
  box-shadow:0 8px 24px rgba(0,0,0,.16)
}
.last-data-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:10px
}
.last-data-head strong{
  display:block;
  margin-top:3px;
  font-size:15px;
  color:#d8f3ff
}
.last-data-head>span{
  font-size:11px;
  color:#708198
}
.raw-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:6px
}
.raw-grid div{
  background:#172132;
  border-radius:9px;
  padding:7px 8px;
  min-width:0
}
.raw-grid span{
  display:block;
  color:#718198;
  font-size:9px;
  margin-bottom:2px
}
.raw-grid b{
  display:block;
  color:#cbd5e1;
  font-size:11px;
  font-weight:650;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap
}
@media(max-width:600px){
  .raw-grid{grid-template-columns:repeat(3,1fr)}
}
@media(max-width:390px){
  .raw-grid{grid-template-columns:repeat(2,1fr)}
  .valve-switch.standalone{grid-template-columns:1fr 1fr}
}


/* v5 - expanded warning diagnostics and simplified last-data block */
.expanded-alert{
  text-align:left;
  padding:18px;
}
.alert-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
}
.warning-state-badge{
  flex:0 0 auto;
  border-radius:999px;
  padding:7px 10px;
  font-size:10px;
  font-weight:900;
  letter-spacing:.05em;
  background:#263246;
  color:#cbd5e1;
}
.warning-state-badge.normal{
  background:#173c25;
  color:#a9f3b9;
}
.warning-state-badge.warn{
  background:#4a3715;
  color:#ffe19a;
}
.warning-state-badge.danger{
  background:#4b2026;
  color:#ffc0c6;
}
.expanded-alert .warning-text{
  text-align:left;
  margin:10px 0 0;
  font-size:clamp(23px,4vw,34px);
}
.warning-explanation{
  margin-top:14px;
  background:#121a28;
  border:1px solid #2c3b51;
  border-radius:14px;
  padding:13px 14px;
  line-height:1.5;
  color:#d8e2ef;
  font-size:13px;
}
.sensor-evidence{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:9px;
  margin-top:12px;
}
.evidence-item{
  background:#172132;
  border:1px solid #2a3850;
  border-radius:13px;
  padding:11px 10px;
}
.evidence-item>span{
  display:block;
  color:#8492a7;
  font-size:10px;
  margin-bottom:4px;
}
.evidence-item>b{
  display:block;
  color:#d9f3ff;
  font-size:18px;
  font-weight:700;
}
.evidence-item>small{
  display:block;
  color:#95a5ba;
  font-size:10px;
  margin-top:4px;
}
.evidence-item.good{
  border-color:#285f3a;
  background:#14271c;
}
.evidence-item.warn{
  border-color:#6a501d;
  background:#2d2616;
}
.evidence-item.danger{
  border-color:#69313a;
  background:#2b191d;
}
.last-seen-card{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  background:#121a28;
  border:1px solid #29364a;
  border-radius:14px;
  padding:11px 13px;
  margin:4px 0 14px;
  color:#708198;
}
.last-seen-card strong{
  display:block;
  margin-top:3px;
  font-size:15px;
  color:#d8f3ff;
}
.last-seen-card>span{
  font-size:11px;
  color:#708198;
}
.raw-grid,.last-data-card{display:none!important}

@media(max-width:600px){
  .sensor-evidence{grid-template-columns:1fr 1fr 1fr;gap:6px}
  .evidence-item{padding:9px 7px}
  .evidence-item>b{font-size:15px}
}

/* v6 */
.block-with-link{position:relative}
.expand-link{
  position:absolute;right:10px;top:10px;z-index:8;
  width:30px;height:30px;border-radius:9px;
  display:grid;place-items:center;
  background:#243147;color:#d9efff;text-decoration:none;
  border:1px solid #34465f;font-size:17px;font-weight:800
}
.expand-link:active{transform:scale(.96)}
.schedule-card,.system-card{
  background:var(--surface);border:1px solid var(--line);
  border-radius:22px;padding:17px;box-shadow:var(--shadow);margin-bottom:14px
}
.schedule-card h2,.system-card h2{margin:3px 0 0;font-size:21px}
.schedule-summary{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:14px}
.schedule-summary div{background:var(--surface2);border-radius:14px;padding:11px}
.schedule-summary span{display:block;color:#8d9bb0;font-size:10px;margin-bottom:4px}
.schedule-summary b{font-size:15px;color:#d9f3ff}
.wide-link{
  display:block;margin-top:12px;text-align:center;text-decoration:none;
  background:#21314a;border:1px solid #38506e;color:#d8eeff;
  padding:10px;border-radius:13px;font-size:13px;font-weight:800
}
.system-card p{color:#91a0b5;font-size:12px;line-height:1.5;margin:12px 35px 0 0}
.page-shell{max-width:1000px;margin:auto;padding:16px 14px 34px}
.page-titlebar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px}
.page-titlebar h1{margin:0;font-size:24px}
.back-link{color:#d9efff;text-decoration:none;background:#202d42;border:1px solid #34465f;padding:8px 11px;border-radius:10px}
.panel-card{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:15px;box-shadow:var(--shadow);margin-bottom:12px}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.toolbar button,.toolbar a,.small-btn{
  border:1px solid #3a4d68;background:#1e2b40;color:#d9edff;
  border-radius:10px;padding:8px 10px;text-decoration:none;cursor:pointer;font-weight:750
}
.toolbar button.active{background:#d8f2ff;color:#142033}
.chart-wrap{height:360px;position:relative}.chart-wrap canvas{width:100%;height:100%}
.table-wrap{overflow:auto}
.dark-table{width:100%;border-collapse:collapse;font-size:12px}
.dark-table th,.dark-table td{padding:9px;border-bottom:1px solid #2b394e;text-align:left;white-space:nowrap}
.dark-table th{color:#8292aa;font-size:10px}.dark-table td{color:#d5e0ee}
.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.field label{display:block;color:#91a0b5;font-size:11px;margin-bottom:5px}
.field input,.field select{
  width:100%;background:#111a29;color:#eef6ff;border:1px solid #33465f;
  border-radius:10px;padding:10px
}
.day-pills{display:flex;gap:6px;flex-wrap:wrap}
.day-pills label{background:#1b293e;border:1px solid #33465f;border-radius:9px;padding:7px 8px;font-size:11px}
.page-note{font-size:11px;color:#8391a5;line-height:1.45}
.health-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}
.health-box{background:#172132;border-radius:13px;padding:11px}
.health-box span{display:block;color:#8492a7;font-size:10px;margin-bottom:5px}
.health-box b{font-size:17px;color:#d9f3ff}
@media(max-width:650px){
  .form-grid{grid-template-columns:1fr}
  .health-grid{grid-template-columns:repeat(2,1fr)}
  .chart-wrap{height:290px}
}

/* v7 */
.stats-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}
.stat-box{background:#172132;border:1px solid #2b3a50;border-radius:13px;padding:12px}
.stat-box span{display:block;color:#8492a7;font-size:10px;margin-bottom:5px}.stat-box b{font-size:19px;color:#d9f3ff}
.zone-stats{display:grid;grid-template-columns:1fr 1fr;gap:9px}.zone-box{background:#16281e;border:1px solid #285b3a;border-radius:14px;padding:13px}
.zone-box span{color:#95ac9f;font-size:10px}.zone-box b{display:block;font-size:20px;color:#bdffd0;margin-top:5px}.zone-box small{color:#7fa28a}
.event-source{display:inline-block;border-radius:999px;padding:4px 7px;background:#243147;color:#cfe8ff;font-size:9px;font-weight:800}
.mode-row{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.connection-chain{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}
.chain-box{background:#172132;border:1px solid #2b3a50;border-radius:14px;padding:12px;text-align:center}
.chain-box .dot{width:10px;height:10px;border-radius:50%;background:#718096;margin:0 auto 7px}.chain-box .dot.ok{background:#7af15a}.chain-box .dot.bad{background:#ff5a68}
.chain-box span{display:block;color:#8492a7;font-size:10px}.chain-box b{display:block;color:#e2efff;font-size:16px;margin-top:4px}
@media(max-width:650px){.stats-grid{grid-template-columns:repeat(2,1fr)}.connection-chain{grid-template-columns:1fr}.zone-stats{grid-template-columns:1fr 1fr}}

/* v8 visual polish */
.brand-line h1{
  font-size:30px;
  font-weight:900;
  letter-spacing:-.035em;
}
.connection-pill{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:78px;height:28px;padding:0 10px;border-radius:999px;
  font-size:10px;font-weight:900;letter-spacing:.06em;
  border:1px solid rgba(255,255,255,.24);
}
.connection-pill.online{
  background:#24c55e;color:#052e16;
  box-shadow:0 0 0 4px rgba(36,197,94,.16);
}
.connection-pill.offline{
  background:#facc15;color:#422006;
  box-shadow:0 0 0 4px rgba(250,204,21,.15);
}
.connection-pill.waiting{background:#64748b;color:#fff}
.flowarc{stroke:#22d3ee}
.flow-title{color:#22d3ee!important}

.uniform-block-title{
  font-size:22px!important;
  font-weight:850!important;
  line-height:1.15!important;
  margin:3px 0 0!important;
}
.section-title-color{font-size:11px!important;font-weight:900!important}
.pump-title{color:#45d86f!important}
.valve-title{color:#5eb8ff!important}
.schedule-title{color:#c084fc!important}
.electric-title{color:#f6c453!important}
.water-title{color:#30d5c8!important}
.alert-title{color:#ff6b7a!important}
.events-title{color:#ff9f43!important}
.system-title{color:#9ba9ff!important}

.warning-badge-inset{
  margin-right:44px;
}
.expanded-alert .alert-head{
  padding-right:4px;
}

.last-seen-card{
  padding-right:52px;
}
.last-seen-inline{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.last-seen-values{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
.last-seen-values strong{
  font-size:19px!important;
  color:#d9f3ff!important;
}
.last-seen-values span{
  font-size:14px!important;
  color:#a9bad0!important;
  font-weight:650;
}
.last-title{color:#7dd3fc!important}

.flow-gauge-card{border-color:#285a69}

.history-analysis{
  margin-top:14px;
  background:#141e2d;
  border:1px solid #2b3a50;
  border-radius:18px;
  padding:15px;
}
.history-analysis h2{
  margin:0 0 12px;
  font-size:20px;
  color:#45d86f
}
.history-analysis-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:9px
}
.history-analysis-grid .stat-box{min-height:76px}

.chart-legend{
  display:flex;flex-wrap:wrap;gap:10px;margin-bottom:8px;font-size:11px;color:#9fb0c5
}
.chart-legend span{display:inline-flex;align-items:center;gap:6px}
.chart-legend i{width:10px;height:10px;border-radius:50%;display:inline-block}

@media(max-width:600px){
  .brand-line h1{font-size:27px}
  .connection-pill{min-width:70px;height:26px}
  .warning-badge-inset{margin-right:38px}
  .history-analysis-grid{grid-template-columns:repeat(2,1fr)}
  .last-seen-inline{gap:8px}
}

/* v8.2 requested fixes */

/* NORMAL/UYARI rozeti, sağ üst ↗ butonunun altına girmesin */
.expanded-alert .alert-head{
  padding-right:92px !important;
}
.warning-badge-inset{
  margin-right:0 !important;
  flex:0 0 auto;
}

/* Son ESP32 verisi: yaş ve tarih/saat aynı font-boyut-kalınlık */
.last-seen-card{
  padding-right:54px;
}
.last-seen-inline{
  display:flex;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
}
.last-seen-values{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.last-seen-values strong,
.last-seen-values span{
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif !important;
  font-size:16px !important;
  line-height:1.2 !important;
  font-weight:700 !important;
  font-variant-numeric:tabular-nums;
  letter-spacing:0 !important;
  color:#d9f3ff !important;
}
.last-title{color:#7dd3fc!important}

/* Genişletilmiş Pompa Analizi */
.pump-analysis-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:14px;
}
.pump-analysis-head h2{
  margin:4px 0 0;
  font-size:22px;
}
.analysis-period{
  display:inline-flex;
  padding:7px 10px;
  border-radius:999px;
  background:#183a27;
  color:#aef5bf;
  border:1px solid #285c3a;
  font-size:10px;
  font-weight:900;
}
.analysis-subtitle{
  margin:18px 0 9px;
  color:#cbd5e1;
  font-size:14px;
  font-weight:800;
}
.compact-stats-table td,
.compact-stats-table th{
  text-align:right;
}
.compact-stats-table td:first-child,
.compact-stats-table th:first-child{
  text-align:left;
}
@media(max-width:600px){
  .expanded-alert .alert-head{padding-right:80px!important}
  .last-seen-inline{gap:8px}
  .last-seen-values strong,.last-seen-values span{font-size:14px!important}
}

/* v8.3 small UI cleanup */
.brand-wrap{align-items:center}
.brand-line{align-items:center}
.brand-wrap .hidden{display:none!important}

/* Su bölümünde üç metrik aynı sırada ve dengeli */
.data-grid.three.water{
  grid-template-columns:repeat(3,1fr);
}
@media(max-width:520px){
  .data-grid.three.water{
    grid-template-columns:repeat(3,1fr);
    gap:7px;
  }
  .data-grid.three.water .data-card{
    padding:10px 6px;
  }
  .data-grid.three.water .data-card b{
    font-size:22px;
  }
  .data-grid.three.water .data-card small{
    font-size:11px;
  }
}

/* v8.4 */

/* Pompa çalışma süresi etiketi biraz daha belirgin */
.pump-runtime-row > span{
  font-size:15px !important;
  font-weight:750;
  color:#b9c5d4;
}

/* Aktif uyarı: durum rozeti başlık ile uyarı metni arasında */
.alert-head-stacked{
  display:flex !important;
  flex-direction:column;
  align-items:flex-start !important;
  gap:8px;
  padding-right:48px !important;
}
.warning-badge-center{
  position:static !important;
  margin:0 0 1px 0 !important;
  align-self:flex-start;
}
.alert-head-stacked .warning-text{
  margin:0 !important;
}

/* Son ESP32: başlık -> tarih -> yaş kutusu */
.last-seen-card{
  padding-right:52px !important;
}
.last-seen-inline{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.last-data-clock{
  font-size:15px !important;
  line-height:1.2;
  font-weight:700;
  color:#d9f3ff !important;
  font-variant-numeric:tabular-nums;
}
.last-age-box{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  min-width:76px;
  padding:7px 10px;
  border-radius:11px;
  background:#20304a;
  border:1px solid #37516f;
  color:#d9f3ff !important;
  font-size:15px !important;
  line-height:1 !important;
  font-weight:800 !important;
  font-variant-numeric:tabular-nums;
}

/* Elektrik ve Su detay butonları başlıktan biraz daha aşağıda */
.metric-expand-lowered{
  top:18px !important;
}
.metric-section-lowered{
  padding-top:20px;
}

/* Açıklaması kaldırılan kartlarda boşluk dengesi */
.system-card > .wide-link{
  margin-top:14px;
}


/* v8.5 - Elektrik ve Su: başlık ile veri kutuları arasındaki boşluk artırıldı */
.metric-section-lowered > .data-grid{
  margin-top:18px !important;
}


/* v8.7 - Gündüz / Gece tema sistemi */

/* Koyu tema mevcut görünümü korur */
html.dark-theme{
  color-scheme:dark;
}

/* Açık / gündüz tema */
html.light-theme{
  color-scheme:light;
}
html.light-theme body{
  background:linear-gradient(180deg,#eef4fb 0%,#f7fafc 100%);
  color:#142033;
}
html.light-theme .topbar{
  background:linear-gradient(135deg,#3b82f6,#60a5fa);
  color:#ffffff;
  box-shadow:0 4px 18px rgba(37,99,235,.18);
}
html.light-theme .brand-wrap p{color:#eaf4ff}
html.light-theme .logo{
  background:#ffffff;
  color:#2563eb;
  box-shadow:0 2px 8px rgba(15,23,42,.12);
}
html.light-theme .icon-btn{
  background:#ffffff;
  color:#1e3a5f;
  border:1px solid rgba(255,255,255,.7);
}
html.light-theme .connection-pill.online{
  background:#22c55e;color:#052e16;
}
html.light-theme .connection-pill.offline{
  background:#facc15;color:#422006;
}

html.light-theme .gauge-card,
html.light-theme .control-card,
html.light-theme .data-section,
html.light-theme .alert-card,
html.light-theme .schedule-card,
html.light-theme .system-card,
html.light-theme .last-seen-card,
html.light-theme .panel-card,
html.light-theme .history-analysis{
  background:#ffffff;
  border-color:#d7e2ef;
  color:#142033;
  box-shadow:0 8px 24px rgba(15,23,42,.07);
}

html.light-theme .gauge-title,
html.light-theme .section-title,
html.light-theme .control-label,
html.light-theme .runtime-row span,
html.light-theme .page-note,
html.light-theme .alert-meta,
html.light-theme footer{
  color:#62748b;
}

html.light-theme .gauge-bg{
  stroke:#d9e2ec;
}
html.light-theme .gauge-value{
  color:#18263a;
}
html.light-theme .gauge-unit{
  color:#62748b;
}
html.light-theme .gauge-scale{
  color:#8493a6;
}

html.light-theme .runtime-row,
html.light-theme .data-card,
html.light-theme .schedule-summary div,
html.light-theme .health-box,
html.light-theme .stat-box,
html.light-theme .evidence-item,
html.light-theme .warning-explanation,
html.light-theme .notify-block{
  background:#f3f7fb;
  border-color:#dbe5ef;
  color:#142033;
}

html.light-theme .runtime-row strong,
html.light-theme .data-card b,
html.light-theme .data-card small,
html.light-theme .health-box b,
html.light-theme .stat-box b{
  color:#18324f;
}

html.light-theme .data-card>span,
html.light-theme .health-box span,
html.light-theme .stat-box span,
html.light-theme .evidence-item>span{
  color:#708197;
}

html.light-theme .valve-switch button{
  background:#edf4fb;
  border-color:#c9d7e7;
  color:#29435f;
}
html.light-theme .valve-switch button.active{
  background:#d9efff;
  color:#11304d;
  border-color:#9bcff3;
}

html.light-theme .wide-link,
html.light-theme .small-btn,
html.light-theme .toolbar button,
html.light-theme .toolbar a,
html.light-theme .back-link{
  background:#eaf3fb;
  border-color:#c7d8e9;
  color:#254664;
}
html.light-theme .toolbar button.active{
  background:#2563eb;
  color:#ffffff;
}

html.light-theme .expand-link{
  background:#eef5fc;
  border-color:#cad9e9;
  color:#315a7c;
}
html.light-theme .last-age-box{
  background:#e9f2fb;
  border-color:#c8d9ea;
  color:#294663!important;
}
html.light-theme .last-data-clock,
html.light-theme .last-seen-values strong,
html.light-theme .last-seen-values span{
  color:#294663!important;
}

html.light-theme .dark-table th{
  color:#718198;
  border-color:#dbe5ef;
}
html.light-theme .dark-table td{
  color:#20364d;
  border-color:#e3ebf4;
}
html.light-theme .chart-wrap{
  background:#ffffff;
}
html.light-theme .notice.ok{
  background:#dcfce7;
  color:#166534;
}
html.light-theme .notice.info{
  background:#dbeafe;
  color:#1e40af;
}
html.light-theme .notice.warn{
  background:#fef3c7;
  color:#92400e;
}
html.light-theme .notice.error{
  background:#fee2e2;
  color:#991b1b;
}
html.light-theme .theme-toggle{
  background:#fff7d6;
  color:#8a6500;
}

/* Formlar */
html.light-theme .field input,
html.light-theme .field select{
  background:#ffffff;
  color:#20364d;
  border-color:#c9d7e7;
}

/* Açık temada blok renkleri korunur ama okunaklı tonlara çekilir */
html.light-theme .pump-title{color:#16883e!important}
html.light-theme .valve-title{color:#1572b8!important}
html.light-theme .schedule-title{color:#8b4ac6!important}
html.light-theme .electric-title{color:#a36b00!important}
html.light-theme .water-title{color:#087f78!important}
html.light-theme .alert-title{color:#c93c4c!important}
html.light-theme .events-title{color:#c86a00!important}
html.light-theme .system-title{color:#5364c7!important}


/* v8.8 - Açık tema kontrast düzeltmeleri */

/* Sulama Zamanlayıcısı: Aktif program / Sıradaki değerleri daha koyu */
html.light-theme .schedule-summary b{
  color:#16324f !important;
  font-weight:800;
}
html.light-theme .schedule-summary span{
  color:#5f7187 !important;
}

/* Aktif Uyarı: Akım / Basınç / Debi değerleri açık temada daha okunaklı */
html.light-theme .sensor-evidence .evidence-item b,
html.light-theme .evidence-item>b{
  color:#17324d !important;
  font-weight:800;
}
html.light-theme .sensor-evidence .evidence-item small,
html.light-theme .evidence-item>small{
  color:#5f7187 !important;
}
html.light-theme .sensor-evidence .evidence-item>span{
  color:#6a7b90 !important;
}

/* Duruma göre renkli kutular açık temada da okunaklı kalsın */
html.light-theme .evidence-item.good{
  background:#eaf8ef !important;
  border-color:#b8dec4 !important;
}
html.light-theme .evidence-item.warn{
  background:#fff7dd !important;
  border-color:#ead18b !important;
}
html.light-theme .evidence-item.danger{
  background:#fdecef !important;
  border-color:#e8b1bb !important;
}

/* Sulama zamanlayıcısı gün checkbox kutuları */
html.light-theme .day-pills label{
  background:#f4f8fc !important;
  border-color:#c9d7e6 !important;
  color:#29445f !important;
}
html.light-theme .day-pills label:hover{
  background:#eaf2f9 !important;
}
html.light-theme .day-pills input{
  accent-color:#2563eb;
}

/* Seçili gün kutusunun görsel geri bildirimi */
html.light-theme .day-pills label:has(input:checked){
  background:#dbeafe !important;
  border-color:#93c5fd !important;
  color:#1e3a5f !important;
  font-weight:800;
}


/* v8.9 - Anlık Güç gauge */
.powerarc{
  stroke:#f59e0b;
}
.power-gauge-card{
  border-color:#5f4922;
}
html.light-theme .power-gauge-card{
  border-color:#ead5a6;
}


/* v8.10 - Sadece mevcut gauge'ların yerleşimi değiştirildi */
.gauge-row-two{
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
}
.gauge-row-one{
  grid-template-columns:minmax(0,1fr) !important;
}
.gauge-row-one .gauge-card{
  width:100%;
}
@media(max-width:640px){
  .gauge-row-two{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:10px;
  }
  .gauge-row-one{
    grid-template-columns:minmax(0,1fr) !important;
  }
}


/* v8.11 — iPhone / Dynamic Island / safe-area header fix */

/* Sayfanın sağa taşmasını ve mavi bandın kesilmesini engelle */
html, body{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}
body{
  min-width:0;
}
.topbar{
  width:100%;
  max-width:100vw;
  box-sizing:border-box;

  /* iPhone notch / Dynamic Island güvenli alanları */
  padding-top:calc(10px + env(safe-area-inset-top, 0px)) !important;
  padding-right:calc(12px + env(safe-area-inset-right, 0px)) !important;
  padding-bottom:10px !important;
  padding-left:calc(12px + env(safe-area-inset-left, 0px)) !important;

  min-width:0;
  overflow:visible;
}
.page,
.page-shell{
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  padding-left:calc(10px + env(safe-area-inset-left, 0px));
  padding-right:calc(10px + env(safe-area-inset-right, 0px));
}
.brand-wrap,
.brand-line,
.header-actions{
  min-width:0;
}
.brand-wrap{
  flex:1 1 auto;
  max-width:calc(100% - 150px);
}
.brand-line{
  min-width:0;
}
.brand-line h1{
  white-space:nowrap;
}
.header-actions{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:5px;
}
.header-actions .icon-btn{
  flex:0 0 auto;
}

/* iPhone 15/16 ve benzer dar ekranlar */
@media (max-width: 480px){
  .topbar{
    gap:6px;
  }

  .brand-wrap{
    gap:7px;
    max-width:calc(100% - 136px);
  }

  .logo{
    width:34px !important;
    height:34px !important;
    min-width:34px;
    border-radius:10px;
    font-size:18px !important;
  }

  .brand-line{
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    justify-content:center;
    gap:2px !important;
  }

  .brand-line h1{
    font-size:21px !important;
    line-height:1.05;
    letter-spacing:-.025em;
  }

  /* ONLINE/OFFLINE başlığın altına alınır; yatay alan kazanılır */
  .connection-pill{
    min-width:58px !important;
    height:18px !important;
    padding:0 6px !important;
    font-size:8px !important;
    line-height:18px;
    box-shadow:none !important;
  }

  .header-actions{
    gap:4px !important;
  }

  .header-actions .icon-btn{
    width:30px !important;
    height:30px !important;
    min-width:30px;
    border-radius:8px !important;
    font-size:16px !important;
    padding:0 !important;
  }
}

/* Çok dar iPhone ekranlarında da tüm kontroller tek satırda kalsın */
@media (max-width: 375px){
  .brand-wrap{
    max-width:calc(100% - 124px);
    gap:5px;
  }

  .logo{
    width:31px !important;
    height:31px !important;
    min-width:31px;
    font-size:16px !important;
  }

  .brand-line h1{
    font-size:19px !important;
  }

  .connection-pill{
    min-width:54px !important;
    font-size:7.5px !important;
  }

  .header-actions .icon-btn{
    width:28px !important;
    height:28px !important;
    min-width:28px;
    font-size:15px !important;
  }
}

/* Home-screen PWA'da alt safe-area için son içerik kesilmesin */
@media (display-mode: standalone){
  body{
    padding-bottom:env(safe-area-inset-bottom, 0px);
  }
}


/* v8.12 — Masaüstü estetiğini geri getir, iPhone düzeltmesini koru */

/*
  v8.11'de safe-area düzeltmeleri global uygulanınca masaüstünde içerik gereğinden
  fazla yatay genişliyordu. Aşağıdaki kurallar yalnızca tablet/masaüstünde eski
  merkezi kolon yapısını geri getirir.
*/
@media (min-width: 769px){

  .topbar{
    width:100% !important;
    max-width:none !important;
    box-sizing:border-box;

    /* Eski masaüstü merkezleme */
    padding-top:14px !important;
    padding-bottom:14px !important;
    padding-left:max(16px, calc((100% - 880px) / 2)) !important;
    padding-right:max(16px, calc((100% - 880px) / 2)) !important;
  }

  .page{
    width:auto !important;
    max-width:880px !important;
    margin-left:auto !important;
    margin-right:auto !important;
    padding-left:14px !important;
    padding-right:14px !important;
  }

  .page-shell{
    width:auto !important;
    max-width:1000px !important;
    margin-left:auto !important;
    margin-right:auto !important;
    padding-left:14px !important;
    padding-right:14px !important;
  }

  .brand-wrap{
    max-width:none !important;
    flex:0 1 auto;
  }

  .header-actions{
    gap:8px !important;
  }

  .header-actions .icon-btn{
    width:39px !important;
    height:39px !important;
    min-width:39px !important;
    border-radius:10px !important;
    font-size:20px !important;
  }

  .logo{
    width:40px !important;
    height:40px !important;
    min-width:40px !important;
    font-size:21px !important;
  }

  .brand-line{
    flex-direction:row !important;
    align-items:center !important;
    gap:9px !important;
  }

  .brand-line h1{
    font-size:30px !important;
  }

  .connection-pill{
    min-width:78px !important;
    height:28px !important;
    padding:0 10px !important;
    font-size:10px !important;
    line-height:normal !important;
  }
}

/* Mobilde v8.11 safe-area davranışı aynen devam eder */
@media (max-width: 768px){
  .page,
  .page-shell{
    max-width:100% !important;
  }
}


/* v8.13 — iPhone safe-area düzeltmesi TÜM alt sayfalarda */

/*
  Ana dashboard'da topbar safe-area ile korunuyordu.
  Grafikler / İstatistikler / Uyarılar / Ayarlar / Sulama / Bağlantı Sağlığı /
  Olay Günlüğü gibi alt sayfalarda ise doğrudan .page-shell başladığı için
  "← Panel" butonu Dynamic Island / notch alanına girebiliyordu.
*/

@media (max-width: 768px){

  /* Alt sayfaların tamamını notch / Dynamic Island altına indir */
  .page-shell{
    box-sizing:border-box !important;
    width:100% !important;
    max-width:100% !important;
    margin:0 auto !important;

    padding-top:calc(16px + env(safe-area-inset-top, 0px)) !important;
    padding-right:calc(12px + env(safe-area-inset-right, 0px)) !important;
    padding-bottom:calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    padding-left:calc(12px + env(safe-area-inset-left, 0px)) !important;
  }

  /* İlk satırdaki başlık ve geri tuşu her zaman güvenli alanda */
  .page-titlebar{
    position:relative !important;
    top:auto !important;
    right:auto !important;
    left:auto !important;

    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:10px !important;

    width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
    margin:0 0 14px 0 !important;
  }

  .page-titlebar > div{
    min-width:0 !important;
    flex:1 1 auto !important;
  }

  .page-titlebar h1{
    margin:0 !important;
    font-size:22px !important;
    line-height:1.15 !important;
    overflow-wrap:anywhere;
  }

  /* "← Panel" düğmesi adacık altında kalmasın, dar ekranda küçülsün */
  .page-titlebar .back-link{
    position:relative !important;
    top:auto !important;
    right:auto !important;
    left:auto !important;

    flex:0 0 auto !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;

    min-height:38px !important;
    min-width:72px !important;
    padding:8px 10px !important;
    margin:0 !important;

    border-radius:10px !important;
    font-size:13px !important;
    font-weight:800 !important;
    white-space:nowrap !important;
    z-index:2 !important;
    touch-action:manipulation;
  }

  /* Alt sayfalarda yatay taşma oluşmasın */
  .panel-card,
  .history-analysis,
  .table-wrap,
  .chart-wrap,
  .form-grid,
  .health-grid,
  .stats-grid,
  .connection-chain{
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }

  .table-wrap{
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch;
  }
}

/* Daha dar iPhone ekranları */
@media (max-width: 390px){
  .page-shell{
    padding-top:calc(14px + env(safe-area-inset-top, 0px)) !important;
    padding-left:calc(10px + env(safe-area-inset-left, 0px)) !important;
    padding-right:calc(10px + env(safe-area-inset-right, 0px)) !important;
  }

  .page-titlebar{
    gap:7px !important;
  }

  .page-titlebar h1{
    font-size:20px !important;
  }

  .page-titlebar .back-link{
    min-width:66px !important;
    min-height:36px !important;
    padding:7px 9px !important;
    font-size:12px !important;
  }
}

/*
  Masaüstünde v8.12 merkezlenmiş görünüm korunur.
  Safe-area ek boşluğu sadece mobil breakpoint'te uygulanır.
*/


/* ============================================================
   v8.15 — gerçek login.php + iPhone time input kesin düzeltmesi
   ============================================================ */

/* ---------- LOGIN ---------- */
.login-page{
  margin:0;
  width:100%;
  min-width:0;
  min-height:100vh;
  min-height:100dvh;
  box-sizing:border-box;

  display:flex;
  align-items:center;
  justify-content:center;

  padding:
    calc(24px + env(safe-area-inset-top, 0px))
    calc(18px + env(safe-area-inset-right, 0px))
    calc(24px + env(safe-area-inset-bottom, 0px))
    calc(18px + env(safe-area-inset-left, 0px));

  background:linear-gradient(180deg,#0b1324 0%,#09101d 100%);
  color:#e8f2ff;
}

.login-card{
  width:100%;
  max-width:400px;
  box-sizing:border-box;
  margin:auto;
  padding:30px 26px;
  border:1px solid #2b3a50;
  border-radius:24px;
  background:#111a29;
  box-shadow:0 18px 50px rgba(0,0,0,.24);
}

.login-card h1{
  margin:0 0 8px;
  text-align:center;
  font-size:34px;
  line-height:1.05;
  font-weight:900;
  letter-spacing:-.035em;
  color:#eaf5ff;
}

.login-card > p{
  margin:0 0 22px;
  text-align:center;
  font-size:15px;
  color:#9baabd;
}

.login-card form{
  display:grid;
  gap:12px;
  width:100%;
  min-width:0;
}

.login-card input[type="password"]{
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  height:52px;
  box-sizing:border-box;
  padding:0 15px;
  border:1px solid #34475f;
  border-radius:13px;
  outline:none;
  background:#0b1422;
  color:#eef7ff;
  font-size:17px;
  -webkit-appearance:none;
  appearance:none;
}

.login-card input[type="password"]:focus{
  border-color:#60a5fa;
  box-shadow:0 0 0 3px rgba(96,165,250,.16);
}

.login-card button[type="submit"]{
  width:100%;
  min-height:52px;
  box-sizing:border-box;
  border:0;
  border-radius:13px;
  background:#1681ff;
  color:white;
  font-size:17px;
  font-weight:850;
  cursor:pointer;
  touch-action:manipulation;
}

.login-card .alert,
.login-page .alert{
  margin:0 0 12px;
  padding:10px 12px;
  border-radius:10px;
  background:#482128;
  color:#ffd6db;
  font-size:13px;
  text-align:center;
}

html.light-theme .login-page{
  background:linear-gradient(180deg,#eaf2fa 0%,#f7fafc 100%);
  color:#18324f;
}
html.light-theme .login-card{
  background:#ffffff;
  border-color:#d6e1ed;
  box-shadow:0 18px 45px rgba(15,23,42,.10);
}
html.light-theme .login-card h1{color:#18324f}
html.light-theme .login-card > p{color:#6b7d91}
html.light-theme .login-card input[type="password"]{
  background:#f7fafc;
  color:#18324f;
  border-color:#cbd9e7;
}

@media(max-width:480px){
  .login-page{
    /* gerçek ekran merkezine biraz daha yakın, Dynamic Island güvenli */
    padding-top:calc(18px + env(safe-area-inset-top, 0px));
    padding-bottom:calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .login-card{
    max-width:390px;
    padding:28px 22px;
    border-radius:22px;
  }
  .login-card h1{font-size:32px}
}

/* ---------- FORM GRID TEMEL DÜZELTME ----------
   iOS time input'un min-content genişliğinin grid'i büyütmesini engeller.
*/
.field,
.form-grid > *{
  min-width:0;
  box-sizing:border-box;
}

.field input,
.field select{
  box-sizing:border-box;
  max-width:100%;
  min-width:0;
}

/* ---------- SULAMA ZAMANLAYICISI / BAŞLANGIÇ ----------
   iPhone Safari için width:100% tek başına yeterli değil.
   inline-size + minmax(0,1fr) + overflow constraint birlikte kullanılır.
*/
@media(max-width:768px){

  #scheduleForm{
    width:100%;
    max-width:100%;
    min-width:0;
    box-sizing:border-box;
    overflow:hidden;
  }

  #scheduleForm .form-grid{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
  }

  #scheduleForm .field{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
    overflow:hidden;
  }

  #scheduleForm input,
  #scheduleForm select{
    display:block !important;
    width:100% !important;
    inline-size:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
  }

  #scheduleForm input[type="time"]{
    -webkit-appearance:none;
    appearance:none;

    height:44px !important;
    line-height:44px !important;
    padding:0 11px !important;
    margin:0 !important;

    border-radius:10px !important;
    overflow:hidden !important;

    /* iOS min-content overflow önleme */
    flex:1 1 0 !important;
  }

  #scheduleForm input[type="time"]::-webkit-date-and-time-value{
    min-width:0 !important;
    width:100% !important;
    margin:0 !important;
    padding:0 !important;
    text-align:left !important;
  }

  #scheduleForm input[type="time"]::-webkit-datetime-edit{
    min-width:0 !important;
    padding:0 !important;
  }

  #scheduleForm input[type="time"]::-webkit-calendar-picker-indicator{
    flex:0 0 auto;
    margin:0 0 0 auto !important;
    padding:0 !important;
  }
}


/* ============================================================
   v8.16 — Masaüstü login ekranı düzeltmesi
   Mobil v8.15 davranışı aynen korunur.
   ============================================================ */

/* Login sayfasını masaüstünde de ekranın ortasına yerleştir */
.login-page{
  min-height:100vh !important;
  min-height:100dvh !important;
  width:100% !important;
  max-width:none !important;
  margin:0 !important;
  box-sizing:border-box !important;

  display:flex !important;
  align-items:center !important;
  justify-content:center !important;

  padding:
    calc(28px + env(safe-area-inset-top,0px))
    calc(24px + env(safe-area-inset-right,0px))
    calc(28px + env(safe-area-inset-bottom,0px))
    calc(24px + env(safe-area-inset-left,0px)) !important;
}

/* Masaüstünde kart daha geniş ve dengeli */
.login-page > .login-card{
  width:100% !important;
  max-width:460px !important;
  margin:auto !important;
  padding:36px 34px !important;
  box-sizing:border-box !important;
  border-radius:24px !important;
}

.login-page > .login-card h1{
  font-size:38px !important;
  line-height:1.05 !important;
  margin:0 0 9px !important;
}

.login-page > .login-card > p{
  font-size:16px !important;
  margin-bottom:24px !important;
}

.login-page > .login-card input[type="password"]{
  height:54px !important;
  font-size:18px !important;
}

.login-page > .login-card button[type="submit"]{
  min-height:54px !important;
  font-size:17px !important;
}

/* Mobilde v8.15 ölçülerini geri uygula */
@media(max-width:768px){
  .login-page > .login-card{
    max-width:400px !important;
    padding:30px 26px !important;
  }

  .login-page > .login-card h1{
    font-size:34px !important;
  }

  .login-page > .login-card > p{
    font-size:15px !important;
  }

  .login-page > .login-card input[type="password"],
  .login-page > .login-card button[type="submit"]{
    min-height:52px !important;
    height:52px !important;
  }
}

@media(max-width:480px){
  .login-page > .login-card{
    max-width:390px !important;
    padding:28px 22px !important;
  }

  .login-page > .login-card h1{
    font-size:32px !important;
  }
}


/* =========================================================
   v8.17 — Bağlantı Sağlığı + mobil polish
   ========================================================= */

/* Sağlık kutuları Geçmiş kaldırıldıktan sonra dengeli dağılsın */
.health-grid{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

/* Son online zamanı uzayabileceği için rahat sarma */
#hLastOnline{
  font-size:14px;
  line-height:1.35;
  overflow-wrap:anywhere;
}

/* Yenile ikonu: Unicode karakter yerine diğer ikonlarla uyumlu SVG */
.refresh-btn{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
}
.refresh-svg{
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
  pointer-events:none;
}
.refresh-btn:active .refresh-svg{
  transform:rotate(28deg);
}

/* Mobilde Başlangıç time input: yatay düzeltme korunur,
   dikey yüksekliği diğer form alanlarına yaklaştırılır. */
@media(max-width:768px){
  #scheduleForm input[type="time"]{
    height:38px !important;
    min-height:38px !important;
    line-height:normal !important;
    padding:7px 10px !important;
  }

  #scheduleForm input[type="time"]::-webkit-date-and-time-value{
    line-height:22px !important;
  }

  .health-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  /* Mobil yenile butonu diğer üst ikonlarla aynı görsel ritimde */
  .header-actions .refresh-btn{
    background:rgba(255,255,255,.12) !important;
    border:1px solid rgba(255,255,255,.22) !important;
    color:#ffffff !important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.08) !important;
  }
  html.light-theme .header-actions .refresh-btn{
    background:#ffffff !important;
    border-color:rgba(255,255,255,.72) !important;
    color:#1e3a5f !important;
  }
  .header-actions .refresh-svg{
    width:17px;
    height:17px;
  }
}


/* v8.18 — mobil Yenile butonu: PWA/cache sonrası da belirgin yeni görünüm */
.refresh-btn-v818{
  position:relative;
}
.refresh-btn-v818 .refresh-svg{
  display:block !important;
  width:20px !important;
  height:20px !important;
  stroke:currentColor !important;
  stroke-width:2.15 !important;
  fill:none !important;
  transition:transform .18s ease;
}
.refresh-btn-v818:active .refresh-svg{
  transform:rotate(90deg) scale(.94);
}

@media(max-width:768px){
  .header-actions .refresh-btn-v818{
    width:30px !important;
    height:30px !important;
    min-width:30px !important;
    padding:0 !important;
    border-radius:8px !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    background:rgba(255,255,255,.10) !important;
    border:1px solid rgba(255,255,255,.20) !important;
    color:#fff !important;
    box-shadow:none !important;
  }
  .header-actions .refresh-btn-v818 .refresh-svg{
    width:17px !important;
    height:17px !important;
  }
}


/* v8.20 — manuel yenileme görsel geri bildirimi */
.refresh-btn.is-refreshing{
  opacity:.82;
  cursor:wait;
}
.refresh-btn.is-refreshing .refresh-svg{
  animation:gardeniot-refresh-spin .72s linear infinite;
}
@keyframes gardeniot-refresh-spin{
  from{transform:rotate(0deg)}
  to{transform:rotate(360deg)}
}
@media(prefers-reduced-motion:reduce){
  .refresh-btn.is-refreshing .refresh-svg{
    animation:none;
    opacity:.55;
  }
}


/* v8.21 — mobil yenile ikonu belirgin şekilde değiştirildi */
.refresh-btn-v821{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
}
.refresh-btn-v821 .refresh-sync-svg{
  display:block !important;
  width:20px !important;
  height:20px !important;
  fill:none !important;
  stroke:currentColor !important;
  stroke-width:2.15 !important;
  stroke-linecap:round !important;
  stroke-linejoin:round !important;
}

@media(max-width:768px){
  .header-actions .refresh-btn-v821{
    width:30px !important;
    height:30px !important;
    min-width:30px !important;
    padding:0 !important;
    border-radius:9px !important;
    background:rgba(255,255,255,.16) !important;
    border:1px solid rgba(255,255,255,.28) !important;
    color:#fff !important;
  }
  .header-actions .refresh-btn-v821 .refresh-sync-svg{
    width:18px !important;
    height:18px !important;
  }
  html.light-theme .header-actions .refresh-btn-v821{
    background:#ffffff !important;
    color:#1f4d78 !important;
    border-color:#d7e5f2 !important;
  }
}

/* Yenileme sırasında iki-ok simgesi tam tur döner */
.refresh-btn-v821.is-refreshing .refresh-sync-svg{
  animation:gardeniot-refresh-spin .72s linear infinite;
}


/* v8.22 — Beni hatırla + mobil program buton hizası */
.remember-row{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:9px;
  width:100%;
  min-height:32px;
  margin:0;
  color:#b9c6d6;
  font-size:14px;
  cursor:pointer;
  user-select:none;
}
.remember-row input[type="checkbox"]{
  width:18px !important;
  height:18px !important;
  min-width:18px !important;
  min-height:18px !important;
  margin:0 !important;
  padding:0 !important;
  accent-color:#1681ff;
}
.remember-row span{
  line-height:1.2;
}
html.light-theme .remember-row{
  color:#53677d;
}

.schedule-actions{
  margin-left:auto;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:7px;
  flex:0 0 auto;
}

@media(max-width:768px){
  #scheduleList .runtime-row{
    gap:8px;
  }
  #scheduleList .runtime-row > div:first-child{
    min-width:0;
    flex:1 1 auto;
  }
  #scheduleList .schedule-actions{
    margin-left:auto !important;
    padding-left:8px;
    padding-right:0;
    justify-content:flex-end !important;
  }
  #scheduleList .schedule-actions .small-btn{
    padding-left:8px;
    padding-right:8px;
  }
}


/* v8.25 — Pompa Koruma Davranışı */
.protection-behavior-card .section-title{
  color:#ff7b72;
}
.protection-subtitle{
  margin:18px 0 10px;
  padding-bottom:7px;
  border-bottom:1px solid var(--line);
  color:#cbd8e8;
  font-size:13px;
  font-weight:850;
}
.protection-warning{
  margin-top:11px !important;
  padding:10px 12px;
  border:1px solid #654c24;
  border-radius:11px;
  background:#342a18;
  color:#ffdba0 !important;
}
html.light-theme .protection-subtitle{
  color:#304a64;
  border-bottom-color:#dbe5ef;
}
html.light-theme .protection-warning{
  background:#fff7dd;
  border-color:#ead18b;
  color:#714b00 !important;
}

.field small{display:block;margin-top:6px;line-height:1.35;color:var(--muted);font-size:11px}.calibration-formula{margin:10px 0 14px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:rgba(127,127,127,.07);font-size:12px;font-weight:750}

/* v8.28 */
.retry-dependent:has(input:disabled),.runtime-dependent:has(input:disabled){opacity:.48}.field input:disabled{cursor:not-allowed;filter:saturate(.35)}

/* v8.29 - Safari/iPhone compatible disabled field styling */
.field.setting-disabled{opacity:.45}
.field.setting-disabled input{
  background:rgba(127,127,127,.10)!important;
  color:var(--muted)!important;
  border-color:var(--line)!important;
  cursor:not-allowed;
}

/* v8.34 Web Push */
.push-box{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:12px 0 18px;padding:14px;border:1px solid var(--line);border-radius:14px;background:rgba(127,127,127,.06)}
.push-box small{display:block;margin-top:5px;color:var(--muted)}
.push-actions{display:flex;gap:8px;flex-wrap:wrap}
.push-actions button{border:1px solid var(--line);border-radius:10px;padding:9px 12px;font-weight:750;cursor:pointer}
@media(max-width:640px){.push-box{align-items:stretch;flex-direction:column}.push-actions button{width:100%}}

/* v8.35 Push diagnostics */
.push-diagnostic{margin:-8px 0 16px;padding:9px 11px;border-radius:10px;background:rgba(127,127,127,.07);color:var(--muted);font-size:11px;line-height:1.4}

/* v8.36 mobil bildirim düzeni */
.notification-card .push-actions{display:grid;grid-template-columns:minmax(160px,1fr) minmax(160px,1fr);gap:8px;min-width:340px}
.notification-card .push-actions button{width:100%;min-height:40px}
@media(max-width:640px){
 .notification-card .push-actions{grid-template-columns:1fr;min-width:0;width:100%}
}

/* v8.38 — Mobil bildirim ana kontrolü */
.push-master-box{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:12px 0 12px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(127,127,127,.06);
}
.push-master-box small{display:block;margin-top:5px;color:var(--muted)}
.push-master-actions{
  display:grid;
  grid-template-columns:minmax(170px,1fr) minmax(170px,1fr);
  gap:8px;
  min-width:360px;
}
.push-master-actions button{
  width:100%;
  min-height:40px;
  border:1px solid var(--line);
  border-radius:10px;
  padding:9px 12px;
  font-weight:800;
  cursor:pointer;
}
#pushMasterToggle.is-on{
  box-shadow:inset 0 0 0 1px rgba(34,197,94,.35);
}
.notification-card .push-box{margin-top:0}
.notification-card .push-actions{display:block;min-width:180px}
@media(max-width:640px){
  .push-master-box{align-items:stretch;flex-direction:column}
  .push-master-actions{grid-template-columns:1fr;min-width:0;width:100%}
  .notification-card .push-actions{min-width:0;width:100%}
}

/* v8.39 — Push düğme yerleşimi + Son ESP32 offline rozeti */
.push-master-actions{
  grid-template-columns:minmax(190px,1fr)!important;
  min-width:210px!important;
}
.push-device-actions{
  display:grid!important;
  grid-template-columns:minmax(160px,1fr) minmax(160px,1fr)!important;
  gap:8px!important;
  min-width:340px!important;
}
.push-device-actions button{
  width:100%!important;
  min-height:40px;
}
.last-age-box.is-offline{
  display:inline-flex!important;
  align-items:center;
  gap:7px;
  white-space:nowrap;
}
.last-offline-dot{
  width:9px;
  height:9px;
  border-radius:50%;
  background:currentColor;
  display:inline-block;
  box-shadow:0 0 0 3px rgba(239,68,68,.14);
}
@media(max-width:640px){
  .push-master-actions,
  .push-device-actions{
    grid-template-columns:1fr!important;
    min-width:0!important;
    width:100%!important;
  }
}

/* v8.40 — >3 dk eski veri gösterimi */
.last-age-box.is-stale,
.gauge-value.stale-value{
  white-space:nowrap;
}
.gauge-value.stale-value{
  font-size:22px;
  letter-spacing:-.02em;
}

/* v8.43 — Olay/Uyarı geçmişi yenile düğmesi */
.page-title-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
}
.refresh-page-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  border:1px solid var(--line);
  border-radius:10px;
  padding:8px 11px;
  background:var(--surface2);
  color:var(--text);
  font-weight:750;
  cursor:pointer;
  white-space:nowrap;
}
.refresh-page-btn:disabled{opacity:.55;cursor:wait}
.refresh-page-btn.is-loading{animation:refreshPulse .8s ease-in-out infinite alternate}
@keyframes refreshPulse{from{opacity:.55}to{opacity:1}}
@media(max-width:640px){
  .page-title-actions{gap:6px}
  .refresh-page-btn,.page-title-actions .back-link{padding:8px 9px;font-size:12px}
}

/* v8.43D11 — GardenIoT header application logo */
.gardeniot-header-logo{
  width:100%;
  height:100%;
  display:block;
  object-fit:contain;
  border-radius:22%;
}

/* v8.43D13 — parola değiştirme alanı */
.password-change-form{margin-top:14px}
.password-actions{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-top:14px}
.password-actions .page-note{margin:0}

/* v8.43D15 — Giriş parolası / Ayarları Kaydet düzeni */
.password-panel{margin-top:16px}
.password-actions{display:block;margin-top:14px}
.password-change-btn{width:100%;box-sizing:border-box;text-align:center}
.settings-save-bottom{margin-top:16px}
.settings-save-bottom .wide-link{width:100%;box-sizing:border-box;text-align:center}
.settings-save-bottom #settingsMsg{margin:8px 2px 0}

/* Her iki ana işlem düğmesi için aynı fiziksel tıklama hissi */
.action-pressable{
  transition:transform .10s ease,filter .10s ease,box-shadow .10s ease;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
.action-pressable:active{
  transform:translateY(2px) scale(.985);
  filter:brightness(.92);
  box-shadow:inset 0 2px 6px rgba(0,0,0,.18);
}
.action-pressable:disabled{
  transform:none;
  filter:none;
  opacity:.60;
  cursor:not-allowed;
}

/* v8.43D16 — vana optimistic seçim */
.big-toggle.pending-selection{
  transform:scale(.985);
}

/* Ayarlar ana işlem düğmeleri: kompakt, sola yaslı */
.password-actions,
.settings-save-bottom{
  text-align:left;
}
.password-change-btn,
.settings-save-bottom .wide-link{
  width:auto;
  min-width:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.password-change-btn{
  padding-left:18px;
  padding-right:18px;
}
.settings-save-bottom .wide-link{
  padding-left:18px;
  padding-right:18px;
}

/* v8.43D17 — Panel genelinde standart dokunma/tıklama geri bildirimi
   Yalnız gerçek etkileşimli kontroller; kart/gövde elemanlarına uygulanmaz. */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
a.wide-link,
a.back-link,
a.expand-link,
.wide-link,
.back-link,
.expand-link,
.big-toggle,
.seg-btn,
.icon-btn,
.refresh-btn,
.edit-btn,
.delete-btn{
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
  transition:
    transform .10s ease,
    filter .10s ease,
    box-shadow .10s ease,
    opacity .10s ease;
  transform-origin:center;
}

/* Büyük/ana işlem kontrolleri */
button:active:not(:disabled),
input[type="button"]:active:not(:disabled),
input[type="submit"]:active:not(:disabled),
input[type="reset"]:active:not(:disabled),
.wide-link:active,
.big-toggle:active,
.seg-btn:active{
  transform:translateY(2px) scale(.97);
  filter:brightness(.92);
}

/* Küçük navigasyon / yardımcı işlem kontrolleri */
a.back-link:active,
a.expand-link:active,
.back-link:active,
.expand-link:active,
.icon-btn:active,
.refresh-btn:active,
.edit-btn:active,
.delete-btn:active{
  transform:translateY(1px) scale(.98);
  filter:brightness(.94);
}

/* Disabled kontrol basılmış gibi görünmesin. */
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled{
  transform:none !important;
  filter:none !important;
}

/* Vana pending görünümü tıklama efektinden sonra korunur. */
.big-toggle.pending-selection:not(:active){
  transform:scale(.985);
}

/* v8.43D19 — koyu temada sağ üst Yenile butonu diğer header butonlarıyla aynı */
html.dark-theme .header-actions .refresh-btn,
html.dark-theme .header-actions .refresh-btn-v818{
  background:rgba(255,255,255,.10) !important;
  border:1px solid rgba(255,255,255,.20) !important;
  color:#ffffff !important;
  box-shadow:none !important;
}

/* v8.43D20 — Yenile butonu diğer sağ üst .icon-btn butonlarıyla birebir aynı görünür */
.header-actions .refresh-btn,
.header-actions .refresh-btn-v821{
  background:#111827 !important;
  color:#ffffff !important;
  border:0 !important;
  box-shadow:none !important;
}

/* Açık temada da diğer icon-btn davranışını aynen takip eder */
html.light-theme .header-actions .refresh-btn,
html.light-theme .header-actions .refresh-btn-v821{
  background:#ffffff !important;
  color:#1e3a5f !important;
  border:1px solid rgba(255,255,255,.70) !important;
  box-shadow:none !important;
}

/* Mobilde yalnız boyut/radius diğer icon-btn ile aynı; özel yarı şeffaf zemin yok */
@media(max-width:480px){
  .header-actions .refresh-btn,
  .header-actions .refresh-btn-v821{
    width:30px !important;
    height:30px !important;
    min-width:30px !important;
    padding:0 !important;
    border-radius:8px !important;
  }
}
@media(max-width:375px){
  .header-actions .refresh-btn,
  .header-actions .refresh-btn-v821{
    width:28px !important;
    height:28px !important;
    min-width:28px !important;
    border-radius:8px !important;
  }
}
@media(min-width:769px){
  .header-actions .refresh-btn,
  .header-actions .refresh-btn-v821{
    width:39px !important;
    height:39px !important;
    min-width:39px !important;
    border-radius:10px !important;
  }
}

/* v8.43D21 — Yenile: koyu modda Ayarlar/Çıkış ile aynı SOLID siyah zemin.
   Eski refresh-v818/v821 yarı saydam kurallarını kesin olarak ezer. */
html:not(.light-theme) .topbar .header-actions #refreshBtn.icon-btn.refresh-btn,
html.dark-theme .topbar .header-actions #refreshBtn.icon-btn.refresh-btn{
  background:#111827 !important;
  background-color:#111827 !important;
  border:0 !important;
  color:#ffffff !important;
  box-shadow:none !important;
  opacity:1 !important;
}

/* Açık modun mevcut beyaz davranışı korunur. */
html.light-theme .topbar .header-actions #refreshBtn.icon-btn.refresh-btn{
  background:#ffffff !important;
  background-color:#ffffff !important;
  color:#1e3a5f !important;
}

/* v8.43D22 — Kaydedilmemiş Ayarlar koruması */
body.modal-open{overflow:hidden}
.settings-modal{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.settings-modal.hidden{display:none!important}
.settings-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(3,8,18,.72);
  backdrop-filter:blur(3px);
  -webkit-backdrop-filter:blur(3px);
}
.settings-modal-card{
  position:relative;
  width:min(430px,100%);
  background:#111a29;
  color:#eef6ff;
  border:1px solid #33465f;
  border-radius:18px;
  padding:18px;
  box-shadow:0 22px 70px rgba(0,0,0,.45);
}
.settings-modal-title{
  font-size:18px;
  font-weight:850;
  margin-bottom:7px;
}
.settings-modal-text{
  color:#b7c5d8;
  font-size:13px;
  line-height:1.5;
}
.settings-modal-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:16px;
}
.settings-modal-actions .wide-link{
  width:auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin:0;
  padding:9px 13px;
}
.settings-modal-actions .secondary-action{
  background:#172236;
  border-color:#30435d;
}
.settings-modal-message{margin:10px 2px 0}
html.light-theme .settings-modal-backdrop{background:rgba(15,23,42,.38)}
html.light-theme .settings-modal-card{
  background:#ffffff;
  color:#172033;
  border-color:#cad9e9;
  box-shadow:0 22px 65px rgba(15,23,42,.22);
}
html.light-theme .settings-modal-text{color:#5b6c80}
html.light-theme .settings-modal-actions .secondary-action{
  background:#eef5fc;
  border-color:#cad9e9;
  color:#315a7c;
}
@media(max-width:520px){
  .settings-modal-actions{flex-direction:column}
  .settings-modal-actions .wide-link{width:100%}
}

/* D36 sensor controls */
[hidden]{display:none!important}
.sensor-switch{display:flex!important;align-items:center;gap:10px;cursor:pointer;flex-wrap:wrap}
.sensor-switch input{position:absolute;opacity:0;width:1px;height:1px}
.sensor-switch-track{width:44px;height:25px;border-radius:20px;background:#64748b;position:relative;flex-shrink:0}
.sensor-switch-track:before{content:"";position:absolute;left:3px;top:3px;width:19px;height:19px;background:white;border-radius:50%;transition:transform .15s}
.sensor-switch input:checked+.sensor-switch-track{background:#16845b}
.sensor-switch input:checked+.sensor-switch-track:before{transform:translateX(19px)}
.sensor-switch input:focus-visible+.sensor-switch-track{outline:3px solid #60a5fa;outline-offset:3px}
.sensor-off{font-size:clamp(15px,4vw,24px)!important}
