:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --border: #d8dee6;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #b91c1c;
    --success: #047857;
    --chip: #eef2ff;
    --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px; line-height: 1.5;
}

.site-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
}
.site-header .brand {
    font-weight: 600; color: var(--text); text-decoration: none;
    font-size: 1.05rem;
}
.site-header .header-right { display: flex; align-items: center; gap: 1rem; }
.site-header .user-chip {
    background: var(--chip); padding: 0.25rem 0.6rem; border-radius: 999px;
    font-size: 0.85rem; color: var(--text);
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.site-header .user-chip button.linkish {
    background: none; border: none; color: var(--primary); cursor: pointer; padding: 0;
    font-size: 0.8rem; text-decoration: underline;
}
.site-header .lang-switch select {
    padding: 0.3rem 0.5rem; border: 1px solid var(--border); border-radius: 6px;
    background: var(--panel);
}

.container {
    max-width: 820px; margin: 2rem auto; padding: 0 1.25rem;
}

h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
.lede { color: var(--muted); margin-top: 0; }

.messages { list-style: none; padding: 0 1.25rem; max-width: 820px; margin: 1rem auto 0; }
.msg {
    padding: 0.6rem 0.9rem; border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: #eff6ff; border: 1px solid #bfdbfe;
}
.msg.msg-success { background: #ecfdf5; border-color: #a7f3d0; color: var(--success); }
.msg.msg-error, .msg.msg-warning { background: #fef2f2; border-color: #fecaca; color: var(--danger); }

.welcome, .success {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 2rem; box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.name-form label { display: block; font-weight: 500; margin: 0.75rem 0 0.25rem; }
.name-form input {
    width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border);
    border-radius: 6px; font-size: 1rem;
}

.button-row { display: flex; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
button.primary, a.primary {
    background: var(--primary); color: #fff; border: none; padding: 0.6rem 1.2rem;
    border-radius: 6px; font-size: 0.95rem; cursor: pointer; text-decoration: none;
    display: inline-block;
}
button.primary:hover, a.primary:hover { background: var(--primary-hover); }
a.secondary, button.secondary {
    background: transparent; color: var(--primary);
    border: 1px solid var(--border); padding: 0.55rem 1.1rem;
    border-radius: 6px; text-decoration: none; display: inline-block;
}

.big-form fieldset {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem 1.25rem 1.25rem;
    margin-bottom: 1rem;
}
.big-form legend {
    padding: 0 0.35rem; font-weight: 600; color: var(--text);
}

.field { margin-bottom: 0.9rem; }
.field label { display: block; font-weight: 500; margin-bottom: 0.25rem; font-size: 0.95rem; }
.field.required label::after { /* marker rendered inline via template */ }
.field input[type="text"], .field input[type="number"], .field input[type="email"],
.field input:not([type]),
.field textarea, .field select {
    width: 100%; padding: 0.5rem 0.65rem; border: 1px solid var(--border);
    border-radius: 6px; font: inherit; background: #fff;
}
.field textarea { min-height: 2.4rem; resize: vertical; }
.field.checkbox label { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; }
.field.checkbox input { width: auto; }
.field .help { color: var(--muted); font-size: 0.82rem; display: block; margin-top: 0.2rem; }
.field-errors { color: var(--danger); font-size: 0.85rem; margin-top: 0.3rem; }
.field.has-errors input, .field.has-errors select, .field.has-errors textarea { border-color: var(--danger); }

.field ul { list-style: none; padding: 0; margin: 0; }
.field ul li label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 400; }
.field ul li label input { width: auto; margin-right: 0.25rem; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.heating-row {
    border-top: 1px dashed var(--border); padding-top: 0.6rem; margin-top: 0.6rem;
}
.heating-row:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.heating-detail {
    margin-left: 1.5rem; padding-left: 1rem;
    border-left: 2px solid var(--chip);
    margin-top: 0.5rem;
}

[data-show-when-checked], [data-show-when-value] { display: none; }
[data-show-when-checked].is-visible, [data-show-when-value].is-visible { display: block; }

.map-widget {
    height: 320px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 0.25rem;
}
.leaflet-container { font-family: inherit; }

/* ---- Form tabs in the header ---- */
.site-header { gap: 1rem; }
.form-tabs {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}
.form-tab {
    padding: 0.45rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--muted);
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.95rem;
}
.form-tab:hover { background: var(--chip); color: var(--text); }
.form-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ---- Save-confirmation modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal-backdrop.is-open { display: flex; }
.modal {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}
.modal h2 { margin-top: 0; font-size: 1.2rem; }
.modal p { margin: 0.5rem 0; }
.modal .modal-note { color: var(--muted); font-size: 0.9rem; }
.modal .button-row { margin-top: 1.2rem; justify-content: flex-end; }
