@font-face {
    font-family: Lexend;
    src: url('/fonts/Lexend-Regular.ttf') format('truetype');
    font-display: swap;
    font-weight: 400;
}
@font-face {
    font-family: Lexend;
    src: url('/fonts/Lexend-Bold.ttf') format('truetype');
    font-display: swap;
    font-weight: 700;
}
:root {
    color-scheme: light;
    font-family: Lexend, system-ui, sans-serif;
    --teal: #103f4c;
    --teal-hover: #0b2e38;
    --green: #6db39c;
    --blue: #2d527c;
    --border: #cbd8d2;
    background: #f5f7f5;
    color: #292929;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: clamp(.75rem, 3vw, 2.5rem); }
body.signed-in { background: var(--green); min-height: 100vh; }
main { max-width: 75rem; margin: auto; padding: clamp(.875rem, 3vw, 1.75rem); border-radius: .875rem; background: #ebebeb; }
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: .625rem;
    background: var(--teal);
    color: #e3eeec;
}
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.65rem, 5vw, 2.5rem); line-height: 1.2; overflow-wrap: anywhere; }
h2, h3 { color: var(--blue); }
h2 { font-size: 1.3rem; margin: 1.5rem 0 .875rem; }
.site-name { margin-bottom: .35rem; font-size: .875rem; }
a, button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: .65rem .9rem;
    border-radius: .45rem;
    border: 1px solid transparent;
    color: #102b24;
    background: var(--green);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
a:hover, button:hover { background: #83c3ae; }
.secondary { border-color: var(--border); color: var(--teal); background: #fff; }
.secondary:hover { background: #edf5f1; }
header .secondary { color: #e3eeec; border-color: #78949b; background: transparent; }
header .secondary:hover { background: var(--teal-hover); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
header :focus-visible { outline-color: #e3eeec; }
label { display: grid; gap: .4rem; font-weight: 700; }
input, select {
    width: 100%;
    min-height: 44px;
    padding: .65rem .75rem;
    border-radius: .45rem;
    border: 1px solid #879e95;
    background: #fff;
    color: #292929;
    font: inherit;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
article, .empty, .account-form, .address-controls { border: 1px solid var(--border); border-radius: .625rem; padding: 1.25rem; background: #fff; }
article p { margin-top: .75rem; }
.reading { border-top: 1px solid var(--border); margin-top: .75rem; padding-top: .75rem; overflow-wrap: anywhere; }
dt, time, article p { color: #4e635d; }
dd strong { display: block; padding: .25rem 0; }
time, .address-count { font-size: .875rem; }
.account { max-width: 41rem; }
.account-form { display: grid; gap: 1rem; margin-top: 1rem; }
.account-form button { justify-self: start; color: #e3eeec; background: var(--teal); }
.account-form button:hover { background: var(--teal-hover); }
.form-error { color: #923329; }
.actions, .address-controls, .address-picker { display: flex; align-items: end; flex-wrap: wrap; gap: .75rem; }
.address-controls { margin-top: 1rem; }
.address-picker { min-width: 0; }
.address-picker label { min-width: 0; max-width: 100%; }
.address-picker select { max-width: min(27rem, 100%); }
.address-count { flex-basis: 100%; color: #4e635d; }
.address-count:empty { display: none; }
.account-form .primary { color: #e3eeec; background: var(--teal); }
.account-form .primary:hover { background: var(--teal-hover); }

.dashboard-shell {
    max-width: 92rem;
    padding: 0;
    background: #f3f6f3;
    box-shadow: 0 1rem 3rem #103f4c24;
}
.dashboard-layout {
    display: grid;
    gap: clamp(1rem, 2.5vw, 2rem);
    padding: clamp(.75rem, 2.5vw, 2rem);
}
.dashboard-content, .location-label { color: #386451; font-size: .8rem; font-weight: 700; }
.address-browser { margin-top: 1rem; border-top: 1px solid #dce7df; }
.address-browser summary {
    min-height: 44px;
    padding: .65rem 0;
    color: var(--teal);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 700;
}
.address-browser .address-picker { display: grid; gap: .7rem; padding: .25rem 0; }
.address-browser .address-picker select { max-width: 100%; }
.address-browser .address-picker button { justify-self: start; }
.location-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    padding: clamp(1.15rem, 4vw, 2rem);
    border: 1px solid #bbd6c6;
    border-radius: .875rem;
    background: linear-gradient(125deg, #e3f1e9, #f7faf5 85%);
}
.location-overview h2 {
    margin: .25rem 0 0;
    color: var(--teal);
    font-size: clamp(1.6rem, 4.5vw, 2.85rem);
    line-height: 1.15;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
}
.overview-stats { display: flex; flex-wrap: wrap; gap: .6rem; }
.overview-stats div { min-width: 5rem; padding: .55rem .75rem; border: 1px solid #caddce; border-radius: .55rem; background: #fff; }
.overview-stats dt { font-size: .75rem; }
.overview-stats dd { margin-top: .15rem; color: var(--teal); font-size: 1.25rem; font-weight: 700; }
.sensor-section > h2 { margin-top: 1.6rem; }
.sensor-card { min-width: 0; align-self: start; border-radius: .8rem; padding: 1rem; box-shadow: 0 2px 6px #103f4c0b; }
.sensor-card h3 { overflow-wrap: anywhere; }
.sensor-card .sensor-readings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
    gap: .55rem;
    margin-top: .8rem;
}
.sensor-card .reading { margin: 0; padding: .65rem .7rem; border: 0; border-radius: .5rem; background: #f2f6f4; }
.sensor-card dt { font-size: .8rem; }
.sensor-card dd strong { padding: .2rem 0; color: var(--teal); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.sensor-card time { font-size: .75rem; }
@media (min-width: 58rem) {
    .location-overview { grid-template-columns: minmax(0, 1fr) auto; }
    .location-overview form { grid-column: 1 / -1; }
}
@media (max-width: 35rem) {
    .dashboard-layout { gap: .75rem; }
}

.secondary-home-picker, .secondary-home-list { display: grid; gap: .7rem; }
.secondary-home-list { margin: 0; padding: 0; list-style: none; }
.secondary-home-list li { display: flex; justify-content: space-between; align-items: center; gap: .7rem; overflow-wrap: anywhere; }
.secondary-home-list button { color: var(--teal); background: #edf5f1; }
.secondary-home-list button:hover { background: #dcece4; }
