:root {
  --bg: #F1F6F9; --card: #fff; --ink: #142730; --muted: #5a6b75; --line: #dbe6ec;
  --accent: #146C94; --accent-2: #e2f0f6; --warn: #b5651d; --warn-bg: #fbf0e4; --err: #b3261e; --err-bg: #fbe9e7;
  --ok: #2e7d4f; --heat: #d2552d; --water: #2a7ab0; --power: #7a5ec2;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2 { font-family: "Gloock", Georgia, serif; font-weight: 400; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; } .grow { flex: 1; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }

header.top { background: #0E3B52; color: #fff; }
header.top .brand { font-family: "Gloock", Georgia, serif; font-weight: 400 !important; font-size: 1.25rem !important; }
header.top .wrap { display: flex; align-items: center; gap: 1rem; padding-top: .8rem; padding-bottom: .8rem; flex-wrap: wrap; }
header.top .brand { font-weight: 700; font-size: 1.05rem; color: #fff; text-decoration: none; }
header.top nav { display: flex; gap: .25rem; flex-wrap: wrap; }
header.top nav a { color: #cfd6d2; text-decoration: none; padding: .35rem .7rem; border-radius: 8px; }
header.top nav a.on, header.top nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
header.top .user { margin-left: auto; font-size: .9rem; color: #cfd6d2; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; border: 1px solid var(--line); }
.card.flat { box-shadow: none; }
.card h3 { display: flex; align-items: center; gap: .5rem; }
.stack > * + * { margin-top: 1rem; }

button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .5rem .9rem; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
button:hover, .btn:hover { border-color: #c8c3ba; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--err); }
button.sm { padding: .3rem .6rem; font-size: .85rem; border-radius: 8px; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea { font: inherit; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); border-color: var(--accent); }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.field { margin-bottom: .75rem; }
.form-grid { display: grid; gap: .25rem 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: .95rem; }
.check input { width: auto; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eee; color: #444; white-space: nowrap; }
.badge.ok, .badge.active { background: #e3f3ea; color: var(--ok); }
.badge.confirmed { background: var(--accent-2); color: var(--accent); }
.badge.pending, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.cancelled, .badge.error { background: var(--err-bg); color: var(--err); }
.badge.completed { background: #eceae6; color: #555; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; background: #bbb; }
.dot.ok { background: var(--ok); } .dot.error { background: var(--err); } .dot.unknown { background: #bbb; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.table-wrap { overflow-x: auto; }

.msg { padding: .7rem .9rem; border-radius: 10px; margin: .5rem 0; }
.msg.err { background: var(--err-bg); color: var(--err); } .msg.ok { background: #e3f3ea; color: var(--ok); } .msg.info { background: var(--accent-2); color: var(--accent); }
#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 99; }
#toast .msg { box-shadow: var(--shadow); }

/* Eszköz csempék */
.dev { display: flex; flex-direction: column; gap: .6rem; }
.dev .head { display: flex; align-items: center; gap: .5rem; }
.dev .name { font-weight: 600; }
.dev .big { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.dev .big small { font-size: .95rem; font-weight: 500; color: var(--muted); }
.dev .meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.dev.k-heat_pump .big { color: var(--heat); } .dev.k-jacuzzi .big { color: var(--water); } .dev.k-energy_meter .big { color: var(--power); }
.sp { display: flex; align-items: center; gap: .4rem; }
.sp button { width: 2.2rem; justify-content: center; padding: .35rem 0; font-weight: 700; }
.sp .val { min-width: 4.5rem; text-align: center; font-weight: 600; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #ccc; border-radius: 26px; transition: .2s; cursor: pointer; }
.switch span:before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span:before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { border: 0; background: none; border-bottom: 2px solid transparent; border-radius: 0; padding: .6rem .9rem; color: var(--muted); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.prop-band { height: 6px; border-radius: 6px 6px 0 0; margin: -1.1rem -1.1rem .9rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .2rem .9rem; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

.chart { width: 100%; height: 220px; display: block; }
.chart text { font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: .8rem; height: .2rem; border-radius: 2px; vertical-align: middle; margin-right: .3rem; }

.log { font-size: .85rem; max-height: 360px; overflow: auto; }
.log div { padding: .35rem 0; border-bottom: 1px dashed var(--line); display: flex; gap: .6rem; }
.log time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log .warn { color: var(--warn); } .log .error { color: var(--err); }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(720px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,25,22,.45); }
dialog .dlg-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
dialog .dlg-body { padding: 1.2rem; max-height: 70vh; overflow: auto; }
dialog .dlg-foot { padding: .9rem 1.2rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; }

/* Loxone böngésző */
.lox-list { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.lox-item { padding: .5rem .7rem; border-bottom: 1px solid var(--line); font-size: .88rem; }
.lox-item:last-child { border-bottom: 0; }
.lox-item .t { font-size: .75rem; color: var(--muted); }
.lox-item .states { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.lox-item .states button { font-size: .78rem; padding: .15rem .45rem; border-radius: 6px; }
.addr-field { display: flex; gap: .4rem; }
.addr-field input { font-family: ui-monospace, monospace; font-size: .8rem; }
code { font-family: ui-monospace, monospace; font-size: .85em; background: #f0eee9; padding: .05rem .3rem; border-radius: 4px; }

/* Foglalási oldal */
.hero { background: linear-gradient(135deg, #24433b, #2f6f62); color: #fff; padding: 2.5rem 0 2rem; }
.hero p { color: #d5e5df; max-width: 46rem; }
.prop-card .img { height: 150px; border-radius: 10px; margin-bottom: .8rem; position: relative; overflow: hidden; }
.prop-card .img span { position: absolute; left: .8rem; bottom: .6rem; color: #fff; font-weight: 700; font-size: 1.2rem; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.price { font-size: 1.3rem; font-weight: 700; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; font-size: .85rem; }
.cal .h { text-align: center; color: var(--muted); font-size: .75rem; padding: .2rem 0; }
.cal .d { text-align: center; padding: .45rem 0; border-radius: 8px; cursor: pointer; background: #fff; border: 1px solid var(--line); user-select: none; }
.cal .d.x { background: #eee; color: #aaa; text-decoration: line-through; cursor: not-allowed; border-color: #eee; }
.cal .d.past { color: #bbb; cursor: not-allowed; background: transparent; border-color: transparent; }
.cal .d.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal .d.in { background: var(--accent-2); border-color: var(--accent-2); }
.cal .d.empty { visibility: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }

.center-box { max-width: 420px; margin: 8vh auto; }
.hidden { display: none !important; }

@media (max-width: 640px) {
  .wrap { padding: .9rem; }
  h1 { font-size: 1.35rem; }
  .dev .big { font-size: 1.7rem; }
  header.top .user { margin-left: 0; width: 100%; }
}

/* Fotókezelő */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.img-grid figure { margin: 0; background: #f4f6f3; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.img-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.img-grid figcaption { display: flex; gap: .3rem; align-items: center; justify-content: space-between; padding: .35rem .4rem; }
/* Vendégoldal fejléckép */
.guest-hero { height: 220px; border-radius: var(--radius); background: #0E3B52 center/cover; position: relative; overflow: hidden; margin-bottom: 1rem; }
.guest-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(8,32,46,.75)); }
.guest-hero .t { position: absolute; z-index: 1; left: 1.2rem; bottom: 1rem; right: 1.2rem; color: #fff; }
.guest-hero h1 { margin: 0; font-size: 2rem; }
.cred { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: 1rem; }
.cred dt { color: var(--muted); } .cred dd { margin: 0; font-weight: 600; }
.cred code { font-size: 1.05rem; }

/* Nyaraló szerkesztő */
.pe-head { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: .8rem; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: .4rem 0; }
.pe-tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.pe-tabs button { border-radius: 999px; padding: .35rem .85rem; font-size: .9rem; }
.pe-tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.am-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .35rem 1rem; margin-bottom: 1rem; }
.sec { margin-bottom: 1rem; background: #f7f9f6; }
.season-tbl td { padding: .3rem; } .season-tbl input { padding: .35rem .5rem; }
.btn.sm { padding: .3rem .6rem; font-size: .85rem; border-radius: 8px; }
