:root {
  --ink: #17302e;
  --muted: #687876;
  --paper: #f6f3ec;
  --card: #fffdf8;
  --accent: #1f6259;
  --accent-dark: #173f3a;
  --line: #dce3df;
  --danger: #b33a2f;
  --shadow: 0 12px 35px rgba(25, 49, 46, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.login-page {
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.14), transparent 30%),
    linear-gradient(145deg, #234d47, #102d2a 70%);
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-shell { width: min(100%, 470px); }
.login-card { background: var(--card); border-radius: 28px; padding: 34px 26px; box-shadow: 0 30px 80px rgba(0,0,0,.25); text-align: center; }
.brand-mark { width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 20px; display: grid; place-items: center; font-size: 32px; color: white; background: var(--accent); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 800; color: var(--accent); margin: 0 0 8px; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1; }
.intro { color: var(--muted); line-height: 1.55; margin: 18px auto 24px; }
.pin-form, .stack-form { display: grid; gap: 14px; text-align: left; }
.stack-form label { display: grid; gap: 7px; font-size: .86rem; font-weight: 750; }
.pin-input, .stack-form input { width: 100%; min-height: 56px; border: 1.5px solid var(--line); border-radius: 15px; padding: 0 16px; background: white; color: var(--ink); outline: none; }
.pin-input { text-align: center; letter-spacing: .18em; }
.pin-input:focus, .stack-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,98,89,.12); }
.primary-button { min-height: 56px; border: 0; border-radius: 15px; display: grid; place-items: center; padding: 0 20px; background: var(--accent); color: white; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button:hover { background: var(--accent-dark); }
.privacy-note { margin: 22px 0 0; font-size: .78rem; color: var(--muted); }
.notice { padding: 14px; border-radius: 14px; background: #e9efec; margin: 16px 0; line-height: 1.45; }
.notice.error, .callout.danger { background: #fae6e3; color: #76241d; }
.notice.success { background: #e2f2e9; color: #185438; }

.accent-giuseppe { --accent: #7b4d2d; --accent-dark: #58341e; }
.topbar { height: 70px; position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 44px 1fr auto; gap: 11px; align-items: center; padding: 8px max(16px, env(safe-area-inset-left)); background: rgba(255,253,248,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.topbar strong, .topbar small { display: block; }
.topbar small { color: var(--muted); margin-top: 2px; font-size: .74rem; }
.home-link { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: white; background: var(--accent); text-decoration: none; font-size: 22px; }
.logout-link { color: var(--muted); font-size: .83rem; font-weight: 700; text-decoration: none; padding: 12px 4px; }
.manual-shell { width: min(100% - 28px, 760px); margin: 0 auto; padding-bottom: 110px; }
.hero { padding: 40px 2px 22px; }
.hero h1 { font-size: clamp(2.5rem, 11vw, 4.3rem); }
.hero > p:not(.eyebrow) { color: var(--muted); margin: 12px 0 24px; }
.search-box { min-height: 58px; display: grid; grid-template-columns: 30px 1fr; align-items: center; background: white; border: 1px solid var(--line); border-radius: 18px; padding: 0 16px; box-shadow: 0 7px 25px rgba(25,49,46,.06); }
.search-box span { font-size: 24px; color: var(--accent); }
.search-box input { width: 100%; height: 54px; border: 0; outline: none; background: transparent; color: var(--ink); }
.arrival-card {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #d8e2dd;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(25,49,46,.08);
}
.arrival-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 17px;
  color: var(--ink);
  background: linear-gradient(135deg, #edf5f1, #f8faf8);
  border-bottom: 1px solid #e1e8e4;
}
.arrival-title span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--accent);
  font-size: 20px;
}
.arrival-title strong { font-size: 1.05rem; }
.maps-link {
  display: grid;
  gap: 10px;
  padding: 16px 17px 17px;
  color: var(--ink);
  text-decoration: none;
}
.maps-link span {
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.4;
}
.maps-link strong {
  width: fit-content;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 12px;
  color: white;
  background: var(--accent);
  font-size: .82rem;
  box-shadow: 0 5px 14px rgba(31,98,89,.18);
}
.maps-link:active strong { background: var(--accent-dark); }
.access-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  background: #f3f6f4;
}
.access-details > span {
  min-width: 0;
  padding: 14px 17px 16px;
}
.access-details > span + span { border-left: 1px solid var(--line); }
.access-details small,
.access-details strong { display: block; }
.access-details small {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.access-details strong {
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1.2;
}
.access-details > span:first-child strong {
  color: var(--accent);
  font-size: 1.35rem;
  letter-spacing: .09em;
}
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.topic-card { min-height: 138px; position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 1px solid var(--line); border-radius: 20px; padding: 18px; background: var(--card); color: var(--ink); cursor: pointer; box-shadow: 0 5px 18px rgba(25,49,46,.045); }
.topic-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.topic-card[hidden] { display: none; }
.topic-card.urgent { grid-column: 1 / -1; min-height: 96px; flex-direction: row; align-items: center; gap: 14px; color: #721f18; border-color: #efc2bc; background: #fff2f0; }
.topic-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); font-weight: 900; font-size: 21px; margin-bottom: 17px; }
.urgent .topic-icon { background: #f5d4cf; color: var(--danger); margin: 0; }
.topic-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.topic-card strong { display: block; font-size: 1rem; }
.topic-card small { display: block; color: var(--muted); line-height: 1.35; margin-top: 5px; }
.arrow { position: absolute; right: 14px; bottom: 12px; font-size: 24px; color: #9ba7a4; }
.urgent .arrow { top: 50%; bottom: auto; transform: translateY(-50%); }
.manual-footer { padding: 28px 0; color: var(--muted); font-size: .75rem; text-align: center; }

.guide-dialog { width: min(calc(100% - 20px), 680px); max-height: min(88vh, 850px); padding: 0; border: 0; border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.guide-dialog::backdrop { background: rgba(9,28,26,.68); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.dialog-head .topic-icon { margin: 0; }
.close-dialog { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #edf1ef; color: var(--ink); font-size: 28px; cursor: pointer; }
.dialog-body { padding: 25px 22px 36px; line-height: 1.6; }
.dialog-body h2 { margin: 0 0 12px; font: 700 2rem/1.1 Georgia, serif; }
.dialog-body h3 { margin-top: 28px; }
.dialog-body ol { padding-left: 24px; }
.dialog-body li { margin: 11px 0; }
.lead { font-size: 1.08rem; color: var(--muted); }
.tab-help { margin: -10px 0 15px; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.water-tabs { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: white; }
.water-tab-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; background: #edf1ef; }
.water-tab-list button { min-height: 58px; display: grid; place-items: center; align-content: center; gap: 2px; padding: 7px 5px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); cursor: pointer; }
.water-tab-list button span { font-size: .82rem; font-weight: 850; text-transform: uppercase; }
.water-tab-list button small { font-size: .62rem; font-weight: 750; }
.water-tab-list button[aria-selected="true"] { color: white; background: var(--accent); box-shadow: 0 5px 14px rgba(25,49,46,.18); }
.water-tab-panel { padding: 21px 17px 24px; }
.water-tab-panel[hidden] { display: none; }
.water-tab-panel > h3:first-child { margin-top: 0; }
.heating-status { display: grid; gap: 5px; margin: 4px 0 24px; padding: 18px; border-radius: 17px; }
.heating-status small { font-size: .72rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; opacity: .72; }
.heating-status strong { font-size: 1.08rem; }
.heating-status span { font-size: .88rem; line-height: 1.45; }
.heating-status.active { color: #18506a; background: #e1f1f7; border: 1px solid #b9dbe8; }
.heating-status.inactive { color: #60450b; background: #fff0c9; border: 1px solid #ead697; }
.hot-water-status { display: grid; gap: 5px; margin: 4px 0 24px; padding: 18px; border-radius: 17px; }
.hot-water-status small { font-size: .72rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; opacity: .72; }
.hot-water-status strong { font-size: 1.08rem; }
.hot-water-status span { font-size: .88rem; line-height: 1.45; }
.hot-water-status.active { color: #164d37; background: #dff2e8; border: 1px solid #b9dfca; }
.hot-water-status.inactive { color: #60450b; background: #fff0c9; border: 1px solid #ead697; }
.callout { padding: 16px; border-radius: 15px; background: #e7f1ee; margin: 20px 0; }
.callout.warning { background: #fff0c9; color: #60450b; }
.phone-link { display: inline-flex; min-height: 48px; align-items: center; margin: 12px 0 7px; padding: 0 18px; border-radius: 13px; background: var(--danger); color: white; font-size: 1.08rem; font-weight: 850; text-decoration: none; }
.contact-list { display: grid; gap: 11px; margin: 14px 0 24px; }
.contact-card { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: white; color: var(--ink); text-decoration: none; }
.contact-card strong, .contact-card small { display: block; }
.contact-card strong { text-transform: uppercase; font-size: .75rem; letter-spacing: .06em; color: var(--muted); }
.contact-card small { margin-top: 3px; font-size: .98rem; color: var(--ink); }
.call-action { flex: 0 0 auto; padding: 9px 12px; border-radius: 10px; background: var(--accent); color: white; font-size: .78rem; font-weight: 800; }.placeholder { padding: 14px; border: 1px dashed #c7b990; border-radius: 13px; background: #fffbec; color: #6d613f; font-size: .88rem; }
.key-code-note p { margin: 5px 0 0; }
.owner-call { margin-bottom: 0; background: var(--accent); font-size: .9rem; }
.step-photos { display: grid; gap: 14px; margin-top: 22px; }
.step-photos figure { position: relative; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.step-photos img { display: block; width: 100%; max-height: 520px; object-fit: cover; }
.step-photos figcaption { padding: 10px 12px 12px; color: var(--ink); font-size: .8rem; font-weight: 700; text-align: center; }
.step-badge { position: absolute; top: 10px; left: 10px; width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid white; border-radius: 50%; background: var(--accent); color: white; font-weight: 900; box-shadow: 0 3px 10px rgba(0,0,0,.22); }
.instruction-photo { margin: 20px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.instruction-photo img { display: block; width: 100%; max-height: 580px; object-fit: cover; }
.instruction-photo figcaption { padding: 10px 12px 12px; color: var(--muted); font-size: .76rem; text-align: center; }
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.photo-grid figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: white; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.photo-grid figcaption { padding: 9px 10px 11px; color: var(--muted); font-size: .74rem; line-height: 1.35; }
@media (max-width: 430px) {
  .photo-grid { grid-template-columns: 1fr; }
  .photo-grid img { aspect-ratio: 4 / 3; }
}
.electric-panel { margin: 20px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px 16px 0 0; background: white; }
.electric-panel img { display: block; width: 100%; height: auto; }
.electric-panel figcaption { padding: 9px 12px; color: var(--muted); font-size: .74rem; text-align: center; }
.switch-labels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: hidden; margin-bottom: 22px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 16px 16px; background: #f3f6f4; }
.switch-labels span { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 3px 12px; text-align: center; }
.switch-labels span + span { border-left: 1px solid var(--line); }
.switch-labels b { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: .72rem; }
.switch-labels strong { font-size: clamp(.52rem, 2.2vw, .7rem); line-height: 1.15; text-transform: uppercase; overflow-wrap: anywhere; }
@media (max-width: 390px) {
  .switch-labels { grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-radius: 14px; margin-top: 10px; }
  .switch-labels span { border: 0 !important; border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line) !important; }
}
.interactive-checklist { padding: 0; list-style: none; }
.interactive-checklist label { min-height: 54px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.interactive-checklist input { width: 23px; height: 23px; accent-color: var(--accent); }
.bottom-nav { position: fixed; z-index: 15; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 28px), 430px); height: 66px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid rgba(255,255,255,.15); border-radius: 21px; padding: 5px; background: rgba(19,52,48,.96); box-shadow: 0 12px 40px rgba(0,0,0,.25); backdrop-filter: blur(12px); }
.bottom-nav a, .bottom-nav button { border: 0; background: transparent; color: white; text-decoration: none; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; font-size: .69rem; cursor: pointer; }
.bottom-nav span { font-size: 20px; font-weight: 800; }

@media (min-width: 640px) {
.card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topic-card.urgent { grid-column: 1 / -1; }
  .login-card { padding: 44px; }
}

@media (max-width: 360px) {
.card-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 105px; }
}

@media (prefers-reduced-motion: no-preference) {
  .topic-card, .primary-button { transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
}

/* Temperature Netatmo */
.residence-temperatures { position: relative; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); background: #e7efec; }
.residence-temperatures > span { min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 11px 17px 18px; }
.residence-temperatures > span + span { border-left: 1px solid var(--line); }
.residence-temperatures small { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.residence-temperatures strong { color: var(--accent); font-size: 1.08rem; white-space: nowrap; }
.residence-temperatures em { position: absolute; right: 17px; bottom: 4px; color: var(--muted); font-size: .59rem; font-style: normal; }
.temperature-mini { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 2px 0 18px; }
.temperature-mini > span { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.temperature-mini small { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.temperature-mini strong { color: var(--ink); font-size: 1.25rem; }

/* Inventario */
.inventory-empty { display: grid; justify-items: center; gap: 5px; padding: 30px 18px; border: 1px dashed #c8d2cd; border-radius: 17px; background: #f7f8f6; color: var(--muted); text-align: center; }
.inventory-empty > span { font-size: 2rem; color: var(--accent); }
.inventory-empty p { margin: 0; font-size: .85rem; }
.inventory-search { min-height: 52px; display: grid; grid-template-columns: 28px 1fr; align-items: center; margin: 18px 0 12px; padding: 0 14px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.inventory-search > span { color: var(--accent); font-size: 21px; }
.inventory-search input { width: 100%; height: 50px; border: 0; outline: 0; background: transparent; }
.inventory-filters { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 14px; scrollbar-width: none; }
.inventory-filters::-webkit-scrollbar { display: none; }
.inventory-filters button { flex: 0 0 auto; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); font-size: .75rem; font-weight: 750; cursor: pointer; }
.inventory-filters button.active { border-color: var(--accent); background: var(--accent); color: white; }
.inventory-list { display: grid; gap: 13px; }
.inventory-item { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: white; }
.inventory-item[hidden] { display: none; }
.inventory-item img { display: block; width: 100%; max-height: 390px; object-fit: cover; }
.inventory-item > div { padding: 15px 16px 17px; }
.inventory-item small { color: var(--accent); font-size: .68rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.inventory-item h3 { margin: 3px 0 8px; }
.inventory-item p { margin: 4px 0; font-size: .88rem; }
.inventory-note { color: var(--muted); }
.inventory-no-results { padding: 20px; color: var(--muted); text-align: center; }
.home-inventory-results { display: grid; gap: 8px; margin-top: 10px; }
.home-inventory-results[hidden] { display: none; }
.home-inventory-results button { min-height: 64px; display: grid; grid-template-columns: 52px 1fr 20px; align-items: center; gap: 11px; padding: 7px 12px 7px 7px; border: 1px solid var(--line); border-radius: 15px; background: white; color: var(--ink); text-align: left; box-shadow: 0 5px 16px rgba(25,49,46,.05); cursor: pointer; }
.home-inventory-results button[hidden] { display: none; }
.home-inventory-results img { width: 52px; height: 52px; border-radius: 11px; object-fit: cover; }
.home-inventory-results button:not(:has(img)) { grid-template-columns: 1fr 20px; padding-left: 14px; }
.home-inventory-results span, .home-inventory-results strong, .home-inventory-results small { display: block; min-width: 0; }
.home-inventory-results small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.home-inventory-results b { color: var(--accent); font-size: 1.35rem; }

