/* FutureKNX — akıllı ev kontrol arayüzü (yeşil→mavi tema, Google Home ilhamlı). */
:root {
  --green: #2ba74b; --green-2: #37bd5c;
  --blue: #036cb2;  --blue-2: #1a8fd6;
  --amber: #f19a3c;
  --bg: #eef1f6; --surface: #ffffff; --surface-2: #f2f5f9;
  --text: #0f2033; --muted: #6d7d90; --border: #e4e9f0;
  --shadow-sm: 0 2px 8px rgba(16,42,67,.06);
  --shadow: 0 10px 30px rgba(16,42,67,.12);
  --radius: 20px;
  --nav-h: 66px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
button, input, select { font-family: inherit; }
.hidden { display: none !important; }
svg { display: block; }

/* ================= LOGIN ================= */
.login-wrap {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 22px; overflow-y: auto;
  background:
    radial-gradient(900px 500px at 8% -8%, rgba(43,167,75,.16), transparent 60%),
    radial-gradient(1000px 620px at 108% 118%, rgba(3,108,178,.18), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border-radius: 26px; box-shadow: var(--shadow); padding: 32px 28px 26px;
}
.login-logo {
  width: 62px; height: 62px; border-radius: 20px; background: linear-gradient(150deg, var(--green-2), var(--green));
  display: grid; place-items: center; color: #fff; box-shadow: 0 10px 22px rgba(43,167,75,.35); margin-bottom: 22px;
}
.login-logo svg { width: 32px; height: 32px; }
.login-h1 { margin: 0; font-size: 27px; font-weight: 800; line-height: 1.18; letter-spacing: -.02em; }
.login-hero-sub { margin: 10px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.field { margin-bottom: 15px; }
.field label { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field-tag { text-transform: none; letter-spacing: 0; font-size: 11px; font-weight: 700; color: var(--green); background: rgba(43,167,75,.12); padding: 2px 8px; border-radius: 20px; }
.field input {
  width: 100%; padding: 13px 14px; font-size: 15px; color: var(--text);
  border: 1.5px solid var(--border); border-radius: 13px; background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(3,108,178,.12); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: none; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-eye svg { width: 20px; height: 20px; }
.remember { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; margin: 4px 0 20px; user-select: none; }
.remember input { display: none; }
.rm-box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border); display: grid; place-items: center; transition: .15s; }
.rm-box::after { content: ''; width: 10px; height: 6px; border-left: 2.4px solid #fff; border-bottom: 2.4px solid #fff; transform: rotate(-45deg) scale(0); transition: transform .15s; margin-top: -2px; }
.remember input:checked + .rm-box { background: var(--green); border-color: var(--green); }
.remember input:checked + .rm-box::after { transform: rotate(-45deg) scale(1); }
.btn-primary {
  width: 100%; padding: 15px; border: none; border-radius: 15px; cursor: pointer;
  background: linear-gradient(150deg, var(--blue-2), var(--blue)); color: #fff; font-size: 15.5px; font-weight: 700;
  box-shadow: 0 10px 22px rgba(3,108,178,.3); transition: transform .1s, filter .15s;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .7; cursor: default; }
.login-msg { margin-top: 14px; font-size: 13px; min-height: 18px; text-align: center; }
.login-msg.error { color: #e5484d; }
.login-msg.info { color: var(--blue); }
.spinner { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; margin-right: 7px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= APP SHELL ================= */
.app { display: flex; flex-direction: column; height: 100%; }
.content { flex: 1; overflow-y: auto; padding: 20px 18px calc(var(--nav-h) + 26px); -webkit-overflow-scrolling: touch; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Sayfa başlığı */
.page-head { margin: 4px 2px 18px; }
.ph-eyebrow { font-size: 13px; font-weight: 700; color: var(--muted); min-height: 16px; }
.ph-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ph-title { margin: 2px 0 0; font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.ph-sub { margin-top: 3px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.hero-weather { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 30px; background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.hero-weather .hw-icon { font-size: 17px; }
.hero-weather .hw-temp { font-size: 15px; font-weight: 800; }

.section-lbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 24px 2px 11px; display: flex; align-items: center; gap: 8px; }
.section-lbl:first-of-type { margin-top: 8px; }

/* ================= SENARYOLAR ================= */
.scene-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.scene-row::-webkit-scrollbar { display: none; }
.scene-card {
  flex: 0 0 auto; width: 118px; border: none; cursor: pointer; text-align: left;
  background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px; transition: transform .12s;
}
.scene-card:active { transform: scale(.96); }
.scene-top { display: flex; align-items: center; justify-content: space-between; }
.scene-card .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(241,154,60,.14); color: var(--amber); }
.scene-card .ico svg { width: 21px; height: 21px; }
.scene-play { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(150deg, var(--blue-2), var(--blue)); color: #fff; display: grid; place-items: center; box-shadow: 0 5px 12px rgba(3,108,178,.32); }
.scene-play svg { width: 15px; height: 15px; }
.scene-card .name { font-size: 14px; font-weight: 700; }
/* Senaryolar sekmesi ızgara */
.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 13px; }
.scene-grid .scene-card { width: auto; }

/* ================= CİHAZ KARTLARI ================= */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.dcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; box-shadow: var(--shadow-sm); position: relative;
  display: flex; flex-direction: column; gap: 12px; min-height: 108px;
  transition: transform .12s, box-shadow .2s, background .25s, border-color .2s;
}
.dcard.wide { grid-column: 1 / -1; }
.dcard.tappable { cursor: pointer; user-select: none; }
.dcard.tappable:active { transform: scale(.985); }
.dcard.unknown { opacity: .82; }
/* Açık/aktif → renkli kart (FutureKNX accent paleti) */
.dcard.on { --acc: #2ba74b; border-color: transparent; color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--acc) 30%, transparent); }
.dcard.on.green  { --acc: #2ba74b; background: linear-gradient(150deg, #37bd5c, #2ba74b); }
.dcard.on.blue   { --acc: #036cb2; background: linear-gradient(150deg, #1a8fd6, #036cb2); }
.dcard.on.amber  { --acc: #e0891f; background: linear-gradient(150deg, #f6b053, #e0891f); }
.dcard.on.teal   { --acc: #0e9f90; background: linear-gradient(150deg, #1fc6b5, #0e9f90); }
.dcard.on.violet { --acc: #6a56e0; background: linear-gradient(150deg, #8f80f2, #6a56e0); }
/* Perde vb. buton feedback nabzı */
.dcard.pulse { animation: cardPulse .5s ease; }
@keyframes cardPulse { 0% { transform: scale(1); } 32% { transform: scale(1.025); box-shadow: 0 0 0 3px rgba(3,108,178,.4), var(--shadow-sm); } 100% { transform: scale(1); } }
/* Yükleniyor (ilk açılışta feedback beklerken): shimmer + ikon yerinde spinner. Perde hariç. */
.dcard.loading { overflow: hidden; }
.dcard.loading::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  background: linear-gradient(100deg, transparent 25%, rgba(3,108,178,.10) 50%, transparent 75%);
  background-size: 220% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 185% 0; } 100% { background-position: -70% 0; } }
.dcard.loading .dc-ico { position: relative; }
.dcard.loading .dc-ico svg { opacity: .18; }
.dcard.loading .dc-ico::after {
  content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(3,108,178,.18);
  border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; z-index: 3;
}

.dc-top { display: flex; align-items: flex-start; gap: 10px; }
.dc-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; transition: background .2s, color .2s; }
.dc-ico svg { width: 22px; height: 22px; }
.dcard.on .dc-ico { background: rgba(255,255,255,.22); color: #fff; }
.dc-top .spacer { flex: 1; }
.dc-name { font-size: 14.5px; font-weight: 700; line-height: 1.25; word-break: break-word; }
.dc-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.dcard.on .dc-sub { color: rgba(255,255,255,.85); }
.dc-body { margin-top: auto; }

/* Toggle switch */
.toggle { position: relative; width: 46px; height: 28px; flex: none; cursor: pointer; }
.toggle input { display: none; }
.toggle .tk { position: absolute; inset: 0; border-radius: 30px; background: #cfd8e3; transition: background .2s; }
.toggle .tk::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.22); transition: transform .2s; }
.toggle input:checked + .tk { background: var(--green); }
.toggle input:checked + .tk::after { transform: translateX(18px); }
.dcard.on .toggle input:checked + .tk { background: rgba(255,255,255,.9); }
.dcard.on .toggle input:checked + .tk::after { background: var(--acc); }

/* Büyüt (expand) butonu */
.dc-expand { width: 32px; height: 32px; border-radius: 10px; border: none; background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; transition: background .15s; }
.dc-expand svg { width: 16px; height: 16px; }
.dcard.on .dc-expand { background: rgba(255,255,255,.22); color: #fff; }
.dc-expand:hover { filter: brightness(.96); }
/* Kart üzerinde güç butonu (termostat) */
.dc-power { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; transition: background .15s, color .15s; }
.dc-power svg { width: 17px; height: 17px; }
.dc-power.on { background: var(--green); color: #fff; box-shadow: 0 4px 10px rgba(43,167,75,.35); }
.dcard.on .dc-power { background: rgba(255,255,255,.9); color: var(--acc); }
.dc-power:active { transform: scale(.92); }

.state-pill { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: var(--surface-2); color: var(--muted); }
.dcard.on .state-pill { background: rgba(255,255,255,.22); color: #fff; }

/* Dimmer satırı (kart içi) */
.dc-slider { display: flex; align-items: center; gap: 12px; }
.dc-slider .pct { font-size: 14px; font-weight: 800; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.slider { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 8px; border-radius: 30px; outline: none; cursor: pointer; margin: 0;
  background: linear-gradient(90deg, var(--green) 0%, var(--green) var(--dim,0%), var(--surface-2) var(--dim,0%)); }
.dcard.on .slider { background: linear-gradient(90deg, #fff 0%, #fff var(--dim,0%), rgba(255,255,255,.35) var(--dim,0%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: pointer; }
.slider::-moz-range-thumb { width: 20px; height: 20px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }

/* Perde/panjur satırı */
.dc-shutter { display: flex; align-items: center; gap: 8px; }
.sh-btn { width: 40px; height: 40px; border-radius: 12px; border: none; cursor: pointer; display: grid; place-items: center; background: var(--surface-2); color: var(--text); flex: none; transition: filter .15s, background .15s; }
.sh-btn svg { width: 18px; height: 18px; }
.sh-btn.stop { color: #e5484d; }
.dcard.on .sh-btn { background: rgba(255,255,255,.2); color: #fff; }
.dcard.on .sh-btn.stop { color: #ffd7d7; }
.sh-btn:active { transform: scale(.94); }

/* Termostat kart içi mini kontrol */
.dc-thermo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 6px; }
.step-btn { width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer; font-size: 20px; font-weight: 600; background: var(--surface-2); color: var(--text); display: grid; place-items: center; flex: none; }
.dcard.on .step-btn { background: rgba(255,255,255,.2); color: #fff; }
.step-val { font-size: 18px; font-weight: 800; min-width: 46px; text-align: center; }
.mini-modes { display: flex; gap: 6px; margin-left: auto; }
.mini-mode { padding: 8px 12px; border-radius: 11px; border: none; cursor: pointer; font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.mini-mode.heat.active { background: #ffe4cf; color: #d97a2b; }
.mini-mode.cool.active { background: #d6ecff; color: var(--blue); }
.dcard.on .mini-mode { background: rgba(255,255,255,.18); color: rgba(255,255,255,.9); }
.dcard.on .mini-mode.active { background: #fff; color: var(--text); }

/* ================= ODALAR (liste) ================= */
.room-list { display: flex; flex-direction: column; gap: 13px; }
.roomc { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s, box-shadow .2s; text-align: left; width: 100%; }
.roomc:active { transform: scale(.99); }
.roomc.active { background: linear-gradient(150deg, var(--blue-2), var(--blue)); border-color: transparent; color: #fff; box-shadow: 0 10px 24px rgba(3,108,178,.26); }
.roomc .rc-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.roomc.active .rc-ico { background: rgba(255,255,255,.22); color: #fff; }
.roomc .rc-ico svg { width: 24px; height: 24px; }
.rc-main { flex: 1; min-width: 0; }
.rc-name { font-size: 16px; font-weight: 800; }
.rc-meta { font-size: 12px; margin-top: 2px; color: var(--muted); }
.roomc.active .rc-meta { color: rgba(255,255,255,.85); }
.rc-chips { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.rc-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 20px; background: var(--surface-2); color: var(--muted); }
.roomc.active .rc-chip { background: rgba(255,255,255,.2); color: #fff; }
.rc-chip svg { width: 12px; height: 12px; }
.rc-arrow { color: var(--muted); flex: none; }
.roomc.active .rc-arrow { color: rgba(255,255,255,.8); }
.rc-arrow svg { width: 20px; height: 20px; }

/* Oda detayı */
.detail-head { display: flex; align-items: center; gap: 12px; }
.back-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; flex: none; }
.back-btn svg { width: 20px; height: 20px; }
.detail-head .ph-title { flex: 1; font-size: 22px; }
.pill-dark { display: inline-flex; align-items: center; gap: 7px; padding: 10px 15px; border-radius: 30px; border: none; background: #10202f; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; flex: none; }
.pill-dark svg { width: 16px; height: 16px; }
.pill-dark:active { transform: scale(.97); }

/* ================= ALARM PANELİ ================= */
.alarm-panel { max-width: 560px; }
.alarm-status { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); --am: #64748b; }
.alarm-status.arm { --am: #e5484d; } .alarm-status.disarm { --am: var(--green); } .alarm-status.sleep { --am: #6366f1; } .alarm-status.custom { --am: var(--amber); }
.alarm-status { border-color: color-mix(in srgb, var(--am) 40%, var(--border)); background: color-mix(in srgb, var(--am) 7%, var(--surface)); }
.alarm-badge { width: 54px; height: 54px; border-radius: 16px; flex: none; display: grid; place-items: center; color: #fff; background: var(--am); box-shadow: 0 6px 16px color-mix(in srgb, var(--am) 40%, transparent); }
.alarm-badge svg { width: 28px; height: 28px; }
.alarm-current-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.alarm-current-val { font-size: 21px; font-weight: 800; color: var(--am); margin-top: 2px; }
.alarm-hint { font-size: 12.5px; color: var(--muted); margin: 13px 2px 10px; }
.alarm-modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.alarm-mode { --am: #64748b; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 12px; border-radius: 15px; cursor: pointer; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; transition: transform .12s, border-color .15s, background .2s, color .2s; }
.alarm-mode.arm { --am: #e5484d; } .alarm-mode.disarm { --am: var(--green); } .alarm-mode.sleep { --am: #6366f1; } .alarm-mode.custom { --am: var(--amber); }
.alarm-mode svg { width: 25px; height: 25px; color: var(--am); }
.alarm-mode:active { transform: scale(.97); }
.alarm-mode.active { background: var(--am); border-color: var(--am); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--am) 38%, transparent); }
.alarm-mode.active svg { color: #fff; }

/* Alarm tetik bandı */
.alarm-banner { display: flex; align-items: center; gap: 14px; padding: 13px 18px; background: #e5484d; color: #fff; box-shadow: 0 4px 18px rgba(229,72,77,.5); position: relative; z-index: 40; animation: alarmPulse 1s ease-in-out infinite; }
.alarm-banner svg { width: 28px; height: 28px; flex: none; }
.alarm-banner-text { flex: 1; min-width: 0; }
.alarm-banner-title { font-size: 15px; font-weight: 900; letter-spacing: .04em; }
.alarm-banner-msg { font-size: 12.5px; opacity: .95; word-break: break-word; }
.alarm-banner-stop { flex: none; padding: 9px 18px; border-radius: 12px; border: none; background: #fff; color: #e5484d; font-size: 13px; font-weight: 800; cursor: pointer; }
@keyframes alarmPulse { 0%,100% { background: #e5484d; } 50% { background: #b7343a; } }

/* ================= AYARLAR ================= */
.settings-list { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; border-radius: 15px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.set-label { font-size: 14px; font-weight: 600; }
.set-value { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.set-action { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-radius: 15px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: background .15s; }
.set-action svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.set-action:hover { background: var(--surface-2); }
.set-action.danger { color: #e5484d; } .set-action.danger svg { color: #e5484d; }
.set-action.spinning svg { animation: spin 1s linear infinite; color: var(--blue); }
.lang-select { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; padding: 6px 8px; cursor: pointer; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #b9c4d2; }
.dot.connected { background: #eab308; }
.dot.authed { background: var(--green); box-shadow: 0 0 0 3px rgba(43,167,75,.18); }

/* ================= ALT NAVİGASYON ================= */
.bottomnav {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--nav-h);
  display: flex; background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 20;
}
.bn { flex: 1; border: none; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 10.5px; font-weight: 700; transition: color .15s; }
.bn svg { width: 23px; height: 23px; }
.bn.active { color: var(--blue); }
.bn span { white-space: nowrap; }

/* ================= DETAY MODALI (bottom sheet) ================= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,20,35,.45); z-index: 50; opacity: 1; transition: opacity .2s; }
.modal-backdrop.hidden { display: none; }
.detail-modal {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--surface);
  border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(16,42,67,.22); max-height: 88vh; overflow-y: auto;
  animation: sheetUp .28s cubic-bezier(.2,.8,.2,1);
}
.detail-modal.hidden { display: none; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grab { width: 42px; height: 5px; border-radius: 4px; background: #d7dee8; margin: 4px auto 14px; }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.sheet-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.sheet-ico svg { width: 27px; height: 27px; }
.sheet-title { font-size: 20px; font-weight: 800; }
.sheet-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.sheet-close { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--muted); font-size: 17px; cursor: pointer; flex: none; }
.sheet-sec { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 22px 0 12px; }
/* Büyük termostat kadranı */
.big-dial { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 6px 0 6px; }
.big-dial .dial-btn { width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--text); font-size: 28px; cursor: pointer; display: grid; place-items: center; }
.big-dial .dial-center { text-align: center; }
.big-dial .target { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.big-dial .target span { font-size: 26px; vertical-align: top; }
.big-dial .current { font-size: 13px; color: var(--muted); margin-top: 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { padding: 11px 15px; border-radius: 13px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 700; cursor: pointer; transition: .15s; }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 5px 14px rgba(3,108,178,.28); }
.chip-row.fan-row .chip.active { background: var(--green); border-color: var(--green); box-shadow: 0 5px 14px rgba(43,167,75,.28); }
/* Modal içi büyük slider / perde */
.big-slider { display: flex; align-items: center; gap: 16px; }
.big-slider .slider { height: 12px; }
.big-slider .pct { font-size: 22px; font-weight: 800; min-width: 62px; text-align: right; }
.big-shutter { display: flex; gap: 12px; }
.big-shutter .sh-btn { width: 60px; height: 56px; border-radius: 16px; }
.big-shutter .sh-btn svg { width: 24px; height: 24px; }
.modal-power { display: flex; gap: 12px; margin-top: 22px; }
.modal-power .mp { flex: 1; padding: 15px; border-radius: 15px; border: 1.5px solid var(--border); background: var(--surface); font-size: 15px; font-weight: 800; cursor: pointer; color: var(--text); }
.modal-power .mp.on.sel { background: var(--green); border-color: var(--green); color: #fff; }
.modal-power .mp.off.sel { background: #eef1f6; border-color: var(--border); color: var(--muted); }

/* ================= FEEDBACK PANELİ ================= */
.backdrop { position: fixed; inset: 0; background: rgba(10,20,35,.4); z-index: 60; }
.debug { position: fixed; top: 0; right: 0; width: min(420px, 92vw); height: 100%; background: #0f1622; color: #cbd5e1; z-index: 61; transform: translateX(100%); transition: transform .25s; display: flex; flex-direction: column; font-family: "SF Mono", Consolas, monospace; }
.debug.open { transform: none; }
.debug-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #1e2a3a; }
.debug-head .title { font-weight: 700; color: #fff; font-family: system-ui; }
.debug-head .rate { margin-left: auto; font-size: 12px; color: #7c8aa0; }
.debug-head .close { cursor: pointer; font-size: 18px; color: #7c8aa0; }
.logbox { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 12px; }
.logbox.rx { border-top: 1px solid #1e2a3a; }
.logbox .lbl { color: #5f6f85; text-transform: uppercase; font-size: 10px; letter-spacing: .08em; margin-bottom: 6px; font-family: system-ui; }
.logbox .line { padding: 2px 0; white-space: pre-wrap; word-break: break-all; }
.logbox .line.matched { color: #6ee7a8; }
.empty { text-align: center; color: #aab6c4; padding: 40px 20px; }
.empty svg { width: 34px; height: 34px; margin: 0 auto 10px; opacity: .5; }

/* ================= RESPONSIVE ================= */
/* Modal: masaüstünde ekranın ortasında yüzen bir kart */
@keyframes sheetPop { from { opacity: 0; transform: translate(-50%, 18px) scale(.98); } to { opacity: 1; transform: translateX(-50%); } }
@media (min-width: 560px) {
  .detail-modal { left: 50%; right: auto; transform: translateX(-50%); width: 440px; bottom: 24px; border-radius: 24px; max-height: 84vh; animation: sheetPop .24s ease; }
  .detail-modal.hidden { display: none; }
  .sheet-grab { display: none; }
}
/* Tablet ve üstü: geniş kartlar tüm satırı kaplamasın; akışkan çok sütun */
@media (min-width: 640px) {
  .content { padding: 22px 26px calc(var(--nav-h) + 26px); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 15px; }
  .dcard.wide { grid-column: auto; }
  .scene-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .room-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 15px; }
  .alarm-panel { max-width: none; }
  .alarm-modes { grid-template-columns: repeat(4, 1fr); }
}
/* Masaüstü: ortalanmış içerik kolonu + yatay alt navigasyon */
@media (min-width: 1000px) {
  .content { padding: 32px 40px calc(var(--nav-h) + 30px); }
  .view { max-width: 1260px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 16px; }
  .ph-title { font-size: 30px; }
  .bottomnav { justify-content: center; gap: 50px; }
  .bn { flex: none; width: 140px; flex-direction: row; gap: 9px; font-size: 13px; }
  .bn svg { width: 20px; height: 20px; }
}
@media (max-width: 360px) { .ph-title { font-size: 24px; } .bn span { font-size: 9.5px; } }
