:root {
  color-scheme: light;
  --ink: #102536;
  --muted: #6c7c87;
  --navy: #112f42;
  --teal: #1d746d;
  --teal-soft: #e2f2ef;
  --blue-soft: #e7f0f8;
  --orange: #d36f35;
  --orange-soft: #fff0e6;
  --red: #b84a4a;
  --red-soft: #fdeaea;
  --gold: #d5a448;
  --surface: #ffffff;
  --canvas: #f3f6f5;
  --line: #dce5e4;
  --shadow: 0 12px 30px rgba(17, 47, 66, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.login-screen { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #204c5d, var(--navy) 52%, #0a202d); }
.login-card { width: min(420px, 100%); padding: 38px; border-radius: 20px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.login-brand-mark { width: 54px; height: 54px; margin-bottom: 22px; display: grid; place-items: center; border-radius: 14px; background: var(--navy); color: #f4c366; font-family: Georgia, serif; font-size: 30px; }
.login-card h1 { margin: 5px 0 8px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.login-intro { margin: 0 0 25px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-card label { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.login-card input { height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.login-card button { width: 100%; height: 46px; margin-top: 20px; border: 0; border-radius: 10px; background: var(--teal); color: white; font-weight: 750; }
.login-card button:disabled { opacity: .6; cursor: wait; }
.login-error { margin: 13px 0 0; padding: 10px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 12px; }
.demo-login { margin: 17px 0 0; color: var(--muted); text-align: center; font-size: 11px; }
.user-name { color: #d8e8ed; font-size: 12px; }
.logout-button { height: 38px; padding: 0 12px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: transparent; color: white; font-size: 12px; }
.topbar { height: 84px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: white; box-shadow: 0 6px 22px rgba(4, 29, 43, .2); }
.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.45); border-radius: 12px; color: #f4c366; font-family: Georgia, serif; font-size: 27px; }
.brand h1 { margin: 1px 0 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.brand .eyebrow { color: #a9c0ca; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.app-switcher { display: flex; padding: 3px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(255,255,255,.07); }
.app-switcher button, .app-switcher a { padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: #c8dbe2; font-size: 11px; text-decoration: none; }
.app-switcher .active { background: white; color: var(--navy); }
.readonly-badge { padding: 7px 11px; border-radius: 999px; background: rgba(255,255,255,.1); color: #d8e8ed; font-size: 12px; }
.icon-button { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: transparent; color: white; font-size: 20px; }
.icon-button:disabled { opacity: .5; cursor: wait; }
main { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 64px; }
.hotel-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.hotel-controls { display: flex; align-items: center; gap: 12px; }
.schedule-button { height: 51px; padding: 0 15px; border: 1px solid #c8a05a; border-radius: 12px; background: #fff8e9; color: #77551d; font-size: 12px; font-weight: 750; }
.schedule-button span { margin-right: 5px; font-size: 17px; }
.master-switch { min-width: 190px; height: 51px; padding: 0 12px 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 3px 12px rgba(17,47,66,.04); cursor: pointer; }
.master-switch > span { display: flex; flex-direction: column; }
.master-switch strong { font-size: 12px; }
.master-switch small { margin-top: 2px; color: var(--teal); font-size: 10px; font-weight: 800; }
.master-switch input, .card-switch input { position: absolute; opacity: 0; pointer-events: none; }
.master-switch i, .card-switch i { position: relative; flex: 0 0 auto; width: 38px; height: 22px; border-radius: 999px; background: #b7c2c4; transition: .18s ease; }
.master-switch i::after, .card-switch i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .18s ease; }
.master-switch input:checked + i, .card-switch input:checked + i { background: var(--teal); }
.master-switch input:checked + i::after, .card-switch input:checked + i::after { transform: translateX(16px); }
.hotel-head h2, .section-title h2 { margin: 4px 0; font-family: Georgia, serif; font-weight: 500; }
.hotel-head h2 { font-size: clamp(25px, 3vw, 36px); }
.muted { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.hotel-switch { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #e9efee; }
.hotel-switch button { border: 0; padding: 9px 14px; border-radius: 8px; background: transparent; color: var(--muted); }
.hotel-switch button.active { background: white; color: var(--ink); box-shadow: 0 2px 8px rgba(17,47,66,.08); }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.summary article { display: flex; align-items: center; gap: 13px; min-height: 86px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 6px 18px rgba(17,47,66,.04); }
.summary article div { display: flex; flex-direction: column; }
.summary strong { font-size: 25px; line-height: 1; }
.summary article div span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.summary-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; }
.summary-icon.normal { background: var(--teal-soft); color: var(--teal); }
.summary-icon.window { background: var(--orange-soft); color: var(--orange); }
.summary-icon.heating { background: var(--blue-soft); color: #3e7299; }
.summary-icon.battery { background: var(--red-soft); color: var(--red); }
.toolbar { margin: 28px 0 26px; display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.search-wrap { width: min(380px, 100%); height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.search-wrap input { flex: 1; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.filters { display: flex; gap: 7px; flex-wrap: wrap; }
.filters button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); font-size: 12px; }
.filters button.active { background: var(--navy); color: white; border-color: var(--navy); }
.notice { margin-bottom: 20px; padding: 13px 16px; border-radius: 10px; background: #fff5d9; border: 1px solid #ead28f; color: #725813; font-size: 13px; }
.section-title { margin-bottom: 14px; display: flex; align-items: end; justify-content: space-between; }
.section-title h2 { font-size: 25px; }
.section-title > span { color: var(--muted); font-size: 12px; }
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.device-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.card-accent { height: 4px; background: var(--teal); }
.device-card.window-open .card-accent { background: var(--orange); }
.device-card.low-battery .card-accent { background: var(--red); }
.device-card header { padding: 18px 18px 10px; display: flex; justify-content: space-between; gap: 12px; }
.card-head-actions { display: flex; align-items: start; gap: 6px; }
.room-plan { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--muted); font-size: 10px; font-weight: 700; }
.room-plan:hover { color: var(--teal); border-color: #9fc8c3; }
.device-card h3 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.category { margin: 0; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.status-pill { align-self: start; padding: 6px 9px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 11px; font-weight: 700; }
.window-open .status-pill { background: var(--orange-soft); color: var(--orange); }
.low-battery:not(.window-open) .status-pill { background: var(--red-soft); color: var(--red); }
.temperature-row { padding: 7px 18px 18px; display: flex; justify-content: space-between; align-items: end; }
.temperature { display: flex; flex-direction: column; }
.temperature strong { font-size: 35px; letter-spacing: -.03em; }
.temperature span, .setpoint span { color: var(--muted); font-size: 11px; }
.setpoint { display: flex; flex-direction: column; text-align: right; }
.setpoint strong { margin-top: 3px; font-size: 18px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafcfc; }
.metrics div { padding: 13px 10px; display: flex; flex-direction: column; text-align: center; }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics span { color: var(--muted); font-size: 10px; }
.metrics strong { margin-top: 5px; font-size: 13px; }
.battery-low { color: var(--red); }
.device-card footer { min-height: 54px; padding: 7px 13px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #8b969b; }
.online-dot.online { background: #45a37b; box-shadow: 0 0 0 3px #e4f4ec; }
.window-stop { margin-left: auto; padding: 7px 9px; border: 1px solid #edb58f; border-radius: 8px; background: var(--orange-soft); color: #a75020; font-size: 10px; font-weight: 700; }
.card-switch { margin-left: auto; display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 10px; font-weight: 700; cursor: pointer; }
.card-switch i { width: 32px; height: 18px; }
.card-switch i::after { width: 12px; height: 12px; }
.card-switch input:checked + i::after { transform: translateX(14px); }
.device-card.automation-off { opacity: .68; }
.device-card.automation-off .card-accent { background: #98a4a8; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 24px 80px rgba(5,29,42,.3); }
dialog::backdrop { background: rgba(8,29,42,.55); backdrop-filter: blur(3px); }
.schedule-form { padding: 25px; }
.schedule-form > header { display: flex; justify-content: space-between; align-items: start; }
.schedule-form h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); font-size: 23px; line-height: 1; }
.dialog-note { margin: 10px 0 22px; color: var(--muted); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 650; }
.field input, .field select { height: 40px; min-width: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.field.full { width: min(280px, 100%); margin-bottom: 16px; }
.phase-list { display: flex; flex-direction: column; gap: 9px; }
.phase-row { display: grid; grid-template-columns: 110px 1fr 1fr 1.2fr; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbfa; }
.phase-row > strong { align-self: center; font-size: 13px; }
.number-field { position: relative; }
.number-field input { width: 100%; padding-right: 36px; }
.number-field span { position: absolute; right: 11px; top: 11px; color: var(--muted); font-size: 12px; }
.schedule-basics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.inherit-plan { display: flex; align-items: center; gap: 8px; margin-top: 17px; font-size: 12px; font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.dialog-actions button { padding: 10px 15px; border-radius: 9px; font-weight: 700; }
.dialog-actions .secondary { border: 1px solid var(--line); background: white; color: var(--muted); }
.dialog-actions .primary { border: 1px solid var(--teal); background: var(--teal); color: white; }
.simulation-note { margin: 12px 0 0; text-align: right; color: var(--muted); font-size: 10px; }
.users-panel { padding: 25px; }
.users-panel > header { display: flex; align-items: start; justify-content: space-between; }
.users-panel h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.user-row small { display: block; margin-top: 3px; color: var(--muted); }
.user-row button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font-size: 11px; }
.user-row.inactive { opacity: .55; }
.user-form { margin-top: 22px; padding-top: 19px; border-top: 1px solid var(--line); }
.user-form h3 { margin: 0 0 13px; }
.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hotel-rights { margin-top: 14px; display: flex; align-items: center; gap: 16px; font-size: 12px; }
.hotel-rights label { display: flex; align-items: center; gap: 5px; }
@media (max-width: 860px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-wrap { width: 100%; max-width: none; }
}
@media (max-width: 560px) {
  .topbar { height: 74px; padding: 0 16px; }
  .brand-mark { width: 39px; height: 39px; }
  .brand h1 { font-size: 21px; }
  .readonly-badge { display: none; }
  .app-switcher { position: fixed; z-index: 5; left: 12px; right: 12px; bottom: 12px; justify-content: center; background: var(--navy); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
  .user-name { display: none; }
  .logout-button { padding: 0 8px; }
  .login-card { padding: 28px 22px; }
  main { width: min(100% - 24px, 1500px); padding-top: 24px; }
  .hotel-head { align-items: stretch; flex-direction: column; }
  .hotel-controls { align-items: stretch; flex-direction: column; }
  .schedule-button { width: 100%; }
  .hotel-switch { align-self: stretch; }
  .hotel-switch button { flex: 1; }
  .summary { grid-template-columns: 1fr 1fr; gap: 9px; }
  .summary article { padding: 13px; min-height: 76px; }
  .summary-icon { display: none; }
  .summary strong { font-size: 22px; }
  .device-grid { grid-template-columns: 1fr; }
  .phase-row { grid-template-columns: 1fr 1fr; }
  .phase-row > strong { grid-column: 1 / -1; }
  .schedule-basics { grid-template-columns: 1fr; }
  .user-form-grid { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr auto; }
  .user-row > span { grid-column: 1 / 2; }
}

